From 8effa3270b3629348310dee440f24d20b5f12dd9 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 1 Nov 2022 17:47:14 +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 --- .../controller/OrderPayNotifyController.java | 3 +- .../com/hai/dao/HighOrderRefundMapper.java | 39 ++++++----- .../hai/dao/HighOrderRefundSqlProvider.java | 14 ++++ .../java/com/hai/entity/HighOrderRefund.java | 16 +++++ .../hai/entity/HighOrderRefundExample.java | 70 +++++++++++++++++++ .../impl/OrderPaySuccessServiceImpl.java | 8 ++- .../order/service/impl/OrderServiceImpl.java | 9 +-- 7 files changed, 136 insertions(+), 23 deletions(-) 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 4186d970..633390eb 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java @@ -72,7 +72,8 @@ public class OrderPayNotifyController { if (order != null && order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { // 处理订单业务 paySuccessService.orderPaySuccessHandle(map.get("out_trade_no"), - OrderPayType.PAY_TYPE2, map.get("out_trade_no"), + OrderPayType.PAY_TYPE2, + map.get("transaction_id"), new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100")), null); } diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java index 0d36b8fe..b7100049 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java @@ -46,13 +46,14 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { "goods_name, goods_desc, ", "goods_img, goods_spec_name, ", "goods_count, refund_order_no, ", - "return_total_price, refund_goods_num, ", - "refund_price, refund_integral, ", - "refund_remark, refund_status, ", - "refund_fail_reason, create_time, ", - "refund_time, update_time, ", - "ext_1, ext_2, ext_3, ", - "ext_4, ext_5, ext_6)", + "third_party_refund_order_no, return_total_price, ", + "refund_goods_num, refund_price, ", + "refund_integral, refund_remark, ", + "refund_status, refund_fail_reason, ", + "create_time, refund_time, ", + "update_time, ext_1, ", + "ext_2, ext_3, ext_4, ", + "ext_5, ext_6)", "values (#{orderId,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, ", "#{orderChildId,jdbcType=BIGINT}, #{orderChildNo,jdbcType=VARCHAR}, ", "#{memId,jdbcType=BIGINT}, #{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", @@ -60,13 +61,14 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { "#{goodsName,jdbcType=VARCHAR}, #{goodsDesc,jdbcType=VARCHAR}, ", "#{goodsImg,jdbcType=VARCHAR}, #{goodsSpecName,jdbcType=VARCHAR}, ", "#{goodsCount,jdbcType=INTEGER}, #{refundOrderNo,jdbcType=VARCHAR}, ", - "#{returnTotalPrice,jdbcType=DECIMAL}, #{refundGoodsNum,jdbcType=INTEGER}, ", - "#{refundPrice,jdbcType=DECIMAL}, #{refundIntegral,jdbcType=INTEGER}, ", - "#{refundRemark,jdbcType=VARCHAR}, #{refundStatus,jdbcType=INTEGER}, ", - "#{refundFailReason,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{refundTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", - "#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" + "#{thirdPartyRefundOrderNo,jdbcType=VARCHAR}, #{returnTotalPrice,jdbcType=DECIMAL}, ", + "#{refundGoodsNum,jdbcType=INTEGER}, #{refundPrice,jdbcType=DECIMAL}, ", + "#{refundIntegral,jdbcType=INTEGER}, #{refundRemark,jdbcType=VARCHAR}, ", + "#{refundStatus,jdbcType=INTEGER}, #{refundFailReason,jdbcType=VARCHAR}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{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(HighOrderRefund record); @@ -93,6 +95,7 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { @Result(column="goods_spec_name", property="goodsSpecName", jdbcType=JdbcType.VARCHAR), @Result(column="goods_count", property="goodsCount", jdbcType=JdbcType.INTEGER), @Result(column="refund_order_no", property="refundOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="third_party_refund_order_no", property="thirdPartyRefundOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="return_total_price", property="returnTotalPrice", jdbcType=JdbcType.DECIMAL), @Result(column="refund_goods_num", property="refundGoodsNum", jdbcType=JdbcType.INTEGER), @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @@ -116,9 +119,9 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { "select", "id, order_id, order_no, order_child_id, order_child_no, mem_id, mem_name, mem_phone, ", "goods_type, goods_id, goods_name, goods_desc, goods_img, goods_spec_name, goods_count, ", - "refund_order_no, return_total_price, refund_goods_num, refund_price, refund_integral, ", - "refund_remark, refund_status, refund_fail_reason, create_time, refund_time, ", - "update_time, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", + "refund_order_no, third_party_refund_order_no, return_total_price, refund_goods_num, ", + "refund_price, refund_integral, refund_remark, refund_status, refund_fail_reason, ", + "create_time, refund_time, update_time, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", "from high_order_refund", "where id = #{id,jdbcType=BIGINT}" }) @@ -139,6 +142,7 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { @Result(column="goods_spec_name", property="goodsSpecName", jdbcType=JdbcType.VARCHAR), @Result(column="goods_count", property="goodsCount", jdbcType=JdbcType.INTEGER), @Result(column="refund_order_no", property="refundOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="third_party_refund_order_no", property="thirdPartyRefundOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="return_total_price", property="returnTotalPrice", jdbcType=JdbcType.DECIMAL), @Result(column="refund_goods_num", property="refundGoodsNum", jdbcType=JdbcType.INTEGER), @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @@ -184,6 +188,7 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { "goods_spec_name = #{goodsSpecName,jdbcType=VARCHAR},", "goods_count = #{goodsCount,jdbcType=INTEGER},", "refund_order_no = #{refundOrderNo,jdbcType=VARCHAR},", + "third_party_refund_order_no = #{thirdPartyRefundOrderNo,jdbcType=VARCHAR},", "return_total_price = #{returnTotalPrice,jdbcType=DECIMAL},", "refund_goods_num = #{refundGoodsNum,jdbcType=INTEGER},", "refund_price = #{refundPrice,jdbcType=DECIMAL},", diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java index dd868b96..0667e007 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java @@ -88,6 +88,10 @@ public class HighOrderRefundSqlProvider { sql.VALUES("refund_order_no", "#{refundOrderNo,jdbcType=VARCHAR}"); } + if (record.getThirdPartyRefundOrderNo() != null) { + sql.VALUES("third_party_refund_order_no", "#{thirdPartyRefundOrderNo,jdbcType=VARCHAR}"); + } + if (record.getReturnTotalPrice() != null) { sql.VALUES("return_total_price", "#{returnTotalPrice,jdbcType=DECIMAL}"); } @@ -177,6 +181,7 @@ public class HighOrderRefundSqlProvider { sql.SELECT("goods_spec_name"); sql.SELECT("goods_count"); sql.SELECT("refund_order_no"); + sql.SELECT("third_party_refund_order_no"); sql.SELECT("return_total_price"); sql.SELECT("refund_goods_num"); sql.SELECT("refund_price"); @@ -274,6 +279,10 @@ public class HighOrderRefundSqlProvider { sql.SET("refund_order_no = #{record.refundOrderNo,jdbcType=VARCHAR}"); } + if (record.getThirdPartyRefundOrderNo() != null) { + sql.SET("third_party_refund_order_no = #{record.thirdPartyRefundOrderNo,jdbcType=VARCHAR}"); + } + if (record.getReturnTotalPrice() != null) { sql.SET("return_total_price = #{record.returnTotalPrice,jdbcType=DECIMAL}"); } @@ -362,6 +371,7 @@ public class HighOrderRefundSqlProvider { sql.SET("goods_spec_name = #{record.goodsSpecName,jdbcType=VARCHAR}"); sql.SET("goods_count = #{record.goodsCount,jdbcType=INTEGER}"); sql.SET("refund_order_no = #{record.refundOrderNo,jdbcType=VARCHAR}"); + sql.SET("third_party_refund_order_no = #{record.thirdPartyRefundOrderNo,jdbcType=VARCHAR}"); sql.SET("return_total_price = #{record.returnTotalPrice,jdbcType=DECIMAL}"); sql.SET("refund_goods_num = #{record.refundGoodsNum,jdbcType=INTEGER}"); sql.SET("refund_price = #{record.refundPrice,jdbcType=DECIMAL}"); @@ -448,6 +458,10 @@ public class HighOrderRefundSqlProvider { sql.SET("refund_order_no = #{refundOrderNo,jdbcType=VARCHAR}"); } + if (record.getThirdPartyRefundOrderNo() != null) { + sql.SET("third_party_refund_order_no = #{thirdPartyRefundOrderNo,jdbcType=VARCHAR}"); + } + if (record.getReturnTotalPrice() != null) { sql.SET("return_total_price = #{returnTotalPrice,jdbcType=DECIMAL}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderRefund.java b/hai-service/src/main/java/com/hai/entity/HighOrderRefund.java index 3bab2d54..5459b65c 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderRefund.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderRefund.java @@ -104,6 +104,11 @@ public class HighOrderRefund implements Serializable { */ private String refundOrderNo; + /** + * 退款订单号第三方 + */ + private String thirdPartyRefundOrderNo; + /** * 退款总金额 */ @@ -299,6 +304,14 @@ public class HighOrderRefund implements Serializable { this.refundOrderNo = refundOrderNo; } + public String getThirdPartyRefundOrderNo() { + return thirdPartyRefundOrderNo; + } + + public void setThirdPartyRefundOrderNo(String thirdPartyRefundOrderNo) { + this.thirdPartyRefundOrderNo = thirdPartyRefundOrderNo; + } + public BigDecimal getReturnTotalPrice() { return returnTotalPrice; } @@ -455,6 +468,7 @@ public class HighOrderRefund implements Serializable { && (this.getGoodsSpecName() == null ? other.getGoodsSpecName() == null : this.getGoodsSpecName().equals(other.getGoodsSpecName())) && (this.getGoodsCount() == null ? other.getGoodsCount() == null : this.getGoodsCount().equals(other.getGoodsCount())) && (this.getRefundOrderNo() == null ? other.getRefundOrderNo() == null : this.getRefundOrderNo().equals(other.getRefundOrderNo())) + && (this.getThirdPartyRefundOrderNo() == null ? other.getThirdPartyRefundOrderNo() == null : this.getThirdPartyRefundOrderNo().equals(other.getThirdPartyRefundOrderNo())) && (this.getReturnTotalPrice() == null ? other.getReturnTotalPrice() == null : this.getReturnTotalPrice().equals(other.getReturnTotalPrice())) && (this.getRefundGoodsNum() == null ? other.getRefundGoodsNum() == null : this.getRefundGoodsNum().equals(other.getRefundGoodsNum())) && (this.getRefundPrice() == null ? other.getRefundPrice() == null : this.getRefundPrice().equals(other.getRefundPrice())) @@ -493,6 +507,7 @@ public class HighOrderRefund implements Serializable { result = prime * result + ((getGoodsSpecName() == null) ? 0 : getGoodsSpecName().hashCode()); result = prime * result + ((getGoodsCount() == null) ? 0 : getGoodsCount().hashCode()); result = prime * result + ((getRefundOrderNo() == null) ? 0 : getRefundOrderNo().hashCode()); + result = prime * result + ((getThirdPartyRefundOrderNo() == null) ? 0 : getThirdPartyRefundOrderNo().hashCode()); result = prime * result + ((getReturnTotalPrice() == null) ? 0 : getReturnTotalPrice().hashCode()); result = prime * result + ((getRefundGoodsNum() == null) ? 0 : getRefundGoodsNum().hashCode()); result = prime * result + ((getRefundPrice() == null) ? 0 : getRefundPrice().hashCode()); @@ -534,6 +549,7 @@ public class HighOrderRefund implements Serializable { sb.append(", goodsSpecName=").append(goodsSpecName); sb.append(", goodsCount=").append(goodsCount); sb.append(", refundOrderNo=").append(refundOrderNo); + sb.append(", thirdPartyRefundOrderNo=").append(thirdPartyRefundOrderNo); sb.append(", returnTotalPrice=").append(returnTotalPrice); sb.append(", refundGoodsNum=").append(refundGoodsNum); sb.append(", refundPrice=").append(refundPrice); diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java b/hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java index 3e6740c1..0908b192 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java @@ -1176,6 +1176,76 @@ public class HighOrderRefundExample { return (Criteria) this; } + public Criteria andThirdPartyRefundOrderNoIsNull() { + addCriterion("third_party_refund_order_no is null"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoIsNotNull() { + addCriterion("third_party_refund_order_no is not null"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoEqualTo(String value) { + addCriterion("third_party_refund_order_no =", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoNotEqualTo(String value) { + addCriterion("third_party_refund_order_no <>", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoGreaterThan(String value) { + addCriterion("third_party_refund_order_no >", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoGreaterThanOrEqualTo(String value) { + addCriterion("third_party_refund_order_no >=", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoLessThan(String value) { + addCriterion("third_party_refund_order_no <", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoLessThanOrEqualTo(String value) { + addCriterion("third_party_refund_order_no <=", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoLike(String value) { + addCriterion("third_party_refund_order_no like", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoNotLike(String value) { + addCriterion("third_party_refund_order_no not like", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoIn(List values) { + addCriterion("third_party_refund_order_no in", values, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoNotIn(List values) { + addCriterion("third_party_refund_order_no not in", values, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoBetween(String value1, String value2) { + addCriterion("third_party_refund_order_no between", value1, value2, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoNotBetween(String value1, String value2) { + addCriterion("third_party_refund_order_no not between", value1, value2, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + public Criteria andReturnTotalPriceIsNull() { addCriterion("return_total_price is null"); return (Criteria) this; 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 2e76ea33..c1398d32 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 @@ -101,7 +101,13 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { order.setPayRealPrice(payRealPrice); order.setPayTime(new Date()); order.setPayType(payType != null?payType.getNumber():null); - order.setOrderStatus(OrderStatusEnum.type2.getType()); + + if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { + order.setOrderStatus(OrderStatusEnum.type3.getType()); + } else { + order.setOrderStatus(OrderStatusEnum.type2.getType()); + } + if (userCard != null) { order.setMemCardId(userCard.getId()); order.setMemCardNo(userCard.getCardNo()); 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 8b0c65ad..1cfac1d2 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 @@ -532,13 +532,13 @@ public class OrderServiceImpl implements OrderService { order.setRefundTime(new Date()); order.setOrderStatus(OrderStatus.STATUS4.getNumber()); - // todo 退款金额,原路返回 + // 退回金额,原路返回 RefundPriceModel refundPrice = orderRefundService.refundPrice(refundOrderNo , order , OrderPayType.getDataByType(order.getPayType()) , order.getPayRealPrice() , order.getPayGold()); - if (refundPrice.getRefundSuccess() == true) { + if (refundPrice.getRefundSuccess() == false) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试"); } @@ -546,6 +546,7 @@ public class OrderServiceImpl implements OrderService { for (HighOrderRefund orderRefund : refundList) { orderRefund.setRefundStatus(OrderRefundStatus.STATUS2.getNumber()); orderRefund.setRefundTime(new Date()); + orderRefund.setThirdPartyRefundOrderNo(refundPrice.getThirdPartyRefundOrderNo()); orderRefundService.update(orderRefund); rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_REFUND_SUCCESS.getTopic(), orderRefund); @@ -580,13 +581,13 @@ public class OrderServiceImpl implements OrderService { orderChild.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber()); } - // todo 退款金额,原路返回 + // 退回金额,原路返回 RefundPriceModel refundPrice = orderRefundService.refundPrice(orderRefund.getRefundOrderNo() , order , OrderPayType.getDataByType(order.getPayType()) , orderRefund.getRefundPrice() , orderRefund.getRefundIntegral()); - if (!refundPrice.getRefundSuccess() == true) { + if (refundPrice.getRefundSuccess() == false) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试"); }