导粉进粉通过率统计,食谱计划生成优化

This commit is contained in:
xiezhijun
2021-06-08 18:52:13 +08:00
parent bedd258c04
commit 0115dfa36f
16 changed files with 330 additions and 23 deletions

View File

@ -1,7 +1,10 @@
package com.stdiet.custom.mapper;
import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysImportFanRecord;
import com.stdiet.custom.domain.SysWxFanStatistics;
/**
* 导粉管理Mapper接口
@ -68,4 +71,11 @@ public interface SysImportFanRecordMapper
//查询总导粉数量
int selectTotalSysImportFanNum(SysImportFanRecord sysImportFanRecord);
/**
* 根据时间范围统计各个渠道的总导粉数量
* @param sysWxFanStatistics
* @return
*/
List<Map<String,Object>> getTotalFanNumGroupByChannel(SysWxFanStatistics sysWxFanStatistics);
}

View File

@ -3,6 +3,7 @@ package com.stdiet.custom.mapper;
import com.stdiet.custom.domain.SysRecipes;
import com.stdiet.custom.domain.SysRecipesDaily;
import com.stdiet.custom.domain.SysRecipesDailyDishes;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -33,4 +34,8 @@ public interface SysRecipesMapper {
public List<SysRecipesDailyDishes> selectDishesByMenuId(Long id);
public List<SysRecipesDailyDishes> selectDishesByMenuIdShow(Long id);
List<SysRecipesDaily> getRecipesListByRecipesId(@Param("recipesId")Long id);
int updateRecipesById(SysRecipesDaily sysRecipesDaily);
}

View File

@ -3,6 +3,7 @@ package com.stdiet.custom.mapper;
import com.stdiet.custom.domain.SysWxFanStatistics;
import java.util.List;
import java.util.Map;
/**
* 进粉统计Mapper接口
@ -73,4 +74,11 @@ public interface SysWxFanStatisticsMapper {
public int selectFanNumCount(SysWxFanStatistics sysWxFanStatistics);
public List<SysWxFanStatistics> exportStatisticsList(SysWxFanStatistics sysWxFanStatistics);
/**
* 根据时间范围统计每个渠道的进粉数量
* @param sysWxFanStatistics
* @return
*/
public List<Map<String,Object>> getTotalFanNumGroupByChannel(SysWxFanStatistics sysWxFanStatistics);
}

View File

@ -1,7 +1,10 @@
package com.stdiet.custom.service;
import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysImportFanRecord;
import com.stdiet.custom.domain.SysWxFanStatistics;
/**
* 导粉管理Service接口
@ -61,4 +64,11 @@ public interface ISysImportFanRecordService
//查询总导粉数量
int selectTotalSysImportFanNum(SysImportFanRecord sysImportFanRecord);
/**
* 根据时间范围统计各个渠道的总导粉数量
* @param sysWxFanStatistics
* @return
*/
List<Map<String,Object>> getTotalFanNumGroupByChannel(SysWxFanStatistics sysWxFanStatistics);
}

View File

@ -1,6 +1,7 @@
package com.stdiet.custom.service;
import java.util.List;
import java.util.Map;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.custom.domain.SysWxFanStatistics;
@ -84,4 +85,11 @@ public interface ISysWxFanStatisticsService
public int selectFanNumCount(SysWxFanStatistics sysWxFanStatistics);
List<SysWxFanStatistics> exportStatisticsList(SysWxFanStatistics sysWxFanStatistics);
/**
* 根据时间范围统计每个渠道的进粉数量
* @param sysWxFanStatistics
* @return
*/
public List<Map<String,Object>> getTotalFanNumGroupByChannel(SysWxFanStatistics sysWxFanStatistics);
}

View File

@ -2,8 +2,11 @@ package com.stdiet.custom.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.custom.domain.SysImportFanWxAccount;
import com.stdiet.custom.domain.SysWxFanStatistics;
import com.stdiet.custom.service.ISysImportFanWxAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -138,4 +141,13 @@ public class SysImportFanRecordServiceImpl implements ISysImportFanRecordService
public int selectTotalSysImportFanNum(SysImportFanRecord sysImportFanRecord){
return sysImportFanRecordMapper.selectTotalSysImportFanNum(sysImportFanRecord);
}
/**
* 根据时间范围统计各个渠道的总导粉数量
* @param sysWxFanStatistics
* @return
*/
public List<Map<String,Object>> getTotalFanNumGroupByChannel(SysWxFanStatistics sysWxFanStatistics){
return sysImportFanRecordMapper.getTotalFanNumGroupByChannel(sysWxFanStatistics);
}
}

View File

@ -214,23 +214,37 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
*/
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);
if(list == null || list.size() == 0){
return;
}
for (Map<String,Object> map : list) {
Long recipesId = (Long)map.get("recipesId");
Integer startNumDay = (Integer)map.get("startNumDay");
Integer endNumDay = (Integer)map.get("endNumDay");
if(recipesId == null || startNumDay == null || endNumDay == null){
continue;
}
List<SysRecipesDaily> recipesDailyList = sysRecipesMapper.getRecipesListByRecipesId(recipesId);
if(recipesDailyList != null && recipesDailyList.size() > 0){
for (SysRecipesDaily sysRecipesDaily : recipesDailyList) {
sysRecipesDaily.setNumDay(startNumDay);
//更新
sysRecipesMapper.updateRecipesById(sysRecipesDaily);
startNumDay++;
}
}
recipesDailyList = new ArrayList<>();
for (int i = startNumDay; i <= endNumDay; i++) {
SysRecipesDaily sysRecipesDaily = new SysRecipesDaily();
sysRecipesDaily.setNumDay(i);
sysRecipesDaily.setRecipesId(recipesId);
sysRecipesDaily.setCusId(cusId);
recipesDailyList.add(sysRecipesDaily);
}
if(recipesDailyList.size() > 0){
//批量添加
sysRecipesMapper.bashAddMenus(recipesDailyList);
}
}
}

View File

@ -1,6 +1,7 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import java.util.Map;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.utils.DateUtils;
@ -149,4 +150,14 @@ public class SysWxFanStatisticsServiceImpl implements ISysWxFanStatisticsService
public List<SysWxFanStatistics> exportStatisticsList(SysWxFanStatistics sysWxFanStatistics) {
return sysWxFanStatisticsMapper.exportStatisticsList(sysWxFanStatistics);
}
/**
* 根据时间范围统计每个渠道的进粉数量
* @param sysWxFanStatistics
* @return
*/
@Override
public List<Map<String,Object>> getTotalFanNumGroupByChannel(SysWxFanStatistics sysWxFanStatistics){
return sysWxFanStatisticsMapper.getTotalFanNumGroupByChannel(sysWxFanStatistics);
}
}