فهرست منبع

'优化巡检签到、签退信息记录接口,增加签到签退RabbitMQ消息推送'

james 10 ماه پیش
والد
کامیت
5acf82c0a9

+ 16 - 5
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAttendanceServiceImpl.java

@@ -18,11 +18,14 @@ import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.fire.service.PatrolInspectionPersonnelService;
 import com.usky.fire.service.PatrolInspectionTypeService;
 
+import com.usky.fire.service.config.rabbitmq.RabbitMQConfig;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.usky.system.RemoteDeptService;
 
+import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -59,6 +62,12 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
     @Value("${agBox.push}")
     private Integer pushFlag;
 
+    @Resource
+    private RabbitTemplate rabbitTemplate;
+
+    @Autowired
+    private RabbitMQConfig rabbitMQConfig;
+
     @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);
@@ -144,16 +153,18 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
         jsonObj.put("triggerTime", formattedTime);
         Integer eventCode = 17;
         if(patrolInspectionAttendance.getSignInType().equals(0)){
-            eventCode=1;
+            eventCode=31;
         }else {
-            eventCode=2;
+            eventCode=32;
         }
         jsonObj.put("eventCode", eventCode);
         jsonObj.put("name", SecurityUtils.getUsername());
         jsonObj.put("certifiedNo", patrolInspectionAttendance.getIdentificationNumber());
-        if (pushFlag.equals(1)){
-            JSONObject a = remotePatrolAgboxService.addEvent(jsonObj.toJSONString());
-        }
+
+        rabbitTemplate.convertAndSend(rabbitMQConfig.patrolFEventExchange,"",jsonObj.toJSONString());
+//        if (pushFlag.equals(1)){
+//            JSONObject a = remotePatrolAgboxService.addEvent(jsonObj.toJSONString());
+//        }
     }
 
     /**

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

@@ -70,8 +70,8 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
 
     @Override
     public void add(BaseAppInfo baseAppInfo){
-        JSONObject jsonObj = new JSONObject();
-        jsonObj.put("deviceId", baseAppInfo.getDeviceId());
+//        JSONObject jsonObj = new JSONObject();
+//        jsonObj.put("deviceId", baseAppInfo.getDeviceId());
 //        baseAppInfo.setNetworkService(a.toJSONString());
         HttpServletRequest request = getHttpServletRequest();
         String accessIp = getIpAddress(request);
@@ -87,8 +87,8 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
         rabbitTemplate.convertAndSend(rabbitMQConfig.patrolFInfoExchange,"",JSONObject.toJSONString(map));
 
         this.save(baseAppInfo);
-        if (pushFlag.equals(1)){
-            JSONObject a = remotePatrolAgboxService.updateHeart(jsonObj.toJSONString());
-        }
+//        if (pushFlag.equals(1)){
+//            JSONObject a = remotePatrolAgboxService.updateHeart(jsonObj.toJSONString());
+//        }
     }
 }