提交代码

dev-discount
胡锐 2 years ago
parent 3bbc59e4af
commit 6f07f5b2cb
  1. 35
      hai-order/src/main/java/com/web/controller/OrderRefundController.java
  2. 26
      hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java
  3. 42
      hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java
  4. 48
      hai-service/src/main/java/com/hai/entity/HighOrderRefund.java
  5. 190
      hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java
  6. 5
      hai-service/src/main/java/com/hai/order/service/OrderRefundService.java
  7. 6
      hai-service/src/main/java/com/hai/order/service/OrderService.java
  8. 14
      hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java
  9. 13
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  10. 52
      hai-service/src/main/java/com/hai/order/type/OrderRefundOrderOpUserType.java

@ -15,6 +15,7 @@ import com.hai.entity.HighOrderRefund;
import com.hai.enum_type.OrderStatusEnum;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.order.model.CreateOrderChildModel;
import com.hai.order.model.CreateOrderModel;
import com.hai.order.model.ExportGasOrderModel;
@ -42,6 +43,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Controller
@RequestMapping(value = "")
@ -67,6 +69,10 @@ public class OrderRefundController {
@ApiOperation(value = "交易订单退款")
public ResponseData refundOrder(@RequestBody JSONObject body) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
}
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");
}
@ -79,7 +85,12 @@ public class OrderRefundController {
&& !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误");
}
orderService.refundOrder(order, body.getString("remarks"));
orderService.refundOrder(order,
body.getString("remarks"),
OrderRefundOrderOpUserType.TYPE2,
userInfoModel.getSecUser().getId(),
userInfoModel.getSecUser().getUserName()
);
return ResponseMsgUtil.success("退款成功");
@ -100,17 +111,31 @@ public class OrderRefundController {
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");
}
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
}
// 查询订单编号
HighChildOrder orderChild = orderService.getChildOrderByNo(body.getString("childOrderNo"));
if (orderChild == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单编号");
}
if (orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS2.getNumber())
|| orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){
if (!orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS2.getNumber())
&& !orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "子订单状态错误");
}
orderService.refundChildOrder(orderChild.getOrderNo(), body.getString("childOrderNo"), body.getInteger("refundGoodsNum"), body.getString("remarks"));
HighOrder order = orderService.getOrderDetailByNo(orderChild.getOrderNo());
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易订单不存在");
}
orderService.refundChildOrder(
order, body.getString("childOrderNo"),
body.getInteger("refundGoodsNum"),
body.getString("remarks"),
OrderRefundOrderOpUserType.TYPE2,
userInfoModel.getSecUser().getId(),
userInfoModel.getSecUser().getUserName()
);
return ResponseMsgUtil.success("退款成功");

