食谱计划优化,未修改完
This commit is contained in:
		| @@ -188,10 +188,21 @@ public class SysOrderServiceImpl implements ISysOrderService { | |||||||
|         sysOrder.setUpdateBy(SecurityUtils.getUsername()); |         sysOrder.setUpdateBy(SecurityUtils.getUsername()); | ||||||
|         sysOrder.setUpdateTime(DateUtils.getNowDate()); |         sysOrder.setUpdateTime(DateUtils.getNowDate()); | ||||||
|         //体验单 |         //体验单 | ||||||
|         /*if("2".equals(sysOrder.getOrderType())){ |         if("2".equals(sysOrder.getOrderType())){ | ||||||
|  |             sysOrder.setAfterSaleId(null); | ||||||
|         }*/ |             sysOrder.setNutritionistId(null); | ||||||
|  |             sysOrder.setNutriAssisId(null); | ||||||
|  |         } | ||||||
|  |         //提成单 | ||||||
|  |         if(sysOrder.getAfterSaleCommissOrder().intValue() == 1){ | ||||||
|  |             sysOrder.setAfterSaleId(null); | ||||||
|  |             sysOrder.setNutritionistId(null); | ||||||
|  |             sysOrder.setNutriAssisId(null); | ||||||
|  |             sysOrder.setPlannerId(null); | ||||||
|  |             sysOrder.setPlannerAssisId(null); | ||||||
|  |             sysOrder.setOperatorId(null); | ||||||
|  |             sysOrder.setOperatorAssisId(null); | ||||||
|  |         } | ||||||
|         //更新订单 |         //更新订单 | ||||||
|         int row = sysOrderMapper.updateSysOrder(sysOrder); |         int row = sysOrderMapper.updateSysOrder(sysOrder); | ||||||
|         // 审核后的订单才生成食谱 |         // 审核后的订单才生成食谱 | ||||||
|   | |||||||
| @@ -120,6 +120,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|     @Override |     @Override | ||||||
|     @Async |     @Async | ||||||
|     public void regenerateRecipesPlan(Long orderId) { |     public void regenerateRecipesPlan(Long orderId) { | ||||||
|  |         try{ | ||||||
|  |             Thread.sleep(5000); | ||||||
|  |         }catch (Exception e){ | ||||||
|  |             e.printStackTrace(); | ||||||
|  |         } | ||||||
|         if (orderId == null || orderId <= 0) { |         if (orderId == null || orderId <= 0) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @@ -129,7 +134,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|                 || sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) { |                 || sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| //        System.out.println(DateUtils.dateToLocalDate(sysOrder.getOrderTime()).getYear()); |         //判断是否提成单,拆分单中的副单,体验单 | ||||||
|  |         if(sysOrder.getAfterSaleCommissOrder().intValue() == 1 || ("1".equals(sysOrder.getOrderType()) && sysOrder.getMainOrderId().intValue() == 1) || | ||||||
|  |             "2".equals(sysOrder.getOrderType())){ | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|         try { |         try { | ||||||
|             //获取redis中该订单对应的锁 |             //获取redis中该订单对应的锁 | ||||||
|             if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, orderId))) { |             if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, orderId))) { | ||||||
| @@ -137,16 +146,12 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|                 queryParam.setOrderId(orderId); |                 queryParam.setOrderId(orderId); | ||||||
|                 List<SysRecipesPlan> oldRecipesPlanList = sysRecipesPlanMapper.selectSysRecipesPlanList(queryParam); |                 List<SysRecipesPlan> oldRecipesPlanList = sysRecipesPlanMapper.selectSysRecipesPlanList(queryParam); | ||||||
|                 //判断是否已存在食谱 |                 //判断是否已存在食谱 | ||||||
|                 if (oldRecipesPlanList != null && oldRecipesPlanList.size() > 0) { |                 /*if (oldRecipesPlanList != null && oldRecipesPlanList.size() > 0) { | ||||||
|                     Long[] orderIdArray = new Long[1]; |                     Long[] orderIdArray = new Long[1]; | ||||||
|                     orderIdArray[0] = orderId; |                     orderIdArray[0] = orderId; | ||||||
|                     //删除该订单对于食谱 |                     //删除该订单对于食谱 | ||||||
|                     delRecipesPlanByOrderId(orderIdArray); |                     //delRecipesPlanByOrderId(orderIdArray); | ||||||
|                 } |                 }*/ | ||||||
| //                //判断订单金额、开始时间、结束时间,为空则直接返回,不重新生成食谱计划 |  | ||||||
| //                if (sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) { |  | ||||||
| //                    return; |  | ||||||
| //                } |  | ||||||
|                 SysOrderPause pauseParam = new SysOrderPause(); |                 SysOrderPause pauseParam = new SysOrderPause(); | ||||||
|                 pauseParam.setOrderId(sysOrder.getOrderId()); |                 pauseParam.setOrderId(sysOrder.getOrderId()); | ||||||
|                 //暂停记录列表 |                 //暂停记录列表 | ||||||
| @@ -156,9 +161,6 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|                 if (planList != null && planList.size() > 0) { |                 if (planList != null && planList.size() > 0) { | ||||||
|                     sysRecipesPlanMapper.insertBatch(planList); |                     sysRecipesPlanMapper.insertBatch(planList); | ||||||
|                 } |                 } | ||||||
|                 /*for (SysRecipesPlan sysRecipesPlan : planList) { |  | ||||||
|                      getTestDate(sysRecipesPlan.getStartDate(), sysRecipesPlan.getEndDate()); |  | ||||||
|                  }*/ |  | ||||||
|             } |             } | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
| @@ -168,14 +170,6 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void getTestDate(Date date, Date date2) { |  | ||||||
|         LocalDate d = DateUtils.dateToLocalDate(date); |  | ||||||
|         LocalDate d2 = DateUtils.dateToLocalDate(date2); |  | ||||||
|         String s1 = d.getYear() + "-" + d.getMonthValue() + "-" + d.getDayOfMonth(); |  | ||||||
|         String s2 = d2.getYear() + "-" + d2.getMonthValue() + "-" + d2.getDayOfMonth(); |  | ||||||
|         System.out.println(s1 + "   " + s2); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据订单ID、订单开始服务时间、结束时间、暂停列表生成食谱计划列表 |      * 根据订单ID、订单开始服务时间、结束时间、暂停列表生成食谱计划列表 | ||||||
|      * |      * | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user