导粉记录,订单条件筛选,食谱计划生成优化
This commit is contained in:
@ -39,6 +39,10 @@ public class SysImportFanRecord extends BaseEntity
|
||||
/** 删除标识,0未删除 1已删除 */
|
||||
private Long delFlag;
|
||||
|
||||
//导粉时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date importTime;
|
||||
|
||||
//微信ID
|
||||
private Long wxAccountId;
|
||||
|
||||
@ -62,6 +66,8 @@ public class SysImportFanRecord extends BaseEntity
|
||||
|
||||
private String fanNums;
|
||||
|
||||
private String importTimes;
|
||||
|
||||
|
||||
//总进粉数量
|
||||
private Integer totalFanNum;
|
||||
|
@ -33,6 +33,11 @@ public class SysImportFanWxAccount extends BaseEntity
|
||||
@Excel(name = "导粉数量")
|
||||
private Long importFanNum;
|
||||
|
||||
/** 导粉时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
@Excel(name = "导粉时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
|
||||
private Date importTime;
|
||||
|
||||
/** 删除标识 0未删除 1已删除 */
|
||||
private Long delFlag;
|
||||
|
||||
|
@ -2,6 +2,8 @@ package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -117,4 +119,11 @@ public interface SysRecipesPlanMapper
|
||||
* @return
|
||||
*/
|
||||
int updateMuchRecipesPlanDate(SysRecipesPlan sysRecipesPlan);
|
||||
|
||||
/**
|
||||
* 查询食谱计划中对应食谱存在天数缺失的食谱计划
|
||||
* @param cusId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getNeedSupplyRecipesByCusId(@Param("cusId")Long cusId);
|
||||
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||
@ -122,4 +123,11 @@ public interface ISysRecipesPlanService
|
||||
*/
|
||||
List<SysRecipesPlan> selectPlanListByCusId(Long cusId);
|
||||
|
||||
/**
|
||||
* 查询食谱计划中对应食谱存在天数缺失的食谱计划
|
||||
* @param cusId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getNeedSupplyRecipesByCusId(Long cusId);
|
||||
|
||||
}
|
@ -72,15 +72,18 @@ public class SysImportFanRecordServiceImpl implements ISysImportFanRecordService
|
||||
sysImportFanWxAccount.setImportFanRecordId(record != null ? record.getId() : sysImportFanRecord.getId());
|
||||
sysImportFanWxAccount.setImportWxAccountId(sysImportFanRecord.getWxAccountId());
|
||||
sysImportFanWxAccount.setImportFanNum(sysImportFanRecord.getFanNum());
|
||||
sysImportFanWxAccount.setImportTime(sysImportFanRecord.getImportTime());
|
||||
sysImportFanWxAccount.setCreateTime(new Date());
|
||||
row = sysImportFanWxAccountService.insertSysImportFanWxAccount(sysImportFanWxAccount);
|
||||
|
||||
//根据微信号、导粉记录查询是否存在
|
||||
SysImportFanWxAccount oldFanWxAccount = sysImportFanWxAccountService.getWxAccountByFanRecordId(sysImportFanWxAccount);
|
||||
/*SysImportFanWxAccount oldFanWxAccount = sysImportFanWxAccountService.getWxAccountByFanRecordId(sysImportFanWxAccount);
|
||||
if(oldFanWxAccount == null){
|
||||
row = sysImportFanWxAccountService.insertSysImportFanWxAccount(sysImportFanWxAccount);
|
||||
}else{
|
||||
oldFanWxAccount.setImportFanNum((oldFanWxAccount.getImportFanNum() == null ? 0 : oldFanWxAccount.getImportFanNum()) + sysImportFanWxAccount.getImportFanNum());
|
||||
row = sysImportFanWxAccountService.updateSysImportFanWxAccount(oldFanWxAccount);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
@ -4,10 +4,8 @@ import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.SynchrolockUtil;
|
||||
import com.stdiet.common.utils.sign.Md5Utils;
|
||||
import com.stdiet.custom.domain.SysOrder;
|
||||
import com.stdiet.custom.domain.SysOrderPause;
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||
import com.stdiet.custom.domain.*;
|
||||
import com.stdiet.custom.mapper.SysRecipesMapper;
|
||||
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||
import com.stdiet.custom.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -43,6 +41,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
private IWechatAppletService wechatAppletService;
|
||||
@Autowired
|
||||
private ISysCustomerService sysCustomerService;
|
||||
@Autowired
|
||||
private SysRecipesMapper sysRecipesMapper;
|
||||
|
||||
/**
|
||||
* 查询食谱计划
|
||||
@ -151,7 +151,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
@Async
|
||||
public void regenerateRecipesPlan(Long cusId) {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
Thread.sleep(3000);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -196,6 +196,8 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
}
|
||||
}
|
||||
}
|
||||
//食谱计划更新完成之后需要查询是否存在天数缺失情况,进行补充
|
||||
supplyRecipesBmenu(cusId);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -206,6 +208,34 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询食谱计划中对应食谱存在天数缺失的食谱计划,食谱计划发生变化时,可能会导致sys_customer_daily_menu表中天数缺失,需要查询出来进行补充
|
||||
* @param cusId 客户ID
|
||||
*/
|
||||
private void supplyRecipesBmenu(Long cusId){
|
||||
List<Map<String,Object>> list = getNeedSupplyRecipesByCusId(cusId);
|
||||
if(list != null && list.size() > 0){
|
||||
for (Map<String,Object> map : list) {
|
||||
Long recipesId = (Long)map.get("recipesId");
|
||||
Integer enNumDay = (Integer)map.get("enNumDay");
|
||||
Integer maxNumDay = (Integer)map.get("maxNumDay");
|
||||
if(recipesId != null && enNumDay != null && maxNumDay != null){
|
||||
List<SysRecipesDaily> menus = new ArrayList<>();
|
||||
for (int i = maxNumDay+1; i <= enNumDay; i++) {
|
||||
SysRecipesDaily daily = new SysRecipesDaily();
|
||||
daily.setCusId(cusId);
|
||||
daily.setNumDay(i);
|
||||
daily.setRecipesId(recipesId);
|
||||
menus.add(daily);
|
||||
}
|
||||
sysRecipesMapper.bashAddMenus(menus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新食谱计划,删除旧食谱中多余的,添加新食谱中多的
|
||||
*
|
||||
@ -474,4 +504,13 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询食谱计划中对应食谱存在天数缺失的食谱计划
|
||||
* @param cusId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> getNeedSupplyRecipesByCusId(Long cusId){
|
||||
return sysRecipesPlanMapper.getNeedSupplyRecipesByCusId(cusId);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user