食谱计划优化,未修改完

This commit is contained in:
xiezhijun 2021-02-25 19:05:14 +08:00
parent 204529f52e
commit 912300838a
2 changed files with 28 additions and 23 deletions

View File

@ -188,10 +188,21 @@ public class SysOrderServiceImpl implements ISysOrderService {
sysOrder.setUpdateBy(SecurityUtils.getUsername());
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);
// 审核后的订单才生成食谱

View File

@ -120,6 +120,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
@Override
@Async
public void regenerateRecipesPlan(Long orderId) {
try{
Thread.sleep(5000);
}catch (Exception e){
e.printStackTrace();
}
if (orderId == null || orderId <= 0) {
return;
}
@ -129,7 +134,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|| sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) {
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 {
//获取redis中该订单对应的锁
if (synchrolockUtil.lock(String.format(generateRecipesPlanLockKey, orderId))) {
@ -137,16 +146,12 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
queryParam.setOrderId(orderId);
List<SysRecipesPlan> oldRecipesPlanList = sysRecipesPlanMapper.selectSysRecipesPlanList(queryParam);
//判断是否已存在食谱
if (oldRecipesPlanList != null && oldRecipesPlanList.size() > 0) {
/*if (oldRecipesPlanList != null && oldRecipesPlanList.size() > 0) {
Long[] orderIdArray = new Long[1];
orderIdArray[0] = orderId;
//删除该订单对于食谱
delRecipesPlanByOrderId(orderIdArray);
}
// //判断订单金额开始时间结束时间为空则直接返回不重新生成食谱计划
// if (sysOrder.getAmount().floatValue() <= 0 || sysOrder.getStartTime() == null || sysOrder.getServerEndTime() == null) {
// return;
// }
//delRecipesPlanByOrderId(orderIdArray);
}*/
SysOrderPause pauseParam = new SysOrderPause();
pauseParam.setOrderId(sysOrder.getOrderId());
//暂停记录列表
@ -156,9 +161,6 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
if (planList != null && planList.size() > 0) {
sysRecipesPlanMapper.insertBatch(planList);
}
/*for (SysRecipesPlan sysRecipesPlan : planList) {
getTestDate(sysRecipesPlan.getStartDate(), sysRecipesPlan.getEndDate());
}*/
}
} catch (Exception e) {
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订单开始服务时间结束时间暂停列表生成食谱计划列表
*