src/main/java/org/springblade/common/utils/InvestigateUtil.java
@@ -13,12 +13,61 @@ */ public class InvestigateUtil { public static String httpGet(String idCardNo) { /** * 人员审查 * @param idCardNo 人员身份证号 * @return */ public static String httpGet(String idCardNo,Integer pageNum,Integer pageSize) { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("http://47.49.27.44:8000/dbapi/dmc_zdrybjhc?page_num=1&page_size=1000&sfzh="+idCardNo) .url("http://47.49.27.44:8000/dbapi/dmc_bjhc?page_num="+pageNum+"&page_size="+pageSize+"&sfzh="+idCardNo) .get() .addHeader("Authorization","Bearer eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiIsInVjIjoiMzYwNjAyMTk4OTA3MDgxMDE4IiwidG9rZW5fdHlwZSI6MX0.eyJpc3MiOiIybXhiRW1RUXZjc01JMFJ1OHFQamZBTWQ4TExib2p6aSIsImlhdCI6MTYyODU4NDk4Nn0.yy8cAdZLUkCMGdkChOGkTlPeGW3tga_RvQOau4ROGpM") .addHeader("Authorization","Bearer eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiIsInVjIjoiMzYwNjAyMTk4OTA3MDgxMDE4IiwidG9rZW5fdHlwZSI6MX0.eyJpc3MiOiJITGdGVGYwZWwwNTRDYlNWNUptMUY1eXA3UjRWNnpuMyIsImlhdCI6MTYyOTc5NDk4MH0.KOyEdkXDc5FP98KFLYOBnDgthJZF6VDOxJvlYFrXmrA") .build(); try{ Response response = client.newCall(request).execute(); return response.body().string(); } catch(Exception e) { } return null; } /** * 人员审查 * @param idCardNo 人员身份证号 * @return */ public static String httpGetOne(String idCardNo) { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("http://47.49.27.44:8000/dbapi/dmc_bjhc?page_num=1&page_size=1000&sfzh="+idCardNo) .get() .addHeader("Authorization","Bearer eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiIsInVjIjoiMzYwNjAyMTk4OTA3MDgxMDE4IiwidG9rZW5fdHlwZSI6MX0.eyJpc3MiOiJITGdGVGYwZWwwNTRDYlNWNUptMUY1eXA3UjRWNnpuMyIsImlhdCI6MTYyOTc5NDk4MH0.KOyEdkXDc5FP98KFLYOBnDgthJZF6VDOxJvlYFrXmrA") .build(); try{ Response response = client.newCall(request).execute(); return response.body().string(); } catch(Exception e) { } return null; } /** * 枪支定位 * @param idCardNo 护卫员身份证号 * @param deptName 所在单位名称 * @param startTime 定位开始时间 * @param endTime 定位结束时间 */ public static String httpGetGunPosition(String idCardNo,String deptName,String startTime,String endTime,Integer pageNum,Integer pageSize) { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("http://47.49.27.44:8000/dbapi/dmc_qzdw?page_num="+pageNum+"&page_size="+pageSize+"&hwysfzh="+idCardNo+"&szdw="+deptName+"&kssj="+startTime+"&jssj="+endTime) .get() .addHeader("Authorization","Bearer eyJ0eXAiOiJqd3QiLCJhbGciOiJIUzI1NiIsInVjIjoiMzYwNjAyMTk4OTA3MDgxMDE4IiwidG9rZW5fdHlwZSI6MX0.eyJpc3MiOiI3aWN5MXplc3N2eVBPVlJKUVk2aHpPRTJhc0JMdkw1MyIsImlhdCI6MTYyOTI1MTMzOX0.DLasFawQHexpRBFORQU64tbSR_n76bpway42GfIwPf4") .build(); try{ Response response = client.newCall(request).execute(); src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -881,7 +881,7 @@ FROM blade_user u LEFT JOIN blade_dept d ON d.id = u.dept_id LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction WHERE u.examination_type = 1 and u.is_deleted=0 WHERE u.examination_type = 1 and u.is_deleted=0 and u.status = 1 <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1123598813738675201'"> and u.jurisdiction =#{jurisdiction} </if> src/main/java/org/springblade/modules/investigate/Investigate.java
@@ -10,10 +10,7 @@ import org.springblade.modules.system.entity.User; import org.springblade.modules.system.service.IUserService; import org.springframework.retry.backoff.Sleeper; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.function.BiConsumer; @@ -31,16 +28,33 @@ private final IUserService userService; /** * * 单个人员审查 * @param idCardNo 身份证号码 * @return */ @GetMapping("/investigate") public String getInvestigate(String idCardNo){ System.out.println("idCardNo = " + idCardNo); return InvestigateUtil.httpGet(idCardNo); public String getInvestigate(String idCardNo, @RequestParam(defaultValue = "1")Integer pageNum, @RequestParam(defaultValue = "10")Integer pageSize){ return InvestigateUtil.httpGetOne(idCardNo); } /** * 枪支定位 * @param idCardNo 护卫员身份证号 * @param deptName 所在单位名称 * @param startTime 定位开始时间 * @param endTime 定位结束时间 */ @GetMapping("/investigate/gun") public String getInvestigateGun(String idCardNo, String deptName, String startTime, String endTime, @RequestParam(defaultValue = "1")Integer pageNum, @RequestParam(defaultValue = "10")Integer pageSize){ return InvestigateUtil.httpGetGunPosition(idCardNo,deptName,startTime,endTime,pageNum,pageSize); } @@ -81,44 +95,68 @@ // } /** * * 人员审查 * @return */ @GetMapping("/investigate/byUser") public R investigateByUser(){ public R investigateByUser(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "1000")Integer pageSize){ //查询用户数据,未删除的,未审核的 List<User> users = userService.getNotAuditAllUserList(); //遍历 users.forEach(InvestigateUtil.consumerWithIndex((user,index) ->{ if (index==80){ try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } String body = InvestigateUtil.httpGet(user.getCardid()); JSONObject jsonObject = new JSONObject(body); Object data = jsonObject.get("data"); JSONObject jsonData = new JSONObject(data.toString()); JSONArray res = jsonData.getJSONArray("res"); if (res.length()==0){ //没有数据正常 user.setExaminationType("0"); }else { user.setExaminationType("1"); for (int i = 0; i < res.length(); i++) { if(res.getJSONObject(i).get("zdxsfzqkry").toString()!=null && res.getJSONObject(i).get("zdxsfzqkry").toString()!=""){ user.setExaminationMx(res.getJSONObject(i).get("zdxsfzqkry").toString()); //更新用户数据 userService.updateById(user); break; if (null!=user.getCardid() && user.getCardid()!="") { if (index == 1000) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } String body = InvestigateUtil.httpGetOne(user.getCardid()); JSONObject jsonObject = new JSONObject(body); Object data = jsonObject.get("data"); JSONObject jsonData = new JSONObject(data.toString()); JSONArray res = jsonData.getJSONArray("res"); if (res.length() == 0) { //没有数据正常 user.setExaminationType("0"); } else { user.setExaminationType("1"); for (int i = 0; i < res.length(); i++) { if (res.getJSONObject(i).get("zdrylbjh").toString() != null && res.getJSONObject(i).get("zdrylbjh").toString() != "") { user.setExaminationMx(res.getJSONObject(i).get("zdrylbjh").toString()); //更新用户数据 userService.updateById(user); break; } if (res.getJSONObject(i).get("zdryxlmc").toString() != null && res.getJSONObject(i).get("zdryxlmc").toString() != "") { user.setExaminationMx(res.getJSONObject(i).get("zdryxlmc").toString()); //更新用户数据 userService.updateById(user); break; } if (res.getJSONObject(i).get("ztrylx").toString() != null && res.getJSONObject(i).get("ztrylx").toString() != "") { user.setExaminationMx(res.getJSONObject(i).get("ztrylx").toString()); //更新用户数据 userService.updateById(user); break; } if (res.getJSONObject(i).get("ajlbmc").toString() != null && res.getJSONObject(i).get("ajlbmc").toString() != "") { user.setExaminationMx(res.getJSONObject(i).get("ajlbmc").toString()); //更新用户数据 userService.updateById(user); break; } } } //更新用户数据 userService.updateById(user); } //更新用户数据 userService.updateById(user); })); return R.data(users.size()); } src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -165,7 +165,7 @@ public R submit(@Valid @RequestBody User user) { CacheUtil.clear(USER_CACHE); //资格审查 String body = InvestigateUtil.httpGet(user.getCardid()); String body = InvestigateUtil.httpGetOne(user.getCardid()); JSONObject jsonObject = new JSONObject(body); String data = jsonObject.get("data").toString(); JSONObject jsonData = new JSONObject(data); @@ -175,7 +175,7 @@ user.setExaminationType("0"); }else { user.setExaminationType("1"); user.setExaminationMx(res.getJSONObject(0).get("zdxsfzqkry").toString()); user.setExaminationMx(res.getJSONObject(0).get("zdrylbjh").toString()); } return R.status(userService.submit(user)); } src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -155,6 +155,7 @@ on si.departmentid = bu.dept_id where is_deleted = 0 and status = 1 <if test="user.realName!=null and user.realName != ''"> and bu.real_name like concat(concat('%', #{user.realName}),'%') </if> @@ -172,9 +173,6 @@ </if> <if test="user.sex!=null and user.sex != ''"> and bu.sex = #{user.sex} </if> <if test="user.status!=null and user.status != ''"> and bu.status = #{user.status} </if> <if test="user.hold!=null and user.hold != ''"> and bu.hold = #{user.hold} @@ -266,10 +264,9 @@ select id,cardid from blade_user where is_deleted = 0 </select> <!--查询用户数据,未删除的,未审核的--> <!--查询用户数据,未审核的--> <select id="getNotAuditAllUserList" resultType="org.springblade.modules.system.entity.User"> select id,cardid from blade_user where is_deleted = 0 and (examination_type!='0' or examination_type is null) select id,cardid from blade_user where examination_type is null </select> </mapper>