陶杰
2024-11-14 d94e7d6bbf23698c27147a60ee866c64b2d43775
Merge remote-tracking branch 'origin/master-v4' into master-v4
已修改5个文件
28 ■■■■ 文件已修改
src/main/java/com/mzl/flower/dto/response/customer/CustomerDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/point/CustomerPointService.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/customer/CustomerMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/payment/OrderItemMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/payment/OrderMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/response/customer/CustomerDTO.java
@@ -58,4 +58,6 @@
    private Boolean isEnabled;
    private UserGrowthRecordDTO userGrowthRecord;
    private Integer orderNum;
}
src/main/java/com/mzl/flower/service/point/CustomerPointService.java
@@ -15,6 +15,7 @@
import com.mzl.flower.mapper.point.CustomerPointDetailMapper;
import com.mzl.flower.mapper.point.CustomerPointMapper;
import com.mzl.flower.service.BaseService;
import com.mzl.flower.service.payment.RedisLockService;
import com.mzl.flower.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@@ -36,10 +37,13 @@
    private final CustomerPointDetailMapper customerPointDetailMapper;
    private final  RedisLockService redisLockService;
    public CustomerPointService(CustomerPointMapper customerPointMapper, CustomerPointDetailMapper customerPointDetailMapper) {
    public CustomerPointService(CustomerPointMapper customerPointMapper, CustomerPointDetailMapper customerPointDetailMapper, RedisLockService redisLockService) {
        this.customerPointMapper = customerPointMapper;
        this.customerPointDetailMapper = customerPointDetailMapper;
        this.redisLockService = redisLockService;
    }
    public Page<CustomerPointDTO> queryPage(QueryCustomerPointDTO dto, Page page) {
@@ -79,6 +83,11 @@
    }
    public void updateCustomerPoint(CustomerPointDetail detail) {
        boolean lock = redisLockService.getObjectLock("LOCK_KEY_CUSTOMER_POINT_", detail.getUserId());
        if(!lock){
            return;
        }
        try {
        CustomerPoint point = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>()
                .eq(CustomerPoint::getCustomerId, detail.getCustomerId()));
        boolean isAdd = false;
@@ -116,7 +125,9 @@
        }else{
            customerPointMapper.updateById(point);
        }
        }finally {
            redisLockService.releaseObjectLock("LOCK_KEY_CUSTOMER_POINT_", detail.getUserId());
        }
    }
    public void deductionPoint(ChangePointDTO dto) {
src/main/resources/mapper/customer/CustomerMapper.xml
@@ -9,7 +9,8 @@
            c.*,
            p.name as partnerName,
            u.nick_name,
            u.tel
            u.tel,
            (select count(o.id) from t_order o where o.create_by = c.user_id  and o.deleted=0 and o.status_backend not in ('PENDING','CANCEL','REFUND')) as orderNum
        FROM
            t_customer_info c
                LEFT JOIN t_user u ON c.user_id = u.id left join t_partner_info p on c.partner_id = p.id where c.deleted = 0
src/main/resources/mapper/payment/OrderItemMapper.xml
@@ -76,8 +76,8 @@
        SELECT sum(oi.num)
        FROM t_order_item oi
        JOIN t_order o on oi.order_id = o.id
        WHERE o.payment_time is not null
        and o.refund_time is null
        WHERE o.deleted=0
        and o.status_backend not in ('PENDING','CANCEL','REFUND')
        <if test="startTime != null">
            and o.create_time &gt; #{startTime}
        </if>
src/main/resources/mapper/payment/OrderMapper.xml
@@ -374,8 +374,8 @@
    <select id="getOrderSaleAmount" resultType="java.math.BigDecimal">
        SELECT sum(o.payment_amount)
        FROM t_order o
        WHERE o.payment_time is not null
        and o.refund_time is null
        WHERE o.deleted=0
        and o.status_backend not in ('PENDING','CANCEL','REFUND')
        <if test="startTime != null">
            and o.create_time &gt; #{startTime}
        </if>