@ -51,9 +51,10 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt {
"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)",
"update_time, op_user_type, ",
"op_user_id, op_user_name, ",
"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}, ",
@ -66,9 +67,10 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt {
"#{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})"
"#{updateTime,jdbcType=TIMESTAMP}, #{opUserType,jdbcType=INTEGER}, ",
"#{opUserId,jdbcType=INTEGER}, #{opUserName,jdbcType=VARCHAR}, ",
"#{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);
@ -106,6 +108,9 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt {
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR),
@ -121,7 +126,8 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt {
"goods_type, goods_id, goods_name, goods_desc, goods_img, goods_spec_name, goods_count, ",
"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",
"create_time, refund_time, update_time, op_user_type, op_user_id, op_user_name, ",
"ext_1, ext_2, ext_3, ext_4, ext_5, ext_6",
"from high_order_refund",
"where id = #{id,jdbcType=BIGINT}"
})
@ -153,6 +159,9 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt {
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR),
@ -199,6 +208,9 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt {
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"refund_time = #{refundTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"op_user_type = #{opUserType,jdbcType=INTEGER},",
"op_user_id = #{opUserId,jdbcType=INTEGER},",
"op_user_name = #{opUserName,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR},",

@ -132,6 +132,18 @@ public class HighOrderRefundSqlProvider {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.VALUES("op_user_type", "#{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.VALUES("op_user_id", "#{opUserId,jdbcType=INTEGER}");
}
if (record.getOpUserName() != null) {
sql.VALUES("op_user_name", "#{opUserName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
@ -192,6 +204,9 @@ public class HighOrderRefundSqlProvider {
sql.SELECT("create_time");
sql.SELECT("refund_time");
sql.SELECT("update_time");
sql.SELECT("op_user_type");
sql.SELECT("op_user_id");
sql.SELECT("op_user_name");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
@ -323,6 +338,18 @@ public class HighOrderRefundSqlProvider {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{record.opUserId,jdbcType=INTEGER}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
@ -382,6 +409,9 @@ public class HighOrderRefundSqlProvider {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
sql.SET("op_user_id = #{record.opUserId,jdbcType=INTEGER}");
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
@ -502,6 +532,18 @@ public class HighOrderRefundSqlProvider {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{opUserId,jdbcType=INTEGER}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{opUserName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}

@ -162,6 +162,21 @@ public class HighOrderRefund implements Serializable {
*/
private Date updateTime;
/**
* 操作人类型 1. 系统 2. 管理员 3. 用户
*/
private Integer opUserType;
/**
* 操作人id
*/
private Integer opUserId;
/**
* 操作人名称
*/
private String opUserName;
private String ext1;
private String ext2;
@ -392,6 +407,30 @@ public class HighOrderRefund implements Serializable {
this.updateTime = updateTime;
}
public Integer getOpUserType() {
return opUserType;
}
public void setOpUserType(Integer opUserType) {
this.opUserType = opUserType;
}
public Integer getOpUserId() {
return opUserId;
}
public void setOpUserId(Integer opUserId) {
this.opUserId = opUserId;
}
public String getOpUserName() {
return opUserName;
}
public void setOpUserName(String opUserName) {
this.opUserName = opUserName;
}
public String getExt1() {
return ext1;
}
@ -479,6 +518,9 @@ public class HighOrderRefund implements Serializable {
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getRefundTime() == null ? other.getRefundTime() == null : this.getRefundTime().equals(other.getRefundTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getOpUserType() == null ? other.getOpUserType() == null : this.getOpUserType().equals(other.getOpUserType()))
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId()))
&& (this.getOpUserName() == null ? other.getOpUserName() == null : this.getOpUserName().equals(other.getOpUserName()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()))
@ -518,6 +560,9 @@ public class HighOrderRefund implements Serializable {
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getRefundTime() == null) ? 0 : getRefundTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getOpUserType() == null) ? 0 : getOpUserType().hashCode());
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode());
result = prime * result + ((getOpUserName() == null) ? 0 : getOpUserName().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
@ -560,6 +605,9 @@ public class HighOrderRefund implements Serializable {
sb.append(", createTime=").append(createTime);
sb.append(", refundTime=").append(refundTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", opUserType=").append(opUserType);
sb.append(", opUserId=").append(opUserId);
sb.append(", opUserName=").append(opUserName);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);

@ -1866,6 +1866,196 @@ public class HighOrderRefundExample {
return (Criteria) this;
}
public Criteria andOpUserTypeIsNull() {
addCriterion("op_user_type is null");
return (Criteria) this;
}
public Criteria andOpUserTypeIsNotNull() {
addCriterion("op_user_type is not null");
return (Criteria) this;
}
public Criteria andOpUserTypeEqualTo(Integer value) {
addCriterion("op_user_type =", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeNotEqualTo(Integer value) {
addCriterion("op_user_type <>", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeGreaterThan(Integer value) {
addCriterion("op_user_type >", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("op_user_type >=", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeLessThan(Integer value) {
addCriterion("op_user_type <", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeLessThanOrEqualTo(Integer value) {
addCriterion("op_user_type <=", value, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeIn(List<Integer> values) {
addCriterion("op_user_type in", values, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeNotIn(List<Integer> values) {
addCriterion("op_user_type not in", values, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeBetween(Integer value1, Integer value2) {
addCriterion("op_user_type between", value1, value2, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserTypeNotBetween(Integer value1, Integer value2) {
addCriterion("op_user_type not between", value1, value2, "opUserType");
return (Criteria) this;
}
public Criteria andOpUserIdIsNull() {
addCriterion("op_user_id is null");
return (Criteria) this;
}
public Criteria andOpUserIdIsNotNull() {
addCriterion("op_user_id is not null");
return (Criteria) this;
}
public Criteria andOpUserIdEqualTo(Integer value) {
addCriterion("op_user_id =", value, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdNotEqualTo(Integer value) {
addCriterion("op_user_id <>", value, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdGreaterThan(Integer value) {
addCriterion("op_user_id >", value, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdGreaterThanOrEqualTo(Integer value) {
addCriterion("op_user_id >=", value, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdLessThan(Integer value) {
addCriterion("op_user_id <", value, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdLessThanOrEqualTo(Integer value) {
addCriterion("op_user_id <=", value, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdIn(List<Integer> values) {
addCriterion("op_user_id in", values, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdNotIn(List<Integer> values) {
addCriterion("op_user_id not in", values, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdBetween(Integer value1, Integer value2) {
addCriterion("op_user_id between", value1, value2, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserIdNotBetween(Integer value1, Integer value2) {
addCriterion("op_user_id not between", value1, value2, "opUserId");
return (Criteria) this;
}
public Criteria andOpUserNameIsNull() {
addCriterion("op_user_name is null");
return (Criteria) this;
}
public Criteria andOpUserNameIsNotNull() {
addCriterion("op_user_name is not null");
return (Criteria) this;
}
public Criteria andOpUserNameEqualTo(String value) {
addCriterion("op_user_name =", value, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameNotEqualTo(String value) {
addCriterion("op_user_name <>", value, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameGreaterThan(String value) {
addCriterion("op_user_name >", value, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameGreaterThanOrEqualTo(String value) {
addCriterion("op_user_name >=", value, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameLessThan(String value) {
addCriterion("op_user_name <", value, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameLessThanOrEqualTo(String value) {
addCriterion("op_user_name <=", value, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameLike(String value) {
addCriterion("op_user_name like", value, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameNotLike(String value) {
addCriterion("op_user_name not like", value, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameIn(List<String> values) {
addCriterion("op_user_name in", values, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameNotIn(List<String> values) {
addCriterion("op_user_name not in", values, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameBetween(String value1, String value2) {
addCriterion("op_user_name between", value1, value2, "opUserName");
return (Criteria) this;
}
public Criteria andOpUserNameNotBetween(String value1, String value2) {
addCriterion("op_user_name not between", value1, value2, "opUserName");
return (Criteria) this;
}
public Criteria andExt1IsNull() {
addCriterion("ext_1 is null");
return (Criteria) this;

@ -5,6 +5,7 @@ import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderRefund;
import com.hai.order.model.RefundPriceModel;
import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderRefundOrderOpUserType;
import java.math.BigDecimal;
import java.util.List;
@ -29,7 +30,7 @@ public interface OrderRefundService {
* @param order 交易订单
* @param remarks 退款备注
*/
HighOrder createOrderRefund(String refundOrderNo,HighOrder order, String remarks) throws Exception;
HighOrder createOrderRefund(String refundOrderNo, HighOrder order, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception;
/**
* 子订单退款
@ -38,7 +39,7 @@ public interface OrderRefundService {
* @param refundGoodsCount 退款商品数量
* @param remarks 退款备注
*/
HighOrderRefund createOrderChildRefund(HighChildOrder orderChild, String refundOrderNo, Integer refundGoodsCount, String remarks) throws Exception;
HighOrderRefund createOrderChildRefund(HighChildOrder orderChild, String refundOrderNo, Integer refundGoodsCount, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception;
/**
* 交易退钱

@ -4,6 +4,7 @@ import com.alicp.jetcache.anno.CacheUpdate;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.order.model.CreateOrderModel;
import com.hai.order.type.OrderRefundOrderOpUserType;
import java.util.List;
import java.util.Map;
@ -50,16 +51,17 @@ public interface OrderService {
* @param remarks
* @return
*/
HighOrder refundOrder(HighOrder order,String remarks) throws Exception;
HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception;
/**
* 子订单退款
* @param order
* @param childOrderNo
* @param refundGoodsNum
* @param remarks
* @return
*/
HighOrder refundChildOrder(String orderNo,String childOrderNo,Integer refundGoodsNum,String remarks) throws Exception;
HighOrder refundChildOrder(HighOrder order,String childOrderNo,Integer refundGoodsNum,String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception;
/**
* 根据订单号查询交易订单号详情

@ -17,10 +17,7 @@ import com.hai.model.OrderRefundModel;
import com.hai.order.model.RefundPriceModel;
import com.hai.order.service.OrderRefundService;
import com.hai.order.service.OrderService;
import com.hai.order.type.OrderChildStatus;
import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderRefundStatus;
import com.hai.order.type.OrderStatus;
import com.hai.order.type.*;
import com.hai.order.utils.OrderUtil;
import com.hai.service.HighOilCardService;
import com.hai.service.HighUserService;
@ -65,10 +62,10 @@ public class OrderRefundServiceImpl implements OrderRefundService {
}
@Override
public HighOrder createOrderRefund(String refundOrderNo,HighOrder order, String remarks) throws Exception {
public HighOrder createOrderRefund(String refundOrderNo, HighOrder order, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception {
for (HighChildOrder orderChild : order.getHighChildOrderList()) {
// 创建退款记录
HighOrderRefund orderRefund = createOrderChildRefund(orderChild, refundOrderNo, orderChild.getSaleCount(), remarks);
HighOrderRefund orderRefund = createOrderChildRefund(orderChild, refundOrderNo, orderChild.getSaleCount(), remarks, opUserType,opUserId,opUserName);
orderChild.setSurplusRefundNum(orderChild.getSurplusRefundNum() - orderRefund.getRefundGoodsNum());
orderChild.setSurplusRefundPrice(orderChild.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice()));
orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral());
@ -80,7 +77,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
}
@Override
public HighOrderRefund createOrderChildRefund(HighChildOrder orderChild,String refundOrderNo,Integer refundGoodsCount, String remarks) throws Exception {
public HighOrderRefund createOrderChildRefund(HighChildOrder orderChild,String refundOrderNo,Integer refundGoodsCount, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception {
if (!orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS2.getNumber())
&& !orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "子订单状态错误");
@ -127,6 +124,9 @@ public class OrderRefundServiceImpl implements OrderRefundService {
orderRefund.setRefundStatus(OrderRefundStatus.STATUS1.getNumber());
orderRefund.setCreateTime(new Date());
orderRefund.setUpdateTime(new Date());
orderRefund.setOpUserType(opUserType.getNumber());
orderRefund.setOpUserId(opUserType.getNumber());
orderRefund.setOpUserName(opUserType.getName());
orderRefundMapper.insert(orderRefund);
return orderRefund;
}

@ -506,7 +506,7 @@ public class OrderServiceImpl implements OrderService {
timeout = 10,
rollbackFor = Exception.class)
@CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order")
public HighOrder refundOrder(HighOrder order, String remarks) throws Exception {
public HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception {
if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())
&& !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误");
@ -525,7 +525,7 @@ public class OrderServiceImpl implements OrderService {
String refundOrderNo = OrderUtil.generateRefundOrderNo();
// 创建退款
order = orderRefundService.createOrderRefund(refundOrderNo, order, remarks);
order = orderRefundService.createOrderRefund(refundOrderNo, order, remarks, opUserType, opUserId, opUserName);
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGiveawayType() == false) {
@ -568,11 +568,8 @@ public class OrderServiceImpl implements OrderService {
isolation = Isolation.READ_COMMITTED,
timeout = 10,
rollbackFor = Exception.class)
public HighOrder refundChildOrder(String orderNo,String childOrderNo,Integer refundGoodsNum, String remarks) throws Exception {
HighOrder order = getOrderDetailByNo(orderNo);
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易订单不存在");
}
@CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order")
public HighOrder refundChildOrder(HighOrder order,String childOrderNo,Integer refundGoodsNum, String remarks, OrderRefundOrderOpUserType opUserType, Long opUserId, String opUserName) throws Exception {
List<HighChildOrder> collect = order.getHighChildOrderList().stream().filter(o -> o.getChildOrderNo().equals(childOrderNo)).collect(Collectors.toList());
if (collect == null || collect.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");
@ -580,7 +577,7 @@ public class OrderServiceImpl implements OrderService {
HighChildOrder orderChild = collect.get(0);
// 创建退款记录
HighOrderRefund orderRefund = orderRefundService.createOrderChildRefund(orderChild, OrderUtil.generateRefundOrderNo(), refundGoodsNum, remarks);
HighOrderRefund orderRefund = orderRefundService.createOrderChildRefund(orderChild, OrderUtil.generateRefundOrderNo(), refundGoodsNum, remarks, opUserType, opUserId, opUserName);
orderChild.setSurplusRefundNum(orderChild.getSurplusRefundNum() - orderRefund.getRefundGoodsNum());
orderChild.setSurplusRefundPrice(orderChild.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice()));

@ -0,0 +1,52 @@
package com.hai.order.type;
import java.util.Objects;
/**
* @className: OrderRefundOrderOpUserType
* @author: HuRui
* @date: 2022/11/2
**/
public enum OrderRefundOrderOpUserType {
TYPE1(1, "系统"),
TYPE2(2, "管理员"),
TYPE3(3, "用户"),
;
private Integer number;
private String name;
OrderRefundOrderOpUserType(int number, String name) {
this.number = number;
this.name = name;
}
/**
* 根据类型查询数据
* @param type
* @return
*/
public static OrderRefundOrderOpUserType getDataByType(Integer type) {
for (OrderRefundOrderOpUserType ele : values()) {
if(Objects.equals(type,ele.getNumber())) return ele;
}
return null;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Loading…
Cancel
Save