|
@@ -1,26 +1,43 @@
|
|
package com.boman.web.core.service;
|
|
package com.boman.web.core.service;
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
import com.boman.common.core.utils.DateUtils;
|
|
import com.boman.common.core.utils.DateUtils;
|
|
-import com.boman.common.core.utils.SecurityUtils;
|
|
|
|
|
|
+import com.boman.common.core.utils.StringUtils;
|
|
|
|
+import com.boman.common.core.utils.number.NumberUtils;
|
|
|
|
+import com.boman.common.core.utils.obj.ObjectUtils;
|
|
|
|
+import com.boman.common.redis.service.RedisService;
|
|
|
|
+import com.boman.common.security.service.TokenService;
|
|
|
|
+import com.boman.domain.Czrk;
|
|
|
|
+import com.boman.domain.CzrkJzdz;
|
|
|
|
+import com.boman.domain.SysDept;
|
|
import com.boman.domain.SysUser;
|
|
import com.boman.domain.SysUser;
|
|
-import com.boman.domain.dto.AjaxResult;
|
|
|
|
import com.boman.domain.dto.FormDataDto;
|
|
import com.boman.domain.dto.FormDataDto;
|
|
|
|
+import com.boman.system.api.RemoteDeptService;
|
|
import com.boman.system.api.RemoteUserService;
|
|
import com.boman.system.api.RemoteUserService;
|
|
|
|
+import com.boman.web.core.mapper.CzrkMapper;
|
|
|
|
+import com.boman.web.core.mapper.GridInfoMapper;
|
|
import com.boman.web.core.service.common.ICommonService;
|
|
import com.boman.web.core.service.common.ICommonService;
|
|
-import com.boman.web.core.utils.AuthUtils;
|
|
|
|
|
|
+import com.boman.web.core.service.czrk.CzrkServiceImpl;
|
|
|
|
+import com.boman.web.core.service.czrk.ICzrkJzdzService;
|
|
|
|
+import com.boman.web.core.service.ip.IpTimesService;
|
|
|
|
+import org.apache.commons.lang3.BooleanUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
-import springfox.documentation.spring.web.json.Json;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.sql.Timestamp;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
-import java.util.Date;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
+import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
|
|
|
|
+import static com.boman.common.core.utils.obj.ObjectUtils.map;
|
|
|
|
+import static com.boman.common.redis.RedisKey.STS_CZRK_;
|
|
import static com.boman.domain.constant.AttendanceConst.*;
|
|
import static com.boman.domain.constant.AttendanceConst.*;
|
|
-import static com.boman.domain.constant.AttendanceConst.ATTENDANCE_DEPT_ID;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -29,6 +46,26 @@ import static com.boman.domain.constant.AttendanceConst.ATTENDANCE_DEPT_ID;
|
|
*/
|
|
*/
|
|
@Component
|
|
@Component
|
|
public class TaskService {
|
|
public class TaskService {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CzrkMapper czrkMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private RemoteDeptService remoteDeptService;
|
|
|
|
+ @Resource
|
|
|
|
+ private RedisService redisService;
|
|
|
|
+ @Resource
|
|
|
|
+ private ICzrkJzdzService czrkJzdzService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private GridInfoMapper gridInfoMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private IpTimesService ipTimesService;
|
|
|
|
+ @Resource
|
|
|
|
+ private CzrkServiceImpl czrkServiceImpl;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private TokenService tokenService;
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private TableServiceCmdService tableServiceCmdService;
|
|
private TableServiceCmdService tableServiceCmdService;
|
|
|
|
|
|
@@ -83,4 +120,578 @@ public class TaskService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /***
|
|
|
|
+ * 定时执行首页数据任务(每天凌晨1点执行)
|
|
|
|
+ * (cron = "0 0 1 * * ?")
|
|
|
|
+ */
|
|
|
|
+ @Scheduled(cron = "0 0 1 * * ?")
|
|
|
|
+ public void execute() {
|
|
|
|
+ //将每个deptId(潜山市,乡镇,村)的首页都存入redis
|
|
|
|
+ JSONObject results = new JSONObject(16);
|
|
|
|
+ JSONObject resultz = new JSONObject(16);
|
|
|
|
+ JSONObject resultc = new JSONObject(16);
|
|
|
|
+ String startTime = DateUtils.getTodayStartStr();
|
|
|
|
+ String endTime = DateUtils.getTodayEndStr();
|
|
|
|
+
|
|
|
|
+ Timestamp s = Timestamp.valueOf(startTime);
|
|
|
|
+ Timestamp e = Timestamp.valueOf(endTime);
|
|
|
|
+ //潜山市
|
|
|
|
+ List<SysDept> allDepts = remoteDeptService.listChildrenDepts(1L);
|
|
|
|
+ results.put("dqdw", "潜山市");
|
|
|
|
+ //所有乡镇集合
|
|
|
|
+ List<SysDept> townsDepts = new ArrayList<>(16);
|
|
|
|
+
|
|
|
|
+ for (SysDept allDept : allDepts) {
|
|
|
|
+ if (isEmpty(allDept.getParentId())){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (allDept.getParentId() == (1L)) {
|
|
|
|
+ townsDepts.add(allDept);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ results.put("zhen", townsDepts.size()); // 镇的数量
|
|
|
|
+
|
|
|
|
+ //所有村集合
|
|
|
|
+ List<SysDept> cunDepts = new ArrayList<>(16);
|
|
|
|
+ for (SysDept townsDept : townsDepts) {
|
|
|
|
+ for (SysDept allDept : allDepts) {
|
|
|
|
+ if (isEmpty(allDept.getParentId())) continue;
|
|
|
|
+ if (townsDept.getId().equals(allDept.getParentId())) {
|
|
|
|
+ cunDepts.add(allDept);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ results.put("cun", isEmpty(cunDepts) ? 0 : cunDepts.size());
|
|
|
|
+ //查找潜山市户籍人口总数
|
|
|
|
+ List<Czrk> czrkList = czrkMapper.getAllCzrkRegionId("340882000000");
|
|
|
|
+ if(czrkList==null){
|
|
|
|
+ czrkList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ //潜山市户籍人口总数
|
|
|
|
+ int hjzrs = czrkList.size();
|
|
|
|
+
|
|
|
|
+ //潜山市 户籍人口今日新增
|
|
|
|
+ int hjxz = 0;
|
|
|
|
+ //潜山市 户籍人口今日减少
|
|
|
|
+ int hjjs = 0;
|
|
|
|
+
|
|
|
|
+ //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
|
|
|
|
+ for (Czrk czrk : czrkList) {
|
|
|
|
+ if("Y".equals(czrk.getIsDel())){
|
|
|
|
+ hjzrs--;
|
|
|
|
+ }
|
|
|
|
+ //判断是否是在今天操作的人员信息
|
|
|
|
+ if(s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)){
|
|
|
|
+ if("Y".equals(czrk.getIsDel())){
|
|
|
|
+ hjjs++;
|
|
|
|
+ }else{
|
|
|
|
+ hjxz++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //潜山市总人数
|
|
|
|
+ results.put("hjzrs", hjzrs);
|
|
|
|
+ //潜山市新增
|
|
|
|
+ results.put("hjxz", hjxz);
|
|
|
|
+ //潜山市减少
|
|
|
|
+ results.put("hjjs", hjjs);
|
|
|
|
+
|
|
|
|
+ results.put("hjbfb", NumberUtils.percent(hjzrs, hjzrs));
|
|
|
|
+
|
|
|
|
+ //查找潜山市常驻人口信息
|
|
|
|
+ List<CzrkJzdz> czrkJzdzList = czrkJzdzService.selectCzrkJzdzListByRegionId("340882000000");
|
|
|
|
+ if(czrkJzdzList==null){
|
|
|
|
+ czrkJzdzList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ //潜山市居住人口总数
|
|
|
|
+ int czzrs = czrkJzdzList.size();
|
|
|
|
+
|
|
|
|
+ //潜山市居住人口今日新增
|
|
|
|
+ int czxz = 0;
|
|
|
|
+ //潜山市居住人口今日减少
|
|
|
|
+ int czjs = 0;
|
|
|
|
+
|
|
|
|
+ //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
|
|
|
|
+ for (CzrkJzdz czrkJzdz : czrkJzdzList) {
|
|
|
|
+ if("N".equals(czrkJzdz.getStatus())){
|
|
|
|
+ czzrs--;
|
|
|
|
+ }
|
|
|
|
+ //判断是否是在今天操作的人员信息
|
|
|
|
+ if(s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)){
|
|
|
|
+ if("N".equals(czrkJzdz.getStatus())){
|
|
|
|
+ czjs++;
|
|
|
|
+ }else{
|
|
|
|
+ czxz++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //潜山市总人数
|
|
|
|
+ results.put("czzrs", czzrs);
|
|
|
|
+ //潜山市新增
|
|
|
|
+ results.put("czxz", czxz);
|
|
|
|
+ //潜山市减少
|
|
|
|
+ results.put("czjs", czjs);
|
|
|
|
+ results.put("czbfb", NumberUtils.percent(czzrs, czzrs));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*List<Long> deptIdList = null;
|
|
|
|
+ int zrs = czrkMapper.countAll(); // 总人数
|
|
|
|
+ int hjzrs = czrkMapper.countHj1(deptIdList); // 该镇户籍人口总数
|
|
|
|
+ //潜山市总人数
|
|
|
|
+ results.put("hjzrs", hjzrs);
|
|
|
|
+ int hjxz = czrkMapper.countByHjXz1(startTime, endTime, deptIdList); // 该镇 户籍人口今日新增
|
|
|
|
+ //潜山市新增
|
|
|
|
+ results.put("hjxz", hjxz);
|
|
|
|
+ int hjjs = czrkMapper.countByHjJs1(startTime, endTime, deptIdList); // 该镇 户籍人口今日减少
|
|
|
|
+ results.put("hjjs", hjjs);
|
|
|
|
+ results.put("hjbfb", NumberUtils.percent(hjzrs, zrs));*/
|
|
|
|
+
|
|
|
|
+ /*int czzrs = czrkMapper.countCz1(deptIdList); // 该镇常住人口总数
|
|
|
|
+ results.put("czzrs", czzrs);
|
|
|
|
+ int czxz = czrkMapper.countByCzXz1(startTime, endTime, deptIdList); // 该镇 常住人口今日新增
|
|
|
|
+ int czjs = czrkMapper.countByCzJs1(startTime, endTime, deptIdList); // 该镇 常住人口今日减少
|
|
|
|
+ results.put("czxz", czxz);
|
|
|
|
+ results.put("czjs", czjs);
|
|
|
|
+ results.put("czbfb", NumberUtils.percent(czzrs, zrs));*/
|
|
|
|
+
|
|
|
|
+ // 以各个镇为单位单独处理 townsDepts
|
|
|
|
+ ArrayList<JSONObject> towsDataList = new ArrayList<>(20);
|
|
|
|
+
|
|
|
|
+ //czrkList czrkJzdzList
|
|
|
|
+ for (SysDept townsDept : townsDepts) {
|
|
|
|
+ JSONObject townsResult = new JSONObject(16);
|
|
|
|
+ townSts(townsResult, townsDept, czrkList, czrkJzdzList,hjzrs, czzrs);
|
|
|
|
+ towsDataList.add(townsResult);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ results.put("townDatas", towsDataList);
|
|
|
|
+// redisService.setCacheObject(packRedisKey(deptId + ""), result, 1L, TimeUnit.DAYS);
|
|
|
|
+ setIntoRedis(packRedisKey(1L + ""), results);
|
|
|
|
+ //QIANSHANSHI = result;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //镇数据存入redis
|
|
|
|
+ for (SysDept townsDept : townsDepts) {
|
|
|
|
+ townSts(resultz, townsDept, czrkList, czrkJzdzList,hjzrs, czzrs);
|
|
|
|
+// redisService.setCacheObject(packRedisKey("town:" + deptId), result, 1L, TimeUnit.DAYS);
|
|
|
|
+ setIntoRedis(packRedisKey("town:" + townsDept.getId()), resultz);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //村数据存入redis
|
|
|
|
+ for (SysDept cunDept : cunDepts) {
|
|
|
|
+ Long deptId = cunDept.getId();
|
|
|
|
+ String deptName = cunDept.getDeptName();
|
|
|
|
+ String areaId = cunDept.getAreaId();
|
|
|
|
+ resultc.put("dqdw", deptName);
|
|
|
|
+
|
|
|
|
+ //查找村的数据
|
|
|
|
+ if(czrkList==null){
|
|
|
|
+ czrkList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ //该村户籍人口总数
|
|
|
|
+ int hjzrsc = 0;
|
|
|
|
+
|
|
|
|
+ //该村 户籍人口今日新增
|
|
|
|
+ int hjxzc = 0;
|
|
|
|
+ //该村 户籍人口今日减少
|
|
|
|
+ int hjjsc = 0;
|
|
|
|
+
|
|
|
|
+ //循环所有人判断当前总人数,该村 户籍人口今日新增,该镇 户籍人口今日减少
|
|
|
|
+ for (Czrk czrk : czrkList) {
|
|
|
|
+ if(StringUtils.isNotEmpty(czrk.getVillageId()) && czrk.getVillageId().equals(areaId)){
|
|
|
|
+ if("N".equals(czrk.getIsDel())){
|
|
|
|
+ hjzrsc++;
|
|
|
|
+ }
|
|
|
|
+ //判断是否是在今天操作的人员信息
|
|
|
|
+ if(s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)){
|
|
|
|
+ if("Y".equals(czrk.getIsDel())){
|
|
|
|
+ hjjsc++;
|
|
|
|
+ }else{
|
|
|
|
+ hjxzc++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ resultc.put("hjzrs", hjzrsc);
|
|
|
|
+ resultc.put("hjxz", hjxzc);
|
|
|
|
+ resultc.put("hjjs", hjjsc);
|
|
|
|
+ resultc.put("hjbfb", NumberUtils.percent(hjzrs, czzrs));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(czrkJzdzList==null){
|
|
|
|
+ czrkJzdzList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ //该镇户籍人口总数
|
|
|
|
+ int czzrsc = 0;
|
|
|
|
+
|
|
|
|
+ //该镇 户籍人口今日新增
|
|
|
|
+ int czxzc = 0;
|
|
|
|
+ //该镇 户籍人口今日减少
|
|
|
|
+ int czjsc = 0;
|
|
|
|
+
|
|
|
|
+ //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
|
|
|
|
+ for (CzrkJzdz czrkJzdz : czrkJzdzList) {
|
|
|
|
+ if(StringUtils.isNotEmpty(czrkJzdz.getVillageId()) && czrkJzdz.getVillage().equals(areaId)){
|
|
|
|
+ if("Y".equals(czrkJzdz.getStatus())){
|
|
|
|
+ czzrsc++;
|
|
|
|
+ }
|
|
|
|
+ //判断是否是在今天操作的人员信息
|
|
|
|
+ if(s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)){
|
|
|
|
+ if("N".equals(czrkJzdz.getStatus())){
|
|
|
|
+ czjsc++;
|
|
|
|
+ }else{
|
|
|
|
+ czxzc++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ resultc.put("czzrs", czzrsc);
|
|
|
|
+ resultc.put("czxz", czxzc);
|
|
|
|
+ resultc.put("czjs", czjsc);
|
|
|
|
+ resultc.put("czbfb", NumberUtils.percent(czzrs, czzrs));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*List<SysDept> depts = remoteDeptService.listChildrenDepts(deptId);
|
|
|
|
+ resultc.put("dqdw", deptName);
|
|
|
|
+ List<Long> cdeptIdList = map(depts, SysDept::getId);
|
|
|
|
+ int zrsc = czrkMapper.countAll(); // 总人数
|
|
|
|
+ int hjzrsc = czrkMapper.countHj1(cdeptIdList); // 该镇户籍人口总数
|
|
|
|
+ resultc.put("hjzrs", hjzrsc);
|
|
|
|
+ int hjxzc = czrkMapper.countByHjXz1(startTime, endTime, cdeptIdList); // 该镇 户籍人口今日新增
|
|
|
|
+ resultc.put("hjxz", hjxzc);
|
|
|
|
+ int hjjsc = czrkMapper.countByHjJs1(startTime, endTime, cdeptIdList); // 该镇 户籍人口今日减少
|
|
|
|
+ resultc.put("hjjs", hjjsc);
|
|
|
|
+ resultc.put("hjbfb", NumberUtils.percent(hjzrs, zrs));
|
|
|
|
+
|
|
|
|
+ int czzrsc = czrkMapper.countCz1(cdeptIdList); // 该镇常住人口总数
|
|
|
|
+ resultc.put("czzrs", czzrsc);
|
|
|
|
+ int czxzc = czrkMapper.countByCzXz1(startTime, endTime, cdeptIdList); // 该镇 常住人口今日新增
|
|
|
|
+ int czjsc = czrkMapper.countByCzJs1(startTime, endTime, cdeptIdList); // 该镇 常住人口今日减少
|
|
|
|
+ resultc.put("czxz", czxzc);
|
|
|
|
+ resultc.put("czjs", czjsc);
|
|
|
|
+ resultc.put("czbfb", NumberUtils.percent(czzrsc, zrsc));*/
|
|
|
|
+ setIntoRedis(packRedisKey("village:" + deptId), resultc);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ System.out.println("定时任务");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void townSts(JSONObject result, SysDept sysDept, List<Czrk> czrkList, List<CzrkJzdz> czrkJzdzList ,int shjzrs, int sczzrs) {
|
|
|
|
+ String startTime = DateUtils.getTodayStartStr();
|
|
|
|
+ String endTime = DateUtils.getTodayEndStr();
|
|
|
|
+ Timestamp s = Timestamp.valueOf(startTime);
|
|
|
|
+ Timestamp e = Timestamp.valueOf(endTime);
|
|
|
|
+ Long deptId = sysDept.getId();
|
|
|
|
+ String deptName = sysDept.getDeptName();
|
|
|
|
+ String areaId = sysDept.getAreaId();
|
|
|
|
+ // 乡镇以下的所有部门
|
|
|
|
+ List<SysDept> depts = remoteDeptService.listChildrenDepts(deptId);
|
|
|
|
+ List<SysDept> cunDepts = new ArrayList<>(16);
|
|
|
|
+ for (SysDept dept : depts) {
|
|
|
|
+ if (isEmpty(dept.getParentId())) continue;
|
|
|
|
+ if (deptId.equals(dept.getParentId())) {
|
|
|
|
+ cunDepts.add(dept);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.put("cun", isEmpty(cunDepts) ? 0 : cunDepts.size());
|
|
|
|
+
|
|
|
|
+ List<SysDept> zuDept = new ArrayList<>(16);
|
|
|
|
+ for (SysDept cunDept : cunDepts) {
|
|
|
|
+ for (SysDept dept : depts) {
|
|
|
|
+ if (cunDept.getId().equals(dept.getParentId())) {
|
|
|
|
+ zuDept.add(dept);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ result.put("zu", isEmpty(zuDept) ? 0 : zuDept.size());
|
|
|
|
+
|
|
|
|
+ /** **/
|
|
|
|
+ /*int zrs = 0; // 总人数
|
|
|
|
+ if (BooleanUtils.isTrue(percent)) {
|
|
|
|
+ zrs = czrkMapper.countAll();
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ if(czrkList==null){
|
|
|
|
+ czrkList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ //该镇户籍人口总数
|
|
|
|
+ int hjzrs = 0;
|
|
|
|
+
|
|
|
|
+ //该镇 户籍人口今日新增
|
|
|
|
+ int hjxz = 0;
|
|
|
|
+ //该镇 户籍人口今日减少
|
|
|
|
+ int hjjs = 0;
|
|
|
|
+
|
|
|
|
+ //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
|
|
|
|
+ for (Czrk czrk : czrkList) {
|
|
|
|
+ if(StringUtils.isNotEmpty(czrk.getVillageTownsId()) && String.valueOf(czrk.getVillageTownsId()).equals(areaId)){
|
|
|
|
+ if("N".equals(czrk.getIsDel())){
|
|
|
|
+ hjzrs++;
|
|
|
|
+ }
|
|
|
|
+ //判断是否是在今天操作的人员信息
|
|
|
|
+ if(s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)){
|
|
|
|
+ if("Y".equals(czrk.getIsDel())){
|
|
|
|
+ hjjs++;
|
|
|
|
+ }else{
|
|
|
|
+ hjxz++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.put("hjzrs", hjzrs);
|
|
|
|
+ result.put("hjxz", hjxz);
|
|
|
|
+ result.put("hjjs", hjjs);
|
|
|
|
+ result.put("hjbfb", NumberUtils.percent(hjzrs, shjzrs));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(czrkJzdzList==null){
|
|
|
|
+ czrkJzdzList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ //该镇户籍人口总数
|
|
|
|
+ int czzrs = 0;
|
|
|
|
+
|
|
|
|
+ //该镇 户籍人口今日新增
|
|
|
|
+ int czxz = 0;
|
|
|
|
+ //该镇 户籍人口今日减少
|
|
|
|
+ int czjs = 0;
|
|
|
|
+
|
|
|
|
+ //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
|
|
|
|
+ for (CzrkJzdz czrkJzdz : czrkJzdzList) {
|
|
|
|
+ if(StringUtils.isNotEmpty(czrkJzdz.getTownId()) && czrkJzdz.getTownId().equals(areaId)){
|
|
|
|
+ if("Y".equals(czrkJzdz.getStatus())){
|
|
|
|
+ czzrs++;
|
|
|
|
+ }
|
|
|
|
+ //判断是否是在今天操作的人员信息
|
|
|
|
+ if(s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)){
|
|
|
|
+ if("N".equals(czrkJzdz.getStatus())){
|
|
|
|
+ czjs++;
|
|
|
|
+ }else{
|
|
|
|
+ czxz++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ result.put("czzrs", czzrs);
|
|
|
|
+ result.put("czxz", czxz);
|
|
|
|
+ result.put("czjs", czjs);
|
|
|
|
+ result.put("czbfb", NumberUtils.percent(czzrs, sczzrs));
|
|
|
|
+
|
|
|
|
+ /*int czzrs = czrkMapper.countCz1(deptIdList); // 该镇常住人口总数
|
|
|
|
+ result.put("czzrs", czzrs);
|
|
|
|
+ int czxz = czrkMapper.countByCzXz1(startTime, endTime, deptIdList); // 该镇 常住人口今日新增
|
|
|
|
+ int czjs = czrkMapper.countByCzJs1(startTime, endTime, deptIdList); // 该镇 常住人口今日减少
|
|
|
|
+ result.put("czxz", czxz);
|
|
|
|
+ result.put("czjs", czjs);
|
|
|
|
+ result.put("czbfb", NumberUtils.percent(czzrs, zrs));*/
|
|
|
|
+
|
|
|
|
+ result.put("zhen", deptName);
|
|
|
|
+ /** **/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 常住人口信息
|
|
|
|
+// int type = 4; // 乡镇
|
|
|
|
+// int czzrs = czrkMapper.countCzrk(type, areaId); // 常住人口
|
|
|
|
+// result.put("czzrs", czzrs);
|
|
|
|
+//
|
|
|
|
+// int zrs = 0;
|
|
|
|
+// // 常住人口占总人口的百分比
|
|
|
|
+// if (BooleanUtils.isTrue(percent)) {
|
|
|
|
+// // 查全部
|
|
|
|
+// zrs = czrkMapper.countCzrk(type, areaId);
|
|
|
|
+// String czbfb = NumberUtils.percent(czzrs, zrs);
|
|
|
|
+// result.put("czbfb", czbfb);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+//// type = 4;
|
|
|
|
+// int czxz = czrkMapper.countByCzXz(startTime, endTime, type, areaId);
|
|
|
|
+// int czjs = czrkMapper.countByCzJs(startTime, endTime, type, areaId);
|
|
|
|
+// result.put("czxz", czxz);
|
|
|
|
+// result.put("czjs", czjs);
|
|
|
|
+//
|
|
|
|
+// result.put("zhen", deptName);
|
|
|
|
+//
|
|
|
|
+// // 户籍人口信息
|
|
|
|
+// int hjxz = czrkMapper.countByHjXz(startTime, endTime, type, areaId); // 新增
|
|
|
|
+// int hjjs = czrkMapper.countByHjJs(startTime, endTime, type, areaId);// 减少
|
|
|
|
+// result.put("hjxz", hjxz);
|
|
|
|
+// result.put("hjjs", hjjs);
|
|
|
|
+//
|
|
|
|
+// // 户籍总人数
|
|
|
|
+// int hjzrs = czrkMapper.countHj(startTime, endTime, type, areaId);
|
|
|
|
+//// int hjzrs= isEmpty(hjzrsList) ? 0 : hjzrsList.size();
|
|
|
|
+// result.put("hjzrs", hjzrs);
|
|
|
|
+// String hjbfb = NumberUtils.percent(hjzrs, zrs);
|
|
|
|
+// result.put("hjbfb", hjbfb);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*private void townSts(JSONObject result, SysDept sysDept, boolean percent) {
|
|
|
|
+ String startTime = DateUtils.getTodayStartStr();
|
|
|
|
+ String endTime = DateUtils.getTodayEndStr();
|
|
|
|
+ Timestamp s = Timestamp.valueOf(startTime);
|
|
|
|
+ Timestamp e = Timestamp.valueOf(endTime);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 乡镇以下的所有部门
|
|
|
|
+ List<SysDept> depts = remoteDeptService.listChildrenDepts(deptId);
|
|
|
|
+ List<SysDept> cunDepts = new ArrayList<>(16);
|
|
|
|
+ for (SysDept dept : depts) {
|
|
|
|
+ if (isEmpty(dept.getParentId())) continue;
|
|
|
|
+ if (deptId.equals(dept.getParentId())) {
|
|
|
|
+ cunDepts.add(dept);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.put("cun", isEmpty(cunDepts) ? 0 : cunDepts.size());
|
|
|
|
+
|
|
|
|
+ List<SysDept> zuDept = new ArrayList<>(16);
|
|
|
|
+ for (SysDept cunDept : cunDepts) {
|
|
|
|
+ for (SysDept dept : depts) {
|
|
|
|
+ if (cunDept.getId().equals(dept.getParentId())) {
|
|
|
|
+ zuDept.add(dept);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ result.put("zu", isEmpty(zuDept) ? 0 : zuDept.size());
|
|
|
|
+
|
|
|
|
+ *//** **//*
|
|
|
|
+ int zrs = 0; // 总人数
|
|
|
|
+ if (BooleanUtils.isTrue(percent)) {
|
|
|
|
+ zrs = czrkMapper.countAll();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Long> deptIdList = map(depts, SysDept::getAreaId);
|
|
|
|
+ //查询当前乡镇下的户籍总人数
|
|
|
|
+ List<Czrk> czrkList = czrkMapper.selectCzrkListByDeptId(deptIdList);
|
|
|
|
+ if(czrkList==null){
|
|
|
|
+ czrkList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ //该镇户籍人口总数
|
|
|
|
+ int hjzrs = czrkList.size();
|
|
|
|
+
|
|
|
|
+ //该镇 户籍人口今日新增
|
|
|
|
+ int hjxz = 0;
|
|
|
|
+ //该镇 户籍人口今日减少
|
|
|
|
+ int hjjs = 0;
|
|
|
|
+
|
|
|
|
+ //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
|
|
|
|
+ for (Czrk czrk : czrkList) {
|
|
|
|
+ if("Y".equals(czrk.getIsDel())){
|
|
|
|
+ hjzrs--;
|
|
|
|
+ }
|
|
|
|
+ //判断是否是在今天操作的人员信息
|
|
|
|
+ if(s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)){
|
|
|
|
+ if("Y".equals(czrk.getIsDel())){
|
|
|
|
+ hjjs++;
|
|
|
|
+ }else{
|
|
|
|
+ hjxz++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.put("hjzrs", czrkList.size());
|
|
|
|
+ result.put("hjxz", hjxz);
|
|
|
|
+ result.put("hjjs", hjjs);
|
|
|
|
+ result.put("hjbfb", NumberUtils.percent(hjzrs, zrs));
|
|
|
|
+
|
|
|
|
+ *//*List<Long> deptIdList = map(depts, SysDept::getId);
|
|
|
|
+ int hjzrs = czrkMapper.countHj1(deptIdList); // 该镇户籍人口总数
|
|
|
|
+ result.put("hjzrs", hjzrs);
|
|
|
|
+ int hjxz = czrkMapper.countByHjXz1(startTime, endTime, deptIdList); // 该镇 户籍人口今日新增
|
|
|
|
+ result.put("hjxz", hjxz);
|
|
|
|
+ int hjjs = czrkMapper.countByHjJs1(startTime, endTime, deptIdList); // 该镇 户籍人口今日减少
|
|
|
|
+ result.put("hjjs", hjjs);
|
|
|
|
+ result.put("hjbfb", NumberUtils.percent(hjzrs, zrs));*//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<CzrkJzdz> czrkJzdzList = czrkJzdzService.selectCzrkJzdzListByDeptId(deptIdList);
|
|
|
|
+ if(czrkJzdzList==null){
|
|
|
|
+ czrkJzdzList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ //该镇户籍人口总数
|
|
|
|
+ int czzrs = czrkJzdzList.size();
|
|
|
|
+
|
|
|
|
+ //该镇 户籍人口今日新增
|
|
|
|
+ int czxz = 0;
|
|
|
|
+ //该镇 户籍人口今日减少
|
|
|
|
+ int czjs = 0;
|
|
|
|
+
|
|
|
|
+ //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
|
|
|
|
+ for (CzrkJzdz czrkJzdz : czrkJzdzList) {
|
|
|
|
+ if("Y".equals(czrkJzdz.getStatus())){
|
|
|
|
+ czzrs--;
|
|
|
|
+ }
|
|
|
|
+ //判断是否是在今天操作的人员信息
|
|
|
|
+ if(s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)){
|
|
|
|
+ if("Y".equals(czrkJzdz.getStatus())){
|
|
|
|
+ czjs++;
|
|
|
|
+ }else{
|
|
|
|
+ czxz++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.put("czzrs", czzrs);
|
|
|
|
+ result.put("czxz", czxz);
|
|
|
|
+ result.put("czjs", czjs);
|
|
|
|
+ result.put("czbfb", NumberUtils.percent(czzrs, zrs));
|
|
|
|
+
|
|
|
|
+ *//*int czzrs = czrkMapper.countCz1(deptIdList); // 该镇常住人口总数
|
|
|
|
+ result.put("czzrs", czzrs);
|
|
|
|
+ int czxz = czrkMapper.countByCzXz1(startTime, endTime, deptIdList); // 该镇 常住人口今日新增
|
|
|
|
+ int czjs = czrkMapper.countByCzJs1(startTime, endTime, deptIdList); // 该镇 常住人口今日减少
|
|
|
|
+ result.put("czxz", czxz);
|
|
|
|
+ result.put("czjs", czjs);
|
|
|
|
+ result.put("czbfb", NumberUtils.percent(czzrs, zrs));*//*
|
|
|
|
+
|
|
|
|
+ result.put("zhen", deptName);
|
|
|
|
+ *//** **//*
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 常住人口信息
|
|
|
|
+// int type = 4; // 乡镇
|
|
|
|
+// int czzrs = czrkMapper.countCzrk(type, areaId); // 常住人口
|
|
|
|
+// result.put("czzrs", czzrs);
|
|
|
|
+//
|
|
|
|
+// int zrs = 0;
|
|
|
|
+// // 常住人口占总人口的百分比
|
|
|
|
+// if (BooleanUtils.isTrue(percent)) {
|
|
|
|
+// // 查全部
|
|
|
|
+// zrs = czrkMapper.countCzrk(type, areaId);
|
|
|
|
+// String czbfb = NumberUtils.percent(czzrs, zrs);
|
|
|
|
+// result.put("czbfb", czbfb);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+//// type = 4;
|
|
|
|
+// int czxz = czrkMapper.countByCzXz(startTime, endTime, type, areaId);
|
|
|
|
+// int czjs = czrkMapper.countByCzJs(startTime, endTime, type, areaId);
|
|
|
|
+// result.put("czxz", czxz);
|
|
|
|
+// result.put("czjs", czjs);
|
|
|
|
+//
|
|
|
|
+// result.put("zhen", deptName);
|
|
|
|
+//
|
|
|
|
+// // 户籍人口信息
|
|
|
|
+// int hjxz = czrkMapper.countByHjXz(startTime, endTime, type, areaId); // 新增
|
|
|
|
+// int hjjs = czrkMapper.countByHjJs(startTime, endTime, type, areaId);// 减少
|
|
|
|
+// result.put("hjxz", hjxz);
|
|
|
|
+// result.put("hjjs", hjjs);
|
|
|
|
+//
|
|
|
|
+// // 户籍总人数
|
|
|
|
+// int hjzrs = czrkMapper.countHj(startTime, endTime, type, areaId);
|
|
|
|
+//// int hjzrs= isEmpty(hjzrsList) ? 0 : hjzrsList.size();
|
|
|
|
+// result.put("hjzrs", hjzrs);
|
|
|
|
+// String hjbfb = NumberUtils.percent(hjzrs, zrs);
|
|
|
|
+// result.put("hjbfb", hjbfb);
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ private void setIntoRedis(String key, Object result) {
|
|
|
|
+ redisService.setCacheObject(key, result, 1L, TimeUnit.DAYS);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String packRedisKey(String deptId) {
|
|
|
|
+ return STS_CZRK_ + deptId + ":" + DateUtils.getDate();
|
|
|
|
+ }
|
|
}
|
|
}
|