e15121030e0510229a38c65582eb9c4c3543cc2b..84f1e606d3cdd3733b0e92927bd46bf60ad93063
2024-08-30 gongzuming
Merge remote-tracking branch 'origin/master-v2' into master-v2
84f1e6 对比 | 目录
2024-08-30 gongzuming
消费积分记录
f1ff3a 对比 | 目录
已修改1个文件
19 ■■■■■ 文件已修改
src/main/java/com/mzl/flower/service/point/CustomerPointService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/service/point/CustomerPointService.java
@@ -17,6 +17,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
@@ -118,4 +119,22 @@
        //更新汇总表
        updateCustomerPoint(detail);
    }
    public void consumptionPoint(BigDecimal orderAmount, String orderNo,String userId)  {
        CustomerPointDetail detail = new CustomerPointDetail();
        Customer customer = getCustomerByUserId(userId);
        detail.setCustomerId(customer.getId());
        detail.setUserId(customer.getUserId());
        BigDecimal point = orderAmount.setScale(0, BigDecimal.ROUND_HALF_UP);
        detail.setPoint(point.intValue());
        detail.setRemarks(orderNo);
        detail.setRecordDate(LocalDate.now());
        detail.setChangeType(POINT_CHANGE_TYPE.add.name());
        detail.setType(POINT_TYPE.consume.name());
        detail.create(SecurityUtils.getUserId());
        customerPointDetailMapper.insert(detail);
        //更新汇总表
        updateCustomerPoint(detail);
    }
}