Commit 55e96a19 by jinxin

查询未完成营销任务数量添加缓存

parent a88f2d66
...@@ -24,6 +24,7 @@ import com.gic.haoban.manage.web.vo.MarketingCountVO; ...@@ -24,6 +24,7 @@ import com.gic.haoban.manage.web.vo.MarketingCountVO;
import com.gic.haoban.manage.web.vo.notify.PairValVO; import com.gic.haoban.manage.web.vo.notify.PairValVO;
import com.gic.haoban.task.api.service.TelTaskApiService; import com.gic.haoban.task.api.service.TelTaskApiService;
import com.gic.haoban.task.manage.api.service.IMarketClueTaskApiService; import com.gic.haoban.task.manage.api.service.IMarketClueTaskApiService;
import com.gic.redis.data.util.RedisUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -32,10 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -32,10 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* Created 2021/12/16. * Created 2021/12/16.
...@@ -216,31 +214,59 @@ public class NotifyController extends WebBaseController { ...@@ -216,31 +214,59 @@ public class NotifyController extends WebBaseController {
logger.info("查询是否店长:{}", clerkId); logger.info("查询是否店长:{}", clerkId);
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if (clerkDTO != null) { if (clerkDTO != null) {
Integer groupChatCount, telTaskCount, groupMessageCount, total = 0; Integer groupChatCount = 0, telTaskCount=0, groupMessageCount=0, total = 0;
Integer clerkType = clerkDTO.getClerkType(); Integer clerkType = clerkDTO.getClerkType();
if (clerkType == 1 || clerkType == 2) { if (clerkType == 1 || clerkType == 2) {
//店长维度 //店长维度
//社群群发 //添加redis缓存
logger.info("店长维度查询社群群发"); String cacheKey = "marketing_Count:"+storeId;
groupChatCount = groupChatPlanApiService.getTotalCount(enterpriseId, null, storeId).getResult(); Object value = RedisUtil.getCache(cacheKey);
//话务群发 if (null != value){
logger.info("店长维度查询话务群发"); String cache = String.valueOf(value);
telTaskCount = telTaskApiService.getTotalCount(enterpriseId, null, storeId).getResult(); List<String> cacheList = Arrays.asList(cache.split(","));
//群发 groupChatCount = Integer.valueOf(cacheList.get(0));
logger.info("店长维度查询群发"); telTaskCount = Integer.valueOf(cacheList.get(1));
groupMessageCount = iMarketClueTaskApiService.getTotalCount(enterpriseId, null, storeId).getResult(); groupMessageCount = Integer.valueOf(cacheList.get(2));
}else {
//社群群发
logger.info("店长维度查询社群群发");
groupChatCount = groupChatPlanApiService.getTotalCount(enterpriseId, null, storeId).getResult();
//话务群发
logger.info("店长维度查询话务群发");
telTaskCount = telTaskApiService.getTotalCount(enterpriseId, null, storeId).getResult();
//群发
logger.info("店长维度查询群发");
groupMessageCount = iMarketClueTaskApiService.getTotalCount(enterpriseId, null, storeId).getResult();
String cacheValue = groupChatCount + "," + telTaskCount + "," + groupMessageCount;
//缓存10分钟
RedisUtil.setCache(cacheKey, cacheValue, 600L);
}
total = groupChatCount + telTaskCount + groupMessageCount; total = groupChatCount + telTaskCount + groupMessageCount;
} else { } else {
//导购维度 //导购维度
//社群群发 //添加redis缓存
logger.info("导购维度查询社群群发"); String cacheKey = "marketing_Count:"+storeId+":"+clerkId;
groupChatCount = groupChatPlanApiService.getTotalCount(enterpriseId, clerkId, storeId).getResult(); Object value = RedisUtil.getCache(cacheKey);
//话务群发 if (null != value){
logger.info("导购维度查询话务群发"); String cache = String.valueOf(value);
telTaskCount = telTaskApiService.getTotalCount(enterpriseId, clerkId, storeId).getResult(); List<String> cacheList = Arrays.asList(cache.split(","));
//群发 groupChatCount = Integer.valueOf(cacheList.get(0));
logger.info("导购维度查询群发"); telTaskCount = Integer.valueOf(cacheList.get(1));
groupMessageCount = iMarketClueTaskApiService.getTotalCount(enterpriseId, clerkId, storeId).getResult(); groupMessageCount = Integer.valueOf(cacheList.get(2));
}else {
//社群群发
logger.info("导购维度查询社群群发");
groupChatCount = groupChatPlanApiService.getTotalCount(enterpriseId, clerkId, storeId).getResult();
//话务群发
logger.info("导购维度查询话务群发");
telTaskCount = telTaskApiService.getTotalCount(enterpriseId, clerkId, storeId).getResult();
//群发
logger.info("导购维度查询群发");
groupMessageCount = iMarketClueTaskApiService.getTotalCount(enterpriseId, clerkId, storeId).getResult();
String cacheValue = groupChatCount + "," + telTaskCount + "," + groupMessageCount;
//缓存10分钟
RedisUtil.setCache(cacheKey, cacheValue, 600L);
}
total = groupChatCount + telTaskCount + groupMessageCount; total = groupChatCount + telTaskCount + groupMessageCount;
} }
marketingCountVO.setGroupChatCount(groupChatCount); marketingCountVO.setGroupChatCount(groupChatCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment