From c07a4b655e743cd71002d2e0284e4ffbaed6e432 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 17 Nov 2023 11:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/web/controller/OrderController.java | 144 ++++++------------ .../controller/OrderPayNotifyController.java | 4 +- .../notify/HuiPayNotifyController.java | 12 +- .../java/com/hai/dao/HighOrderMapper.java | 87 ++++++----- .../com/hai/dao/HighOrderSqlProvider.java | 14 ++ .../main/java/com/hai/entity/HighOrder.java | 42 +++-- .../java/com/hai/entity/HighOrderExample.java | 70 +++++++++ .../order/service/OrderPaySuccessService.java | 3 +- .../com/hai/order/service/OrderService.java | 2 + .../service/impl/OrderPayServiceImpl.java | 8 +- .../impl/OrderPaySuccessServiceImpl.java | 5 +- .../order/service/impl/OrderServiceImpl.java | 19 ++- 12 files changed, 244 insertions(+), 166 deletions(-) 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 6a1c572d..f87c4614 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -280,139 +280,81 @@ public class OrderController { @ResponseBody @ApiOperation(value = "根据订单号查询详情") public ResponseData getDetailByOrderNo(@RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo) { + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payChannelOrderNo", required = false) String payChannelOrderNo + ) { try { - - - if (StringUtils.isBlank(orderNo) && StringUtils.isBlank(paySerialNo)) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.USE_VISIT_ILLEGAL, ""); + if (StringUtils.isBlank(orderNo) && StringUtils.isBlank(paySerialNo) && StringUtils.isBlank(payChannelOrderNo)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); } HighOrder highOrder = null; + if (StringUtils.isNotBlank(orderNo)) { 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()); - - GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); - BeanUtils.copyProperties(highOrder , goodsOrderModel); - goodsOrderModel.setGoodsOrder(order); - goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress); - - - - return ResponseMsgUtil.success(goodsOrderModel); - - } else if (highOrder.getProductType() == 17) { - - GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); - BeanUtils.copyProperties(highOrder , goodsOrderModel); - - HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(highOrder.getOrderNo()); - - JSONObject object = groupService.getGroupContent(highGroupOrder.getGroupId()); - - if (object.getString("return_code").equals("000000")) { - goodsOrderModel.setGroupData(object.getJSONObject("return_data")); - } - - JSONObject objectStore = groupService.getStoreMsg(highGroupOrder.getStoreId()); - - if (objectStore.getString("return_code").equals("000000")) { - goodsOrderModel.setStoreData(objectStore.getJSONObject("return_data")); - } - - Map map = new HashMap<>(); - map.put("orderId" , highOrder.getId()); + } else if (StringUtils.isNotBlank(paySerialNo)) { + highOrder = orderService.getOrderDetailBySerialNo(paySerialNo); - HighGroupCode highGroupCode = groupCodeService.findGroupCode(map); - goodsOrderModel.setHighGroupCode(highGroupCode); - return ResponseMsgUtil.success(goodsOrderModel); + } else if (StringUtils.isNotBlank(payChannelOrderNo)) { + highOrder = orderService.getOrderDetailByChannelOrderNo(payChannelOrderNo); } - - - - - + if (highOrder == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); } - if (StringUtils.isNotBlank(paySerialNo)) { - highOrder = orderService.getOrderDetailBySerialNo(paySerialNo); - if (highOrder.getProductType() == 12) { - - // todo 临时代码 + if (highOrder.getProductType() == 12) { - for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { + // todo 临时代码 - GoodsLogistics logistics = goodsLogisticsService.findGoodsLogistics(childOrder.getId()); - if (logistics != null) { - childOrder.setExt6(logistics.getLogisticsStatusDesc()); - childOrder.setExt4(logistics.getNumber()); - } + 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()); - - GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); - BeanUtils.copyProperties(highOrder , goodsOrderModel); - goodsOrderModel.setGoodsOrder(order); - goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress); - + } - return ResponseMsgUtil.success(goodsOrderModel); + GoodsOrder order = goodsOrderExtService.findGoodsOrder(highOrder.getOrderNo()); + GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(order.getDeliveryAddressId()); - } else if (highOrder.getProductType() == 17) { + GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); + BeanUtils.copyProperties(highOrder , goodsOrderModel); + goodsOrderModel.setGoodsOrder(order); + goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress); - GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); - BeanUtils.copyProperties(highOrder , goodsOrderModel); - HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(highOrder.getOrderNo()); - JSONObject object = groupService.getGroupContent(highGroupOrder.getGroupId()); + return ResponseMsgUtil.success(goodsOrderModel); - if (object.getString("return_code").equals("000000")) { - goodsOrderModel.setGroupData(object.getJSONObject("return_data")); - } + } else if (highOrder.getProductType() == 17) { - JSONObject objectStore = groupService.getStoreMsg(highGroupOrder.getStoreId()); + GoodsOrderModel goodsOrderModel = new GoodsOrderModel(); + BeanUtils.copyProperties(highOrder , goodsOrderModel); - if (objectStore.getString("return_code").equals("000000")) { - goodsOrderModel.setStoreData(objectStore.getJSONObject("return_data")); - } + HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(highOrder.getOrderNo()); + JSONObject object = groupService.getGroupContent(highGroupOrder.getGroupId()); - Map map = new HashMap<>(); - map.put("orderId" , highOrder.getId()); - - HighGroupCode highGroupCode = groupCodeService.findGroupCode(map); - goodsOrderModel.setHighGroupCode(highGroupCode); - return ResponseMsgUtil.success(goodsOrderModel); + if (object.getString("return_code").equals("000000")) { + goodsOrderModel.setGroupData(object.getJSONObject("return_data")); } + JSONObject objectStore = groupService.getStoreMsg(highGroupOrder.getStoreId()); + if (objectStore.getString("return_code").equals("000000")) { + goodsOrderModel.setStoreData(objectStore.getJSONObject("return_data")); + } + Map map = new HashMap<>(); + map.put("orderId" , highOrder.getId()); + HighGroupCode highGroupCode = groupCodeService.findGroupCode(map); + goodsOrderModel.setHighGroupCode(highGroupCode); + return ResponseMsgUtil.success(goodsOrderModel); } return ResponseMsgUtil.success(highOrder); diff --git a/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java b/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java index 633390eb..f141854b 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java @@ -75,7 +75,7 @@ public class OrderPayNotifyController { OrderPayType.PAY_TYPE2, map.get("transaction_id"), new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100")), - null); + null,null); } log.info("处理业务完成"); @@ -115,7 +115,7 @@ public class OrderPayNotifyController { OrderPayType.PAY_TYPE5, body.getString("wtorderid"), order.getPayPrice(), - null); + null,null); } log.info("处理业务完成"); } diff --git a/hai-order/src/main/java/com/web/controller/notify/HuiPayNotifyController.java b/hai-order/src/main/java/com/web/controller/notify/HuiPayNotifyController.java index ebaeb4bd..4a699f10 100644 --- a/hai-order/src/main/java/com/web/controller/notify/HuiPayNotifyController.java +++ b/hai-order/src/main/java/com/web/controller/notify/HuiPayNotifyController.java @@ -20,6 +20,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; @Controller @RequestMapping(value = "/huiPayNotify") @@ -57,12 +59,18 @@ public class HuiPayNotifyController { } else if (dataObject.getString("payMode").equals("UQRCODEPAY")) { orderPayType = OrderPayType.PAY_TYPE5; } + + Map other = new HashMap<>(); + other.put("payChannelOrderNo", dataObject.getString("platformTradeNo")); + // 处理订单业务 - paySuccessService.orderPaySuccessHandle(dataObject.getString("outTradeNo"), + paySuccessService.orderPaySuccessHandle( + dataObject.getString("outTradeNo"), orderPayType, dataObject.getString("accTradeNo"), dataObject.getBigDecimal("tradeAmount"), - null); + null, + other); } log.info("处理业务完成"); log.info("============回调任务End============="); diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java index 827ff5f7..da0112dc 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java @@ -45,50 +45,52 @@ public interface HighOrderMapper extends HighOrderMapperExt { "mem_id, mem_name, mem_phone, ", "combine_order_no, order_no, ", "pay_serial_no, pay_channel, ", - "pay_type, mem_card_id, ", - "mem_card_type, mem_card_no, ", - "freight_price, goods_total_price, ", - "total_price, payable_price, ", - "pay_price, pay_real_price, ", - "order_status, remarks, ", - "create_time, total_deduction_price, ", - "deduction_coupon_price, deduction_product_price, ", - "pay_gold, surplus_refund_price, ", - "surplus_refund_integral, pay_time, ", - "finish_time, cancel_time, ", - "cancel_remarks, refund_time, ", - "account_merchant_num, profit_sharing_status, ", - "profit_sharing_record_id, whether_check, ", - "whether_rebate, exception_status, ", - "exception_content, company_name, ", - "promote_code, sec_user_id, ", - "ext_1, ext_2, ext_3, ", - "ext_4, ext_5, ext_6)", + "pay_channel_order_no, pay_type, ", + "mem_card_id, mem_card_type, ", + "mem_card_no, freight_price, ", + "goods_total_price, total_price, ", + "payable_price, pay_price, ", + "pay_real_price, order_status, ", + "remarks, create_time, ", + "total_deduction_price, deduction_coupon_price, ", + "deduction_product_price, pay_gold, ", + "surplus_refund_price, surplus_refund_integral, ", + "pay_time, finish_time, ", + "cancel_time, cancel_remarks, ", + "refund_time, account_merchant_num, ", + "profit_sharing_status, profit_sharing_record_id, ", + "whether_check, whether_rebate, ", + "exception_status, exception_content, ", + "company_name, promote_code, ", + "sec_user_id, ext_1, ", + "ext_2, ext_3, ext_4, ", + "ext_5, ext_6)", "values (#{title,jdbcType=VARCHAR}, #{searchTitle,jdbcType=VARCHAR}, ", "#{productType,jdbcType=INTEGER}, #{companyId,jdbcType=BIGINT}, ", "#{memDiscountId,jdbcType=BIGINT}, #{memDiscountName,jdbcType=VARCHAR}, ", "#{memId,jdbcType=BIGINT}, #{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", "#{combineOrderNo,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, ", "#{paySerialNo,jdbcType=VARCHAR}, #{payChannel,jdbcType=INTEGER}, ", - "#{payType,jdbcType=INTEGER}, #{memCardId,jdbcType=BIGINT}, ", - "#{memCardType,jdbcType=INTEGER}, #{memCardNo,jdbcType=VARCHAR}, ", - "#{freightPrice,jdbcType=DECIMAL}, #{goodsTotalPrice,jdbcType=DECIMAL}, ", - "#{totalPrice,jdbcType=DECIMAL}, #{payablePrice,jdbcType=DECIMAL}, ", - "#{payPrice,jdbcType=DECIMAL}, #{payRealPrice,jdbcType=DECIMAL}, ", - "#{orderStatus,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{totalDeductionPrice,jdbcType=DECIMAL}, ", - "#{deductionCouponPrice,jdbcType=DECIMAL}, #{deductionProductPrice,jdbcType=DECIMAL}, ", - "#{payGold,jdbcType=INTEGER}, #{surplusRefundPrice,jdbcType=DECIMAL}, ", - "#{surplusRefundIntegral,jdbcType=INTEGER}, #{payTime,jdbcType=TIMESTAMP}, ", - "#{finishTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ", - "#{cancelRemarks,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, ", - "#{accountMerchantNum,jdbcType=VARCHAR}, #{profitSharingStatus,jdbcType=BIT}, ", - "#{profitSharingRecordId,jdbcType=BIGINT}, #{whetherCheck,jdbcType=BIT}, ", - "#{whetherRebate,jdbcType=BIT}, #{exceptionStatus,jdbcType=BIT}, ", - "#{exceptionContent,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, ", - "#{promoteCode,jdbcType=VARCHAR}, #{secUserId,jdbcType=BIGINT}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", - "#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" + "#{payChannelOrderNo,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, ", + "#{memCardId,jdbcType=BIGINT}, #{memCardType,jdbcType=INTEGER}, ", + "#{memCardNo,jdbcType=VARCHAR}, #{freightPrice,jdbcType=DECIMAL}, ", + "#{goodsTotalPrice,jdbcType=DECIMAL}, #{totalPrice,jdbcType=DECIMAL}, ", + "#{payablePrice,jdbcType=DECIMAL}, #{payPrice,jdbcType=DECIMAL}, ", + "#{payRealPrice,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER}, ", + "#{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{totalDeductionPrice,jdbcType=DECIMAL}, #{deductionCouponPrice,jdbcType=DECIMAL}, ", + "#{deductionProductPrice,jdbcType=DECIMAL}, #{payGold,jdbcType=INTEGER}, ", + "#{surplusRefundPrice,jdbcType=DECIMAL}, #{surplusRefundIntegral,jdbcType=INTEGER}, ", + "#{payTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ", + "#{cancelTime,jdbcType=TIMESTAMP}, #{cancelRemarks,jdbcType=VARCHAR}, ", + "#{refundTime,jdbcType=TIMESTAMP}, #{accountMerchantNum,jdbcType=VARCHAR}, ", + "#{profitSharingStatus,jdbcType=BIT}, #{profitSharingRecordId,jdbcType=BIGINT}, ", + "#{whetherCheck,jdbcType=BIT}, #{whetherRebate,jdbcType=BIT}, ", + "#{exceptionStatus,jdbcType=BIT}, #{exceptionContent,jdbcType=VARCHAR}, ", + "#{companyName,jdbcType=VARCHAR}, #{promoteCode,jdbcType=VARCHAR}, ", + "#{secUserId,jdbcType=BIGINT}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ", + "#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighOrder record); @@ -113,6 +115,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), @Result(column="pay_channel", property="payChannel", jdbcType=JdbcType.INTEGER), + @Result(column="pay_channel_order_no", property="payChannelOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), @Result(column="mem_card_id", property="memCardId", jdbcType=JdbcType.BIGINT), @Result(column="mem_card_type", property="memCardType", jdbcType=JdbcType.INTEGER), @@ -160,9 +163,9 @@ public interface HighOrderMapper extends HighOrderMapperExt { "select", "id, title, search_title, product_type, company_id, mem_discount_id, mem_discount_name, ", "mem_id, mem_name, mem_phone, combine_order_no, order_no, pay_serial_no, pay_channel, ", - "pay_type, mem_card_id, mem_card_type, mem_card_no, freight_price, goods_total_price, ", - "total_price, payable_price, pay_price, pay_real_price, order_status, remarks, ", - "create_time, total_deduction_price, deduction_coupon_price, deduction_product_price, ", + "pay_channel_order_no, pay_type, mem_card_id, mem_card_type, mem_card_no, freight_price, ", + "goods_total_price, total_price, payable_price, pay_price, pay_real_price, order_status, ", + "remarks, create_time, total_deduction_price, deduction_coupon_price, deduction_product_price, ", "pay_gold, surplus_refund_price, surplus_refund_integral, pay_time, finish_time, ", "cancel_time, cancel_remarks, refund_time, account_merchant_num, profit_sharing_status, ", "profit_sharing_record_id, whether_check, whether_rebate, exception_status, exception_content, ", @@ -186,6 +189,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), @Result(column="pay_channel", property="payChannel", jdbcType=JdbcType.INTEGER), + @Result(column="pay_channel_order_no", property="payChannelOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), @Result(column="mem_card_id", property="memCardId", jdbcType=JdbcType.BIGINT), @Result(column="mem_card_type", property="memCardType", jdbcType=JdbcType.INTEGER), @@ -253,6 +257,7 @@ public interface HighOrderMapper extends HighOrderMapperExt { "order_no = #{orderNo,jdbcType=VARCHAR},", "pay_serial_no = #{paySerialNo,jdbcType=VARCHAR},", "pay_channel = #{payChannel,jdbcType=INTEGER},", + "pay_channel_order_no = #{payChannelOrderNo,jdbcType=VARCHAR},", "pay_type = #{payType,jdbcType=INTEGER},", "mem_card_id = #{memCardId,jdbcType=BIGINT},", "mem_card_type = #{memCardType,jdbcType=INTEGER},", diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java index 1072ecb9..d56f53fa 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java @@ -80,6 +80,10 @@ public class HighOrderSqlProvider { sql.VALUES("pay_channel", "#{payChannel,jdbcType=INTEGER}"); } + if (record.getPayChannelOrderNo() != null) { + sql.VALUES("pay_channel_order_no", "#{payChannelOrderNo,jdbcType=VARCHAR}"); + } + if (record.getPayType() != null) { sql.VALUES("pay_type", "#{payType,jdbcType=INTEGER}"); } @@ -263,6 +267,7 @@ public class HighOrderSqlProvider { sql.SELECT("order_no"); sql.SELECT("pay_serial_no"); sql.SELECT("pay_channel"); + sql.SELECT("pay_channel_order_no"); sql.SELECT("pay_type"); sql.SELECT("mem_card_id"); sql.SELECT("mem_card_type"); @@ -376,6 +381,10 @@ public class HighOrderSqlProvider { sql.SET("pay_channel = #{record.payChannel,jdbcType=INTEGER}"); } + if (record.getPayChannelOrderNo() != null) { + sql.SET("pay_channel_order_no = #{record.payChannelOrderNo,jdbcType=VARCHAR}"); + } + if (record.getPayType() != null) { sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}"); } @@ -558,6 +567,7 @@ public class HighOrderSqlProvider { sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}"); sql.SET("pay_channel = #{record.payChannel,jdbcType=INTEGER}"); + sql.SET("pay_channel_order_no = #{record.payChannelOrderNo,jdbcType=VARCHAR}"); sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}"); sql.SET("mem_card_id = #{record.memCardId,jdbcType=BIGINT}"); sql.SET("mem_card_type = #{record.memCardType,jdbcType=INTEGER}"); @@ -660,6 +670,10 @@ public class HighOrderSqlProvider { sql.SET("pay_channel = #{payChannel,jdbcType=INTEGER}"); } + if (record.getPayChannelOrderNo() != null) { + sql.SET("pay_channel_order_no = #{payChannelOrderNo,jdbcType=VARCHAR}"); + } + if (record.getPayType() != null) { sql.SET("pay_type = #{payType,jdbcType=INTEGER}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java index bfad0ae1..f86f6908 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java @@ -98,6 +98,11 @@ public class HighOrder implements Serializable { */ private Integer payChannel; + /** + * 支付渠道订单号 + */ + private String payChannelOrderNo; + /** * 支付方式: 1:支付宝 2:微信 3:金币 4:汇联通工会卡 5:银联 */ @@ -287,14 +292,18 @@ public class HighOrder implements Serializable { private String goodsTypeName; - public String getGoodsTypeName() { - return goodsTypeName; + private List highChildOrderList; + + public List getHighChildOrderList() { + return highChildOrderList; } - public void setGoodsTypeName(String goodsTypeName) { - this.goodsTypeName = goodsTypeName; + public void setHighChildOrderList(List highChildOrderList) { + this.highChildOrderList = highChildOrderList; } + private static final long serialVersionUID = 1L; + public String getTime() { return time; } @@ -303,16 +312,12 @@ public class HighOrder implements Serializable { this.time = time; } - private static final long serialVersionUID = 1L; - - private List highChildOrderList; - - public List getHighChildOrderList() { - return highChildOrderList; + public String getGoodsTypeName() { + return goodsTypeName; } - public void setHighChildOrderList(List highChildOrderList) { - this.highChildOrderList = highChildOrderList; + public void setGoodsTypeName(String goodsTypeName) { + this.goodsTypeName = goodsTypeName; } public Long getId() { @@ -427,6 +432,14 @@ public class HighOrder implements Serializable { this.payChannel = payChannel; } + public String getPayChannelOrderNo() { + return payChannelOrderNo; + } + + public void setPayChannelOrderNo(String payChannelOrderNo) { + this.payChannelOrderNo = payChannelOrderNo; + } + public Integer getPayType() { return payType; } @@ -773,6 +786,7 @@ public class HighOrder implements Serializable { && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo())) && (this.getPaySerialNo() == null ? other.getPaySerialNo() == null : this.getPaySerialNo().equals(other.getPaySerialNo())) && (this.getPayChannel() == null ? other.getPayChannel() == null : this.getPayChannel().equals(other.getPayChannel())) + && (this.getPayChannelOrderNo() == null ? other.getPayChannelOrderNo() == null : this.getPayChannelOrderNo().equals(other.getPayChannelOrderNo())) && (this.getPayType() == null ? other.getPayType() == null : this.getPayType().equals(other.getPayType())) && (this.getMemCardId() == null ? other.getMemCardId() == null : this.getMemCardId().equals(other.getMemCardId())) && (this.getMemCardType() == null ? other.getMemCardType() == null : this.getMemCardType().equals(other.getMemCardType())) @@ -833,6 +847,7 @@ public class HighOrder implements Serializable { result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode()); result = prime * result + ((getPaySerialNo() == null) ? 0 : getPaySerialNo().hashCode()); result = prime * result + ((getPayChannel() == null) ? 0 : getPayChannel().hashCode()); + result = prime * result + ((getPayChannelOrderNo() == null) ? 0 : getPayChannelOrderNo().hashCode()); result = prime * result + ((getPayType() == null) ? 0 : getPayType().hashCode()); result = prime * result + ((getMemCardId() == null) ? 0 : getMemCardId().hashCode()); result = prime * result + ((getMemCardType() == null) ? 0 : getMemCardType().hashCode()); @@ -896,6 +911,7 @@ public class HighOrder implements Serializable { sb.append(", orderNo=").append(orderNo); sb.append(", paySerialNo=").append(paySerialNo); sb.append(", payChannel=").append(payChannel); + sb.append(", payChannelOrderNo=").append(payChannelOrderNo); sb.append(", payType=").append(payType); sb.append(", memCardId=").append(memCardId); sb.append(", memCardType=").append(memCardType); @@ -940,4 +956,4 @@ public class HighOrder implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java index c187a267..1e87364a 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java @@ -1046,6 +1046,76 @@ public class HighOrderExample { return (Criteria) this; } + public Criteria andPayChannelOrderNoIsNull() { + addCriterion("pay_channel_order_no is null"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoIsNotNull() { + addCriterion("pay_channel_order_no is not null"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoEqualTo(String value) { + addCriterion("pay_channel_order_no =", value, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoNotEqualTo(String value) { + addCriterion("pay_channel_order_no <>", value, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoGreaterThan(String value) { + addCriterion("pay_channel_order_no >", value, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoGreaterThanOrEqualTo(String value) { + addCriterion("pay_channel_order_no >=", value, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoLessThan(String value) { + addCriterion("pay_channel_order_no <", value, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoLessThanOrEqualTo(String value) { + addCriterion("pay_channel_order_no <=", value, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoLike(String value) { + addCriterion("pay_channel_order_no like", value, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoNotLike(String value) { + addCriterion("pay_channel_order_no not like", value, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoIn(List values) { + addCriterion("pay_channel_order_no in", values, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoNotIn(List values) { + addCriterion("pay_channel_order_no not in", values, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoBetween(String value1, String value2) { + addCriterion("pay_channel_order_no between", value1, value2, "payChannelOrderNo"); + return (Criteria) this; + } + + public Criteria andPayChannelOrderNoNotBetween(String value1, String value2) { + addCriterion("pay_channel_order_no not between", value1, value2, "payChannelOrderNo"); + return (Criteria) this; + } + public Criteria andPayTypeIsNull() { addCriterion("pay_type is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/order/service/OrderPaySuccessService.java b/hai-service/src/main/java/com/hai/order/service/OrderPaySuccessService.java index fdeb6412..90cfeea6 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderPaySuccessService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderPaySuccessService.java @@ -6,6 +6,7 @@ import com.hai.entity.HighUserCard; import com.hai.order.type.OrderPayType; import java.math.BigDecimal; +import java.util.Map; /** * 订单支付成功业务 @@ -23,6 +24,6 @@ public interface OrderPaySuccessService { * @param userCard 用户卡 * @return */ - HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard); + HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard, Map other); } diff --git a/hai-service/src/main/java/com/hai/order/service/OrderService.java b/hai-service/src/main/java/com/hai/order/service/OrderService.java index 72c1791c..1621eff3 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderService.java @@ -80,6 +80,8 @@ public interface OrderService { */ HighOrder getOrderDetailBySerialNo(String paySerialNo); + HighOrder getOrderDetailByChannelOrderNo(String payChannelOrderNo); + /** * @Author Sum1Dream * @Name getOrderDetail diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java index 7a67bc55..504aa530 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java @@ -113,7 +113,7 @@ public class OrderPayServiceImpl implements OrderPayService { OrderPayType.PAY_TYPE4, consumptionResult.getString("orderId"), order.getPayPrice(), - userCard); + userCard,null); } @@ -133,7 +133,7 @@ public class OrderPayServiceImpl implements OrderPayService { OrderPayType.PAY_TYPE7, null, order.getPayPrice(), - userCard); + userCard,null); } @Override @@ -169,7 +169,7 @@ public class OrderPayServiceImpl implements OrderPayService { OrderPayType.PAY_TYPE8, null, order.getPayPrice(), - userCard); + userCard,null); } @Override @@ -199,7 +199,7 @@ public class OrderPayServiceImpl implements OrderPayService { OrderPayType.PAY_TYPE9, null, order.getPayPrice(), - null); + null,null); } else { // 加锁失败,重试 Thread.sleep(100); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index 248ea096..3d90354e 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -20,6 +20,8 @@ import com.hai.order.service.OrderService; import com.hai.order.topic.OrderTopic; import com.hai.order.type.*; import com.hai.service.*; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.rocketmq.client.producer.SendCallback; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.spring.core.RocketMQTemplate; @@ -131,12 +133,13 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { @Override - public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard) { + public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard, Map other) { HighOrder order = orderService.getOrderDetailByNo(orderNo); try { if (order != null) { order.setPaySerialNo(paySerialNo); order.setPayRealPrice(payRealPrice); + order.setPayChannelOrderNo(other!=null&& StringUtils.isNotBlank(MapUtils.getString(other, "payChannelOrderNo"))?MapUtils.getString(other, "payChannelOrderNo"):null); order.setPayTime(new Date()); order.setPayType(payType != null?payType.getNumber():null); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index fbea33ff..00384d5a 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -609,7 +609,7 @@ public class OrderServiceImpl implements OrderService { // 支付校验 orderPayBeforeService.payOrderCheck(order); // 处理业务 - return paySuccessService.orderPaySuccessHandle(orderData.getOrderNo(), OrderPayType.PAY_TYPE3, null, new BigDecimal("0"), null); + return paySuccessService.orderPaySuccessHandle(orderData.getOrderNo(), OrderPayType.PAY_TYPE3, null, new BigDecimal("0"), null, null); } return orderData; } @@ -848,6 +848,23 @@ public class OrderServiceImpl implements OrderService { return order; } + @Override + public HighOrder getOrderDetailByChannelOrderNo(String paySerialNo) { + HighOrderExample orderExample = new HighOrderExample(); + orderExample.createCriteria().andPayChannelOrderNoEqualTo(paySerialNo); + List orderList = orderMapper.selectByExample(orderExample); + if (orderList.size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号"); + } + HighOrder order = orderList.get(0); + + // 子订单 + HighChildOrderExample childOrderExample = new HighChildOrderExample(); + childOrderExample.createCriteria().andOrderIdEqualTo(order.getId()); + order.setHighChildOrderList(childOrderMapper.selectByExample(childOrderExample)); + return order; + } + @Override public HighOrder getOrderDetail(String orderNo) { HighOrderExample orderExample = new HighOrderExample();