代码合并
This commit is contained in:
		| @@ -4,6 +4,7 @@ import com.aliyun.vod20170321.models.GetPlayInfoResponseBody; | |||||||
| import com.aliyun.vod20170321.models.GetVideoInfoResponseBody; | import com.aliyun.vod20170321.models.GetVideoInfoResponseBody; | ||||||
| import com.stdiet.common.core.controller.BaseController; | import com.stdiet.common.core.controller.BaseController; | ||||||
| import com.stdiet.common.core.domain.AjaxResult; | import com.stdiet.common.core.domain.AjaxResult; | ||||||
|  | import com.stdiet.common.core.domain.entity.SysDictData; | ||||||
| import com.stdiet.common.core.page.TableDataInfo; | import com.stdiet.common.core.page.TableDataInfo; | ||||||
| import com.stdiet.common.exception.file.FileNameLengthLimitExceededException; | import com.stdiet.common.exception.file.FileNameLengthLimitExceededException; | ||||||
| import com.stdiet.common.utils.AliyunVideoUtils; | import com.stdiet.common.utils.AliyunVideoUtils; | ||||||
| @@ -19,6 +20,7 @@ import com.stdiet.custom.dto.response.MessageNoticeResponse; | |||||||
| import com.stdiet.custom.dto.response.NutritionalVideoResponse; | import com.stdiet.custom.dto.response.NutritionalVideoResponse; | ||||||
| import com.stdiet.custom.page.WxLogInfo; | import com.stdiet.custom.page.WxLogInfo; | ||||||
| import com.stdiet.custom.service.*; | import com.stdiet.custom.service.*; | ||||||
|  | import com.stdiet.system.service.ISysDictTypeService; | ||||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||||
| @@ -50,15 +52,18 @@ public class WechatAppletController extends BaseController { | |||||||
|     private ISysAskNutritionQuestionService sysAskNutritionQuestionService; |     private ISysAskNutritionQuestionService sysAskNutritionQuestionService; | ||||||
|     @Autowired |     @Autowired | ||||||
|     private ISysCustomerService iSysCustomerService; |     private ISysCustomerService iSysCustomerService; | ||||||
|  |  | ||||||
|     @Autowired |     @Autowired | ||||||
|     private ISysMessageNoticeService sysMessageNoticeService; |     private ISysMessageNoticeService sysMessageNoticeService; | ||||||
|  |  | ||||||
|     @Autowired |     @Autowired | ||||||
|     private ISysCustomerService sysCustomerService; |     private ISysCustomerService sysCustomerService; | ||||||
|  |  | ||||||
|     @Autowired |     @Autowired | ||||||
|     private ISysNutritionalVideoService sysNutritionalVideoService; |     private ISysNutritionalVideoService sysNutritionalVideoService; | ||||||
|  |     @Autowired | ||||||
|  |     private ISysRecipesPlanService sysRecipesPlanService; | ||||||
|  |     @Autowired | ||||||
|  |     private ISysOrderPauseService sysOrderPauseService; | ||||||
|  |     @Autowired | ||||||
|  |     private ISysDictTypeService iSysDictTypeService; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询微信小程序中展示的客户案例 |      * 查询微信小程序中展示的客户案例 | ||||||
| @@ -445,17 +450,23 @@ public class WechatAppletController extends BaseController { | |||||||
|                 return AjaxResult.error(5003, "未查到用户信息,请联系销售顾问"); |                 return AjaxResult.error(5003, "未查到用户信息,请联系销售顾问"); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             sysWxUserInfo.setCusId(sysCustomer.getId()); | ||||||
|             if (StringUtils.isNull(curWxUserInfo)) { |             if (StringUtils.isNull(curWxUserInfo)) { | ||||||
|                 // 新增sys_wx_user_info |                 // 新增sys_wx_user_info | ||||||
|                 sysWxUserInfo.setCusId(sysCustomer.getId()); |  | ||||||
|                 sysWxUserInfo.setCreateTime(DateUtils.getNowDate()); |                 sysWxUserInfo.setCreateTime(DateUtils.getNowDate()); | ||||||
|                 sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo); |                 sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo); | ||||||
|             } else { |             } else { | ||||||
|                 // 更新sys_wx_user_info数据, |                 // 更新sys_wx_user_info数据, | ||||||
|                 curWxUserInfo.setCusId(sysCustomer.getId()); |                 sysWxUserInfo.setUpdateTime(DateUtils.getNowDate()); | ||||||
|                 curWxUserInfo.setUpdateTime(DateUtils.getNowDate()); |                 sysWxUserInfoService.updateSysWxUserInfo(sysWxUserInfo); | ||||||
|                 sysWxUserInfoService.updateSysWxUserInfo(curWxUserInfo); |  | ||||||
|             } |             } | ||||||
|  |             // 更新对象 | ||||||
|  |             curWxUserInfo = sysWxUserInfo; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // 更新时间超过7天,重新登录获取最新信息 | ||||||
|  |         if (StringUtils.isEmpty(curWxUserInfo.getAvatarUrl()) || ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(curWxUserInfo.getUpdateTime()), LocalDate.now()) >= 7) { | ||||||
|  |             return AjaxResult.error(5001, "信息缺失或者过期需要重新登录"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         curWxUserInfo.setCustomerId(AesUtils.encrypt(curWxUserInfo.getCusId().toString())); |         curWxUserInfo.setCustomerId(AesUtils.encrypt(curWxUserInfo.getCusId().toString())); | ||||||
| @@ -463,4 +474,38 @@ public class WechatAppletController extends BaseController { | |||||||
|         // 并返回一系列登录后的数据 |         // 并返回一系列登录后的数据 | ||||||
|         return AjaxResult.success(curWxUserInfo); |         return AjaxResult.success(curWxUserInfo); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @GetMapping("/getRecipesPlans") | ||||||
|  |     public AjaxResult getRecipesPlans(@RequestParam String customerId) { | ||||||
|  |         Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; | ||||||
|  |  | ||||||
|  |         List<SysRecipesPlan> plans = sysRecipesPlanService.selectPlanListByCusId(cusId); | ||||||
|  |  | ||||||
|  |         SysOrderPause orderPause = new SysOrderPause(); | ||||||
|  |         orderPause.setCusId(cusId); | ||||||
|  |         List<SysOrderPause> pauses = sysOrderPauseService.selectSysOrderPauseList(orderPause); | ||||||
|  |  | ||||||
|  |         Map<String, Object> result = new HashMap<>(); | ||||||
|  |         result.put("plans", plans); | ||||||
|  |         result.put("pauses", pauses); | ||||||
|  |  | ||||||
|  |         return AjaxResult.success(result); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @GetMapping("/getDicts") | ||||||
|  |     public AjaxResult getDicts() { | ||||||
|  |  | ||||||
|  |         List<SysDictData> unitDict = iSysDictTypeService.selectDictDataByType("cus_cus_unit"); | ||||||
|  |         List<SysDictData> weightDict = iSysDictTypeService.selectDictDataByType("cus_cus_weight"); | ||||||
|  |         List<SysDictData> menuTypeDict = iSysDictTypeService.selectDictDataByType("cus_dishes_type"); | ||||||
|  |  | ||||||
|  |         Map<String, Object> result = new HashMap<>(); | ||||||
|  |         result.put("unitDict", unitDict); | ||||||
|  |         result.put("weightDict", weightDict); | ||||||
|  |         result.put("menuTypeDict", menuTypeDict); | ||||||
|  |  | ||||||
|  |         return AjaxResult.success(result); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -280,6 +280,8 @@ public class SysOrder extends BaseEntity { | |||||||
|     //订单查询时的订单类型二维数组 |     //订单查询时的订单类型二维数组 | ||||||
|     private JSONArray searchOrderTypeArray; |     private JSONArray searchOrderTypeArray; | ||||||
|  |  | ||||||
|  |     private Integer counted; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.stdiet.custom.domain; | package com.stdiet.custom.domain; | ||||||
|  |  | ||||||
| import com.fasterxml.jackson.annotation.JsonFormat; | import com.fasterxml.jackson.annotation.JsonFormat; | ||||||
|  | import com.fasterxml.jackson.annotation.JsonIgnore; | ||||||
| import com.stdiet.common.annotation.Excel; | import com.stdiet.common.annotation.Excel; | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | import org.apache.commons.lang3.builder.ToStringBuilder; | ||||||
| @@ -25,8 +26,10 @@ public class SysOrderPause { | |||||||
|     /** |     /** | ||||||
|      * 订单id |      * 订单id | ||||||
|      */ |      */ | ||||||
|  |     @JsonIgnore | ||||||
|     private Long orderId; |     private Long orderId; | ||||||
|  |  | ||||||
|  |     @JsonIgnore | ||||||
|     private Long cusId; |     private Long cusId; | ||||||
|  |  | ||||||
|     private String outId; |     private String outId; | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.stdiet.custom.domain; | package com.stdiet.custom.domain; | ||||||
|  |  | ||||||
| import com.fasterxml.jackson.annotation.JsonFormat; | import com.fasterxml.jackson.annotation.JsonFormat; | ||||||
|  | import com.fasterxml.jackson.annotation.JsonIgnore; | ||||||
| import com.stdiet.common.annotation.Excel; | import com.stdiet.common.annotation.Excel; | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
| @@ -24,6 +25,7 @@ public class SysRecipesPlan { | |||||||
|      * 订单ID |      * 订单ID | ||||||
|      */ |      */ | ||||||
|     //@Excel(name = "订单ID") |     //@Excel(name = "订单ID") | ||||||
|  |     @JsonIgnore | ||||||
|     private Long orderId; |     private Long orderId; | ||||||
|  |  | ||||||
|     private Long cusId; |     private Long cusId; | ||||||
| @@ -116,7 +118,9 @@ public class SysRecipesPlan { | |||||||
|      */ |      */ | ||||||
|     private Integer reviewStatus; |     private Integer reviewStatus; | ||||||
|  |  | ||||||
|     /** 该食谱计划中暂停日期,使用 | 隔开 */ |     /** | ||||||
|  |      * 该食谱计划中暂停日期,使用 | 隔开 | ||||||
|  |      */ | ||||||
|     //@Excel(name = "该食谱计划中暂停日期,使用 | 隔开") |     //@Excel(name = "该食谱计划中暂停日期,使用 | 隔开") | ||||||
|     private String pauseDate; |     private String pauseDate; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -120,9 +120,9 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|      */ |      */ | ||||||
|     @Async |     @Async | ||||||
|     public void regenerateRecipesPlan(Long cusId) { |     public void regenerateRecipesPlan(Long cusId) { | ||||||
|         try{ |         try { | ||||||
|             Thread.sleep(5000); |             Thread.sleep(5000); | ||||||
|         }catch (Exception e){ |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
|         } |         } | ||||||
|         if (cusId == null || cusId <= 0) { |         if (cusId == null || cusId <= 0) { | ||||||
| @@ -132,17 +132,17 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|             //获取redis中该订单对应的锁 |             //获取redis中该订单对应的锁 | ||||||
|             if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, cusId))) { |             if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, cusId))) { | ||||||
|                 List<SysOrder> customerOrderList = sysOrderService.getAllOrderByCusId(cusId); |                 List<SysOrder> customerOrderList = sysOrderService.getAllOrderByCusId(cusId); | ||||||
|                 if(customerOrderList != null && customerOrderList.size() > 0){ |                 if (customerOrderList != null && customerOrderList.size() > 0) { | ||||||
|  |  | ||||||
|                     for(SysOrder sysOrder : customerOrderList){ |                     for (SysOrder sysOrder : customerOrderList) { | ||||||
|                         //订单为空、金额小于0、订单未审核不进行食谱生成、更新,只对2021年开始的订单进行食谱计划生成,判断订单金额、开始时间、结束时间,为空则直接返回,不重新生成食谱计划 |                         //订单为空、金额小于0、订单未审核不进行食谱生成、更新,只对2021年开始的订单进行食谱计划生成,判断订单金额、开始时间、结束时间,为空则直接返回,不重新生成食谱计划 | ||||||
|                         if (sysOrder == null || !sysOrder.getReviewStatus().equals("yes") || sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) { |                         if (sysOrder == null || !sysOrder.getReviewStatus().equals("yes") || sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) { | ||||||
|                             continue; |                             continue; | ||||||
|                         } |                         } | ||||||
|                         //判断是否提成单,拆分单中的副单,体验单,定金单 |                         //判断是否提成单,拆分单中的副单,体验单,定金单 | ||||||
|                         if(sysOrder.getAfterSaleCommissOrder().intValue() == 1 || ("1".equals(sysOrder.getOrderType()) && sysOrder.getMainOrderId().intValue() != 0) || |                         if (sysOrder.getAfterSaleCommissOrder().intValue() == 1 || ("1".equals(sysOrder.getOrderType()) && sysOrder.getMainOrderId().intValue() != 0) || | ||||||
|                                 "2".equals(sysOrder.getOrderType()) || "1".equals(sysOrder.getOrderMoneyType())){ |                                 "2".equals(sysOrder.getOrderType()) || "1".equals(sysOrder.getOrderMoneyType()) || sysOrder.getCounted() == 1) { | ||||||
|                             System.out.println("---------------------"+sysOrder.getOrderId()+"不生成食谱------------------------"); |                             System.out.println("---------------------" + sysOrder.getOrderId() + "不生成食谱------------------------"); | ||||||
|                             continue; |                             continue; | ||||||
|                         } |                         } | ||||||
|                         //判断是否已存在食谱计划 |                         //判断是否已存在食谱计划 | ||||||
| @@ -157,9 +157,9 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|                         List<SysOrderPause> pauseList = sysOrderPauseService.getPauseListByCusIdAndOrderId(pauseParam); |                         List<SysOrderPause> pauseList = sysOrderPauseService.getPauseListByCusIdAndOrderId(pauseParam); | ||||||
|  |  | ||||||
|                         List<SysRecipesPlan> planList = generatePlan(sysOrder, DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList); |                         List<SysRecipesPlan> planList = generatePlan(sysOrder, DateUtils.dateToLocalDate(sysOrder.getStartTime()), DateUtils.dateToLocalDate(sysOrder.getServerEndTime()), pauseList); | ||||||
|                         if(oldRecipesPlanList != null && oldRecipesPlanList.size() > 0){ |                         if (oldRecipesPlanList != null && oldRecipesPlanList.size() > 0) { | ||||||
|                             updateOrAddRecipesPlan(oldRecipesPlanList, planList); |                             updateOrAddRecipesPlan(oldRecipesPlanList, planList); | ||||||
|                         }else{ |                         } else { | ||||||
|                             if (planList != null && planList.size() > 0) { |                             if (planList != null && planList.size() > 0) { | ||||||
|                                 sysRecipesPlanMapper.insertBatch(planList); |                                 sysRecipesPlanMapper.insertBatch(planList); | ||||||
|                             } |                             } | ||||||
| @@ -177,43 +177,44 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 更新食谱计划,删除旧食谱中多余的,添加新食谱中多的 |      * 更新食谱计划,删除旧食谱中多余的,添加新食谱中多的 | ||||||
|  |      * | ||||||
|      * @param oldRecipesPlanList |      * @param oldRecipesPlanList | ||||||
|      * @param newRecipesPlanList |      * @param newRecipesPlanList | ||||||
|      */ |      */ | ||||||
|     private void updateOrAddRecipesPlan(List<SysRecipesPlan> oldRecipesPlanList, List<SysRecipesPlan> newRecipesPlanList){ |     private void updateOrAddRecipesPlan(List<SysRecipesPlan> oldRecipesPlanList, List<SysRecipesPlan> newRecipesPlanList) { | ||||||
|         int newSize = newRecipesPlanList.size(); |         int newSize = newRecipesPlanList.size(); | ||||||
|         int index = 0; |         int index = 0; | ||||||
|         List<SysRecipesPlan> addList = new ArrayList<>(); |         List<SysRecipesPlan> addList = new ArrayList<>(); | ||||||
|         List<SysRecipesPlan> updateList = new ArrayList<>(); |         List<SysRecipesPlan> updateList = new ArrayList<>(); | ||||||
|         List<Long> delList = new ArrayList<>(); |         List<Long> delList = new ArrayList<>(); | ||||||
|         for (SysRecipesPlan plan : oldRecipesPlanList) { |         for (SysRecipesPlan plan : oldRecipesPlanList) { | ||||||
|             if(index < newSize){ |             if (index < newSize) { | ||||||
|                 plan.setStartDate(newRecipesPlanList.get(index).getStartDate()); |                 plan.setStartDate(newRecipesPlanList.get(index).getStartDate()); | ||||||
|                 plan.setEndDate(newRecipesPlanList.get(index).getEndDate()); |                 plan.setEndDate(newRecipesPlanList.get(index).getEndDate()); | ||||||
|                 plan.setPauseDate(newRecipesPlanList.get(index).getPauseDate()); |                 plan.setPauseDate(newRecipesPlanList.get(index).getPauseDate()); | ||||||
|                 plan.setStartNumDay(newRecipesPlanList.get(index).getStartNumDay()); |                 plan.setStartNumDay(newRecipesPlanList.get(index).getStartNumDay()); | ||||||
|                 plan.setEndNumDay(newRecipesPlanList.get(index).getEndNumDay()); |                 plan.setEndNumDay(newRecipesPlanList.get(index).getEndNumDay()); | ||||||
|                 updateList.add(plan); |                 updateList.add(plan); | ||||||
|             }else{ |             } else { | ||||||
|                 delList.add(plan.getId()); |                 delList.add(plan.getId()); | ||||||
|             } |             } | ||||||
|             index++; |             index++; | ||||||
|         } |         } | ||||||
|         if(newSize > oldRecipesPlanList.size()){ |         if (newSize > oldRecipesPlanList.size()) { | ||||||
|             addList = newRecipesPlanList.subList(oldRecipesPlanList.size(),newSize); |             addList = newRecipesPlanList.subList(oldRecipesPlanList.size(), newSize); | ||||||
|         } |         } | ||||||
|         //更新 |         //更新 | ||||||
|         if(updateList.size() > 0){ |         if (updateList.size() > 0) { | ||||||
|             for (SysRecipesPlan plan : updateList) { |             for (SysRecipesPlan plan : updateList) { | ||||||
|                 sysRecipesPlanMapper.updateSysRecipesPlan(plan); |                 sysRecipesPlanMapper.updateSysRecipesPlan(plan); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         //删除多余的食谱计划 |         //删除多余的食谱计划 | ||||||
|         if(delList.size() > 0){ |         if (delList.size() > 0) { | ||||||
|             sysRecipesPlanMapper.deleteSysRecipesPlanByIds(delList.toArray(new Long[delList.size()])); |             sysRecipesPlanMapper.deleteSysRecipesPlanByIds(delList.toArray(new Long[delList.size()])); | ||||||
|         } |         } | ||||||
|         //添加新的 |         //添加新的 | ||||||
|         if(addList.size() > 0){ |         if (addList.size() > 0) { | ||||||
|             sysRecipesPlanMapper.insertBatch(addList); |             sysRecipesPlanMapper.insertBatch(addList); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -221,10 +222,10 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|     /** |     /** | ||||||
|      * 根据订单ID、订单开始服务时间、结束时间、暂停列表生成食谱计划列表 |      * 根据订单ID、订单开始服务时间、结束时间、暂停列表生成食谱计划列表 | ||||||
|      * |      * | ||||||
|      * @param sysOrder           订单对象 |      * @param sysOrder        订单对象 | ||||||
|      * @param serverStartDate    服务开始时间 |      * @param serverStartDate 服务开始时间 | ||||||
|      * @param serverEndDate      服务结束时间 |      * @param serverEndDate   服务结束时间 | ||||||
|      * @param pauseList          暂停列表 |      * @param pauseList       暂停列表 | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     private List<SysRecipesPlan> generatePlan(SysOrder sysOrder, LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList) { |     private List<SysRecipesPlan> generatePlan(SysOrder sysOrder, LocalDate serverStartDate, LocalDate serverEndDate, List<SysOrderPause> pauseList) { | ||||||
| @@ -232,7 +233,7 @@ 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; | ||||||
|         //之前是否存在食谱 |         //之前是否存在食谱 | ||||||
|         if(beforeOrderLastPlan != null){ |         if (beforeOrderLastPlan != null) { | ||||||
|             long differDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()), serverStartDate); |             long differDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()), serverStartDate); | ||||||
|             //检查之前食谱的结束时间和目前该订单的开始时间是否连续 |             //检查之前食谱的结束时间和目前该订单的开始时间是否连续 | ||||||
|             if(differDay <= 1){ |             if(differDay <= 1){ | ||||||
| @@ -241,8 +242,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|  |  | ||||||
|                 if(differNum < 6){ |                 if(differNum < 6){ | ||||||
|                     //更新该食谱计划 |                     //更新该食谱计划 | ||||||
|                     beforeOrderLastPlan.setEndNumDay(beforeOrderLastPlan.getStartNumDay()+6); |                     beforeOrderLastPlan.setEndNumDay(beforeOrderLastPlan.getStartNumDay() + 6); | ||||||
|                     beforeOrderLastPlan.setEndDate(DateUtils.localDateToDate(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()).plusDays(6-differNum))); |                     beforeOrderLastPlan.setEndDate(DateUtils.localDateToDate(DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()).plusDays(6 - differNum))); | ||||||
|                     sysRecipesPlanMapper.updateSysRecipesPlan(beforeOrderLastPlan); |                     sysRecipesPlanMapper.updateSysRecipesPlan(beforeOrderLastPlan); | ||||||
|                     serverStartDate = DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()).plusDays(1); |                     serverStartDate = DateUtils.dateToLocalDate(beforeOrderLastPlan.getEndDate()).plusDays(1); | ||||||
|                 } |                 } | ||||||
| @@ -263,8 +264,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|             } |             } | ||||||
|             String[] pauseResult = dealPlanPause(planStartDate, planEndDate, pauseList); |             String[] pauseResult = dealPlanPause(planStartDate, planEndDate, pauseList); | ||||||
|             //根据暂停结果返回的数据更新计划开始、结束时间 |             //根据暂停结果返回的数据更新计划开始、结束时间 | ||||||
|             planStartDate = DateUtils.stringToLocalDate(pauseResult[0],"yyyyMMdd"); |             planStartDate = DateUtils.stringToLocalDate(pauseResult[0], "yyyyMMdd"); | ||||||
|             planEndDate = DateUtils.stringToLocalDate(pauseResult[1],"yyyyMMdd"); |             planEndDate = DateUtils.stringToLocalDate(pauseResult[1], "yyyyMMdd"); | ||||||
|             //判断是否大于服务到期时间 |             //判断是否大于服务到期时间 | ||||||
|             if (ChronoUnit.DAYS.between(planEndDate, serverEndDate) <= 0) { |             if (ChronoUnit.DAYS.between(planEndDate, serverEndDate) <= 0) { | ||||||
|                 planEndDate = serverEndDate; |                 planEndDate = serverEndDate; | ||||||
| @@ -274,7 +275,7 @@ 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; | ||||||
|             } |             } | ||||||
|             //暂停日期 |             //暂停日期 | ||||||
| @@ -287,32 +288,33 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|             startNumDay += 1; |             startNumDay += 1; | ||||||
|             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); |             sysRecipesPlan.setEndNumDay(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())); | ||||||
|         }while (breakFlag); |         } while (breakFlag); | ||||||
|         return planList; |         return planList; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据食谱开始时间、结束时间、暂停列表获取在食谱计划范围内的暂停天数,以及返回调整之后的计划开始、结束时间,以及暂停日期 |      * 根据食谱开始时间、结束时间、暂停列表获取在食谱计划范围内的暂停天数,以及返回调整之后的计划开始、结束时间,以及暂停日期 | ||||||
|  |      * | ||||||
|      * @param planStartDate 原先的计划开始时间 |      * @param planStartDate 原先的计划开始时间 | ||||||
|      * @param planEndDate 原先计划结束时间 |      * @param planEndDate   原先计划结束时间 | ||||||
|      * @param pauseList 暂停列表集合 |      * @param pauseList     暂停列表集合 | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     private String[] dealPlanPause(LocalDate planStartDate, LocalDate planEndDate, List<SysOrderPause> pauseList) { |     private String[] dealPlanPause(LocalDate planStartDate, LocalDate planEndDate, List<SysOrderPause> pauseList) { | ||||||
|         //分别为计划开始时间、计划结束时间,范围内暂停天数,具体暂停日期,使用|隔开 |         //分别为计划开始时间、计划结束时间,范围内暂停天数,具体暂停日期,使用|隔开 | ||||||
|         String[] result = {"","","0",""}; |         String[] result = {"", "", "0", ""}; | ||||||
|         long pauseDay = 0; |         long pauseDay = 0; | ||||||
|         Set<String> pauseDateString = new TreeSet<>(new MyComparator()); |         Set<String> pauseDateString = new TreeSet<>(new MyComparator()); | ||||||
|         //判断这个时间内是否存在暂停 |         //判断这个时间内是否存在暂停 | ||||||
|         if (pauseList != null && pauseList.size() > 0) { |         if (pauseList != null && pauseList.size() > 0) { | ||||||
|             //每条暂停时间的范围不会重叠,在添加暂停时做了限制 |             //每条暂停时间的范围不会重叠,在添加暂停时做了限制 | ||||||
|             for (SysOrderPause sysOrderPause : pauseList) { |             for (SysOrderPause sysOrderPause : pauseList) { | ||||||
|                 while(true){ |                 while (true) { | ||||||
|                     LocalDate pauseStartDate = DateUtils.dateToLocalDate(sysOrderPause.getPauseStartDate()); |                     LocalDate pauseStartDate = DateUtils.dateToLocalDate(sysOrderPause.getPauseStartDate()); | ||||||
|                     LocalDate pauseEndDate = DateUtils.dateToLocalDate(sysOrderPause.getPauseEndDate()); |                     LocalDate pauseEndDate = DateUtils.dateToLocalDate(sysOrderPause.getPauseEndDate()); | ||||||
|                     if (ChronoUnit.DAYS.between(pauseEndDate, planStartDate) > 0 || ChronoUnit.DAYS.between(planEndDate, pauseStartDate) > 0) { |                     if (ChronoUnit.DAYS.between(pauseEndDate, planStartDate) > 0 || ChronoUnit.DAYS.between(planEndDate, pauseStartDate) > 0) { | ||||||
| @@ -325,10 +327,10 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|                         pauseEndDate = planEndDate; |                         pauseEndDate = planEndDate; | ||||||
|                     }*/ |                     }*/ | ||||||
|                     //判断暂停记录是否从食谱计划开始时间开始的 |                     //判断暂停记录是否从食谱计划开始时间开始的 | ||||||
|                     if(ChronoUnit.DAYS.between(pauseStartDate, planStartDate) == 0){ |                     if (ChronoUnit.DAYS.between(pauseStartDate, planStartDate) == 0) { | ||||||
|                         planStartDate = pauseEndDate.plusDays(1); |                         planStartDate = pauseEndDate.plusDays(1); | ||||||
|                         planEndDate = planStartDate.plusDays(6); |                         planEndDate = planStartDate.plusDays(6); | ||||||
|                     }else{ |                     } else { | ||||||
|                         planEndDate = planEndDate.plusDays(ChronoUnit.DAYS.between(pauseStartDate, pauseEndDate) + 1); |                         planEndDate = planEndDate.plusDays(ChronoUnit.DAYS.between(pauseStartDate, pauseEndDate) + 1); | ||||||
|                         pauseDateString.addAll(getPauseDateString(pauseStartDate, pauseEndDate)); |                         pauseDateString.addAll(getPauseDateString(pauseStartDate, pauseEndDate)); | ||||||
|                         break; |                         break; | ||||||
| @@ -340,37 +342,27 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|                 System.out.println("---------------------------------------");*/ |                 System.out.println("---------------------------------------");*/ | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         result[0] = DateUtils.localDateToString(planStartDate,"yyyyMMdd"); |         result[0] = DateUtils.localDateToString(planStartDate, "yyyyMMdd"); | ||||||
|         result[1] = DateUtils.localDateToString(planEndDate,"yyyyMMdd"); |         result[1] = DateUtils.localDateToString(planEndDate, "yyyyMMdd"); | ||||||
|         result[2] = pauseDay + ""; |         result[2] = pauseDay + ""; | ||||||
|         result[3] = pauseDateString.size() > 0 ? StringUtils.join(pauseDateString,"|") : ""; |         result[3] = pauseDateString.size() > 0 ? StringUtils.join(pauseDateString, "|") : ""; | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据暂停时间范围获取范围内的日期 |      * 根据暂停时间范围获取范围内的日期 | ||||||
|  |      * | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     private Set<String> getPauseDateString(LocalDate pauseStartDate, LocalDate pauseEndDate){ |     private Set<String> getPauseDateString(LocalDate pauseStartDate, LocalDate pauseEndDate) { | ||||||
|         Set<String> pauseDateList = new HashSet<>(); |         Set<String> pauseDateList = new HashSet<>(); | ||||||
|         long daysBetween = ChronoUnit.DAYS.between(pauseStartDate, pauseEndDate); |         long daysBetween = ChronoUnit.DAYS.between(pauseStartDate, pauseEndDate); | ||||||
|         for(int i = 0; i <= daysBetween; i++){ |         for (int i = 0; i <= daysBetween; i++) { | ||||||
|             pauseDateList.add(DateUtils.localDateToString(pauseStartDate.plusDays(i),"yyyyMMdd")); |             pauseDateList.add(DateUtils.localDateToString(pauseStartDate.plusDays(i), "yyyyMMdd")); | ||||||
|         } |         } | ||||||
|         return pauseDateList; |         return pauseDateList; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 集合排序key值比较器 |  | ||||||
|      * */ |  | ||||||
|     class MyComparator implements Comparator<String>{ |  | ||||||
|  |  | ||||||
|         @Override |  | ||||||
|         public int compare(String o1, String o2) { |  | ||||||
|             return Integer.parseInt(o1) - Integer.parseInt(o2); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据订单ID删除所有食谱安排计划 |      * 根据订单ID删除所有食谱安排计划 | ||||||
|      * |      * | ||||||
| @@ -406,10 +398,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据客户ID查询最后一天食谱计划 |      * 根据客户ID查询最后一天食谱计划 | ||||||
|  |      * | ||||||
|      * @param customerId 客户ID |      * @param customerId 客户ID | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     public SysRecipesPlan getLastDayRecipesPlan(Long customerId, Date orderTime){ |     public SysRecipesPlan getLastDayRecipesPlan(Long customerId, Date orderTime) { | ||||||
|         return sysRecipesPlanMapper.getLastDayRecipesPlan(customerId, orderTime); |         return sysRecipesPlanMapper.getLastDayRecipesPlan(customerId, orderTime); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -432,4 +425,15 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|         return sysRecipesPlanMapper.selectRecipesModelList(sysRecipesPlan); |         return sysRecipesPlanMapper.selectRecipesModelList(sysRecipesPlan); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 集合排序key值比较器 | ||||||
|  |      */ | ||||||
|  |     class MyComparator implements Comparator<String> { | ||||||
|  |  | ||||||
|  |         @Override | ||||||
|  |         public int compare(String o1, String o2) { | ||||||
|  |             return Integer.parseInt(o1) - Integer.parseInt(o2); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
| } | } | ||||||
| @@ -49,6 +49,7 @@ | |||||||
|         <result property="afterSaleCommissOrder" column="after_sale_commiss_order"/> |         <result property="afterSaleCommissOrder" column="after_sale_commiss_order"/> | ||||||
|         <result property="commissStartTime" column="commiss_start_time"/> |         <result property="commissStartTime" column="commiss_start_time"/> | ||||||
|         <result property="delFlag" column="del_flag"/> |         <result property="delFlag" column="del_flag"/> | ||||||
|  |         <result property="counted" column="counted"/> | ||||||
|  |  | ||||||
|         <!-- 非持久化字段 --> |         <!-- 非持久化字段 --> | ||||||
|         <result property="afterSale" column="afterSale_name"></result><!-- 售后名称  --> |         <result property="afterSale" column="afterSale_name"></result><!-- 售后名称  --> | ||||||
| @@ -61,7 +62,7 @@ | |||||||
|         o.serve_time_id, o.pay_type_id, pay.dict_label as pay_type, o.pre_sale_id, o.create_by, o.create_time, o.after_sale_id, o.update_by, o.update_time, |         o.serve_time_id, o.pay_type_id, pay.dict_label as pay_type, o.pre_sale_id, o.create_by, o.create_time, o.after_sale_id, o.update_by, o.update_time, | ||||||
|         o.nutritionist_id, o.remark, o.nutri_assis_id, o.account_id, acc.dict_label as account, o.planner_id, o.planner_assis_id, o.operator_id, o.operator_assis_id, |         o.nutritionist_id, o.remark, o.nutri_assis_id, o.account_id, acc.dict_label as account, o.planner_id, o.planner_assis_id, o.operator_id, o.operator_assis_id, | ||||||
|         o.recommender, o.order_time,o.give_serve_day,o.conditioning_project_id,cp.dict_label as conditioning_project,o.server_end_time, |         o.recommender, o.order_time,o.give_serve_day,o.conditioning_project_id,cp.dict_label as conditioning_project,o.server_end_time, | ||||||
|         o.on_sale_id,o.order_type,o.order_count_type,o.order_money_type,o.main_order_id,o.after_sale_commiss_order,o.commiss_start_time |         o.on_sale_id,o.order_type,o.order_count_type,o.order_money_type,o.main_order_id,o.after_sale_commiss_order,o.commiss_start_time, o.counted | ||||||
|         from sys_order o |         from sys_order o | ||||||
|         LEFT JOIN sys_customer sc ON sc.id = o.cus_id |         LEFT JOIN sys_customer sc ON sc.id = o.cus_id | ||||||
|         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_pay_type') AS pay ON pay.dict_value = o.pay_type_id |         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_pay_type') AS pay ON pay.dict_value = o.pay_type_id | ||||||
| @@ -243,6 +244,7 @@ | |||||||
|             <if test="afterSaleCommissOrder != null">after_sale_commiss_order,</if> |             <if test="afterSaleCommissOrder != null">after_sale_commiss_order,</if> | ||||||
|             <if test="commissStartTime != null">commiss_start_time,</if> |             <if test="commissStartTime != null">commiss_start_time,</if> | ||||||
|             <if test="delFlag != null">del_flag,</if> |             <if test="delFlag != null">del_flag,</if> | ||||||
|  |             <if test="counted != null">counted,</if> | ||||||
|         </trim> |         </trim> | ||||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> |         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||||
|             <if test="orderId != null">#{orderId},</if> |             <if test="orderId != null">#{orderId},</if> | ||||||
| @@ -285,6 +287,7 @@ | |||||||
|             <if test="afterSaleCommissOrder != null">#{afterSaleCommissOrder},</if> |             <if test="afterSaleCommissOrder != null">#{afterSaleCommissOrder},</if> | ||||||
|             <if test="commissStartTime != null">#{commissStartTime},</if> |             <if test="commissStartTime != null">#{commissStartTime},</if> | ||||||
|             <if test="delFlag != null">#{delFlag},</if> |             <if test="delFlag != null">#{delFlag},</if> | ||||||
|  |             <if test="counted != null">#{counted},</if> | ||||||
|         </trim> |         </trim> | ||||||
|     </insert> |     </insert> | ||||||
|  |  | ||||||
| @@ -330,6 +333,7 @@ | |||||||
|             <if test="afterSaleCommissOrder != null">after_sale_commiss_order = #{afterSaleCommissOrder},</if> |             <if test="afterSaleCommissOrder != null">after_sale_commiss_order = #{afterSaleCommissOrder},</if> | ||||||
|             <if test="commissStartTime != null">commiss_start_time = #{commissStartTime},</if> |             <if test="commissStartTime != null">commiss_start_time = #{commissStartTime},</if> | ||||||
|             <if test="delFlag != null">del_flag = #{delFlag},</if> |             <if test="delFlag != null">del_flag = #{delFlag},</if> | ||||||
|  |             <if test="counted != null">counted = #{counted},</if> | ||||||
|         </trim> |         </trim> | ||||||
|         where order_id = #{orderId} |         where order_id = #{orderId} | ||||||
|     </update> |     </update> | ||||||
|   | |||||||
| @@ -70,7 +70,7 @@ | |||||||
|         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'fan_channel') AS cn ON cn.dict_value = wd.account_id |         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'fan_channel') AS cn ON cn.dict_value = wd.account_id | ||||||
|         LEFT JOIN sys_user AS su ON su.user_id = wd.user_id |         LEFT JOIN sys_user AS su ON su.user_id = wd.user_id | ||||||
|         WHERE wd.del_flag = 0 |         WHERE wd.del_flag = 0 | ||||||
|         ORDER BY wd.sale_group_id, wd.user_id ASC |         ORDER BY wd.sale_group_id, wd.user_id, wd.wechat_account ASC | ||||||
|     </select> |     </select> | ||||||
|  |  | ||||||
|     <!-- 查询总进粉数量 --> |     <!-- 查询总进粉数量 --> | ||||||
|   | |||||||
| @@ -107,6 +107,7 @@ export default { | |||||||
|           title: "既往病史/用药史评估", |           title: "既往病史/用药史评估", | ||||||
|           content: [ |           content: [ | ||||||
|             { title: "病史体征", value: "physicalSigns" }, |             { title: "病史体征", value: "physicalSigns" }, | ||||||
|  |             { title: "忌口过敏食物", value: "dishesIngredient" }, | ||||||
|             { title: "湿气数据", value: "moistureDate" }, |             { title: "湿气数据", value: "moistureDate" }, | ||||||
|             { title: "气血数据", value: "bloodData" }, |             { title: "气血数据", value: "bloodData" }, | ||||||
|             { title: "家族疾病史", value: "familyIllnessHistory" }, |             { title: "家族疾病史", value: "familyIllnessHistory" }, | ||||||
| @@ -118,7 +119,16 @@ export default { | |||||||
|             { title: "是否出现过过敏症状", value: "allergyFlag" }, |             { title: "是否出现过过敏症状", value: "allergyFlag" }, | ||||||
|             { title: "过敏症状", value: "allergySituation" }, |             { title: "过敏症状", value: "allergySituation" }, | ||||||
|             { title: "过敏源", value: "allergen" }, |             { title: "过敏源", value: "allergen" }, | ||||||
|             { title: "忌口过敏食物", value: "dishesIngredient" }, |           ], | ||||||
|  |         }, | ||||||
|  |          { | ||||||
|  |           title: "运动习惯评估", | ||||||
|  |           content: [ | ||||||
|  |             { title: "每周运动次数", value: "motionNum" }, | ||||||
|  |             { title: "每次运动的时长", value: "motionDuration" }, | ||||||
|  |             { title: "每天运动的时间", value: "motionTime" }, | ||||||
|  |             { title: "运动", value: "motion" }, | ||||||
|  |             { title: "运动场地", value: "motionField" }, | ||||||
|           ], |           ], | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
| @@ -193,16 +203,7 @@ export default { | |||||||
|             { title: "排便的颜色", value: "defecationColor" }, |             { title: "排便的颜色", value: "defecationColor" }, | ||||||
|           ], |           ], | ||||||
|         }, |         }, | ||||||
|         { |  | ||||||
|           title: "运动习惯评估", |  | ||||||
|           content: [ |  | ||||||
|             { title: "每周运动次数", value: "motionNum" }, |  | ||||||
|             { title: "每次运动的时长", value: "motionDuration" }, |  | ||||||
|             { title: "每天运动的时间", value: "motionTime" }, |  | ||||||
|             { title: "运动", value: "motion" }, |  | ||||||
|             { title: "运动场地", value: "motionField" }, |  | ||||||
|           ], |  | ||||||
|         }, |  | ||||||
|         { |         { | ||||||
|           title: "睡眠质量评估", |           title: "睡眠质量评估", | ||||||
|           content: [ |           content: [ | ||||||
|   | |||||||
| @@ -83,7 +83,7 @@ | |||||||
|           /> |           /> | ||||||
|         </el-select> |         </el-select> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|        |  | ||||||
|     <el-form-item label="病史体征" prop="physicalSignsId"> |     <el-form-item label="病史体征" prop="physicalSignsId"> | ||||||
|           <el-select |           <el-select | ||||||
|             v-model="queryParams.physicalSignsId" |             v-model="queryParams.physicalSignsId" | ||||||
| @@ -147,7 +147,7 @@ | |||||||
|         label="创建时间" |         label="创建时间" | ||||||
|         align="center" |         align="center" | ||||||
|         prop="createTime" |         prop="createTime" | ||||||
|         width="100" |         width="110" | ||||||
|       > |       > | ||||||
|         <template slot-scope="scope"> |         <template slot-scope="scope"> | ||||||
|           <div v-for="time in scope.row.createTime.split(' ')" :key="time"> |           <div v-for="time in scope.row.createTime.split(' ')" :key="time"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user