src/main/java/com/mzl/flower/dto/response/point/PointGoodsRecordDTO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/mzl/flower/entity/point/PointGoodsRecord.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/mzl/flower/mapper/point/PointGoodsRecordMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/mzl/flower/schedule/PointScheduleService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/mzl/flower/service/point/PointGoodsService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/point/PointGoodMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/mzl/flower/dto/response/point/PointGoodsRecordDTO.java
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDateTime; @Data public class PointGoodsRecordDTO extends AbstractTransDTO { @@ -48,4 +50,7 @@ private String status; private String statusStr; @ApiModelProperty(value = "到期时间") private LocalDateTime expireTime; } src/main/java/com/mzl/flower/entity/point/PointGoodsRecord.java
@@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDate; import java.time.LocalDateTime; @Data @TableName("t_point_goods_record") public class PointGoodsRecord extends BaseAutoEntity { @@ -47,4 +50,8 @@ @ApiModelProperty(value = "绑定订单ID") private String orderId; @ApiModelProperty(value = "到期时间") private LocalDateTime expireTime; } src/main/java/com/mzl/flower/mapper/point/PointGoodsRecordMapper.java
@@ -13,4 +13,6 @@ @Repository public interface PointGoodsRecordMapper extends BaseMapper<PointGoodsRecord> { List<PointGoodsRecordDTO> selectMyExchangeGoods(@Param("dto") QueryExchangeGoodsDTO dto, Page page); void updateExpiredPointGoodsRecord(); } src/main/java/com/mzl/flower/schedule/PointScheduleService.java
@@ -1,23 +1,21 @@ package com.mzl.flower.schedule; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.response.point.ExpiredPointDTO; import com.mzl.flower.entity.flower.FlowerCategory; import com.mzl.flower.entity.partner.Partner; import com.mzl.flower.entity.point.CustomerPoint; import com.mzl.flower.entity.point.CustomerPointDetail; import com.mzl.flower.mapper.point.CustomerPointDetailMapper; import com.mzl.flower.mapper.point.CustomerPointMapper; import com.mzl.flower.mapper.point.PointGoodsRecordMapper; import com.mzl.flower.utils.DateUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.time.DateFormatUtils; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.List; @@ -30,9 +28,12 @@ private final CustomerPointDetailMapper customerPointDetailMapper; public PointScheduleService(CustomerPointMapper customerPointMapper, CustomerPointDetailMapper customerPointDetailMapper) { private final PointGoodsRecordMapper pointGoodsRecordMapper; public PointScheduleService(CustomerPointMapper customerPointMapper, CustomerPointDetailMapper customerPointDetailMapper, PointGoodsRecordMapper pointGoodsRecordMapper) { this.customerPointMapper = customerPointMapper; this.customerPointDetailMapper = customerPointDetailMapper; this.pointGoodsRecordMapper = pointGoodsRecordMapper; } @@ -80,4 +81,15 @@ } /** * 积分兑换券过期 */ @Scheduled(cron = "0 46 11 * * ?") public void expiredPointGoodsRecord() { log.info("积分兑换券过期计算开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); pointGoodsRecordMapper.updateExpiredPointGoodsRecord(); log.info("积分兑换券过期计算开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); } } src/main/java/com/mzl/flower/service/point/PointGoodsService.java
@@ -19,6 +19,7 @@ import com.mzl.flower.mapper.point.PointGoodsRecordMapper; import com.mzl.flower.service.BaseService; import com.mzl.flower.service.payment.RedisLockService; import com.mzl.flower.utils.DateUtils; import com.mzl.flower.utils.UUIDGenerator; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @Service @@ -163,6 +165,9 @@ record.setCover(p.getCover()); record.setRedeemCode(UUIDGenerator.getUUID()); record.setStatus(Constants.POINT_GOODS_RECORD_STATUS.A.name());//未使用 LocalDate expireDate = LocalDate.now().plusYears(1); String expireDateStr = DateUtils.toString(expireDate,"yyyy-MM-dd"); record.setExpireTime(DateUtils.dateToLocalDateTime(expireDateStr,false)); record.create(SecurityUtils.getUserId()); pointGoodsRecordMapper.insert(record); src/main/resources/mapper/point/PointGoodMapper.xml
@@ -1,6 +1,13 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.mzl.flower.mapper.point.PointGoodsRecordMapper"> <update id="updateExpiredPointGoodsRecord"> update t_point_goods_record p set p.`status`='E' where p.deleted = 0 and p.`status` = 'A' and <![CDATA[ p.expire_time < NOW() ]]> </update> <select id="selectMyExchangeGoods" resultType="com.mzl.flower.dto.response.point.PointGoodsRecordDTO"> SELECT