|
@@ -1,20 +1,25 @@
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-import com.ruoyi.common.core.domain.entity.SysDictType;
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.alibaba.fastjson2.JSONArray;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.alibaba.fastjson2.TypeReference;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.utils.http.HttpClientUtils;
|
|
|
+import com.ruoyi.common.utils.http.HttpUtils;
|
|
|
+import com.ruoyi.system.domain.UserInfo;
|
|
|
import com.ruoyi.system.mapper.SysDictTypeMapper;
|
|
|
-import com.ruoyi.system.service.ISysDictTypeService;
|
|
|
+import com.ruoyi.system.mapper.UserInfoMapper;
|
|
|
import com.ruoyi.system.service.IUserInfoService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.ruoyi.system.mapper.UserInfoMapper;
|
|
|
-import com.ruoyi.system.domain.UserInfo;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 导入人员信息Service业务层处理
|
|
@@ -51,6 +56,8 @@ public class UserInfoServiceImpl implements IUserInfoService
|
|
|
@Override
|
|
|
public List<UserInfo> selectUserInfoList(UserInfo userInfo)
|
|
|
{
|
|
|
+ SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
+ userInfo.setDeptId(String.valueOf(user.getDeptId()));
|
|
|
return userInfoMapper.selectUserInfoList(userInfo);
|
|
|
}
|
|
|
|
|
@@ -104,22 +111,84 @@ public class UserInfoServiceImpl implements IUserInfoService
|
|
|
return userInfoMapper.deleteUserInfoById(id);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 核酸比对人员导入
|
|
|
+ * @param jobStyle 职业类别
|
|
|
+ * @param focusCrowdStyle 重点人群分类
|
|
|
+ * @param detectionNumber 检测频次(次数)
|
|
|
+ * @param detectionScope 检测频次(时间范围)
|
|
|
+ * @param startTime 比对开始时间
|
|
|
+ * @param endTime 比对结束时间
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
@Override
|
|
|
public String importUser(List<UserInfo> userList, String jobStyle, String focusCrowdStyle, String detectionNumber,
|
|
|
- String detectionScope, String startTime, String endTime) {
|
|
|
+ String detectionScope, String startTime, String endTime) throws Exception{
|
|
|
|
|
|
//todo 获取当前上传人员部门id
|
|
|
SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
String deptId = String.valueOf(user.getDeptId());
|
|
|
|
|
|
- //todo 向医院查询上传名单人员核酸数据(将时间段内所有人员数据查询出来),之后与上传人员名单比较,提取身份证号相同的数据
|
|
|
- List<Map<String,Object>> yyMap = new ArrayList<>();
|
|
|
+ //计算两个时间相隔的天数
|
|
|
|
|
|
- for (UserInfo userInfo : userList) {
|
|
|
- for (Map<String, Object> yMap : yyMap) {
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date date1 = simpleDateFormat.parse(startTime);
|
|
|
+ Date date2 = simpleDateFormat.parse(endTime);
|
|
|
+ int dNum = DateUtils.differentDaysByMillisecond(date1,date2);
|
|
|
+
|
|
|
+ if(dNum<=Integer.getInteger(detectionScope)){
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
+
|
|
|
+ String token = getToken();
|
|
|
+ String http = "http://60.171.171.235:9090/service/api/wjw/qsyyhsdbfx";
|
|
|
+ Map<String, String> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("client_id", "066676ef5f7947e794b879550078cfb8");
|
|
|
+ paramMap.put("access_token", token);
|
|
|
+ paramMap.put("sfzhm", "340323200806306216");
|
|
|
+
|
|
|
+ paramMap.put("sjhm", "13585154184");
|
|
|
+ paramMap.put("xm", "陶建筑");
|
|
|
+
|
|
|
+ paramMap.put("start_time", "2022-01-01 10:00:59");
|
|
|
+ paramMap.put("end_time", "2022-08-14 10:00:59");
|
|
|
+ String data = HttpClientUtils.doGet(http, paramMap);
|
|
|
+ List<Map<String,Object>> list = JSON.parseObject(data,new TypeReference<ArrayList<Map<String,Object>>>(){});
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //todo 向医院查询上传名单人员核酸数据(将时间段内所有人员数据查询出来),之后与上传人员名单比较,提取身份证号相同的数据
|
|
|
+ /*List<Map<String,Object>> yyMap = new ArrayList<>();
|
|
|
+ StringBuilder params = new StringBuilder();
|
|
|
+ for (UserInfo userInfo : userList) {
|
|
|
+ params.append("client_id=066676ef5f7947e794b879550078cfb8").append("&access_token=").append(token);
|
|
|
+ params.append("&sfzhm=").append(userInfo.getIdCard()).append("&sjhm=").append(userInfo.getPhoneNum());
|
|
|
+ params.append("&xm=").append(userInfo.getName()).append("&beginTime=").append(startTime).append("&endTime=").append(endTime);
|
|
|
+ String data = HttpUtils.sendGet(http, params.toString());
|
|
|
+ List<Map<String,Object>> list = JSON.parseObject(data,new TypeReference<ArrayList<Map<String,Object>>>(){});
|
|
|
+
|
|
|
+ //释放StringBuilder资源,重置params长度
|
|
|
+ params.setLength(0);
|
|
|
+ }*/
|
|
|
return "操作成功";
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取政务网token
|
|
|
+ */
|
|
|
+ public String getToken() {
|
|
|
+ String token = "";
|
|
|
+ StringBuilder params = new StringBuilder();
|
|
|
+ params.append("client_id=066676ef5f7947e794b879550078cfb8&client_secret=r9jCwdTO");
|
|
|
+ String http = "http://60.171.171.235:9090/oauth/token";
|
|
|
+ String data = HttpUtils.sendGet(http, params.toString());
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ token = jsonObject.getString("access_token");
|
|
|
+ return token;
|
|
|
+ }
|
|
|
}
|