From 4f93b703d6f2d2c9773471d612b952b6b1ce9d0f Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 18 Jan 2023 10:43:46 +0800 Subject: [PATCH] Merge branch 'master' into 2.0-dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * master: 修改配置星巴克 肯德基 会员充值 话费 微信商户号 修改配置星巴克 肯德基 会员充值 话费 微信商户号 # Conflicts: # hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java # hai-cweb/src/main/java/com/cweb/controller/pay/ThirdOrderController.java --- .../com/web/controller/OrderController.java | 3 - .../OrderMobileRechargeController.java | 211 ++++++++++++++++++ .../business/OrderThirdPartyController.java | 2 +- hai-order/src/main/resources/dev/logback.xml | 8 +- .../java/com/hai/entity/OutRechargeOrder.java | 11 + .../service/OutRechargeChildOrderService.java | 10 + .../OutRechargeChildOrderServiceImpl.java | 9 + .../impl/OutRechargeOrderServiceImpl.java | 34 +-- 8 files changed, 265 insertions(+), 23 deletions(-) create mode 100644 hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index e9fe412d..26805693 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -47,9 +47,6 @@ public class OrderController { @Resource private OrderService orderService; - @Resource - private OrderPaySuccessService orderPaySuccessService; - @Resource private UserCenter userCenter; diff --git a/hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java b/hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java new file mode 100644 index 00000000..940470a9 --- /dev/null +++ b/hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java @@ -0,0 +1,211 @@ +package com.web.controller.business; + +import com.alibaba.excel.EasyExcel; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +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.ResponseMsgUtil; +import com.hai.entity.HighOrder; +import com.hai.enum_type.OrderStatusEnum; +import com.hai.enum_type.UserObjectTypeEnum; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.order.model.OrderThirdPartyModel; +import com.hai.order.service.OrderService; +import com.hai.order.type.OrderPayType; +import com.hai.service.OutRechargeOrderService; +import com.hai.service.impl.OutRechargeOrderServiceImpl; +import com.web.config.SysConst; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@RequestMapping(value = "mobileRecharge") +@Api(value = "话费充值业务") +public class OrderMobileRechargeController { + + private static Logger log = LoggerFactory.getLogger(OrderMobileRechargeController.class); + + @Resource + private UserCenter userCenter; + + @Resource + private OutRechargeOrderService outRechargeOrderService; + + + @Resource + private OrderService orderService; + + + @RequestMapping(value = "/getOrderList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询话费订单列表") + public ResponseData getOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "memCardNo", required = false) String memCardNo, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "finishTimeS", required = false) Long finishTimeS, + @RequestParam(name = "finishTimeE", required = false) Long finishTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + Map map = new HashMap<>(); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + map.put("companyId" , companyId); + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + map.put("companyId", userInfoModel.getBsCompany().getId()); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("payTimeS", payTimeS); + map.put("payTimeE", payTimeE); + map.put("finishTimeS", finishTimeS); + map.put("finishTimeE", finishTimeE); + map.put("orderNo", orderNo); + map.put("memPhone", memPhone); + map.put("memCardNo", memCardNo); + map.put("productType", 9); + map.put("status", status); + map.put("payType", payType); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderList(map))); + + } catch (Exception e) { + log.error("OrderCouponController --> getOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/exportMobilePartyOrderList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出话费订单列表") + public ResponseData exportMobilePartyOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "memCardNo", required = false) String memCardNo, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "productType", required = false) Integer productType, + @RequestParam(name = "finishTimeS", required = false) Long finishTimeS, + @RequestParam(name = "finishTimeE", required = false) Long finishTimeE) { + try { + + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + Map map = new HashMap<>(); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + map.put("companyId" , companyId); + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + map.put("companyId", userInfoModel.getBsCompany().getId()); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("payTimeS", payTimeS); + map.put("payTimeE", payTimeE); + map.put("finishTimeS", finishTimeS); + map.put("finishTimeE", finishTimeE); + map.put("orderNo", orderNo); + map.put("memPhone", memPhone); + map.put("memCardNo", memCardNo); + map.put("productType", productType); + map.put("status", status); + map.put("payType", payType); + + // 查询数据 + List orderList = orderService.getOrderList(map); + + List dataList = new ArrayList<>(); + OrderThirdPartyModel model; + + for (HighOrder thirdPartyModel : orderList) { + model = new OrderThirdPartyModel(); + model.setOrderNo(thirdPartyModel.getOrderNo()); + model.setMemPhone(thirdPartyModel.getMemPhone()); + model.setTitle(thirdPartyModel.getTitle()); + model.setTotalPrice(thirdPartyModel.getTotalPrice()); + model.setTotalDeductionPrice(thirdPartyModel.getTotalDeductionPrice()); + model.setDeductionProductPrice(thirdPartyModel.getDeductionProductPrice()); + model.setPayablePrice(thirdPartyModel.getPayablePrice()); + model.setPayPrice(thirdPartyModel.getPayPrice()); + model.setPayType(OrderPayType.getDataByType(thirdPartyModel.getPayType()).getName()); + model.setOrderStatus(OrderStatusEnum.getNameByType(thirdPartyModel.getOrderStatus())); + model.setCreateTime(thirdPartyModel.getCreateTime()); + model.setPayTime(thirdPartyModel.getPayTime()); + dataList.add(model); + } + + String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; + String pathName = System.currentTimeMillis()+".xlsx"; + File file = new File(fileUrl); + if (!file.exists()) { + file.mkdirs(); + } + + EasyExcel.write(fileUrl+pathName) + .head(OrderThirdPartyModel.class) + .sheet("交易订单") + .doWrite(dataList); + return ResponseMsgUtil.success(pathName); + + } catch (Exception e) { + log.error("OrderCouponController --> getOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getMobileOrderDetail",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询话费订单详情") + public ResponseData getMobileOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) { + try { + + return ResponseMsgUtil.success(outRechargeOrderService.findByOrderNo(orderNo)); + + } catch (Exception e) { + log.error("OrderExtController -> getGasOrderDetail() error!",e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java b/hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java index e5d093fd..a37e9d7a 100644 --- a/hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java +++ b/hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java @@ -45,7 +45,7 @@ import java.util.Map; @Api(value = "第三方订单业务") public class OrderThirdPartyController { - private static Logger log = LoggerFactory.getLogger(OrderOilController.class); + private static Logger log = LoggerFactory.getLogger(OrderThirdPartyController.class); @Resource private UserCenter userCenter; diff --git a/hai-order/src/main/resources/dev/logback.xml b/hai-order/src/main/resources/dev/logback.xml index fc978f86..a4ac2c0f 100644 --- a/hai-order/src/main/resources/dev/logback.xml +++ b/hai-order/src/main/resources/dev/logback.xml @@ -95,7 +95,7 @@ class="ch.qos.logback.core.rolling.RollingFileAppender"> log/QzLog.log - log/QzLog.log.%d.%i + log/QzLog/QzLog.log.%d.%i 64 MB @@ -112,7 +112,7 @@ class="ch.qos.logback.core.rolling.RollingFileAppender"> log/RechargeLog.log - log/RechargeLog.log.%d.%i + log/RechargeLog/RechargeLog.log.%d.%i 64 MB @@ -149,4 +149,8 @@ + + + + diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java index 7207b288..9f4b07b3 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java @@ -3,6 +3,7 @@ package com.hai.entity; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; +import java.util.List; /** * out_recharge_order @@ -231,6 +232,16 @@ public class OutRechargeOrder implements Serializable { private static final long serialVersionUID = 1L; + List outRechargeChildOrders; + + public List getOutRechargeChildOrders() { + return outRechargeChildOrders; + } + + public void setOutRechargeChildOrders(List outRechargeChildOrders) { + this.outRechargeChildOrders = outRechargeChildOrders; + } + public Long getId() { return id; } diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeChildOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeChildOrderService.java index 86db1648..198e79f0 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargeChildOrderService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargeChildOrderService.java @@ -19,6 +19,16 @@ public interface OutRechargeChildOrderService { */ List getListRechargeChildOrder(Map map); + /** + * @Author Sum1Dream + * @Name getListRechargeChildOrderByOrderNo + * @Description // 根据订单号查询话费子订单 + * @Date 09:59 2023/1/18 + * @Param [orderNo] + * @Return java.util.List + */ + List getListRechargeChildOrderByOrderId(Long orderId); + /** * @Author Sum1Dream * @name findById.java diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeChildOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeChildOrderServiceImpl.java index a636be22..e7a70087 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeChildOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeChildOrderServiceImpl.java @@ -40,6 +40,15 @@ public class OutRechargeChildOrderServiceImpl implements OutRechargeChildOrderSe return rechargeChildOrderMapper.selectByExample(example); } + @Override + public List getListRechargeChildOrderByOrderId(Long orderId) { + + OutRechargeChildOrderExample example = new OutRechargeChildOrderExample(); + example.createCriteria().andParentOrderIdEqualTo(orderId); + + return rechargeChildOrderMapper.selectByExample(example); + } + @Override public OutRechargeChildOrder findById(Long id) { return rechargeChildOrderMapper.selectByPrimaryKey(id); diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index a29de437..44b84ac4 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -2,6 +2,8 @@ package com.hai.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alicp.jetcache.anno.CacheType; +import com.alicp.jetcache.anno.Cached; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -59,9 +61,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { @Resource private OutRechargeOrderMapperExt outRechargeOrderMapperExt; - @Resource - private HighUserCardService highUserCardService; - @Resource private OrderService orderService; @@ -195,10 +194,24 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } @Override + @Cached(cacheType = CacheType.REMOTE,name="order:", key = "#orderNo",expire = 3600*24*30) public OutRechargeOrder findByOrderNo(String orderNo) { + OutRechargeOrderExample example = new OutRechargeOrderExample(); example.createCriteria().andOrderNoEqualTo(orderNo); - return outRechargeOrderMapper.selectByExample(example).get(0); + + List list = outRechargeOrderMapper.selectByExample(example); + + if (list.size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号"); + } + + OutRechargeOrder outRechargeOrder = list.get(0); + + // 充值子订单 + outRechargeOrder.setOutRechargeChildOrders(outRechargeChildOrderService.getListRechargeChildOrderByOrderId(outRechargeOrder.getId())); + + return outRechargeOrder; } @Override @@ -987,19 +1000,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { childOrder.setUpdateTime(new Date()); outRechargeChildOrderService.insertOrder(childOrder); - // 创建提交记录 -// BsRequestRecord requestRecord = new BsRequestRecord(); -// requestRecord.setCreateTime(new Date()); -// requestRecord.setUpdateTime(new Date()); -// requestRecord.setOrderNo(orderNo); -// requestRecord.setRequestContent(object.toJSONString()); -// requestRecord.setOperatorId(0L); -// requestRecord.setOperatorName("系统生成"); -// requestRecord.setSourceId(childOrder.getId().toString()); -// requestRecord.setSourceType(1); -// -// bsRequestRecordService.insertRequestRecord(requestRecord); - // 判断是否充值提交成功 if (childOrder.getStatus() == 102) { outRechargeOrder.setRechargeStatus(201);