Commit ec30973a authored by liuChang's avatar liuChang

首页缓存

parent 698b5977
package com.dsk.system.dskService;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.mail.MailUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.redis.RedisCache;
import com.dsk.common.utils.DateUtils;
import com.dsk.common.utils.DskOpenApiUtil;
import org.apache.commons.collections4.MapUtils;
......@@ -30,6 +34,9 @@ public class IndexService {
@Autowired
private DskOpenApiUtil dskOpenApiUtil;
@Autowired
private RedisCache redisCache;
public AjaxResult bigWinningBidsPage(JSONObject object) {
ArrayList recentlyBidQueryDtoList = object.getJSONArray("recentlyBidQueryDto");
Map<String,Object> objectMap = new HashMap<>();
......@@ -91,6 +98,26 @@ public class IndexService {
}
public AjaxResult countByCompany(JSONObject object) {
Date startDate = object.getDate("startDate");
Date endDate = object.getDate("endDate");
long l = 0;
long i = 0;
if (startDate!=null&&endDate!=null){
l = DateUtil.betweenDay(startDate, endDate, false);
i = DateUtil.betweenDay(endDate, new Date(), false);
}
if (null!=object&&null==object.get("provinceId")&&null==object.get("type")&&l==3&&i==0){
Map<String, Object> countByCompany = redisCache.getCacheMap("index_countByCompany");
if (null==countByCompany|| MapUtil.isEmpty(countByCompany)){
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/marketAnalysis/centralEnterprse/countByCompany", object);
redisCache.setCacheMap("index_countByCompany",map);
redisCache.expire("index_countByCompany",7200);
return BeanUtil.toBean(countByCompany, AjaxResult.class);
}else {
log.info("首页集团中标业绩从缓存中取");
return BeanUtil.toBean(countByCompany, AjaxResult.class);
}
}
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/marketAnalysis/centralEnterprse/countByCompany", object);
return BeanUtil.toBean(map, AjaxResult.class);
}
......
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