diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index 8a2c67fc..f6c92d21 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -167,6 +167,22 @@ public class HighOrderController { } } + @RequestMapping(value = "/cancelOrder", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "取消订单") + public ResponseData cancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) { + try { + + highOrderService.cancelOrder(orderId); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighOrderController --> cancelOrder() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/getUserOrderList", method = RequestMethod.GET) @ResponseBody diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index 3bea8460..cfb872d3 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -129,8 +129,10 @@ public class OrderController { int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue(); WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo(); weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxAppId()); //公众号id - weChatPayReqInfo.setOpenid(openId); weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号 + weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxMchId()); //子商户号 + + weChatPayReqInfo.setOpenid(openId); weChatPayReqInfo.setNonce_str(nonce_str); //随机字符串 weChatPayReqInfo.setBody(map.get("body").toString()); //商品描述 weChatPayReqInfo.setOut_trade_no(map.get("orderNo").toString()); //商户订单号 diff --git a/hai-service/src/main/java/com/hai/common/pay/entity/WeChatPayReqInfo.java b/hai-service/src/main/java/com/hai/common/pay/entity/WeChatPayReqInfo.java index 7cbe4873..c36a4c13 100644 --- a/hai-service/src/main/java/com/hai/common/pay/entity/WeChatPayReqInfo.java +++ b/hai-service/src/main/java/com/hai/common/pay/entity/WeChatPayReqInfo.java @@ -9,6 +9,7 @@ public class WeChatPayReqInfo implements Serializable { private static final long serialVersionUID = -7642108447915413137L; private String appid; // 公众号id 必填 private String mch_id; // 商户号 必填 + private String sub_mch_id; // 微信支付分配的子商户号 必填 private String nonce_str; // 随机字符串 必填 private String sign; // 签名 必填 private String device_info; // 设备号 可以为终端设备号(门店号或收银设备ID),PC网页或公众号内支付可以传"WEB" @@ -202,4 +203,11 @@ public class WeChatPayReqInfo implements Serializable { this.scene_info = scene_info; } + public String getSub_mch_id() { + return sub_mch_id; + } + + public void setSub_mch_id(String sub_mch_id) { + this.sub_mch_id = sub_mch_id; + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 8029c7c2..125dc511 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -142,6 +142,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (highChildOrder.getGoodsType() == 1) { HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 + code.setReceiveTime(new Date()); highCouponCodeService.updateCouponCode(code); // 卡卷关联用户 @@ -150,6 +151,7 @@ public class HighOrderServiceImpl implements HighOrderService { highUserCoupon.setCouponId(code.getCouponId()); highUserCoupon.setUserId(highOrder.getMemId()); highUserCoupon.setCouponCodeId(code.getId()); + highUserCoupon.setCreateTime(new Date()); highUserCoupon.setUseEndTime(code.getUseEndTime()); highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 highUserCouponMapper.insert(highUserCoupon); @@ -230,7 +232,7 @@ public class HighOrderServiceImpl implements HighOrderService { @Override public List getCloseOrder() { - return null; + return highOrderMapperExt.getCloseOrder(); } @Override @@ -266,6 +268,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (highChildOrder.getGoodsType() == 1) { // 查询卡卷详情 HighCouponCode couponCode = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); + couponCode.setChildOrderId(null); couponCode.setStatus(1); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 highCouponCodeService.updateCouponCode(couponCode); } diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index 1bc58098..aa703bb5 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -67,6 +67,7 @@ public class GoodsOrderServiceImpl implements PayService { highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 + code.setReceiveTime(new Date()); highCouponCodeService.updateCouponCode(code); // 卡卷关联用户 @@ -75,6 +76,7 @@ public class GoodsOrderServiceImpl implements PayService { highUserCoupon.setCouponId(code.getCouponId()); highUserCoupon.setUserId(order.getMemId()); highUserCoupon.setCouponCodeId(code.getId()); + highUserCoupon.setCreateTime(new Date()); highUserCoupon.setUseEndTime(code.getUseEndTime()); highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 highUserCouponMapper.insert(highUserCoupon);