Commit eec69701 by 吕明尚

退款增加消费记录

parent 097485fb
package share.common.enums;
public enum ConsumeNameEnum {
//消费,消费退款
CONSUME(1, "消费"),
REFUND(2, "消费退款"),
;
private Integer code;
private String value;
ConsumeNameEnum() {
}
ConsumeNameEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package share.common.enums;
public enum SignEnum {
//+,-
STRAINHT(1, "+"),
BURDEN(2, "-"),
;
private Integer code;
private String value;
SignEnum() {
}
SignEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
......@@ -38,6 +38,13 @@ public class SConsumptionRecords extends BaseEntity
@Excel(name = "实付金额")
private BigDecimal price;
/**
* 支付类型
*/
private String payType;
private String sign;
public void setId(Long id)
{
this.id = id;
......@@ -84,15 +91,32 @@ public class SConsumptionRecords extends BaseEntity
return price;
}
public String getPayType() {
return payType;
}
public void setPayType(String payType) {
this.payType = payType;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("consumerId", getConsumerId())
.append("orderId", getOrderId())
.append("name", getName())
.append("price", getPrice())
.append("createTime", getCreateTime())
.toString();
return "SConsumptionRecords{" +
"id=" + id +
", consumerId=" + consumerId +
", orderId=" + orderId +
", name='" + name + '\'' +
", price=" + price +
", payType='" + payType + '\'' +
", sign='" + sign + '\'' +
'}';
}
}
......@@ -14,23 +14,18 @@ import share.common.config.WeChatConfig;
import share.common.constant.Constants;
import share.common.constant.WeChatConstants;
import share.common.core.redis.RedisUtil;
import share.common.enums.OrderStatusEnum;
import share.common.enums.OrderTypeEnum;
import share.common.enums.RefundStatusEnum;
import share.common.enums.YesNoEnum;
import share.common.enums.*;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
import share.common.utils.DateUtils;
import share.system.domain.SConsumer;
import share.system.domain.SConsumptionRecords;
import share.system.domain.SOrder;
import share.system.domain.WechatPayInfo;
import share.system.domain.vo.AttachVo;
import share.system.domain.vo.CallbackVo;
import share.system.domain.vo.MyRecord;
import share.system.service.CallbackService;
import share.system.service.ISOrderService;
import share.system.service.SConsumerService;
import share.system.service.WechatPayInfoService;
import share.system.service.*;
import share.system.util.WxPayUtil;
import javax.crypto.Cipher;
......@@ -65,6 +60,9 @@ public class CallbackServiceImpl implements CallbackService {
@Autowired
private WeChatConfig weChatConfig;
@Autowired
private ISConsumptionRecordsService sConsumptionRecordsService;
/**
* 微信支付回调
......@@ -238,6 +236,14 @@ public class CallbackServiceImpl implements CallbackService {
sOrder.setStatus(OrderStatusEnum.CANCEL.getCode());
sOrder.setRefundStatus(RefundStatusEnum.REFUNDED.getCode());
boolean update = sOrderService.updateById(sOrder);
SConsumptionRecords sConsumptionRecords = new SConsumptionRecords();
sConsumptionRecords.setConsumerId(sOrder.getConsumerId());
sConsumptionRecords.setOrderId(sOrder.getId());
sConsumptionRecords.setName(ConsumeNameEnum.REFUND.getValue());
sConsumptionRecords.setPrice(sOrder.getPayPrice());
sConsumptionRecords.setPayType(PayTypeEnum.WECHAT.getName());
sConsumptionRecords.setSign(SignEnum.STRAINHT.getValue());
sConsumptionRecordsService.insertSConsumptionRecords(sConsumptionRecords);
if (update) {
// 退款task
redisUtil.lPush(Constants.ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER, sOrder.getId());
......
......@@ -321,8 +321,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SConsumptionRecords sConsumptionRecords = new SConsumptionRecords();
sConsumptionRecords.setConsumerId(sOrder.getConsumerId());
sConsumptionRecords.setOrderId(sOrder.getId());
sConsumptionRecords.setName(user.getNickName());
sConsumptionRecords.setName(ConsumeNameEnum.CONSUME.getValue());
sConsumptionRecords.setPrice(sOrder.getPayPrice());
sConsumptionRecords.setPayType(PayTypeEnum.WECHAT.getName());
sConsumptionRecords.setSign(SignEnum.BURDEN.getValue());
sConsumptionRecordsService.insertSConsumptionRecords(sConsumptionRecords);
}
return response;
......@@ -609,11 +611,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SConsumptionRecords sConsumptionRecords = new SConsumptionRecords();
sConsumptionRecords.setConsumerId(sOrder.getConsumerId());
sConsumptionRecords.setOrderId(sOrder.getId());
if (Objects.nonNull(sOrder.getPackId())) {
SPack pack = packService.getById(sOrder.getPackId());
sConsumptionRecords.setName(Objects.nonNull(pack)?pack.getName():null);
}
sConsumptionRecords.setName(ConsumeNameEnum.CONSUME.getValue());
sConsumptionRecords.setPrice(sOrder.getPayPrice());
sConsumptionRecords.setPayType(PayTypeEnum.WECHAT.getName());
sConsumptionRecords.setSign(SignEnum.BURDEN.getValue());
sConsumptionRecordsService.insertSConsumptionRecords(sConsumptionRecords);
}
......
......@@ -10,11 +10,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderId" column="order_id" />
<result property="name" column="name" />
<result property="price" column="price" />
<result property="payType" column="pay_type"/>
<result property="sign" column="sign"/>
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectSConsumptionRecordsVo">
select id, consumer_id, order_id, name, price, create_time from s_consumption_records
select id,
consumer_id,
order_id,
name,
price,
pay_type,
sign,
create_time
from s_consumption_records
</sql>
<select id="selectSConsumptionRecordsList" parameterType="SConsumptionRecords" resultMap="SConsumptionRecordsResult">
......@@ -35,6 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null">order_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="price != null">price,</if>
<if test="pay_type != null">pay_type,</if>
<if test="sign != null">sign,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -42,6 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null">#{orderId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="price != null">#{price},</if>
<if test="pay_type != null">#{pay_type},</if>
<if test="sign != null">#{sign},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
......@@ -53,6 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null">order_id = #{orderId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="price != null">price = #{price},</if>
<if test="pay_type != null">pay_type = #{pay_type},</if>
<if test="sign != null">sign = #{sign},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment