食谱计划生成优化

This commit is contained in:
xiezhijun 2021-06-30 11:33:22 +08:00
parent ce7c7e4525
commit 7c269fce9b

View File

@ -327,8 +327,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
SysRecipesPlan beforeOrderLastPlan = getLastDayRecipesPlan(sysOrder.getCusId(), sysOrder.getOrderTime()); SysRecipesPlan beforeOrderLastPlan = getLastDayRecipesPlan(sysOrder.getCusId(), sysOrder.getOrderTime());
int startNumDay = 0; int startNumDay = 0;
//System.out.println(sysOrder.getRecipesPlanContinue() == null); //System.out.println(sysOrder.getRecipesPlanContinue() == null);
int totalDays = (beforeOrderLastPlan != null ? beforeOrderLastPlan.getEndNumDay() : 0) + Integer.parseInt(sysOrder.getServeTimeId()+""); int totalDays = (beforeOrderLastPlan != null ? beforeOrderLastPlan.getEndNumDay() : 0) + Integer.parseInt(ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()))+"") + 1;
System.out.println(totalDays); //System.out.println(totalDays);
//之前是否存在食谱以及该订单食谱计划是否需要连续 //之前是否存在食谱以及该订单食谱计划是否需要连续
if (beforeOrderLastPlan != null && sysOrder.getRecipesPlanContinue().intValue() == 1) { if (beforeOrderLastPlan != null && sysOrder.getRecipesPlanContinue().intValue() == 1) {
long differDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()), serverStartDate); long differDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()), serverStartDate);
@ -383,9 +383,9 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
planStartDate = serverEndDate; planStartDate = serverEndDate;
breakFlag = false; breakFlag = false;
} }
if (planEndDate == planStartDate && StringUtils.isNotEmpty(pauseResult)) { /*if (planEndDate == planStartDate && StringUtils.isNotEmpty(pauseResult)) {
continue; continue;
} }*/
//暂停日期 //暂停日期
sysRecipesPlan.setPauseDate(pauseResult[3]); sysRecipesPlan.setPauseDate(pauseResult[3]);
sysRecipesPlan.setStartDate(DateUtils.localDateToDate(planStartDate)); sysRecipesPlan.setStartDate(DateUtils.localDateToDate(planStartDate));
@ -397,7 +397,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
sysRecipesPlan.setStartNumDay(startNumDay); sysRecipesPlan.setStartNumDay(startNumDay);
long dayNumber = ChronoUnit.DAYS.between(planStartDate, planEndDate); long dayNumber = ChronoUnit.DAYS.between(planStartDate, planEndDate);
startNumDay += dayNumber > 6 ? 6 : dayNumber; startNumDay += dayNumber > 6 ? 6 : dayNumber;
sysRecipesPlan.setEndNumDay(startNumDay > totalDays ? totalDays : startNumDay); sysRecipesPlan.setEndNumDay(startNumDay > totalDays ? totalDays : startNumDay);//
//添加暂停范围内的日期 //添加暂停范围内的日期
planList.add(sysRecipesPlan); planList.add(sysRecipesPlan);
//System.out.println(DateUtils.dateTime(sysRecipesPlan.getStartDate()) + "-----" + DateUtils.dateTime(sysRecipesPlan.getEndDate())); //System.out.println(DateUtils.dateTime(sysRecipesPlan.getStartDate()) + "-----" + DateUtils.dateTime(sysRecipesPlan.getEndDate()));