Commit ba59ec85e045e37af1b6ab4044d30634f8535901

Authored by zhijiantianya@gmail.com
1 parent 0219e6d9

code review 各种活动

Showing 23 changed files with 87 additions and 161 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java
@@ -63,26 +63,6 @@ public class LocalDateTimeUtils { @@ -63,26 +63,6 @@ public class LocalDateTimeUtils {
63 } 63 }
64 64
65 /** 65 /**
66 - * 检查时间重叠 不包含日期  
67 - *  
68 - * @param startTime1 需要校验的开始时间  
69 - * @param endTime1 需要校验的结束时间  
70 - * @param startTime2 校验所需的开始时间  
71 - * @param endTime2 校验所需的结束时间  
72 - * @return 是否重叠  
73 - */  
74 - @Deprecated  
75 - public static boolean checkTimeOverlap(LocalTime startTime1, LocalTime endTime1, LocalTime startTime2, LocalTime endTime2) {  
76 - // 判断时间是否重叠  
77 - // 开始时间在已配置时段的结束时间之前 且 结束时间在已配置时段的开始时间之后 []  
78 - return startTime1.isBefore(endTime2) && endTime1.isAfter(startTime2)  
79 - // 开始时间在已配置时段的开始时间之前 且 结束时间在已配置时段的开始时间之后 (] 或 ()  
80 - || startTime1.isBefore(startTime2) && endTime1.isAfter(startTime2)  
81 - // 开始时间在已配置时段的结束时间之前 且 结束时间在已配值时段的结束时间之后 [) 或 ()  
82 - || startTime1.isBefore(endTime2) && endTime1.isAfter(endTime2);  
83 - }  
84 -  
85 - /**  
86 * 判断时间段是否重叠 66 * 判断时间段是否重叠
87 * 67 *
88 * @param startTime1 开始 time1 68 * @param startTime1 开始 time1
@@ -92,7 +72,6 @@ public class LocalDateTimeUtils { @@ -92,7 +72,6 @@ public class LocalDateTimeUtils {
92 * @return 重叠:true 不重叠:false 72 * @return 重叠:true 不重叠:false
93 */ 73 */
94 public static boolean isOverlap(LocalTime startTime1, LocalTime endTime1, LocalTime startTime2, LocalTime endTime2) { 74 public static boolean isOverlap(LocalTime startTime1, LocalTime endTime1, LocalTime startTime2, LocalTime endTime2) {
95 - // 日期部分使用了当前日期LocalDate.now()  
96 LocalDate nowDate = LocalDate.now(); 75 LocalDate nowDate = LocalDate.now();
97 return LocalDateTimeUtil.isOverlap(LocalDateTime.of(nowDate, startTime1), LocalDateTime.of(nowDate, endTime1), 76 return LocalDateTimeUtil.isOverlap(LocalDateTime.of(nowDate, startTime1), LocalDateTime.of(nowDate, endTime1),
98 LocalDateTime.of(nowDate, startTime2), LocalDateTime.of(nowDate, endTime2)); 77 LocalDateTime.of(nowDate, startTime2), LocalDateTime.of(nowDate, endTime2));
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/dto/BargainRecordCreateReqDTO.java
@@ -40,6 +40,7 @@ public class BargainRecordCreateReqDTO { @@ -40,6 +40,7 @@ public class BargainRecordCreateReqDTO {
40 */ 40 */
41 @NotNull(message = "订单编号不能为空") 41 @NotNull(message = "订单编号不能为空")
42 private Long orderId; 42 private Long orderId;
  43 + // TODO @puhui999:spuName、picUrl、 之类字段不用传递;
43 /** 44 /**
44 * 商品名字 45 * 商品名字
45 */ 46 */
@@ -60,6 +61,7 @@ public class BargainRecordCreateReqDTO { @@ -60,6 +61,7 @@ public class BargainRecordCreateReqDTO {
60 */ 61 */
61 @NotNull(message = "商品原价不能为空") 62 @NotNull(message = "商品原价不能为空")
62 private Integer price; 63 private Integer price;
  64 + // TODO @puhui999:nickname、avatar 不用传递,去查询;
63 /** 65 /**
64 * 用户昵称 66 * 用户昵称
65 */ 67 */
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApi.java
1 package cn.iocoder.yudao.module.promotion.api.combination; 1 package cn.iocoder.yudao.module.promotion.api.combination;
2 2
3 import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; 3 import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
4 -import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateReqDTO; 4 +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateStatusReqDTO;
5 5
6 import javax.validation.Valid; 6 import javax.validation.Valid;
7 7
@@ -18,7 +18,7 @@ public interface CombinationRecordApi { @@ -18,7 +18,7 @@ public interface CombinationRecordApi {
18 * 18 *
19 * @param reqDTO 请求 DTO 19 * @param reqDTO 请求 DTO
20 */ 20 */
21 - void createRecord(@Valid CombinationRecordCreateReqDTO reqDTO); 21 + void createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO);
22 22
23 /** 23 /**
24 * 查询拼团记录是否成功 24 * 查询拼团记录是否成功
@@ -27,13 +27,15 @@ public interface CombinationRecordApi { @@ -27,13 +27,15 @@ public interface CombinationRecordApi {
27 * @param orderId 订单编号 27 * @param orderId 订单编号
28 * @return 拼团是否成功 28 * @return 拼团是否成功
29 */ 29 */
30 - boolean isRecordSuccess(Long userId, Long orderId); 30 + boolean isCombinationRecordSuccess(Long userId, Long orderId);
  31 +
  32 + // TODO @puhui999:是不是搞成具体的方法,拼团成功,拼团失败,这种方法;
31 33
32 /** 34 /**
33 * 更新开团记录状态 35 * 更新开团记录状态
34 * 36 *
35 * @param reqDTO 请求 DTO 37 * @param reqDTO 请求 DTO
36 */ 38 */
37 - void updateRecordStatus(CombinationRecordUpdateReqDTO reqDTO); 39 + void updateCombinationRecordStatus(CombinationRecordUpdateStatusReqDTO reqDTO);
38 40
39 } 41 }
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/dto/CombinationRecordUpdateReqDTO.java renamed to yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/dto/CombinationRecordUpdateStatusReqDTO.java
@@ -6,12 +6,12 @@ import javax.validation.constraints.NotNull; @@ -6,12 +6,12 @@ import javax.validation.constraints.NotNull;
6 import java.time.LocalDateTime; 6 import java.time.LocalDateTime;
7 7
8 /** 8 /**
9 - * 拼团记录的更新 Request DTO 9 + * 拼团记录的更新状态 Request DTO
10 * 10 *
11 * @author HUIHUI 11 * @author HUIHUI
12 */ 12 */
13 @Data 13 @Data
14 -public class CombinationRecordUpdateReqDTO { 14 +public class CombinationRecordUpdateStatusReqDTO {
15 15
16 /** 16 /**
17 * 用户编号 17 * 用户编号
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java
@@ -74,6 +74,9 @@ public interface ErrorCodeConstants { @@ -74,6 +74,9 @@ public interface ErrorCodeConstants {
74 ErrorCode BARGAIN_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1013011001, "存在商品参加了其它砍价活动"); 74 ErrorCode BARGAIN_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1013011001, "存在商品参加了其它砍价活动");
75 ErrorCode BARGAIN_ACTIVITY_STATUS_DISABLE = new ErrorCode(1013011002, "砍价活动已关闭不能修改"); 75 ErrorCode BARGAIN_ACTIVITY_STATUS_DISABLE = new ErrorCode(1013011002, "砍价活动已关闭不能修改");
76 ErrorCode BARGAIN_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013011003, "砍价活动未关闭或未结束,不能删除"); 76 ErrorCode BARGAIN_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013011003, "砍价活动未关闭或未结束,不能删除");
  77 +
  78 + // TODO @puhui999:拆分成砍价记录
  79 +
77 ErrorCode BARGAIN_RECORD_NOT_EXISTS = new ErrorCode(1013011004, "砍价不存在"); 80 ErrorCode BARGAIN_RECORD_NOT_EXISTS = new ErrorCode(1013011004, "砍价不存在");
78 ErrorCode BARGAIN_RECORD_EXISTS = new ErrorCode(1013011005, "砍价失败,已参与过该砍价"); 81 ErrorCode BARGAIN_RECORD_EXISTS = new ErrorCode(1013011005, "砍价失败,已参与过该砍价");
79 ErrorCode BARGAIN_RECORD_HEAD_NOT_EXISTS = new ErrorCode(1013011006, "砍价失败,父砍价不存在"); 82 ErrorCode BARGAIN_RECORD_HEAD_NOT_EXISTS = new ErrorCode(1013011006, "砍价失败,父砍价不存在");
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationRecordApiImpl.java
1 package cn.iocoder.yudao.module.promotion.api.combination; 1 package cn.iocoder.yudao.module.promotion.api.combination;
2 2
3 import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; 3 import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
4 -import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateReqDTO; 4 +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateStatusReqDTO;
5 import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; 5 import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
6 import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService; 6 import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService;
7 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
@@ -20,17 +20,17 @@ public class CombinationRecordApiImpl implements CombinationRecordApi { @@ -20,17 +20,17 @@ public class CombinationRecordApiImpl implements CombinationRecordApi {
20 private CombinationRecordService recordService; 20 private CombinationRecordService recordService;
21 21
22 @Override 22 @Override
23 - public void createRecord(CombinationRecordCreateReqDTO reqDTO) { 23 + public void createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) {
24 recordService.createCombinationRecord(reqDTO); 24 recordService.createCombinationRecord(reqDTO);
25 } 25 }
26 26
27 @Override 27 @Override
28 - public boolean isRecordSuccess(Long userId, Long orderId) { 28 + public boolean isCombinationRecordSuccess(Long userId, Long orderId) {
29 return CombinationRecordStatusEnum.isSuccess(recordService.getCombinationRecord(userId, orderId).getStatus()); 29 return CombinationRecordStatusEnum.isSuccess(recordService.getCombinationRecord(userId, orderId).getStatus());
30 } 30 }
31 31
32 @Override 32 @Override
33 - public void updateRecordStatus(CombinationRecordUpdateReqDTO reqDTO) { 33 + public void updateCombinationRecordStatus(CombinationRecordUpdateStatusReqDTO reqDTO) {
34 if (null == reqDTO.getStartTime()) { 34 if (null == reqDTO.getStartTime()) {
35 recordService.updateCombinationRecordStatusByUserIdAndOrderId(reqDTO); 35 recordService.updateCombinationRecordStatusByUserIdAndOrderId(reqDTO);
36 } else { 36 } else {
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/bargain/vo/activity/BargainActivityRespVO.java
@@ -17,6 +17,8 @@ import java.util.List; @@ -17,6 +17,8 @@ import java.util.List;
17 @ToString(callSuper = true) 17 @ToString(callSuper = true)
18 public class BargainActivityRespVO extends BargainActivityBaseVO { 18 public class BargainActivityRespVO extends BargainActivityBaseVO {
19 19
  20 + // TODO @puhui999:example 补全
  21 +
20 @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618大促") 22 @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618大促")
21 private String spuName; 23 private String spuName;
22 24
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/bargain/vo/product/BargainProductCreateReqVO.java
@@ -5,6 +5,7 @@ import lombok.Data; @@ -5,6 +5,7 @@ import lombok.Data;
5 import lombok.EqualsAndHashCode; 5 import lombok.EqualsAndHashCode;
6 import lombok.ToString; 6 import lombok.ToString;
7 7
  8 +// TODO @puhui999:是不是应该把 BargainProductCreateReqVO 和 BargainProductUpdateReqVO 合并在一起哈。就是一个 SaveReqVO
8 @Schema(description = "管理后台 - 砍价商品创建 Request VO") 9 @Schema(description = "管理后台 - 砍价商品创建 Request VO")
9 @Data 10 @Data
10 @EqualsAndHashCode(callSuper = true) 11 @EqualsAndHashCode(callSuper = true)
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/bargain/vo/product/BargainProductPageReqVO.java deleted
1 -package cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.product;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageParam;  
4 -import io.swagger.v3.oas.annotations.media.Schema;  
5 -import lombok.Data;  
6 -import lombok.EqualsAndHashCode;  
7 -import lombok.ToString;  
8 -import org.springframework.format.annotation.DateTimeFormat;  
9 -  
10 -import java.time.LocalDateTime;  
11 -  
12 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
13 -  
14 -@Schema(description = "管理后台 - 砍价商品分页 Request VO")  
15 -@Data  
16 -@EqualsAndHashCode(callSuper = true)  
17 -@ToString(callSuper = true)  
18 -public class BargainProductPageReqVO extends PageParam {  
19 -  
20 - @Schema(description = "砍价活动编号", example = "6829")  
21 - private Long activityId;  
22 -  
23 - @Schema(description = "商品 SPU 编号", example = "18731")  
24 - private Long spuId;  
25 -  
26 - @Schema(description = "商品 SKU 编号", example = "31675")  
27 - private Long skuId;  
28 -  
29 - @Schema(description = "砍价商品状态", example = "2")  
30 - private Integer activityStatus;  
31 -  
32 - @Schema(description = "活动开始时间点")  
33 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
34 - private LocalDateTime[] activityStartTime;  
35 -  
36 - @Schema(description = "活动结束时间点")  
37 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
38 - private LocalDateTime[] activityEndTime;  
39 -  
40 - @Schema(description = "砍价价格,单位分", example = "27682")  
41 - private Integer activePrice;  
42 -  
43 - @Schema(description = "创建时间")  
44 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
45 - private LocalDateTime[] createTime;  
46 -  
47 -}  
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java
@@ -65,6 +65,7 @@ public interface BargainActivityConvert { @@ -65,6 +65,7 @@ public interface BargainActivityConvert {
65 65
66 List<BargainProductRespVO> convertList2(List<BargainProductDO> productDOs); 66 List<BargainProductRespVO> convertList2(List<BargainProductDO> productDOs);
67 67
  68 + // TODO @puhui999:参数改成 activity、product 会不会干净一点哈
68 @Mappings({ 69 @Mappings({
69 @Mapping(target = "id", ignore = true), 70 @Mapping(target = "id", ignore = true),
70 @Mapping(target = "activityId", source = "activityDO.id"), 71 @Mapping(target = "activityId", source = "activityDO.id"),
@@ -90,6 +91,4 @@ public interface BargainActivityConvert { @@ -90,6 +91,4 @@ public interface BargainActivityConvert {
90 .setActivityStatus(activity.getStatus())); 91 .setActivityStatus(activity.getStatus()));
91 } 92 }
92 93
93 - //BargainRecordDO convert(BargainRecordCreateReqDTO reqDTO);  
94 -  
95 } 94 }
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java
@@ -67,6 +67,7 @@ public interface CombinationActivityConvert { @@ -67,6 +67,7 @@ public interface CombinationActivityConvert {
67 67
68 List<CombinationProductRespVO> convertList2(List<CombinationProductDO> productDOs); 68 List<CombinationProductRespVO> convertList2(List<CombinationProductDO> productDOs);
69 69
  70 + // TODO @puhui999:参数改成 activity、product 会不会干净一点哈
70 @Mappings({ 71 @Mappings({
71 @Mapping(target = "id", ignore = true), 72 @Mapping(target = "id", ignore = true),
72 @Mapping(target = "activityId", source = "activityDO.id"), 73 @Mapping(target = "activityId", source = "activityDO.id"),
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java
@@ -56,6 +56,7 @@ public interface SeckillActivityConvert { @@ -56,6 +56,7 @@ public interface SeckillActivityConvert {
56 return convert1(seckillActivity).setProducts(convertList2(seckillProducts)); 56 return convert1(seckillActivity).setProducts(convertList2(seckillProducts));
57 } 57 }
58 58
  59 + // TODO @puhui999:参数改成 activity、product 会不会干净一点哈
59 @Mappings({ 60 @Mappings({
60 @Mapping(target = "id", ignore = true), 61 @Mapping(target = "id", ignore = true),
61 @Mapping(target = "activityId", source = "activityDO.id"), 62 @Mapping(target = "activityId", source = "activityDO.id"),
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/bargain/BargainAssistDO.java
@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; @@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
7 import lombok.*; 7 import lombok.*;
8 8
9 /** 9 /**
10 - * 砍价助力 DO TODO 10 + * 砍价助力 DO TODO 芋艿:表结构
11 * 11 *
12 * @author HUIHUI 12 * @author HUIHUI
13 */ 13 */
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainProductMapper.java
1 package cn.iocoder.yudao.module.promotion.dal.mysql.bargain; 1 package cn.iocoder.yudao.module.promotion.dal.mysql.bargain;
2 2
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 3 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;  
6 -import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.product.BargainProductPageReqVO;  
7 import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainProductDO; 4 import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainProductDO;
8 import org.apache.ibatis.annotations.Mapper; 5 import org.apache.ibatis.annotations.Mapper;
9 6
@@ -18,18 +15,6 @@ import java.util.List; @@ -18,18 +15,6 @@ import java.util.List;
18 @Mapper 15 @Mapper
19 public interface BargainProductMapper extends BaseMapperX<BargainProductDO> { 16 public interface BargainProductMapper extends BaseMapperX<BargainProductDO> {
20 17
21 - default PageResult<BargainProductDO> selectPage(BargainProductPageReqVO reqVO) {  
22 - return selectPage(reqVO, new LambdaQueryWrapperX<BargainProductDO>()  
23 - .eqIfPresent(BargainProductDO::getActivityId, reqVO.getActivityId())  
24 - .eqIfPresent(BargainProductDO::getSpuId, reqVO.getSpuId())  
25 - .eqIfPresent(BargainProductDO::getSkuId, reqVO.getSkuId())  
26 - .eqIfPresent(BargainProductDO::getActivityStatus, reqVO.getActivityStatus())  
27 - .betweenIfPresent(BargainProductDO::getActivityStartTime, reqVO.getActivityStartTime())  
28 - .betweenIfPresent(BargainProductDO::getActivityEndTime, reqVO.getActivityEndTime())  
29 - .betweenIfPresent(BargainProductDO::getCreateTime, reqVO.getCreateTime())  
30 - .orderByDesc(BargainProductDO::getId));  
31 - }  
32 -  
33 default List<BargainProductDO> selectListByActivityIds(Collection<Long> ids) { 18 default List<BargainProductDO> selectListByActivityIds(Collection<Long> ids) {
34 return selectList(BargainProductDO::getActivityId, ids); 19 return selectList(BargainProductDO::getActivityId, ids);
35 } 20 }
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java
@@ -20,6 +20,7 @@ public interface CombinationRecordMapper extends BaseMapperX&lt;CombinationRecordDO @@ -20,6 +20,7 @@ public interface CombinationRecordMapper extends BaseMapperX&lt;CombinationRecordDO
20 CombinationRecordDO::getOrderId, orderId); 20 CombinationRecordDO::getOrderId, orderId);
21 } 21 }
22 22
  23 + // TODO @puhui999 selectByUserIdAndActivityId
23 /** 24 /**
24 * 查询拼团记录 25 * 查询拼团记录
25 * 26 *
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java
1 package cn.iocoder.yudao.module.promotion.service.combination; 1 package cn.iocoder.yudao.module.promotion.service.combination;
2 2
3 import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; 3 import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
4 -import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateReqDTO; 4 +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateStatusReqDTO;
5 import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; 5 import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO;
6 6
7 /** 7 /**
@@ -16,7 +16,7 @@ public interface CombinationRecordService { @@ -16,7 +16,7 @@ public interface CombinationRecordService {
16 * 16 *
17 * @param reqDTO 请求 DTO 17 * @param reqDTO 请求 DTO
18 */ 18 */
19 - void updateCombinationRecordStatusByUserIdAndOrderId(CombinationRecordUpdateReqDTO reqDTO); 19 + void updateCombinationRecordStatusByUserIdAndOrderId(CombinationRecordUpdateStatusReqDTO reqDTO);
20 20
21 /** 21 /**
22 * 创建拼团记录 22 * 创建拼团记录
@@ -30,7 +30,7 @@ public interface CombinationRecordService { @@ -30,7 +30,7 @@ public interface CombinationRecordService {
30 * 30 *
31 * @param reqDTO 请求 DTO 31 * @param reqDTO 请求 DTO
32 */ 32 */
33 - void updateCombinationRecordStatusAndStartTimeByUserIdAndOrderId(CombinationRecordUpdateReqDTO reqDTO); 33 + void updateCombinationRecordStatusAndStartTimeByUserIdAndOrderId(CombinationRecordUpdateStatusReqDTO reqDTO);
34 34
35 /** 35 /**
36 * 获得拼团状态 36 * 获得拼团状态
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationServiceImpl.java
@@ -11,7 +11,7 @@ import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO; @@ -11,7 +11,7 @@ import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
11 import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; 11 import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi;
12 import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; 12 import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
13 import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; 13 import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
14 -import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateReqDTO; 14 +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateStatusReqDTO;
15 import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO; 15 import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO;
16 import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageReqVO; 16 import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageReqVO;
17 import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; 17 import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO;
@@ -131,15 +131,14 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi @@ -131,15 +131,14 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi
131 /** 131 /**
132 * 更新拼团商品 132 * 更新拼团商品
133 * 133 *
134 - * @param updateObj 更新的活动  
135 - * @param products 商品配置 134 + * @param activity 拼团活动
  135 + * @param products 该活动的最新商品配置
136 */ 136 */
137 - private void updateCombinationProduct(CombinationActivityDO updateObj, List<CombinationProductUpdateReqVO> products) {  
138 - // 默认全部新增  
139 - List<CombinationProductDO> defaultNewList = CombinationActivityConvert.INSTANCE.convertList(products, updateObj);  
140 - // 数据库中的老数据  
141 - List<CombinationProductDO> oldList = combinationProductMapper.selectListByActivityIds(CollUtil.newArrayList(updateObj.getId()));  
142 - List<List<CombinationProductDO>> lists = CollectionUtils.diffList(oldList, defaultNewList, (oldVal, newVal) -> { 137 + private void updateCombinationProduct(CombinationActivityDO activity, List<CombinationProductUpdateReqVO> products) {
  138 + // 第一步,对比新老数据,获得添加、修改、删除的列表
  139 + List<CombinationProductDO> newList = CombinationActivityConvert.INSTANCE.convertList(products, activity);
  140 + List<CombinationProductDO> oldList = combinationProductMapper.selectListByActivityIds(CollUtil.newArrayList(activity.getId()));
  141 + List<List<CombinationProductDO>> diffList = CollectionUtils.diffList(oldList, newList, (oldVal, newVal) -> {
143 boolean same = ObjectUtil.equal(oldVal.getSkuId(), newVal.getSkuId()); 142 boolean same = ObjectUtil.equal(oldVal.getSkuId(), newVal.getSkuId());
144 if (same) { 143 if (same) {
145 newVal.setId(oldVal.getId()); 144 newVal.setId(oldVal.getId());
@@ -147,17 +146,15 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi @@ -147,17 +146,15 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi
147 return same; 146 return same;
148 }); 147 });
149 148
150 - // create  
151 - if (CollUtil.isNotEmpty(lists.get(0))) {  
152 - combinationProductMapper.insertBatch(lists.get(0)); 149 + // 第二步,批量添加、修改、删除
  150 + if (CollUtil.isNotEmpty(diffList.get(0))) {
  151 + combinationProductMapper.insertBatch(diffList.get(0));
153 } 152 }
154 - // update  
155 - if (CollUtil.isNotEmpty(lists.get(1))) {  
156 - combinationProductMapper.updateBatch(lists.get(1)); 153 + if (CollUtil.isNotEmpty(diffList.get(1))) {
  154 + combinationProductMapper.updateBatch(diffList.get(1));
157 } 155 }
158 - // delete  
159 - if (CollUtil.isNotEmpty(lists.get(2))) {  
160 - combinationProductMapper.deleteBatchIds(CollectionUtils.convertList(lists.get(2), CombinationProductDO::getId)); 156 + if (CollUtil.isNotEmpty(diffList.get(2))) {
  157 + combinationProductMapper.deleteBatchIds(CollectionUtils.convertList(diffList.get(2), CombinationProductDO::getId));
161 } 158 }
162 } 159 }
163 160
@@ -204,7 +201,7 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi @@ -204,7 +201,7 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi
204 } 201 }
205 202
206 @Override 203 @Override
207 - public void updateCombinationRecordStatusByUserIdAndOrderId(CombinationRecordUpdateReqDTO reqDTO) { 204 + public void updateCombinationRecordStatusByUserIdAndOrderId(CombinationRecordUpdateStatusReqDTO reqDTO) {
208 // 校验拼团是否存在 205 // 校验拼团是否存在
209 CombinationRecordDO recordDO = validateCombinationRecord(reqDTO.getUserId(), reqDTO.getOrderId()); 206 CombinationRecordDO recordDO = validateCombinationRecord(reqDTO.getUserId(), reqDTO.getOrderId());
210 207
@@ -215,7 +212,7 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi @@ -215,7 +212,7 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi
215 212
216 @Override 213 @Override
217 @Transactional(rollbackFor = Exception.class) 214 @Transactional(rollbackFor = Exception.class)
218 - public void updateCombinationRecordStatusAndStartTimeByUserIdAndOrderId(CombinationRecordUpdateReqDTO reqDTO) { 215 + public void updateCombinationRecordStatusAndStartTimeByUserIdAndOrderId(CombinationRecordUpdateStatusReqDTO reqDTO) {
219 CombinationRecordDO recordDO = validateCombinationRecord(reqDTO.getUserId(), reqDTO.getOrderId()); 216 CombinationRecordDO recordDO = validateCombinationRecord(reqDTO.getUserId(), reqDTO.getOrderId());
220 // 更新状态 217 // 更新状态
221 recordDO.setStatus(reqDTO.getStatus()); 218 recordDO.setStatus(reqDTO.getStatus());
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/seckillactivity/SeckillActivityServiceImpl.java
@@ -137,16 +137,14 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { @@ -137,16 +137,14 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
137 /** 137 /**
138 * 更新秒杀商品 138 * 更新秒杀商品
139 * 139 *
140 - * @param updateObj 更新的活动  
141 - * @param products 商品配置 140 + * @param activity 秒杀活动
  141 + * @param products 该活动的最新商品配置
142 */ 142 */
143 - private void updateSeckillProduct(SeckillActivityDO updateObj, List<SeckillProductUpdateReqVO> products) {  
144 - // 默认全部新增  
145 - List<SeckillProductDO> defaultNewList = SeckillActivityConvert.INSTANCE.convertList(products, updateObj);  
146 - // 数据库中的活动商品  
147 - List<SeckillProductDO> oldList = seckillProductMapper.selectListByActivityId(updateObj.getId());  
148 - // 对比老、新两个列表,找出新增、修改、删除的数据  
149 - List<List<SeckillProductDO>> lists = diffList(oldList, defaultNewList, (oldVal, newVal) -> { 143 + private void updateSeckillProduct(SeckillActivityDO activity, List<SeckillProductUpdateReqVO> products) {
  144 + // 第一步,对比新老数据,获得添加、修改、删除的列表
  145 + List<SeckillProductDO> newList = SeckillActivityConvert.INSTANCE.convertList(products, activity);
  146 + List<SeckillProductDO> oldList = seckillProductMapper.selectListByActivityId(activity.getId());
  147 + List<List<SeckillProductDO>> diffList = diffList(oldList, newList, (oldVal, newVal) -> {
150 boolean same = ObjectUtil.equal(oldVal.getSkuId(), newVal.getSkuId()); 148 boolean same = ObjectUtil.equal(oldVal.getSkuId(), newVal.getSkuId());
151 if (same) { 149 if (same) {
152 newVal.setId(oldVal.getId()); 150 newVal.setId(oldVal.getId());
@@ -154,17 +152,16 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { @@ -154,17 +152,16 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
154 return same; 152 return same;
155 }); 153 });
156 154
157 - // create  
158 - if (isNotEmpty(lists.get(0))) {  
159 - seckillProductMapper.insertBatch(lists.get(0)); 155 + // 第二步,批量添加、修改、删除
  156 + if (isNotEmpty(diffList.get(0))) {
  157 + seckillProductMapper.insertBatch(diffList.get(0));
160 } 158 }
161 - // update  
162 - if (isNotEmpty(lists.get(1))) {  
163 - seckillProductMapper.updateBatch(lists.get(1)); 159 + if (isNotEmpty(diffList.get(1))) {
  160 + seckillProductMapper.updateBatch(diffList.get(1));
164 } 161 }
165 // delete 162 // delete
166 - if (isNotEmpty(lists.get(2))) {  
167 - seckillProductMapper.deleteBatchIds(convertList(lists.get(2), SeckillProductDO::getId)); 163 + if (isNotEmpty(diffList.get(2))) {
  164 + seckillProductMapper.deleteBatchIds(convertList(diffList.get(2), SeckillProductDO::getId));
168 } 165 }
169 } 166 }
170 167
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/MessageTemplateConstants.java
1 package cn.iocoder.yudao.module.trade.enums; 1 package cn.iocoder.yudao.module.trade.enums;
2 2
  3 +// TODO @芋艿:枚举
3 /** 4 /**
4 * 通知模板枚举类 5 * 通知模板枚举类
5 * 6 *
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/notify/TradeNotifyEnums.java
1 package cn.iocoder.yudao.module.trade.enums.notify; 1 package cn.iocoder.yudao.module.trade.enums.notify;
2 2
  3 +// TODO @芋艿:这个枚举的作用?
3 public interface TradeNotifyEnums { 4 public interface TradeNotifyEnums {
4 } 5 }
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/message/TradeMessageServiceImpl.java
@@ -29,6 +29,7 @@ public class TradeMessageServiceImpl implements TradeMessageService { @@ -29,6 +29,7 @@ public class TradeMessageServiceImpl implements TradeMessageService {
29 Map<String, Object> msgMap = new HashMap<>(2); 29 Map<String, Object> msgMap = new HashMap<>(2);
30 msgMap.put("orderId", reqBO.getOrderId()); 30 msgMap.put("orderId", reqBO.getOrderId());
31 msgMap.put("deliveryMessage", reqBO.getMessage()); 31 msgMap.put("deliveryMessage", reqBO.getMessage());
  32 + // TODO 芋艿:看下模版
32 // 2、发送站内信 33 // 2、发送站内信
33 notifyMessageSendApi.sendSingleMessageToMember( 34 notifyMessageSendApi.sendSingleMessageToMember(
34 new NotifySendSingleToUserReqDTO() 35 new NotifySendSingleToUserReqDTO()
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.service.order; @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.service.order;
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
4 import cn.hutool.core.lang.Assert; 4 import cn.hutool.core.lang.Assert;
5 import cn.hutool.core.util.IdUtil; 5 import cn.hutool.core.util.IdUtil;
  6 +import cn.hutool.core.util.ObjectUtil;
6 import cn.hutool.core.util.StrUtil; 7 import cn.hutool.core.util.StrUtil;
7 import cn.iocoder.yudao.framework.common.core.KeyValue; 8 import cn.iocoder.yudao.framework.common.core.KeyValue;
8 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 9 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
@@ -22,7 +23,7 @@ import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDT @@ -22,7 +23,7 @@ import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDT
22 import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; 23 import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
23 import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; 24 import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
24 import cn.iocoder.yudao.module.promotion.api.combination.CombinationRecordApi; 25 import cn.iocoder.yudao.module.promotion.api.combination.CombinationRecordApi;
25 -import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateReqDTO; 26 +import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUpdateStatusReqDTO;
26 import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi; 27 import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi;
27 import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO; 28 import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
28 import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; 29 import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
@@ -59,8 +60,6 @@ import javax.annotation.Resource; @@ -59,8 +60,6 @@ import javax.annotation.Resource;
59 import java.time.LocalDateTime; 60 import java.time.LocalDateTime;
60 import java.util.*; 61 import java.util.*;
61 62
62 -import static cn.hutool.core.util.ObjectUtil.equal;  
63 -import static cn.hutool.core.util.ObjectUtil.notEqual;  
64 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 63 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
65 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; 64 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
66 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; 65 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@@ -172,13 +171,13 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -172,13 +171,13 @@ public class TradeOrderServiceImpl implements TradeOrderService {
172 afterCreateTradeOrder(userId, createReqVO, order, orderItems, calculateRespBO); 171 afterCreateTradeOrder(userId, createReqVO, order, orderItems, calculateRespBO);
173 // 3.3 校验订单类型 172 // 3.3 校验订单类型
174 // 拼团 173 // 拼团
175 - if (equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { 174 + if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) {
176 MemberUserRespDTO user = memberUserApi.getUser(userId); 175 MemberUserRespDTO user = memberUserApi.getUser(userId);
177 // TODO 拼团一次应该只能选择一种规格的商品 176 // TODO 拼团一次应该只能选择一种规格的商品
178 - combinationRecordApi.createRecord(TradeOrderConvert.INSTANCE.convert(order, orderItems.get(0), createReqVO, user)); 177 + combinationRecordApi.createCombinationRecord(TradeOrderConvert.INSTANCE.convert(order, orderItems.get(0), createReqVO, user));
179 } 178 }
180 // TODO 秒杀扣减库存是下单就扣除还是等待订单支付成功再扣除 179 // TODO 秒杀扣减库存是下单就扣除还是等待订单支付成功再扣除
181 - if (equal(TradeOrderTypeEnum.SECKILL.getType(), order.getType())) { 180 + if (Objects.equals(TradeOrderTypeEnum.SECKILL.getType(), order.getType())) {
182 181
183 } 182 }
184 183
@@ -205,7 +204,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -205,7 +204,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
205 TradePriceCalculateRespBO calculateRespBO) { 204 TradePriceCalculateRespBO calculateRespBO) {
206 // 用户选择物流配送的时候才需要填写收货地址 205 // 用户选择物流配送的时候才需要填写收货地址
207 AddressRespDTO address = new AddressRespDTO(); 206 AddressRespDTO address = new AddressRespDTO();
208 - if (equal(createReqVO.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getMode())) { 207 + if (Objects.equals(createReqVO.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getMode())) {
209 // 用户收件地址的校验 208 // 用户收件地址的校验
210 address = validateAddress(userId, createReqVO.getAddressId()); 209 address = validateAddress(userId, createReqVO.getAddressId());
211 } 210 }
@@ -309,9 +308,9 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -309,9 +308,9 @@ public class TradeOrderServiceImpl implements TradeOrderService {
309 } 308 }
310 // 校验活动 309 // 校验活动
311 // 1、拼团活动 310 // 1、拼团活动
312 - if (equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { 311 + if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) {
313 // 更新拼团状态 TODO puhui999:订单支付失败或订单支付过期删除这条拼团记录 312 // 更新拼团状态 TODO puhui999:订单支付失败或订单支付过期删除这条拼团记录
314 - combinationRecordApi.updateRecordStatus(new CombinationRecordUpdateReqDTO().setUserId(order.getUserId()) 313 + combinationRecordApi.updateCombinationRecordStatus(new CombinationRecordUpdateStatusReqDTO().setUserId(order.getUserId())
315 .setOrderId(order.getId()).setStatus(CombinationRecordStatusEnum.IN_PROGRESS.getStatus()).setStartTime(LocalDateTime.now())); 314 .setOrderId(order.getId()).setStatus(CombinationRecordStatusEnum.IN_PROGRESS.getStatus()).setStartTime(LocalDateTime.now()));
316 } 315 }
317 // TODO 芋艿:发送订单变化的消息 316 // TODO 芋艿:发送订单变化的消息
@@ -344,7 +343,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -344,7 +343,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
344 throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID); 343 throw exception(ORDER_UPDATE_PAID_STATUS_NOT_UNPAID);
345 } 344 }
346 // 校验支付订单匹配 345 // 校验支付订单匹配
347 - if (notEqual(order.getPayOrderId(), payOrderId)) { // 支付单号 346 + if (ObjectUtil.notEqual(order.getPayOrderId(), payOrderId)) { // 支付单号
348 log.error("[validateOrderPaid][order({}) 支付单不匹配({}),请进行处理!order 数据是:{}]", 347 log.error("[validateOrderPaid][order({}) 支付单不匹配({}),请进行处理!order 数据是:{}]",
349 id, payOrderId, JsonUtils.toJsonString(order)); 348 id, payOrderId, JsonUtils.toJsonString(order));
350 throw exception(ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR); 349 throw exception(ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR);
@@ -363,13 +362,13 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -363,13 +362,13 @@ public class TradeOrderServiceImpl implements TradeOrderService {
363 throw exception(ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS); 362 throw exception(ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS);
364 } 363 }
365 // 校验支付金额一致 364 // 校验支付金额一致
366 - if (notEqual(payOrder.getPrice(), order.getPayPrice())) { 365 + if (ObjectUtil.notEqual(payOrder.getPrice(), order.getPayPrice())) {
367 log.error("[validateOrderPaid][order({}) payOrder({}) 支付金额不匹配,请进行处理!order 数据是:{},payOrder 数据是:{}]", 366 log.error("[validateOrderPaid][order({}) payOrder({}) 支付金额不匹配,请进行处理!order 数据是:{},payOrder 数据是:{}]",
368 id, payOrderId, JsonUtils.toJsonString(order), JsonUtils.toJsonString(payOrder)); 367 id, payOrderId, JsonUtils.toJsonString(order), JsonUtils.toJsonString(payOrder));
369 throw exception(ORDER_UPDATE_PAID_FAIL_PAY_PRICE_NOT_MATCH); 368 throw exception(ORDER_UPDATE_PAID_FAIL_PAY_PRICE_NOT_MATCH);
370 } 369 }
371 // 校验支付订单匹配(二次) 370 // 校验支付订单匹配(二次)
372 - if (notEqual(payOrder.getMerchantOrderId(), id.toString())) { 371 + if (ObjectUtil.notEqual(payOrder.getMerchantOrderId(), id.toString())) {
373 log.error("[validateOrderPaid][order({}) 支付单不匹配({}),请进行处理!payOrder 数据是:{}]", 372 log.error("[validateOrderPaid][order({}) 支付单不匹配({}),请进行处理!payOrder 数据是:{}]",
374 id, payOrderId, JsonUtils.toJsonString(payOrder)); 373 id, payOrderId, JsonUtils.toJsonString(payOrder));
375 throw exception(ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR); 374 throw exception(ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR);
@@ -393,19 +392,19 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -393,19 +392,19 @@ public class TradeOrderServiceImpl implements TradeOrderService {
393 TradeOrderDO updateOrderObj = new TradeOrderDO(); 392 TradeOrderDO updateOrderObj = new TradeOrderDO();
394 // 判断发货类型 393 // 判断发货类型
395 // 2.1 快递发货 394 // 2.1 快递发货
396 - if (equal(deliveryReqVO.getType(), DeliveryTypeEnum.EXPRESS.getMode())) { 395 + if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.EXPRESS.getMode())) {
397 // 校验快递公司 396 // 校验快递公司
398 validateDeliveryExpress(deliveryReqVO); 397 validateDeliveryExpress(deliveryReqVO);
399 updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()); 398 updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo());
400 } 399 }
401 // 2.2 用户自提 400 // 2.2 用户自提
402 - if (equal(deliveryReqVO.getType(), DeliveryTypeEnum.PICK_UP.getMode())) { 401 + if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.PICK_UP.getMode())) {
403 // TODO 校验自提门店是否存在 402 // TODO 校验自提门店是否存在
404 // 重置一下确保快递公司和快递单号为空 403 // 重置一下确保快递公司和快递单号为空
405 updateOrderObj.setLogisticsId(null).setLogisticsNo(""); 404 updateOrderObj.setLogisticsId(null).setLogisticsNo("");
406 } 405 }
407 // 2.3 TODO 芋艿:如果无需发货,需要怎么存储?回复:需要把 deliverType 设置为 DeliveryTypeEnum.NULL 406 // 2.3 TODO 芋艿:如果无需发货,需要怎么存储?回复:需要把 deliverType 设置为 DeliveryTypeEnum.NULL
408 - if (equal(deliveryReqVO.getType(), DeliveryTypeEnum.NULL.getMode())) { 407 + if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.NULL.getMode())) {
409 // TODO 情况一:正常走发货逻辑和用户自提有点像 不同点:不需要自提门店只需要用户确认收货 408 // TODO 情况一:正常走发货逻辑和用户自提有点像 不同点:不需要自提门店只需要用户确认收货
410 // TODO 情况二:用户下单付款后直接确认收货或等待用户确认收货 409 // TODO 情况二:用户下单付款后直接确认收货或等待用户确认收货
411 // 重置一下确保快递公司和快递单号为空 410 // 重置一下确保快递公司和快递单号为空
@@ -455,17 +454,17 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -455,17 +454,17 @@ public class TradeOrderServiceImpl implements TradeOrderService {
455 } 454 }
456 // 校验订单是否是待发货状态 455 // 校验订单是否是待发货状态
457 if (!TradeOrderStatusEnum.isUndelivered(order.getStatus()) 456 if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())
458 - || notEqual(order.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus())) { 457 + || ObjectUtil.notEqual(order.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus())) {
459 throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED); 458 throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
460 } 459 }
461 // 校验订单是否退款 460 // 校验订单是否退款
462 - if (notEqual(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) { 461 + if (ObjectUtil.notEqual(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) {
463 throw exception(ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE); 462 throw exception(ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE);
464 } 463 }
465 // 订单类型:拼团 464 // 订单类型:拼团
466 - if (equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { 465 + if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) {
467 // 校验订单拼团是否成功 466 // 校验订单拼团是否成功
468 - if (combinationRecordApi.isRecordSuccess(order.getUserId(), order.getId())) { 467 + if (combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) {
469 throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS); 468 throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS);
470 } 469 }
471 } 470 }
@@ -515,7 +514,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -515,7 +514,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
515 } 514 }
516 // 校验订单是否是待收货状态 515 // 校验订单是否是待收货状态
517 if (!TradeOrderStatusEnum.isDelivered(order.getStatus()) 516 if (!TradeOrderStatusEnum.isDelivered(order.getStatus())
518 - || notEqual(order.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.DELIVERED.getStatus())) { 517 + || ObjectUtil.notEqual(order.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.DELIVERED.getStatus())) {
519 throw exception(ORDER_RECEIVE_FAIL_STATUS_NOT_DELIVERED); 518 throw exception(ORDER_RECEIVE_FAIL_STATUS_NOT_DELIVERED);
520 } 519 }
521 return order; 520 return order;
@@ -525,7 +524,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -525,7 +524,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
525 public TradeOrderDO getOrder(Long userId, Long id) { 524 public TradeOrderDO getOrder(Long userId, Long id) {
526 TradeOrderDO order = tradeOrderMapper.selectById(id); 525 TradeOrderDO order = tradeOrderMapper.selectById(id);
527 if (order != null 526 if (order != null
528 - && notEqual(order.getUserId(), userId)) { 527 + && ObjectUtil.notEqual(order.getUserId(), userId)) {
529 return null; 528 return null;
530 } 529 }
531 return order; 530 return order;
@@ -569,7 +568,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -569,7 +568,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
569 public TradeOrderItemDO getOrderItem(Long userId, Long itemId) { 568 public TradeOrderItemDO getOrderItem(Long userId, Long itemId) {
570 TradeOrderItemDO orderItem = tradeOrderItemMapper.selectById(itemId); 569 TradeOrderItemDO orderItem = tradeOrderItemMapper.selectById(itemId);
571 if (orderItem != null 570 if (orderItem != null
572 - && notEqual(orderItem.getUserId(), userId)) { 571 + && ObjectUtil.notEqual(orderItem.getUserId(), userId)) {
573 return null; 572 return null;
574 } 573 }
575 return orderItem; 574 return orderItem;
@@ -649,10 +648,10 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -649,10 +648,10 @@ public class TradeOrderServiceImpl implements TradeOrderService {
649 if (order == null) { 648 if (order == null) {
650 throw exception(ORDER_NOT_FOUND); 649 throw exception(ORDER_NOT_FOUND);
651 } 650 }
652 - if (notEqual(order.getStatus(), TradeOrderStatusEnum.COMPLETED.getStatus())) { 651 + if (ObjectUtil.notEqual(order.getStatus(), TradeOrderStatusEnum.COMPLETED.getStatus())) {
653 throw exception(ORDER_COMMENT_FAIL_STATUS_NOT_COMPLETED); 652 throw exception(ORDER_COMMENT_FAIL_STATUS_NOT_COMPLETED);
654 } 653 }
655 - if (notEqual(order.getCommentStatus(), Boolean.FALSE)) { 654 + if (ObjectUtil.notEqual(order.getCommentStatus(), Boolean.FALSE)) {
656 throw exception(ORDER_COMMENT_STATUS_NOT_FALSE); 655 throw exception(ORDER_COMMENT_STATUS_NOT_FALSE);
657 } 656 }
658 657
@@ -662,7 +661,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -662,7 +661,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
662 // 更新订单项评价状态 661 // 更新订单项评价状态
663 tradeOrderItemMapper.updateById(new TradeOrderItemDO().setId(orderItem.getId()).setCommentStatus(Boolean.TRUE)); 662 tradeOrderItemMapper.updateById(new TradeOrderItemDO().setId(orderItem.getId()).setCommentStatus(Boolean.TRUE));
664 List<TradeOrderItemDO> orderItems = getOrderItemListByOrderId(CollUtil.newArrayList(order.getId())); 663 List<TradeOrderItemDO> orderItems = getOrderItemListByOrderId(CollUtil.newArrayList(order.getId()));
665 - if (!anyMatch(orderItems, item -> equal(item.getCommentStatus(), Boolean.FALSE))) { 664 + if (!anyMatch(orderItems, item -> Objects.equals(item.getCommentStatus(), Boolean.FALSE))) {
666 // 对于 order 来说,就是评论完,把 order 更新完合理的 status 等字段。 665 // 对于 order 来说,就是评论完,把 order 更新完合理的 status 等字段。
667 tradeOrderMapper.updateById(new TradeOrderDO().setId(order.getId()).setCommentStatus(Boolean.TRUE)); 666 tradeOrderMapper.updateById(new TradeOrderDO().setId(order.getId()).setCommentStatus(Boolean.TRUE));
668 } 667 }
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java
@@ -252,6 +252,7 @@ public class PayNotifyServiceImpl implements PayNotifyService { @@ -252,6 +252,7 @@ public class PayNotifyServiceImpl implements PayNotifyService {
252 notifyTaskMapper.updateById(updateTask); 252 notifyTaskMapper.updateById(updateTask);
253 return updateTask.getStatus(); 253 return updateTask.getStatus();
254 } 254 }
  255 +
255 // 情况二:调用失败、调用异常 256 // 情况二:调用失败、调用异常
256 // 2.1 超过最大回调次数 257 // 2.1 超过最大回调次数
257 if (updateTask.getNotifyTimes() >= PayNotifyTaskDO.NOTIFY_FREQUENCY.length) { 258 if (updateTask.getNotifyTimes() >= PayNotifyTaskDO.NOTIFY_FREQUENCY.length) {