|
@@ -3,6 +3,7 @@ package com.boman.web.core.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
+import com.alibaba.nacos.common.http.HttpUtils;
|
|
|
import com.boman.common.core.utils.DateUtils;
|
|
|
import com.boman.common.core.utils.StringUtils;
|
|
|
import com.boman.common.core.utils.number.NumberUtils;
|
|
@@ -16,20 +17,25 @@ import com.boman.domain.SysUser;
|
|
|
import com.boman.domain.dto.FormDataDto;
|
|
|
import com.boman.system.api.RemoteDeptService;
|
|
|
import com.boman.system.api.RemoteUserService;
|
|
|
+import com.boman.web.core.domain.BirthRecords;
|
|
|
import com.boman.web.core.mapper.CzrkMapper;
|
|
|
import com.boman.web.core.mapper.GridInfoMapper;
|
|
|
+import com.boman.web.core.service.birth.BirthRecordsService;
|
|
|
import com.boman.web.core.service.common.ICommonService;
|
|
|
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 com.boman.web.core.utils.HttpClientUtils;
|
|
|
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 javax.annotation.Resource;
|
|
|
+import java.io.IOException;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -72,6 +78,9 @@ public class TaskService {
|
|
|
@Resource
|
|
|
private RemoteUserService remoteUserService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private BirthRecordsService birthRecordsService;
|
|
|
+
|
|
|
@Resource
|
|
|
private ICommonService commonService;
|
|
|
private static final String tableName= "attendance_table";
|
|
@@ -530,163 +539,6 @@ public class TaskService {
|
|
|
// 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);
|
|
|
}
|
|
@@ -694,4 +546,27 @@ public class TaskService {
|
|
|
private String packRedisKey(String deptId) {
|
|
|
return STS_CZRK_ + deptId + ":" + DateUtils.getDate();
|
|
|
}
|
|
|
+
|
|
|
+ public void getNewborn(){
|
|
|
+ Map<String, String> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("client_id","acdf50bd13be4901b64c62b1fee862c0");
|
|
|
+ paramMap.put("client_secret","a3650d67fc034b2d8ea259182b3d99f3");
|
|
|
+ String http = "http://172.27.189.244:9090/oauth/tocken";
|
|
|
+ try {
|
|
|
+ String data = HttpClientUtils.doGet(http,paramMap);
|
|
|
+
|
|
|
+ List<BirthRecords> birthRecordsList = JSONObject.parseArray(data,BirthRecords.class);
|
|
|
+ for (BirthRecords birthRecords : birthRecordsList) {
|
|
|
+ birthRecords.setIsDel("N");
|
|
|
+ birthRecords.setCreateBy("系统");
|
|
|
+ birthRecords.setUpdateBy("系统");
|
|
|
+ birthRecords.setStatus(1);
|
|
|
+ }
|
|
|
+ //批量保存
|
|
|
+ birthRecordsService.insertListBirthRecords(birthRecordsList);
|
|
|
+ System.out.println(data);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|