Commit cfb1416f by 袁伟铭

修改

parent b159c911
......@@ -61,6 +61,12 @@ public class VChildWelfareStats {
private Integer childNum;
/**
* 事实无人领养
*/
@ApiModelProperty("事实无人领养")
private Integer factUnadopted;
/**
* 日期
*/
@ApiModelProperty("日期")
......
......@@ -34,4 +34,16 @@ public class EtStatsAdminController {
return ResultVo.success(etStatsService.getCacheAgencyUnderChildStatsList(vo));
}
@ApiOperation("统计该区域的机构和儿童数量")
@PostMapping(value = "/getAgencyChildStats")
public ResultVo<Object> getAgencyChildStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(etStatsService.getCacheAgencyChildStats(vo));
}
@ApiOperation("获取区域机构占比")
@PostMapping(value = "/getAgencyPercentageStats")
public ResultVo<Object> getAgencyPercentageStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(etStatsService.getCacheAgencyPercentageStats(vo));
}
}
......@@ -19,10 +19,16 @@ public class CjStatsController {
public final CjStatsService cjStatsService;
@ApiOperation("残疾人两项补贴")
@PostMapping(value = "/cjTwoSubsidies")
public ResultVo cjTwoSubsidies(@RequestBody StatsReqVo vo) {
return ResultVo.success(cjStatsService.cjTwoSubsidies(vo));
@ApiOperation("近五年发放人数和金额统计")
@PostMapping(value = "/getPeopleAmountStats")
public ResultVo getPeopleAmountStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(cjStatsService.getCachePeopleAmountStats());
}
@ApiOperation("获取残疾等级统计")
@PostMapping(value = "/getDisabledLevelStats")
public ResultVo getDisabledLevelStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(cjStatsService.getCacheDisabledLevelStats(vo));
}
}
package com.zq.portal.controller.app;
import com.zq.common.vo.ResultVo;
import com.zq.portal.service.ShjzStatsService;
import com.zq.portal.vo.StatsReqVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "社会救助统计相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/portal/app/stats")
public class ShjzStatsController {
public final ShjzStatsService shjzStatsService;
@ApiOperation("获取近五年城市农村低保发放金额统计")
@PostMapping(value = "/getFivesYearShjzProvideStats")
public ResultVo getFivesYearShjzProvideStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(shjzStatsService.getFivesYearShjzProvideStats(vo));
}
@ApiOperation("获取近三年城市农村低保发放金额统计")
@PostMapping(value = "/getThreeYearShjzProvideStats")
public ResultVo getThreeYearShjzProvideStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(shjzStatsService.getThreeYearShjzProvideStats(vo));
}
@ApiOperation("获取近五年城市农村低保发放人数统计")
@PostMapping(value = "/getFivesYearShjzAchieveStats")
public ResultVo getFivesYearShjzAchieveStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(shjzStatsService.getFivesYearShjzAchieveStats(vo));
}
@ApiOperation("获取近三年城市农村低保发放人数统计")
@PostMapping(value = "/getThreeYearShjzAchieveStats")
public ResultVo getThreeYearShjzAchieveStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(shjzStatsService.getThreeYearShjzAchieveStats(vo));
}
@ApiOperation("获取区域统计列表")
@PostMapping(value = "/getAreaShjzStats")
public ResultVo getAreaShjzStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(shjzStatsService.getAreaShjzStats(vo));
}
}
......@@ -2,11 +2,26 @@ package com.zq.portal.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.zq.common.constant.DBName;
import com.zq.portal.vo.StatsReqVo;
import com.zq.portal.vo.StatsVo;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS(DBName.GXCJ)
@Repository
public interface CjStatsDao {
/**
* 统计进5年发放人数和金额
*
* @return
*/
List<StatsVo> getPeopleAmountStats();
/**
* 残疾等级统计
*/
List<StatsVo> getDisabledLevelStats(StatsReqVo vo);
}
......@@ -36,4 +36,12 @@ public interface EtStatsDao {
*/
List<StatsVo> getAgencyUnderChildStats(StatsReqVo vo);
/**
* 事实无人领养
*
* @param vo
* @return
*/
StatsVo getFactUnadoptedStats(StatsReqVo vo);
}
......@@ -32,4 +32,14 @@ public interface VShjzAchieveDao extends BaseMapper<VShjzAchieve> {
"\tiscity")
List<Map<String, Object>> getFivesYearStats(@Param("date") String date);
@Select(value = "SELECT\n" +
"\tget_upunitname 'city',\n" +
"\ts_${year} 'achieveNum' \n" +
"FROM\n" +
"\t`v_shjz_achieve` \n" +
"WHERE\n" +
"\tDATE_FORMAT( create_time, '%Y-%m-%d' ) = '2021-06-26' \n" +
"\tAND iscity = '低保'")
List<Map<String, Object>> getStatsByYear(@Param("year") Integer year);
}
......@@ -32,4 +32,13 @@ public interface VShjzProvideDao extends BaseMapper<VShjzProvide> {
"\tiscity")
List<Map<String, Object>> getFivesYearStats(@Param("date") String date);
@Select(value = "SELECT\n" +
"\tget_upunitname 'city',\n" +
"\tsum_year_${year} 'provideNum' \n" +
"FROM\n" +
"\t`v_shjz_provide` \n" +
"WHERE\n" +
"\tDATE_FORMAT( create_time, '%Y-%m-%d' ) = '2021-06-26' \n" +
"\tAND iscity = '低保'")
List<Map<String, Object>> getStatsByYear(@Param("year") Integer year);
}
......@@ -2,7 +2,7 @@ package com.zq.portal.manager;
import com.zq.portal.vo.StatsReqVo;
public abstract class CacheKeys {
public abstract class PortalCacheKeys {
public static final String PREFIX = "portal.";
......@@ -60,4 +60,14 @@ public abstract class CacheKeys {
public static String getAgencyUnderChildStatsListKey(StatsReqVo vo) {
return PREFIX + "getAgencyUnderChildStatsList." + vo.getAreaCode() + "." + vo.getYear();
}
// 统计进5年发放人数和金额
public static String getPeopleAmountStatsKey() {
return PREFIX + "getPeopleAmountStats.";
}
// 残疾等级统计
public static String getDisabledLevelStatsKey(StatsReqVo vo) {
return PREFIX + "getCacheDisabledLevelStats." + vo.getAreaCode() + "." + vo.getYear();
}
}
package com.zq.portal.service;
import cn.hutool.core.util.StrUtil;
import com.zq.common.config.redis.RedisUtils;
import com.zq.common.entity.SystemArea;
import com.zq.common.utils.StringUtils;
import com.zq.portal.dao.AreaDao;
import com.zq.portal.dao.CjStatsDao;
import com.zq.portal.manager.PortalCacheKeys;
import com.zq.portal.vo.StatsReqVo;
import com.zq.portal.vo.StatsVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@RequiredArgsConstructor
public class CjStatsService {
private final CjStatsDao cjStatsDao;
private final AreaDao areaDao;
private final RedisUtils redisUtils;
/**
* 统计进5年发放人数和金额
*
* @return
*/
public Object getCachePeopleAmountStats() {
Object obj = redisUtils.getObj(PortalCacheKeys.getPeopleAmountStatsKey());
if (obj != null) {
return obj;
}
return getPeopleAmountStats();
}
/**
* 统计进5年发放人数和金额
*
* @return
*/
public Object getPeopleAmountStats() {
List<StatsVo> peopleAmountStats = cjStatsDao.getPeopleAmountStats();
peopleAmountStats.sort(Comparator.comparing(StatsVo::getYear));
List<String> dateList = new ArrayList<>();
List<String> numList = new ArrayList<>();
List<String> amountList = new ArrayList<>();
for (StatsVo peopleAmountStat : peopleAmountStats) {
dateList.add(peopleAmountStat.getYear());
numList.add(String.valueOf(peopleAmountStat.getNum()));
amountList.add(peopleAmountStat.getAmount());
}
Map<String, Object> returnData = new HashMap<>();
returnData.put("dateList", dateList);
returnData.put("numList", numList);
returnData.put("amountList", amountList);
redisUtils.setObj(PortalCacheKeys.getPeopleAmountStatsKey(), returnData);
public Object cjTwoSubsidies(StatsReqVo vo) {
if (StringUtils.isBlank(vo.getAreaCode())) {
return returnData;
}
/**
* 残疾等级统计
*
* @param vo
* @return
*/
public Object getCacheDisabledLevelStats(StatsReqVo vo) {
Object obj = redisUtils.getObj(PortalCacheKeys.getDisabledLevelStatsKey(vo));
if (obj != null) {
return obj;
}
return getDisabledLevelStats(vo);
}
/**
* 残疾等级统计
*
* @param vo
* @return
*/
public Object getDisabledLevelStats(StatsReqVo vo) {
if (StrUtil.isBlank(vo.getAreaCode())) {
vo.setAreaCode("450000000000");
}
SystemArea systemArea = areaDao.selectById(vo.getAreaCode());
vo.setSubAreaCode(systemArea.subAreaCode());
List<Map<String, Object>> returnData = new ArrayList<>();
List<StatsVo> disabledLevelStats = cjStatsDao.getDisabledLevelStats(vo);
for (StatsVo disabledLevelStat : disabledLevelStats) {
Map<String, Object> data = new HashMap<>();
data.put("level", disabledLevelStat.getType() + "级残疾");
data.put("num", "总数" + disabledLevelStat.getNum());
returnData.add(data);
}
redisUtils.setObj(PortalCacheKeys.getDisabledLevelStatsKey(vo), returnData);
return null;
return returnData;
}
}
......@@ -9,7 +9,7 @@ import com.zq.common.entity.VChildWelfareStats;
import com.zq.portal.dao.AreaDao;
import com.zq.portal.dao.EtStatsDao;
import com.zq.portal.dao.VChildWelfareStatsDao;
import com.zq.portal.manager.CacheKeys;
import com.zq.portal.manager.PortalCacheKeys;
import com.zq.portal.vo.StatsReqVo;
import com.zq.portal.vo.StatsVo;
import lombok.RequiredArgsConstructor;
......@@ -30,7 +30,7 @@ public class EtStatsService {
private final RedisUtils redisUtils;
public VChildWelfareStats getCacheAgencyChildStats(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getAgencyChildStatsKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getAgencyChildStatsKey(vo));
if (obj != null) {
return (VChildWelfareStats) obj;
}
......@@ -38,7 +38,7 @@ public class EtStatsService {
}
/**
* 统计该区域的机构和孩子数量
* 统计该区域的机构和儿童数量
*
* @param vo
* @return
......@@ -61,8 +61,10 @@ public class EtStatsService {
build.setAgencyNum(orgStat.getNum());
StatsVo childStats = etStatsDao.getAreaChildStats(vo);
build.setChildNum(childStats.getNum());
StatsVo factUnadoptedStats = etStatsDao.getFactUnadoptedStats(vo);
build.setFactUnadopted(factUnadoptedStats.getNum());
redisUtils.setObj(CacheKeys.getAgencyChildStatsKey(vo), build);
redisUtils.setObj(PortalCacheKeys.getAgencyChildStatsKey(vo), build);
// 放进数据库 有时间条件的不存库
VChildWelfareStats childWelfareStats = vChildWelfareStatsDao.selectOne(Wrappers.lambdaQuery(VChildWelfareStats.builder().year(vo.getYear() == null ? 0 : vo.getYear()).areaCode(systemArea.getCode()).createTime(DateUtil.parseDate(DateUtil.today())).build()));
......@@ -74,7 +76,7 @@ public class EtStatsService {
}
public List<VChildWelfareStats> getCacheAgencyChildStatsList(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getAgencyChildStatsListKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getAgencyChildStatsListKey(vo));
if (obj != null) {
return (List<VChildWelfareStats>) obj;
}
......@@ -82,7 +84,7 @@ public class EtStatsService {
}
/**
* 获取区域下的福利机构和儿童数量统计
* 获取区域下的福利机构和儿童数量统计列表
*
* @param vo
* @return
......@@ -101,7 +103,7 @@ public class EtStatsService {
returnData.add(etAgencyWelfareStats);
}
redisUtils.setObj(CacheKeys.getAgencyChildStatsListKey(vo), returnData);
redisUtils.setObj(PortalCacheKeys.getAgencyChildStatsListKey(vo), returnData);
return returnData;
}
......@@ -113,7 +115,7 @@ public class EtStatsService {
* @return
*/
public Object getCacheAgencyPercentageStats(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getAgencyChildStatsListKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getAgencyChildStatsListKey(vo));
if (obj != null) {
return obj;
}
......@@ -136,13 +138,13 @@ public class EtStatsService {
data.put("vakue", childWelfareStats.getAgencyNum());
}
redisUtils.setObj(CacheKeys.getAgencyPercentageStatsKey(vo), returnData);
redisUtils.setObj(PortalCacheKeys.getAgencyPercentageStatsKey(vo), returnData);
return returnData;
}
public Object getCacheAgencyUnderChildStatsList(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getAgencyUnderChildStatsListKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getAgencyUnderChildStatsListKey(vo));
if (obj != null) {
return obj;
}
......@@ -164,7 +166,7 @@ public class EtStatsService {
List<StatsVo> agencyUnderChildStats = etStatsDao.getAgencyUnderChildStats(vo);
redisUtils.setObj(CacheKeys.getAgencyUnderChildStatsListKey(vo), agencyUnderChildStats);
redisUtils.setObj(PortalCacheKeys.getAgencyUnderChildStatsListKey(vo), agencyUnderChildStats);
return agencyUnderChildStats;
}
......
......@@ -9,7 +9,7 @@ import com.zq.common.utils.StringUtils;
import com.zq.portal.dao.AreaDao;
import com.zq.portal.dao.HyStatsDao;
import com.zq.portal.dao.VMarriageStatsDao;
import com.zq.portal.manager.CacheKeys;
import com.zq.portal.manager.PortalCacheKeys;
import com.zq.portal.vo.LineDataVo;
import com.zq.portal.vo.StatsReqVo;
import com.zq.portal.vo.StatsVo;
......@@ -35,7 +35,7 @@ public class HyStatsService {
* @return
*/
public VMarriageStats getCacheMarriageStats(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getMarriageStatsKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getMarriageStatsKey(vo));
if (obj != null) {
return (VMarriageStats) obj;
}
......@@ -94,9 +94,9 @@ public class HyStatsService {
// 放进缓存
if (vo.getYear() != null) {
// 有时间条件的设置过期时间避免内存暂用
redisUtils.setObj(CacheKeys.getMarriageStatsKey(vo), build, 1, TimeUnit.DAYS);
redisUtils.setObj(PortalCacheKeys.getMarriageStatsKey(vo), build, 1, TimeUnit.DAYS);
} else {
redisUtils.setObj(CacheKeys.getMarriageStatsKey(vo), build);
redisUtils.setObj(PortalCacheKeys.getMarriageStatsKey(vo), build);
}
// 放进数据库 有时间条件的不存库
......@@ -115,7 +115,7 @@ public class HyStatsService {
* @return
*/
public List<VMarriageStats> getCacheAreaUnderMarriageStatsList(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getAreaUnderMarriageStatsListKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getAreaUnderMarriageStatsListKey(vo));
if (obj != null) {
return (List<VMarriageStats>) obj;
}
......@@ -143,9 +143,9 @@ public class HyStatsService {
if (vo.getYear() != null) {
// 搜索的有过期时间避免内存暂用
redisUtils.setObj(CacheKeys.getAreaUnderMarriageStatsListKey(vo), returnData, 1, TimeUnit.DAYS);
redisUtils.setObj(PortalCacheKeys.getAreaUnderMarriageStatsListKey(vo), returnData, 1, TimeUnit.DAYS);
} else {
redisUtils.setObj(CacheKeys.getAreaUnderMarriageStatsListKey(vo), returnData);
redisUtils.setObj(PortalCacheKeys.getAreaUnderMarriageStatsListKey(vo), returnData);
}
return returnData;
......@@ -170,7 +170,7 @@ public class HyStatsService {
* @return
*/
public Object getCacheFivesYearMarriageLine(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getFivesYearMarriageLineKey(vo.getAreaCode()));
Object obj = redisUtils.getObj(PortalCacheKeys.getFivesYearMarriageLineKey(vo.getAreaCode()));
if (obj != null) {
return obj;
}
......@@ -236,7 +236,7 @@ public class HyStatsService {
returnData.put("admin", adminData);
returnData.put("app", appData);
redisUtils.setObj(CacheKeys.getFivesYearMarriageLineKey(vo.getAreaCode()), returnData);
redisUtils.setObj(PortalCacheKeys.getFivesYearMarriageLineKey(vo.getAreaCode()), returnData);
return returnData;
}
......@@ -247,7 +247,7 @@ public class HyStatsService {
* @return
*/
public Object getCacheMonthMarriageLine(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getMonthMarriageLineKey(vo.getAreaCode()));
Object obj = redisUtils.getObj(PortalCacheKeys.getMonthMarriageLineKey(vo.getAreaCode()));
if (obj != null) {
return obj;
}
......@@ -313,7 +313,7 @@ public class HyStatsService {
returnData.put("admin", adminData);
returnData.put("app", appData);
redisUtils.setObj(CacheKeys.getMonthMarriageLineKey(vo.getAreaCode()), returnData);
redisUtils.setObj(PortalCacheKeys.getMonthMarriageLineKey(vo.getAreaCode()), returnData);
return returnData;
}
......
......@@ -7,6 +7,7 @@ import com.zq.portal.vo.StatsReqVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
@Service
......@@ -68,13 +69,13 @@ public class ShjzStatsService {
// 总金额
Map<String, Object> totalData = new HashMap<>();
int villageToatlAmount = 0;
int cityToatlAmount = 0;
BigDecimal villageToatlAmount = BigDecimal.ZERO;
BigDecimal cityToatlAmount = BigDecimal.ZERO;
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
cityToatlAmount = getFivesYearTotalAmount(cityToatlAmount, fivesYearStat);
cityToatlAmount = getFivesYearTotalNum(cityToatlAmount, fivesYearStat);
} else if ("农村低保".equals(fivesYearStat.get("iscity").toString())) {
villageToatlAmount = getFivesYearTotalAmount(villageToatlAmount, fivesYearStat);
villageToatlAmount = getFivesYearTotalNum(villageToatlAmount, fivesYearStat);
}
}
totalData.put("villageToatlAmount", villageToatlAmount);
......@@ -136,13 +137,13 @@ public class ShjzStatsService {
// 总金额
Map<String, Object> totalData = new HashMap<>();
int villageToatlAmount = 0;
int cityToatlAmount = 0;
BigDecimal villageToatlAmount = BigDecimal.ZERO;
BigDecimal cityToatlAmount = BigDecimal.ZERO;
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
cityToatlAmount = getThreeYearTotalAmount(cityToatlAmount, fivesYearStat);
cityToatlAmount = getThreeYearTotalNum(cityToatlAmount, fivesYearStat);
} else if ("农村低保".equals(fivesYearStat.get("iscity").toString())) {
villageToatlAmount = getThreeYearTotalAmount(villageToatlAmount, fivesYearStat);
villageToatlAmount = getThreeYearTotalNum(villageToatlAmount, fivesYearStat);
}
}
totalData.put("villageToatlAmount", villageToatlAmount);
......@@ -156,22 +157,6 @@ public class ShjzStatsService {
return returnData;
}
private int getFivesYearTotalAmount(int toatlAmount, Map<String, Object> fivesYearStat) {
toatlAmount += Integer.parseInt(fivesYearStat.get("s2017").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2018").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2019").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2020").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2021").toString());
return toatlAmount;
}
private int getThreeYearTotalAmount(int toatlAmount, Map<String, Object> fivesYearStat) {
toatlAmount += Integer.parseInt(fivesYearStat.get("s2019").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2020").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2021").toString());
return toatlAmount;
}
/**
* 获取近5年发放人数折线
*
......@@ -224,8 +209,8 @@ public class ShjzStatsService {
// 总金额
Map<String, Object> totalData = new HashMap<>();
int villageToatlNum = 0;
int cityToatlNum = 0;
BigDecimal villageToatlNum = BigDecimal.ZERO;
BigDecimal cityToatlNum = BigDecimal.ZERO;
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
cityToatlNum = getFivesYearTotalNum(cityToatlNum, fivesYearStat);
......@@ -292,8 +277,8 @@ public class ShjzStatsService {
// 总金额
Map<String, Object> totalData = new HashMap<>();
int villageToatlNum = 0;
int cityToatlNum = 0;
BigDecimal villageToatlNum = BigDecimal.ZERO;
BigDecimal cityToatlNum = BigDecimal.ZERO;
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
cityToatlNum = getThreeYearTotalNum(cityToatlNum, fivesYearStat);
......@@ -312,19 +297,36 @@ public class ShjzStatsService {
return returnData;
}
private int getFivesYearTotalNum(int toatlAmount, Map<String, Object> fivesYearStat) {
toatlAmount += Integer.parseInt(fivesYearStat.get("s2017").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2018").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2019").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2020").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2021").toString());
private BigDecimal getFivesYearTotalNum(BigDecimal toatlAmount, Map<String, Object> fivesYearStat) {
toatlAmount = toatlAmount.add(new BigDecimal(fivesYearStat.get("s2017").toString()));
toatlAmount = toatlAmount.add(new BigDecimal(fivesYearStat.get("s2018").toString()));
toatlAmount = toatlAmount.add(new BigDecimal(fivesYearStat.get("s2019").toString()));
toatlAmount = toatlAmount.add(new BigDecimal(fivesYearStat.get("s2020").toString()));
toatlAmount = toatlAmount.add(new BigDecimal(fivesYearStat.get("s2021").toString()));
return toatlAmount;
}
private int getThreeYearTotalNum(int toatlAmount, Map<String, Object> fivesYearStat) {
toatlAmount += Integer.parseInt(fivesYearStat.get("s2019").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2020").toString());
toatlAmount += Integer.parseInt(fivesYearStat.get("s2021").toString());
private BigDecimal getThreeYearTotalNum(BigDecimal toatlAmount, Map<String, Object> fivesYearStat) {
toatlAmount = toatlAmount.add(new BigDecimal(fivesYearStat.get("s2019").toString()));
toatlAmount = toatlAmount.add(new BigDecimal(fivesYearStat.get("s2020").toString()));
toatlAmount = toatlAmount.add(new BigDecimal(fivesYearStat.get("s2021").toString()));
return toatlAmount;
}
public Object getAreaShjzStats(StatsReqVo vo) {
List<Map<String, Object>> achieveStats = vShjzAchieveDao.getStatsByYear(vo.getYear());
List<Map<String, Object>> provideStats = vShjzProvideDao.getStatsByYear(vo.getYear());
for (Map<String, Object> achieveStat : achieveStats) {
String city = achieveStat.get("city").toString();
for (Map<String, Object> provideStat : provideStats) {
if (provideStat.get("city").toString().equals(city)) {
achieveStat.put("provideNum", provideStat.get("provideNum"));
}
}
}
return achieveStats;
}
}
......@@ -9,7 +9,7 @@ import com.zq.common.entity.VSoorganStats;
import com.zq.portal.dao.AreaDao;
import com.zq.portal.dao.ShzzStatsDao;
import com.zq.portal.dao.VSoorganStatsDao;
import com.zq.portal.manager.CacheKeys;
import com.zq.portal.manager.PortalCacheKeys;
import com.zq.portal.vo.StatsReqVo;
import com.zq.portal.vo.StatsVo;
import lombok.RequiredArgsConstructor;
......@@ -36,7 +36,7 @@ public class ShzzStatsService {
* @return
*/
public VSoorganStats getCacheSoorganStats(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getSoorganStatsKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getSoorganStatsKey(vo));
if (obj != null) {
return (VSoorganStats) obj;
}
......@@ -77,7 +77,7 @@ public class ShzzStatsService {
}
}
redisUtils.setObj(CacheKeys.getSoorganStatsKey(vo), build);
redisUtils.setObj(PortalCacheKeys.getSoorganStatsKey(vo), build);
// 放进数据库 有时间条件的不存库
VSoorganStats soorganStats = vSoorganStatsDao.selectOne(Wrappers.lambdaQuery(VSoorganStats.builder().year(vo.getYear() == null ? 0 : vo.getYear()).areaCode(systemArea.getCode()).createTime(DateUtil.parseDate(DateUtil.today())).build()));
......@@ -95,7 +95,7 @@ public class ShzzStatsService {
* @return
*/
public List<VSoorganStats> getCacheAreaUnderSoorganStatsList(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getSoorganStatsListKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getSoorganStatsListKey(vo));
if (obj != null) {
return (List<VSoorganStats>) obj;
}
......@@ -123,7 +123,7 @@ public class ShzzStatsService {
returnData.add(soorganStats);
}
redisUtils.setObj(CacheKeys.getSoorganStatsListKey(vo), returnData);
redisUtils.setObj(PortalCacheKeys.getSoorganStatsListKey(vo), returnData);
return returnData;
}
......@@ -135,7 +135,7 @@ public class ShzzStatsService {
* @return
*/
public Object getCacheSoorganPercentageStats(StatsReqVo vo) {
Object obj = redisUtils.getObj(CacheKeys.getSoorganPercentageStatsKey(vo));
Object obj = redisUtils.getObj(PortalCacheKeys.getSoorganPercentageStatsKey(vo));
if (obj != null) {
return obj;
}
......@@ -164,7 +164,7 @@ public class ShzzStatsService {
returnData.add(data);
}
redisUtils.setObj(CacheKeys.getSoorganPercentageStatsKey(vo), returnData);
redisUtils.setObj(PortalCacheKeys.getSoorganPercentageStatsKey(vo), returnData);
return returnData;
}
......
......@@ -15,4 +15,6 @@ public class StatsVo {
private String name;
private String amount;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zq.portal.dao.CjStatsDao">
<select id="getPeopleAmountStats" resultType="com.zq.portal.vo.StatsVo">
SELECT COUNT(1) 'num', SUM( SUBSIDY_STANDARD_MONEY ) 'amount', `YEAR` 'year'
FROM `cjrjz_application`
WHERE CHECK_STATUS = 1
AND `STATUS` = 0
AND APPROVE_DATE IS NOT NULL
GROUP BY `YEAR`
ORDER BY `YEAR` DESC LIMIT 5
</select>
<select id="getDisabledLevelStats" resultType="com.zq.portal.vo.StatsVo">
SELECT ENSURE_LEVEL_ID 'type', COUNT( 1 ) 'num'
FROM `cjrjz_proposer`
WHERE ENSURE_LEVEL_ID IS NOT NULL
<if test="subAreaCode != null and subAreaCode != ''">
AND CARD_CODE LIKE CONCAT(#{subAreaCode}, '%')
</if>
<if test="year != null">
AND LEFT(CREATE_DATE, 4) = #{year}
</if>
GROUP BY ENSURE_LEVEL_ID
</select>
</mapper>
......@@ -50,4 +50,21 @@
LIMIT 15
</select>
<!--事实无人领养-->
<select id="getFactUnadoptedStats" resultType="com.zq.portal.vo.StatsVo">
SELECT
COUNT(1) 'num'
FROM
jep08 j1
LEFT JOIN jep01 j2 ON j1.AJEP0100 = j2.AJEP0100
WHERE 1=1
j2.AXAA0001 LIKE CONCAT(#{subAreaCode},'%')
<if test="subAreaCode !=null and subAreaCode != ''">
AND j2.AXAA0001 LIKE CONCAT(#{subAreaCode}, '%')
</if>
<if test="year != null">
AND DATE_FORMAT(j1.AJEP0120, "%Y") = #{year}
</if>
</select>
</mapper>
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