Commit ba59ec85e045e37af1b6ab4044d30634f8535901
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 | 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 | 68 | * @param startTime1 开始 time1 |
| ... | ... | @@ -92,7 +72,6 @@ public class LocalDateTimeUtils { |
| 92 | 72 | * @return 重叠:true 不重叠:false |
| 93 | 73 | */ |
| 94 | 74 | public static boolean isOverlap(LocalTime startTime1, LocalTime endTime1, LocalTime startTime2, LocalTime endTime2) { |
| 95 | - // 日期部分使用了当前日期LocalDate.now() | |
| 96 | 75 | LocalDate nowDate = LocalDate.now(); |
| 97 | 76 | return LocalDateTimeUtil.isOverlap(LocalDateTime.of(nowDate, startTime1), LocalDateTime.of(nowDate, endTime1), |
| 98 | 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 | 40 | */ |
| 41 | 41 | @NotNull(message = "订单编号不能为空") |
| 42 | 42 | private Long orderId; |
| 43 | + // TODO @puhui999:spuName、picUrl、 之类字段不用传递; | |
| 43 | 44 | /** |
| 44 | 45 | * 商品名字 |
| 45 | 46 | */ |
| ... | ... | @@ -60,6 +61,7 @@ public class BargainRecordCreateReqDTO { |
| 60 | 61 | */ |
| 61 | 62 | @NotNull(message = "商品原价不能为空") |
| 62 | 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 | 1 | package cn.iocoder.yudao.module.promotion.api.combination; |
| 2 | 2 | |
| 3 | 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 | 6 | import javax.validation.Valid; |
| 7 | 7 | |
| ... | ... | @@ -18,7 +18,7 @@ public interface CombinationRecordApi { |
| 18 | 18 | * |
| 19 | 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 | 27 | * @param orderId 订单编号 |
| 28 | 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 | 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 | 6 | import java.time.LocalDateTime; |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | - * 拼团记录的更新 Request DTO | |
| 9 | + * 拼团记录的更新状态 Request DTO | |
| 10 | 10 | * |
| 11 | 11 | * @author HUIHUI |
| 12 | 12 | */ |
| 13 | 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 | 74 | ErrorCode BARGAIN_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1013011001, "存在商品参加了其它砍价活动"); |
| 75 | 75 | ErrorCode BARGAIN_ACTIVITY_STATUS_DISABLE = new ErrorCode(1013011002, "砍价活动已关闭不能修改"); |
| 76 | 76 | ErrorCode BARGAIN_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013011003, "砍价活动未关闭或未结束,不能删除"); |
| 77 | + | |
| 78 | + // TODO @puhui999:拆分成砍价记录 | |
| 79 | + | |
| 77 | 80 | ErrorCode BARGAIN_RECORD_NOT_EXISTS = new ErrorCode(1013011004, "砍价不存在"); |
| 78 | 81 | ErrorCode BARGAIN_RECORD_EXISTS = new ErrorCode(1013011005, "砍价失败,已参与过该砍价"); |
| 79 | 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 | 1 | package cn.iocoder.yudao.module.promotion.api.combination; |
| 2 | 2 | |
| 3 | 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 | import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService; |
| 7 | 7 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -20,17 +20,17 @@ public class CombinationRecordApiImpl implements CombinationRecordApi { |
| 20 | 20 | private CombinationRecordService recordService; |
| 21 | 21 | |
| 22 | 22 | @Override |
| 23 | - public void createRecord(CombinationRecordCreateReqDTO reqDTO) { | |
| 23 | + public void createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) { | |
| 24 | 24 | recordService.createCombinationRecord(reqDTO); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | @Override |
| 28 | - public boolean isRecordSuccess(Long userId, Long orderId) { | |
| 28 | + public boolean isCombinationRecordSuccess(Long userId, Long orderId) { | |
| 29 | 29 | return CombinationRecordStatusEnum.isSuccess(recordService.getCombinationRecord(userId, orderId).getStatus()); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | @Override |
| 33 | - public void updateRecordStatus(CombinationRecordUpdateReqDTO reqDTO) { | |
| 33 | + public void updateCombinationRecordStatus(CombinationRecordUpdateStatusReqDTO reqDTO) { | |
| 34 | 34 | if (null == reqDTO.getStartTime()) { |
| 35 | 35 | recordService.updateCombinationRecordStatusByUserIdAndOrderId(reqDTO); |
| 36 | 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 | 17 | @ToString(callSuper = true) |
| 18 | 18 | public class BargainActivityRespVO extends BargainActivityBaseVO { |
| 19 | 19 | |
| 20 | + // TODO @puhui999:example 补全 | |
| 21 | + | |
| 20 | 22 | @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "618大促") |
| 21 | 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 | 5 | import lombok.EqualsAndHashCode; |
| 6 | 6 | import lombok.ToString; |
| 7 | 7 | |
| 8 | +// TODO @puhui999:是不是应该把 BargainProductCreateReqVO 和 BargainProductUpdateReqVO 合并在一起哈。就是一个 SaveReqVO | |
| 8 | 9 | @Schema(description = "管理后台 - 砍价商品创建 Request VO") |
| 9 | 10 | @Data |
| 10 | 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 | 65 | |
| 66 | 66 | List<BargainProductRespVO> convertList2(List<BargainProductDO> productDOs); |
| 67 | 67 | |
| 68 | + // TODO @puhui999:参数改成 activity、product 会不会干净一点哈 | |
| 68 | 69 | @Mappings({ |
| 69 | 70 | @Mapping(target = "id", ignore = true), |
| 70 | 71 | @Mapping(target = "activityId", source = "activityDO.id"), |
| ... | ... | @@ -90,6 +91,4 @@ public interface BargainActivityConvert { |
| 90 | 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 | 67 | |
| 68 | 68 | List<CombinationProductRespVO> convertList2(List<CombinationProductDO> productDOs); |
| 69 | 69 | |
| 70 | + // TODO @puhui999:参数改成 activity、product 会不会干净一点哈 | |
| 70 | 71 | @Mappings({ |
| 71 | 72 | @Mapping(target = "id", ignore = true), |
| 72 | 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 | 56 | return convert1(seckillActivity).setProducts(convertList2(seckillProducts)); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | + // TODO @puhui999:参数改成 activity、product 会不会干净一点哈 | |
| 59 | 60 | @Mappings({ |
| 60 | 61 | @Mapping(target = "id", ignore = true), |
| 61 | 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
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainProductMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.dal.mysql.bargain; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | 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 | 4 | import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainProductDO; |
| 8 | 5 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 6 | |
| ... | ... | @@ -18,18 +15,6 @@ import java.util.List; |
| 18 | 15 | @Mapper |
| 19 | 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 | 18 | default List<BargainProductDO> selectListByActivityIds(Collection<Long> ids) { |
| 34 | 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
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordService.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.service.combination; |
| 2 | 2 | |
| 3 | 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 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; |
| 6 | 6 | |
| 7 | 7 | /** |
| ... | ... | @@ -16,7 +16,7 @@ public interface CombinationRecordService { |
| 16 | 16 | * |
| 17 | 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 | 30 | * |
| 31 | 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 | 11 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; |
| 12 | 12 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 13 | 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 | 15 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO; |
| 16 | 16 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageReqVO; |
| 17 | 17 | import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; |
| ... | ... | @@ -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 | 142 | boolean same = ObjectUtil.equal(oldVal.getSkuId(), newVal.getSkuId()); |
| 144 | 143 | if (same) { |
| 145 | 144 | newVal.setId(oldVal.getId()); |
| ... | ... | @@ -147,17 +146,15 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi |
| 147 | 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 | 201 | } |
| 205 | 202 | |
| 206 | 203 | @Override |
| 207 | - public void updateCombinationRecordStatusByUserIdAndOrderId(CombinationRecordUpdateReqDTO reqDTO) { | |
| 204 | + public void updateCombinationRecordStatusByUserIdAndOrderId(CombinationRecordUpdateStatusReqDTO reqDTO) { | |
| 208 | 205 | // 校验拼团是否存在 |
| 209 | 206 | CombinationRecordDO recordDO = validateCombinationRecord(reqDTO.getUserId(), reqDTO.getOrderId()); |
| 210 | 207 | |
| ... | ... | @@ -215,7 +212,7 @@ public class CombinationServiceImpl implements CombinationActivityService, Combi |
| 215 | 212 | |
| 216 | 213 | @Override |
| 217 | 214 | @Transactional(rollbackFor = Exception.class) |
| 218 | - public void updateCombinationRecordStatusAndStartTimeByUserIdAndOrderId(CombinationRecordUpdateReqDTO reqDTO) { | |
| 215 | + public void updateCombinationRecordStatusAndStartTimeByUserIdAndOrderId(CombinationRecordUpdateStatusReqDTO reqDTO) { | |
| 219 | 216 | CombinationRecordDO recordDO = validateCombinationRecord(reqDTO.getUserId(), reqDTO.getOrderId()); |
| 220 | 217 | // 更新状态 |
| 221 | 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 | 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 | 148 | boolean same = ObjectUtil.equal(oldVal.getSkuId(), newVal.getSkuId()); |
| 151 | 149 | if (same) { |
| 152 | 150 | newVal.setId(oldVal.getId()); |
| ... | ... | @@ -154,17 +152,16 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { |
| 154 | 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 | 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
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/notify/TradeNotifyEnums.java
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 | 29 | Map<String, Object> msgMap = new HashMap<>(2); |
| 30 | 30 | msgMap.put("orderId", reqBO.getOrderId()); |
| 31 | 31 | msgMap.put("deliveryMessage", reqBO.getMessage()); |
| 32 | + // TODO 芋艿:看下模版 | |
| 32 | 33 | // 2、发送站内信 |
| 33 | 34 | notifyMessageSendApi.sendSingleMessageToMember( |
| 34 | 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 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.lang.Assert; |
| 5 | 5 | import cn.hutool.core.util.IdUtil; |
| 6 | +import cn.hutool.core.util.ObjectUtil; | |
| 6 | 7 | import cn.hutool.core.util.StrUtil; |
| 7 | 8 | import cn.iocoder.yudao.framework.common.core.KeyValue; |
| 8 | 9 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| ... | ... | @@ -22,7 +23,7 @@ import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDT |
| 22 | 23 | import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; |
| 23 | 24 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; |
| 24 | 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 | 27 | import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi; |
| 27 | 28 | import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO; |
| 28 | 29 | import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; |
| ... | ... | @@ -59,8 +60,6 @@ import javax.annotation.Resource; |
| 59 | 60 | import java.time.LocalDateTime; |
| 60 | 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 | 63 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 65 | 64 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 66 | 65 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| ... | ... | @@ -172,13 +171,13 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 172 | 171 | afterCreateTradeOrder(userId, createReqVO, order, orderItems, calculateRespBO); |
| 173 | 172 | // 3.3 校验订单类型 |
| 174 | 173 | // 拼团 |
| 175 | - if (equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { | |
| 174 | + if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { | |
| 176 | 175 | MemberUserRespDTO user = memberUserApi.getUser(userId); |
| 177 | 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 | 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 | 204 | TradePriceCalculateRespBO calculateRespBO) { |
| 206 | 205 | // 用户选择物流配送的时候才需要填写收货地址 |
| 207 | 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 | 209 | address = validateAddress(userId, createReqVO.getAddressId()); |
| 211 | 210 | } |
| ... | ... | @@ -309,9 +308,9 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 309 | 308 | } |
| 310 | 309 | // 校验活动 |
| 311 | 310 | // 1、拼团活动 |
| 312 | - if (equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { | |
| 311 | + if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { | |
| 313 | 312 | // 更新拼团状态 TODO puhui999:订单支付失败或订单支付过期删除这条拼团记录 |
| 314 | - combinationRecordApi.updateRecordStatus(new CombinationRecordUpdateReqDTO().setUserId(order.getUserId()) | |
| 313 | + combinationRecordApi.updateCombinationRecordStatus(new CombinationRecordUpdateStatusReqDTO().setUserId(order.getUserId()) | |
| 315 | 314 | .setOrderId(order.getId()).setStatus(CombinationRecordStatusEnum.IN_PROGRESS.getStatus()).setStartTime(LocalDateTime.now())); |
| 316 | 315 | } |
| 317 | 316 | // TODO 芋艿:发送订单变化的消息 |
| ... | ... | @@ -344,7 +343,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 344 | 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 | 347 | log.error("[validateOrderPaid][order({}) 支付单不匹配({}),请进行处理!order 数据是:{}]", |
| 349 | 348 | id, payOrderId, JsonUtils.toJsonString(order)); |
| 350 | 349 | throw exception(ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR); |
| ... | ... | @@ -363,13 +362,13 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 363 | 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 | 366 | log.error("[validateOrderPaid][order({}) payOrder({}) 支付金额不匹配,请进行处理!order 数据是:{},payOrder 数据是:{}]", |
| 368 | 367 | id, payOrderId, JsonUtils.toJsonString(order), JsonUtils.toJsonString(payOrder)); |
| 369 | 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 | 372 | log.error("[validateOrderPaid][order({}) 支付单不匹配({}),请进行处理!payOrder 数据是:{}]", |
| 374 | 373 | id, payOrderId, JsonUtils.toJsonString(payOrder)); |
| 375 | 374 | throw exception(ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR); |
| ... | ... | @@ -393,19 +392,19 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 393 | 392 | TradeOrderDO updateOrderObj = new TradeOrderDO(); |
| 394 | 393 | // 判断发货类型 |
| 395 | 394 | // 2.1 快递发货 |
| 396 | - if (equal(deliveryReqVO.getType(), DeliveryTypeEnum.EXPRESS.getMode())) { | |
| 395 | + if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.EXPRESS.getMode())) { | |
| 397 | 396 | // 校验快递公司 |
| 398 | 397 | validateDeliveryExpress(deliveryReqVO); |
| 399 | 398 | updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()); |
| 400 | 399 | } |
| 401 | 400 | // 2.2 用户自提 |
| 402 | - if (equal(deliveryReqVO.getType(), DeliveryTypeEnum.PICK_UP.getMode())) { | |
| 401 | + if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.PICK_UP.getMode())) { | |
| 403 | 402 | // TODO 校验自提门店是否存在 |
| 404 | 403 | // 重置一下确保快递公司和快递单号为空 |
| 405 | 404 | updateOrderObj.setLogisticsId(null).setLogisticsNo(""); |
| 406 | 405 | } |
| 407 | 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 | 408 | // TODO 情况一:正常走发货逻辑和用户自提有点像 不同点:不需要自提门店只需要用户确认收货 |
| 410 | 409 | // TODO 情况二:用户下单付款后直接确认收货或等待用户确认收货 |
| 411 | 410 | // 重置一下确保快递公司和快递单号为空 |
| ... | ... | @@ -455,17 +454,17 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 455 | 454 | } |
| 456 | 455 | // 校验订单是否是待发货状态 |
| 457 | 456 | if (!TradeOrderStatusEnum.isUndelivered(order.getStatus()) |
| 458 | - || notEqual(order.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus())) { | |
| 457 | + || ObjectUtil.notEqual(order.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus())) { | |
| 459 | 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 | 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 | 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 | 514 | } |
| 516 | 515 | // 校验订单是否是待收货状态 |
| 517 | 516 | if (!TradeOrderStatusEnum.isDelivered(order.getStatus()) |
| 518 | - || notEqual(order.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.DELIVERED.getStatus())) { | |
| 517 | + || ObjectUtil.notEqual(order.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.DELIVERED.getStatus())) { | |
| 519 | 518 | throw exception(ORDER_RECEIVE_FAIL_STATUS_NOT_DELIVERED); |
| 520 | 519 | } |
| 521 | 520 | return order; |
| ... | ... | @@ -525,7 +524,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 525 | 524 | public TradeOrderDO getOrder(Long userId, Long id) { |
| 526 | 525 | TradeOrderDO order = tradeOrderMapper.selectById(id); |
| 527 | 526 | if (order != null |
| 528 | - && notEqual(order.getUserId(), userId)) { | |
| 527 | + && ObjectUtil.notEqual(order.getUserId(), userId)) { | |
| 529 | 528 | return null; |
| 530 | 529 | } |
| 531 | 530 | return order; |
| ... | ... | @@ -569,7 +568,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 569 | 568 | public TradeOrderItemDO getOrderItem(Long userId, Long itemId) { |
| 570 | 569 | TradeOrderItemDO orderItem = tradeOrderItemMapper.selectById(itemId); |
| 571 | 570 | if (orderItem != null |
| 572 | - && notEqual(orderItem.getUserId(), userId)) { | |
| 571 | + && ObjectUtil.notEqual(orderItem.getUserId(), userId)) { | |
| 573 | 572 | return null; |
| 574 | 573 | } |
| 575 | 574 | return orderItem; |
| ... | ... | @@ -649,10 +648,10 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 649 | 648 | if (order == null) { |
| 650 | 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 | 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 | 655 | throw exception(ORDER_COMMENT_STATUS_NOT_FALSE); |
| 657 | 656 | } |
| 658 | 657 | |
| ... | ... | @@ -662,7 +661,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { |
| 662 | 661 | // 更新订单项评价状态 |
| 663 | 662 | tradeOrderItemMapper.updateById(new TradeOrderItemDO().setId(orderItem.getId()).setCommentStatus(Boolean.TRUE)); |
| 664 | 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 | 665 | // 对于 order 来说,就是评论完,把 order 更新完合理的 status 等字段。 |
| 667 | 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 | 252 | notifyTaskMapper.updateById(updateTask); |
| 253 | 253 | return updateTask.getStatus(); |
| 254 | 254 | } |
| 255 | + | |
| 255 | 256 | // 情况二:调用失败、调用异常 |
| 256 | 257 | // 2.1 超过最大回调次数 |
| 257 | 258 | if (updateTask.getNotifyTimes() >= PayNotifyTaskDO.NOTIFY_FREQUENCY.length) { | ... | ... |