소스 검색

feat:“日志上传新接口”

soobin 1 년 전
부모
커밋
18fb89689e
1개의 변경된 파일31개의 추가작업 그리고 0개의 파일을 삭제
  1. 31 0
      src/main/java/com/szwl/controller/TEquipmentController.java

+ 31 - 0
src/main/java/com/szwl/controller/TEquipmentController.java

@@ -1715,6 +1715,37 @@ public class TEquipmentController {
         return R.ok();
     }
 
+    /**
+     * 上传日志
+     *
+     * @param equipmentId
+     * @param day
+     */
+    @ApiOperation(value = "上传日志")
+    @GetMapping("/uploadLog")
+    public ResponseModel<?> uploadLog(String equipmentId, String day) {
+        if (StringUtils.isEmpty(equipmentId)) {
+            return R.fail(A0001);
+        }
+        TEquipment tEquipment = tEquipmentService.getById(equipmentId);
+        if (tEquipment == null) {
+            return R.fail(A0001, "该设备不存在");
+        }
+        String clientId = tEquipment.getClientId();
+        String kind = day + "-" + clientId;
+        String channel = tEquipment.getChannel();
+        String equimentType = tEquipment.getEquimentType();
+        if (StringUtils.isEmpty(channel) || channel.equals("1") || StringUtils.isEmpty(equimentType)) {
+            //用个推
+            PushUtils.push(tEquipment.getGtClientId(), "", "", PushUtils.buildJson("log", kind).toString());
+        }
+        if (StringUtils.isNotEmpty(channel) && channel.equals("2") && StringUtils.isNotEmpty(equimentType)) {
+            //用Mq
+            tEquipmentService.sentMessage(tEquipment.getClientId(), PushUtils.buildJson("log", kind).toString());
+        }
+        return R.ok();
+    }
+
     @ApiOperation(value = "查询日志是否上传成功")
     @GetMapping("/queryLog")
     public ResponseModel<?> queryLog(String equipmentId, String day) {