From cf1573cbaad982a0599e312cd34713cb23c9bc54 Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Thu, 25 Jan 2024 17:24:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AF=E6=8E=92=E6=9F=A5?= =?UTF-8?q?=E6=9C=AA=E5=9C=A8=E7=94=B5=E5=AD=90=E5=9B=B4=E6=A0=8F=E7=A6=81?= =?UTF-8?q?=E6=AD=A2=E6=8E=92=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/check/AppListManagerController.java | 10 ++++++++-- .../com/zcloud/controller/system/LoginController.java | 1 + .../zcloud/service/system/impl/UsersServiceImpl.java | 2 +- src/main/java/com/zcloud/util/PLSUtil.java | 8 ++++---- src/main/java/com/zcloud/util/Tools.java | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/zcloud/controller/check/AppListManagerController.java b/src/main/java/com/zcloud/controller/check/AppListManagerController.java index 41833b9..db9ae49 100644 --- a/src/main/java/com/zcloud/controller/check/AppListManagerController.java +++ b/src/main/java/com/zcloud/controller/check/AppListManagerController.java @@ -1,5 +1,6 @@ package com.zcloud.controller.check; +import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; @@ -12,6 +13,7 @@ import com.zcloud.service.risk.RiskPointService; import com.zcloud.service.system.DepartmentService; import com.zcloud.service.system.UsersService; import com.zcloud.util.DateUtil; +import com.zcloud.util.PLSUtil; import com.zcloud.util.ReturnMap; import com.zcloud.util.Tools; import org.springframework.beans.factory.annotation.Autowired; @@ -568,8 +570,12 @@ public class AppListManagerController extends BaseController { @LogAnno(menuType = "手机", menuServer = "隐患排查", instructionsOperate = "清单管理", instructionsType = "判断是人员是否在电子围栏中") public Object isInElectronicFence() throws Exception { PageData pd = this.getPageData(); - - return ReturnMap.error("当前人员不在电子围栏中禁止排查清单"); + if (!Tools.notEmpty(pd.getString("PLS_ID"))) { + return ReturnMap.error("当前人员未绑定定位卡号"); + } + boolean jsonObject = PLSUtil.determineWhetherThePersonIsInTheElectronicFence(pd.getString("CORPINFO_ID"), Integer.valueOf(pd.getString("PLS_ID")), pd.getString("ELECTRONIC_FENCE_ID")); + if (jsonObject) return ReturnMap.ok(); + return ReturnMap.error("当前人员不在电子围栏中禁止排查清单"); } /** diff --git a/src/main/java/com/zcloud/controller/system/LoginController.java b/src/main/java/com/zcloud/controller/system/LoginController.java index af3d15f..f627c64 100644 --- a/src/main/java/com/zcloud/controller/system/LoginController.java +++ b/src/main/java/com/zcloud/controller/system/LoginController.java @@ -135,6 +135,7 @@ public class LoginController extends BaseController { map.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); map.put("CORP_NAME", cpd.getString("CORP_NAME")); map.put("PROVINCE", cpd.getString("PROVINCE")); + map.put("PLS_ID", pd.getOrDefault("PLS_ID","")); // PageData dpd = new PageData(); // dpd.put("DEPARTMENT_ID", pd.getString("DEPARTMENT_ID")); // dpd=departmentService.findById(dpd); diff --git a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java index 89619ee..88929a0 100644 --- a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java @@ -251,7 +251,7 @@ public class UsersServiceImpl implements UsersService { public String changeOrUpdUserCardNo(PageData nowuser) throws Exception { PageData oldUser = usersMapper.findById(nowuser); // 先判断人员新的定位卡号是否有变化,没变化直接可以修改 - if (oldUser.getString("CARDNO").equals(nowuser.getString("CARDNO"))) { + if (oldUser.getString("CARDNO") == null || oldUser.getOrDefault("CARDNO","").equals(nowuser.getString("CARDNO"))) { return Const.CAN_CHENG_USER; } // 有变化看库里是否有人在用这个新卡号 diff --git a/src/main/java/com/zcloud/util/PLSUtil.java b/src/main/java/com/zcloud/util/PLSUtil.java index 2035f71..19caedb 100644 --- a/src/main/java/com/zcloud/util/PLSUtil.java +++ b/src/main/java/com/zcloud/util/PLSUtil.java @@ -62,19 +62,19 @@ public class PLSUtil { } /** - * @Description: 电子围栏列表 + * @Description: 根据定位卡号获取人是否再电子围栏里 * @Author: dearLin * @Date: 2024/1/25/025 14:37 * @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount] * @Return: com.alibaba.fastjson.JSONObject */ - public static JSONObject determineWhetherThePersonIsInTheElectronicFence(String CORPINFO_ID, Integer PLS_ID, String ELECTRONIC_FENCE_ID) throws Exception { + public static Boolean determineWhetherThePersonIsInTheElectronicFence(String CORPINFO_ID, Integer PLS_ID, String ELECTRONIC_FENCE_ID) throws Exception { HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getToken(CORPINFO_ID)); HttpEntity httpEntity = new HttpEntity<>(headers); - ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/region/api/electronicFence/determineWhetherThePersonIsInTheElectronicFence2?psn=" + + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/region/api/electronicFence/determineWhetherThePersonIsInTheElectronicFence2?psn=" + PLS_ID + - "&uuid=" + ELECTRONIC_FENCE_ID, HttpMethod.GET, httpEntity, JSONObject.class); + "&uuid=" + ELECTRONIC_FENCE_ID, HttpMethod.GET, httpEntity, Boolean.class); return exchange.getBody(); } diff --git a/src/main/java/com/zcloud/util/Tools.java b/src/main/java/com/zcloud/util/Tools.java index eb80b85..30993d8 100644 --- a/src/main/java/com/zcloud/util/Tools.java +++ b/src/main/java/com/zcloud/util/Tools.java @@ -36,7 +36,7 @@ public class Tools { * @return 不为空则返回true,否则返回false */ public static boolean notEmpty(String s){ - return s!=null && !"".equals(s) && !"null".equals(s); + return s!=null && !"".equals(s) && !"null".equals(s)&& !"undefined".equals(s); } /**