记得上下班打卡 | git大法好,push需谨慎

Commit ef21fc64 authored by 胡佳晨's avatar 胡佳晨

修改 分批购时间配置

parent ffeb4a04
......@@ -129,16 +129,21 @@ public class GoblinListServiceImpl implements IGoblinListService {
return ResponseDto.failure("结束时间不能晚于商品开售时间");
}
collectVos = redisUtils.getGoblinListCollect(skuId);
boolean isSame = judgeTime(st, et, collectVos);
if(isSame){
return ResponseDto.failure("sku时间不能重合");
}
for (GoblinListCollectVo collectItem : collectVos) {
if (collectItem.getTimeEnd() != null) {
if ((st.isAfter(collectItem.getTimeStart().minusSeconds(1)) && st.isBefore(collectItem.getTimeEnd().plusSeconds(1))) ||
(et.isAfter(collectItem.getTimeStart().plusSeconds(1)) && et.isBefore(collectItem.getTimeEnd().minusSeconds(1))) ||
(st.isBefore(collectItem.getTimeStart().minusSeconds(1)) && et.isAfter(collectItem.getTimeEnd().minusSeconds(1)))
if ((st.isAfter(collectItem.getTimeStart()) && st.isBefore(collectItem.getTimeEnd())) ||
(et.isAfter(collectItem.getTimeStart()) && et.isBefore(collectItem.getTimeEnd())) ||
(st.isBefore(collectItem.getTimeStart()) && et.isAfter(collectItem.getTimeEnd()))
) {//开始时间不能在其他时间段内/结束间不能在其他时间段内/开始结束时间不能包含其他时间段
return ResponseDto.failure("sku时间不能重合");
}
} else {
if (st.isBefore(collectItem.getTimeStart().minusSeconds(1)) && et.isAfter(collectItem.getTimeStart().plusSeconds(1))) {
if (st.isBefore(collectItem.getTimeStart()) && et.isAfter(collectItem.getTimeStart())) {
return ResponseDto.failure("sku时间不能重合");//开始结束时间不能包含只有开始时间的时间段
}
}
......@@ -154,7 +159,6 @@ public class GoblinListServiceImpl implements IGoblinListService {
return ResponseDto.failure("sku时间不能重合");
}
} else {
}
}
}
......@@ -263,13 +267,13 @@ public class GoblinListServiceImpl implements IGoblinListService {
queueUtils.sendMsgByRedisXls(vo.getListId(), param.getBlackUrl(), blackUrl, "4", item.getSkuId());
}
List<GoblinListCollectVo> collectVos = redisUtils.getGoblinListCollect(vo.getItemVo().get(0).getSkuId());
for (GoblinListCollectVo itemVo:collectVos){
if(itemVo.getListId().equals(param.getListId())){
for (GoblinListCollectVo itemVo : collectVos) {
if (itemVo.getListId().equals(param.getListId())) {
itemVo.setWhiteType(vo.getWhiteType());
break;
}
}
redisUtils.setGoblinListCollect(vo.getItemVo().get(0).getSkuId(),collectVos);
redisUtils.setGoblinListCollect(vo.getItemVo().get(0).getSkuId(), collectVos);
redisUtils.setGoblinListDetailsVo(vo);
mongoUtils.changeGoblinListDetailsVo(vo);
//sql入库
......@@ -306,4 +310,19 @@ public class GoblinListServiceImpl implements IGoblinListService {
SqlMapping.get("goblin_list_remove", now, listId));
return ResponseDto.success();
}
private boolean judgeTime(LocalDateTime st, LocalDateTime et, List<GoblinListCollectVo> collects) {
for (GoblinListCollectVo collectItem : collects) {
if (st.compareTo(collectItem.getTimeStart()) == 0) {
return true;
} else if (et != null && et.compareTo(collectItem.getTimeStart()) == 0) {
return true;
} else if (collectItem.getTimeEnd() != null && st.compareTo(collectItem.getTimeEnd()) == 0) {
return true;
} else if (collectItem.getTimeEnd() != null && et != null && et.compareTo(collectItem.getTimeEnd()) == 0) {
return true;
}
}
return false;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment