Browse Source

推送agbox操作改为动态可配置

hanzhengyi 1 year ago
parent
commit
94329b4727

+ 8 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAttendanceServiceImpl.java

@@ -19,6 +19,7 @@ import com.usky.fire.service.PatrolInspectionPersonnelService;
 import com.usky.fire.service.PatrolInspectionTypeService;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.usky.system.RemoteDeptService;
 
@@ -54,6 +55,10 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
 
     @Autowired
     private RemotePatrolAgBoxService remotePatrolAgboxService;
+
+    @Value("${agBox.push}")
+    private Integer pushFlag;
+
     @Override
     public IPage<Map<String, Object>> pageList(Integer pageNum, Integer pageSize, String operateCode, String operator, LocalDateTime startTime, LocalDateTime endTime) {
         IPage<PatrolInspectionAttendance> page = new Page<>(pageNum, pageSize);
@@ -146,7 +151,9 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
         jsonObj.put("eventCode", eventCode);
         jsonObj.put("name", SecurityUtils.getUsername());
         jsonObj.put("certifiedNo", patrolInspectionAttendance.getIdentificationNumber());
-        JSONObject a = remotePatrolAgboxService.addEvent(jsonObj.toJSONString());
+        if (pushFlag.equals(1)){
+            JSONObject a = remotePatrolAgboxService.addEvent(jsonObj.toJSONString());
+        }
     }
 
     /**

+ 7 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseAppInfoServiceImpl.java

@@ -8,6 +8,7 @@ import com.usky.iot.mapper.BaseAppInfoMapper;
 import com.usky.iot.service.BaseAppInfoService;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.context.request.RequestAttributes;
 import org.springframework.web.context.request.RequestContextHolder;
@@ -30,6 +31,9 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
     @Autowired
     private RemotePatrolAgBoxService remotePatrolAgboxService;
 
+    @Value("${agBox.push}")
+    private Integer pushFlag;
+
     public String getIpAddress(HttpServletRequest request) {
         String ip = request.getHeader("X-Forwarded-For");
         if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
@@ -65,6 +69,8 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
         baseAppInfo.setCreateTime(LocalDateTime.now());
         baseAppInfo.setTenantId(SecurityUtils.getTenantId());
         this.save(baseAppInfo);
-        JSONObject a = remotePatrolAgboxService.updateHeart(jsonObj.toJSONString());
+        if (pushFlag.equals(1)){
+            JSONObject a = remotePatrolAgboxService.updateHeart(jsonObj.toJSONString());
+        }
     }
 }