zhuang hai 11 meses
pai
achega
bb564d0747

+ 7 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxApiDao.java

@@ -1,6 +1,7 @@
 package com.rongwei.bscommon.sys.dao;
 
 import com.rongwei.bsentity.vo.ZhcxOutsideInspectionVo;
+import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -67,4 +68,10 @@ public interface ZhcxApiDao {
             " AND DELETED = '0' AND t.STATUS = '正常' "+
             "</script>")
     List<Map<String, Object>> getSupervisionJJYBySupervisionId(@Param("ids") List<String> ids);
+
+    @Select("SELECT count(*) FROM ZHCX_IP WHERE IP = #{ip}")
+    int getIp(@Param("ip") String ip);
+
+    @Insert("INSERT INTO ZHCX_IP (ID,IP) VALUES (#{id},#{ip})")
+    void saveIp(@Param("id")String id,@Param("ip")String ip);
 }

+ 4 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxApiService.java

@@ -39,4 +39,8 @@ public interface ZhcxApiService {
     void initPwd();
 
     JSONObject syncUserData(String data);
+
+    int getIp(String clientIp);
+
+    void saveIp(String clientIp);
 }

+ 11 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxApiServiceImpl.java

@@ -552,6 +552,17 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
         return json;
     }
 
+    @Override
+    public int getIp(String clientIp) {
+        return zhcxApiDao.getIp(clientIp);
+    }
+
+    @Override
+    public void saveIp(String clientIp) {
+        String uuid = SecurityUtil.getUUID();
+        zhcxApiDao.saveIp(uuid,clientIp);
+    }
+
     private List<RectifyApiDataDto> processFirstDeptData(List<ZhcxProjectRectifyMachineVo> list, ZhcxProjectManageDo projectManageDo) {
         Map<String, List<ZhcxProjectRectifyMachineVo>> groupFirstDeptList = list.stream()
                 .filter(e -> Objects.nonNull(e.getFirstdeptid()))

+ 19 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxApiController.java

@@ -1,5 +1,6 @@
 package com.rongwei.bsserver.controller;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.rongwei.bscommon.sys.service.BsOrganizationService;
 import com.rongwei.bscommon.sys.service.DmTableService;
@@ -186,4 +187,22 @@ public class ZhcxApiController {
         JSONObject result = zhcxApiService.syncUserData(data);
         return result;
     }
+
+    @PostMapping("/getIp")
+    public R getIp(@RequestBody Map<String,Object> map){
+        Object uuip = map.get("uuip");
+        JSONObject jsonData = new JSONObject();
+        jsonData.put("ifReFresh", false);
+        if (ObjectUtil.isEmpty(uuip)) {
+            return R.ok(jsonData);
+        }
+        String ip = (String) uuip;
+        int count = zhcxApiService.getIp(ip);
+        if(count == 0){
+            zhcxApiService.saveIp(ip);
+            jsonData.put("ifReFresh", true);
+            return R.ok(jsonData);
+        }
+        return R.ok(jsonData);
+    }
 }