Merge branch '2.0-dev' into 2.0-master

dev-discount
袁野 2 years ago
commit 53dc3c810f
  1. 27
      hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java
  2. 64
      hai-cweb/src/main/java/com/cweb/controller/CommonController.java
  3. 6
      hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java
  4. 24
      hai-order/src/main/java/com/web/controller/OrderController.java
  5. 51
      hai-order/src/main/java/com/web/controller/business/GoodsOrderController.java
  6. 21
      hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java
  7. 22
      hai-service/src/main/java/com/hai/goods/service/GoodsLogisticsService.java
  8. 56
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsLogisticsServiceImpl.java
  9. 18
      hai-service/src/main/java/com/hai/order/model/GoodsChildOrderExtModel.java
  10. 4
      hai-service/src/main/java/com/hai/service/CommonService.java
  11. 27
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  12. 2
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

@ -1,6 +1,7 @@
package com.bweb.controller.Goods;
import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
@ -12,10 +13,12 @@ import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.HighApprove;
import com.hai.entity.HighGoodsType;
import com.hai.enum_type.ApproveType;
import com.hai.goods.service.GoodsDetailService;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighApproveService;
@ -54,6 +57,9 @@ public class GoodsDetailController {
@Autowired
private UserCenter userCenter;
@Resource
private GoodsLogisticsService logisticsService;
@RequestMapping(value = "/getListGoodsDetail", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品列表")
@ -162,6 +168,8 @@ public class GoodsDetailController {
goodsDetail.setStatus(goods.getStatus());
goodsDetail.setCreateTime(goods.getCreateTime());
goodsDetail.setOpName(goods.getOpName());
goodsDetail.setOpId(goods.getOpId());
goodsDetail.setUpdateTime(new Date());
goodsDetail.setGoodsTypeName(goodsType.getTitle());
goodsDetail.setCompanyId(userInfoModel.getBsCompany().getId());
@ -280,8 +288,6 @@ public class GoodsDetailController {
goodsDetail.setStatus(goodsDetail.getStatus() == 1 ? 2:3);
goodsDetail.setUpdateTime(new Date());
goodsDetail.setOpId(userInfoModel.getSecUser().getId());
goodsDetail.setOpName(userInfoModel.getSecUser().getLoginName());
goodsDetailService.updateGoodsDetail(goodsDetail);
return ResponseMsgUtil.success("操作成功!");
@ -291,5 +297,22 @@ public class GoodsDetailController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据快递单号查询物流信息")
public ResponseData getLogisticsMsg(@RequestParam(name = "orderId", required = false) Long orderId) {
try {
GoodsLogistics logistics = (GoodsLogistics) logisticsService.getLogisticsMsg(orderId);
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails());
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -263,7 +263,7 @@ public class CommonController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位");
}
JSONObject object = commonService.findByLatAndLng(lng, lat).getJSONObject("result").getJSONObject("addressComponent");
JSONObject object = jsonObjectR.getJSONObject("result").getJSONObject("addressComponent");
ApiCity apiCity = commonService.findCityByName(object.getString("city"));
@ -296,6 +296,46 @@ public class CommonController {
}
}
@RequestMapping(value = "/baiduApiMapSearch", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取定位信息")
public ResponseData baiduApiMapSearch(
@RequestParam(name = "lng", required = true) String lng,
@RequestParam(name = "lat", required = true) String lat,
@RequestParam(name = "query", required = false) String query) {
try {
if (query == null) {
JSONObject map = commonService.findByLatAndLng(lng, lat);
if (!map.getString("status").equals("0")) {
log.error("findByLatAndLng error!", "定位错误,请重新定位");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位");
}
query = map.getJSONObject("result").getString("formatted_address");
}
Map<String , Object> map = new HashMap<>();
map.put("query" , query);
map.put("location", lat+","+lng);
JSONObject jsonObjectR = commonService.baiduApiMapSearch(map);
if (!jsonObjectR.getString("status").equals("0")) {
log.error("findByLatAndLng error!", "定位错误,请重新定位");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位");
}
return ResponseMsgUtil.success(jsonObjectR.getJSONArray("results"));
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findCompanyByCityName", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取定位信息")
@ -442,4 +482,26 @@ public class CommonController {
}
}
@RequestMapping(value = "/gaoDeApiMapSearch", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取定位信息")
public ResponseData gaoDeApiMapSearch(
@RequestParam(name = "query", required = false) String query) {
try {
Map<String , Object> map = new HashMap<>();
map.put("keywords" , query);
map.put("extensions" , "all");
JSONObject jsonObject = commonService.gaoDeApiMapSearch(map);
return ResponseMsgUtil.success(jsonObject.getJSONArray("tips"));
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -210,10 +210,10 @@ public class GoodsController {
@RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据快递单号查询物流信息")
public ResponseData getLogisticsMsg(@RequestParam(name = "num", required = true) String num) {
public ResponseData getLogisticsMsg(@RequestParam(name = "orderId", required = false) Long orderId) {
try {
return ResponseMsgUtil.success(logisticsService.getLogisticsMsg(num));
return ResponseMsgUtil.success(logisticsService.getLogisticsMsg(orderId));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
@ -222,7 +222,5 @@ public class GoodsController {
}
}

@ -11,12 +11,14 @@ import com.hai.common.utils.BaiduUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.goods.service.DeliveryAddressService;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.goods.service.GoodsOrderExtService;
import com.hai.model.GoodsOrderModel;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.order.model.CreateOrderChildModel;
import com.hai.order.model.CreateOrderModel;
import com.hai.order.model.GoodsChildOrderExtModel;
import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderService;
import com.hai.order.type.OrderChildGoodsType;
@ -37,7 +39,9 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@ -59,6 +63,9 @@ public class OrderController {
@Resource
private DeliveryAddressService deliveryAddressService;
@Resource
private GoodsLogisticsService goodsLogisticsService;
@RequestMapping(value="/create",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建订单")
@ -177,6 +184,21 @@ public class OrderController {
HighOrder highOrder = orderService.getOrderDetailByNo(orderNo);
if (highOrder.getProductType() == 12) {
// todo 临时代码
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
GoodsLogistics logistics = goodsLogisticsService.findGoodsLogistics(childOrder.getId());
if (logistics != null) {
childOrder.setExt6(logistics.getLogisticsStatusDesc());
childOrder.setExt4(logistics.getNumber());
}
}
GoodsOrder order = goodsOrderExtService.findGoodsOrder(highOrder.getOrderNo());
GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(order.getDeliveryAddressId());
@ -184,6 +206,8 @@ public class OrderController {
BeanUtils.copyProperties(highOrder , goodsOrderModel);
goodsOrderModel.setGoodsOrder(order);
goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress);
return ResponseMsgUtil.success(goodsOrderModel);
}

@ -11,10 +11,13 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.PageUtil;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig;
import com.hai.entity.*;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.goods.model.GoodsModel;
import com.hai.goods.service.DeliveryAddressService;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.goods.service.GoodsOrderExtService;
import com.hai.goods.service.GoodsSkuService;
@ -67,6 +70,12 @@ public class GoodsOrderController {
@Resource
private GoodsLogisticsService goodsLogisticsService;
@Resource
private DeliveryAddressService deliveryAddressService;
@Resource
private RedisUtil redisUtil;
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询订单列表")
@ -236,13 +245,16 @@ public class GoodsOrderController {
for (HighChildOrder order : list) {
model = new GoodsChildOrderExtModel();
BeanUtils.copyProperties(order, model);
GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrder(order.getChildOrderNo());
if (goodsOrder != null) {
model.setLogisticsStatus(goodsOrder.getStatus());
GoodsLogistics logistics = goodsLogisticsService.findGoodsLogistics(order.getId());
if (logistics != null) {
model.setLogisticsStatus(logistics.getLogisticsStatusDesc());
model.setLogisticsNo(logistics.getNumber());
}
GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrder(order.getOrderNo());
GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(goodsOrder.getDeliveryAddressId());
model.setDeliveryAddressMsg(goodsOrder.getDeliveryAddress() + "-" + deliveryAddress.getConsignee() + " " + deliveryAddress.getPhone());
goodsChildOrderExtModels.add(model);
}
goodsChildOrderExtModels = goodsChildOrderExtModels.stream().sorted(Comparator.comparing(GoodsChildOrderExtModel::getLogisticsStatus)).collect(Collectors.toList());
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsChildOrderExtModels.size(), pageSize, new PageInfo<>(goodsChildOrderExtModels)));
@ -252,4 +264,35 @@ public class GoodsOrderController {
}
}
@RequestMapping(value = "/editLogisticsNo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "录入运单号")
public ResponseData editLogisticsNo(@RequestParam(name = "orderId", required = false) Long orderId,
@RequestParam(name = "logisticsNo", required = false) String logisticsNo
) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(logisticsNo);
jsonObjects.getJSONObject("data").put("orderId" , orderId);
GoodsLogistics logistics = goodsLogisticsService.editLogistics(jsonObjects.getJSONObject("data"));
redisUtil.set("logisticsMsg" + orderId , logistics ,21600);
return ResponseMsgUtil.success("录入成功");
} catch (Exception e) {
log.error("OrderCouponController --> getOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -7,6 +7,7 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighOrder;
import com.hai.entity.OutRechargeChildOrder;
@ -42,6 +43,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Controller
@RequestMapping(value = "mobileRecharge")
@ -65,6 +67,9 @@ public class OrderMobileRechargeController {
@Autowired
private RedisTemplate redisTemplate;
@Resource
private RedisUtil redisUtil;
@Resource
private OutRechargeChildOrderService outRechargeChildOrderService;
@ -136,6 +141,7 @@ public class OrderMobileRechargeController {
@ApiOperation(value = "导出话费订单列表")
public ResponseData exportMobilePartyOrderList(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "serialNumber", required = false) String serialNumber,
@RequestParam(name = "memCardNo", required = false) String memCardNo,
@RequestParam(name = "payType", required = false) Integer payType,
@RequestParam(name = "orderStatus", required = false) Integer orderStatus,
@ -150,6 +156,7 @@ public class OrderMobileRechargeController {
@RequestParam(name = "refundTimeS", required = false) Long refundTimeS,
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE,
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS,
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE) {
try {
@ -187,8 +194,20 @@ public class OrderMobileRechargeController {
List<ExportOrderMobileModel> list = new ArrayList<>();
// 配置初始化处理条数
int i = 0;
int percent;
ExportOrderMobileModel model;
for (HighOrder highOrder : order) {
i++;
// 生成百分比
percent = i*100/order.size();
redisUtil.set(serialNumber , percent , 3600);
model = new ExportOrderMobileModel();
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo());
@ -235,6 +254,8 @@ public class OrderMobileRechargeController {
.head(ExportOrderMobileModel.class)
.sheet("话费交易订单")
.doWrite(list);
redisUtil.set(serialNumber + "download" , pathName , 600);
return ResponseMsgUtil.success(pathName);
} catch (Exception e) {

@ -55,6 +55,16 @@ public interface GoodsLogisticsService {
*/
GoodsLogistics findGoodsLogisticsById(Long id);
/**
* @Author Sum1Dream
* @Name findGoodsLogisticsById
* @Description // 根据id查询物流信息
* @Date 16:19 2023/4/11
* @Param [id]
* @Return com.hai.entity.GoodsLogistics
*/
GoodsLogistics findGoodsLogistics(Long orderId);
/**
* @Author Sum1Dream
* @Name findGoodsLogisticsByNum
@ -84,4 +94,16 @@ public interface GoodsLogisticsService {
* @Return com.alibaba.fastjson.JSONObject
*/
Object getLogisticsMsg(String num);
/**
* @Author Sum1Dream
* @Name getLogisticsMsg
* @Description // 查询物流信息
* @Date 16:19 2023/4/20
* @Param [num]
* @Return com.alibaba.fastjson.JSONObject
*/
Object getLogisticsMsg(Long orderId);
}

@ -1,6 +1,9 @@
package com.hai.goods.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig;
@ -50,6 +53,22 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
return goodsLogisticsMapper.selectByPrimaryKey(id);
}
@Override
public GoodsLogistics findGoodsLogistics(Long orderId) {
GoodsLogisticsExample example = new GoodsLogisticsExample();
GoodsLogisticsExample.Criteria criteria = example.createCriteria();
criteria.andOrderIdEqualTo(orderId).andStatusEqualTo(1);
List<GoodsLogistics> logistics = goodsLogisticsMapper.selectByExample(example);
if (logistics.size() > 0) {
return logistics.get(0);
}
return null;
}
@Override
public GoodsLogistics findGoodsLogisticsByNum(String num) {
GoodsLogisticsExample example = new GoodsLogisticsExample();
@ -78,6 +97,7 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
}
logistics.setTaskNo(jsonObject.getString("orderNo"));
logistics.setTheLastTime(info.getDate("theLastTime"));
logistics.setTheLastMessage(info.getString("theLastMessage"));
logistics.setTakeTime(info.getString("takeTime"));
@ -87,11 +107,12 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
logistics.setLogisticsStatusDesc(info.getString("logisticsStatusDesc"));
logistics.setLogisticsTraceDetails(info.getString("logisticsTraceDetailList"));
logistics.setStatus(1);
if ( logistics.getId() == null) {
if ( logistics.getId() == null || !Objects.equals(logistics.getOrderId(), jsonObject.getLong("orderId"))) {
logistics.setOrderId(jsonObject.getLong("orderId"));
logistics.setCreateTime(new Date());
insertGoodsLogistics(logistics);
} else {
logistics.setOrderId(jsonObject.getLong("orderId"));
updateGoodsLogistics(logistics);
}
@ -133,4 +154,35 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
return data;
}
}
@Override
public Object getLogisticsMsg(Long orderId) {
Object data = redisUtil.get("logisticsMsg" + orderId);
if (data == null) {
GoodsLogistics goodsLogistics = findGoodsLogistics(orderId);
if (goodsLogistics == null || goodsLogistics.getNumber() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!");
}
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(goodsLogistics.getNumber());
redisUtil.set("logisticsMsgOl" + orderId , jsonObjects ,21600);
if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) {
jsonObjects.getJSONObject("data").put("orderId" , orderId);
GoodsLogistics logistics = editLogistics((JSONObject) jsonObjects.get("data"));
redisUtil.set("logisticsMsg" + orderId , logistics ,21600);
return logistics;
}
return jsonObjects;
} else {
return data;
}
}
}

@ -8,6 +8,24 @@ public class GoodsChildOrderExtModel extends HighChildOrder {
* 1:待发货 2:已发货 3配送中 4已送达 5已取消 6退货中 7已退货 8待支付 0:删除';
*/
private String logisticsStatus;
private String logisticsNo;
private String deliveryAddressMsg;
public String getDeliveryAddressMsg() {
return deliveryAddressMsg;
}
public void setDeliveryAddressMsg(String deliveryAddressMsg) {
this.deliveryAddressMsg = deliveryAddressMsg;
}
public String getLogisticsNo() {
return logisticsNo;
}
public void setLogisticsNo(String logisticsNo) {
this.logisticsNo = logisticsNo;
}
public String getLogisticsStatus() {
return logisticsStatus;

@ -253,6 +253,10 @@ public interface CommonService {
*/
JSONObject findByLatAndLng( String lng , String lat) throws Exception;
JSONObject baiduApiMapSearch(Map<String , Object> map);
JSONObject gaoDeApiMapSearch(Map<String , Object> map);
/**
* @Author Sum1Dream
* @name configPayType.java

@ -562,6 +562,33 @@ public class CommonServiceImpl implements CommonService {
}
@Override
public JSONObject baiduApiMapSearch(Map<String, Object> map) {
//申请百度开放平台KEY(ak)
map.put("ak", "SfrwGH7INvjPq7BwCrYrioBQZm9XXxrR");
// 输出Json数据
map.put("output", "json");
// 圆形区域检索半径,单位为米。(增加区域内数据召回权重,如需严格限制召回数据在区域内,请搭配使用radius_limit参数),当半径过大,超过中心点所在城市边界时,会变为城市范围检索,检索范围为中心点所在城市
map.put("radius", "500");
// 检索结果详细程度。取值为1 或空,则返回基本信息;取值为2,返回检索POI详细信息
map.put("scope", "1");
// 是否召回国标行政区划编码,true(召回)、false(不召回)
map.put("extensions_adcode", "true");
// GPS 经纬度类型
map.put("coordtype", "wgs84ll");
return HttpsUtils.doGet("https://api.map.baidu.com/place/v2/search" , map);
}
@Override
public JSONObject gaoDeApiMapSearch(Map<String, Object> map) {
map.put("key" , "b7f6a6c5cd9801a82a0dc827f271a75d");
return HttpsUtils.doGet("https://restapi.amap.com/v3/assistant/inputtips" , map);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void configPayType(JSONObject object) {

@ -649,6 +649,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if (highOrder != null) {
highOrder.setOrderStatus(OrderStatusEnum.type3.getType());
highOrder.setFinishTime(new Date());
highOrder.setExceptionStatus(false);
highOrder.setExceptionContent(null);
for (HighChildOrder highChildOrder : highOrder.getHighChildOrderList()) {
highChildOrder.setChildOrderStatus(OrderChildStatus.STATUS3.getNumber());
highChildOrder.setFinishTime(new Date());

Loading…
Cancel
Save