提交代码

dev-discount
胡锐 2 years ago
parent 52ec76f5a7
commit 8effa3270b
  1. 3
      hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java
  2. 39
      hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java
  3. 14
      hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java
  4. 16
      hai-service/src/main/java/com/hai/entity/HighOrderRefund.java
  5. 70
      hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java
  6. 8
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  7. 9
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.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);
}

@ -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},",

@ -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}");
}

@ -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);

@ -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<String> values) {
addCriterion("third_party_refund_order_no in", values, "thirdPartyRefundOrderNo");
return (Criteria) this;
}
public Criteria andThirdPartyRefundOrderNoNotIn(List<String> 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;

@ -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());

@ -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, "退款失败,请稍后重试");
}

Loading…
Cancel
Save