...
|
...
|
@@ -124,6 +124,7 @@ public class PromotionServiceImpl implements IPromotionService { |
|
|
activityRsp.setPromotionType(activity.getPromotionType());
|
|
|
activityRsp.setJoinLimitTimes(activity.getJoinLimitTimes());
|
|
|
activityRsp.setProductLimitType(activity.getProductLimitType());
|
|
|
activityRsp.setStatus(activity.getStatus());
|
|
|
if(activity.getProductLimitType().split(",").length == 9){//是否选择全部商品类型
|
|
|
activityRsp.setIsProductTypeAll(1);
|
|
|
}else {
|
...
|
...
|
@@ -153,7 +154,7 @@ public class PromotionServiceImpl implements IPromotionService { |
|
|
productScopeList.add(bo);
|
|
|
}
|
|
|
activityRsp.setProductScopeList(productScopeList);
|
|
|
|
|
|
log.info("getDetailById end. id is {}, rsp is {}", id, activityRsp);
|
|
|
return new ApiResponse.ApiResponseBuilder().data(activityRsp).build();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -192,7 +193,8 @@ public class PromotionServiceImpl implements IPromotionService { |
|
|
PromotionActivity activity = activityMapper.selectByPrimaryKey(id);//获取当前活动的开始结束时间
|
|
|
PromotionActivity activityCheck = activityMapper.selectActivityWithinTime(activity.getStartTime(), activity.getEndTime(), id);
|
|
|
if (activityCheck != null) {
|
|
|
return new ApiResponse.ApiResponseBuilder().code(201).message("活动生效期间有其他活动开启中,无法开启此活动").build();
|
|
|
log.warn("updateStatusById fail: exist same promotionType activity. id is {}, status is {}", id, status);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(201).message("该时段已经存在相同类型的活动,请修改活动时间").build();
|
|
|
}
|
|
|
}
|
|
|
PromotionActivity activity = new PromotionActivity();
|
...
|
...
|
@@ -274,23 +276,27 @@ public class PromotionServiceImpl implements IPromotionService { |
|
|
Integer startTime = DateUtil.getTimeSecondsFromStr(req.getStartTimeStr(), DateUtil.DATE_TIME_FORMAT);
|
|
|
Integer endTime = DateUtil.getTimeSecondsFromStr(req.getEndTimeStr(), DateUtil.DATE_TIME_FORMAT);
|
|
|
if(startTime == null || endTime == null || endTime < startTime){
|
|
|
log.warn("checkParams fail: endTime less than startTime. req is {}", req);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(201).message("结束时间必须大于开始时间").build();
|
|
|
}
|
|
|
if(req.getInitStatus().equals(PromotionStatusEnum.OPEN.getCode())
|
|
|
&&(activityMapper.selectActivityWithinTime(startTime, endTime, req.getId()) != null)){
|
|
|
return new ApiResponse.ApiResponseBuilder().code(201).message("活动生效期间有其他活动开启中,无法开启此活动").build();
|
|
|
log.warn("checkParams fail: exist same promotionType activity. req is {}", req);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(201).message("该时段已经存在相同类型的活动,请修改活动时间").build();
|
|
|
}
|
|
|
for(String params : req.getPromotionProductScopes().split("-")){
|
|
|
PromotionProductScopeBo scopeBo = JSON.parseObject(params, PromotionProductScopeBo.class);
|
|
|
if(scopeBo.getProductScopeType().equals(PromotionProductLimitEnum.ALL.getCode())) continue;
|
|
|
Integer poolId = Integer.valueOf(scopeBo.getScopeValue());
|
|
|
if(ufoProductPoolMapper.selectOneById(poolId) == null){
|
|
|
log.warn("checkParams fail: productPoolId is invalid. req is {}", req);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(201).message("商品池Id无效").build();
|
|
|
}
|
|
|
}
|
|
|
for(String params : req.getPromotionAmountConditions().split("-")){
|
|
|
PromotionAmountConditionBo conditionBo = JSON.parseObject(params,PromotionAmountConditionBo.class);
|
|
|
if(conditionBo.getLimitAmount() * conditionBo.getOfferAmount() > conditionBo.getOfferMaxLimit()){
|
|
|
log.warn("checkParams fail: amountCondition is invalid. req is {}", req);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(201).message("最小折扣不能大于折扣最大值").build();
|
|
|
}
|
|
|
}
|
...
|
...
|
|