Explorar o código

报警接口修改

gao.qiang hai 10 meses
pai
achega
016f4b11f9

+ 19 - 17
vehicle-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -339,24 +339,26 @@ public class GeoHazardMonitorTokenController {
                 msgAlarm.setRailwayCode(reqMsgAlarmVo.getAlarmRailway());
                 String source = split[split.length - 2];
                 msgAlarm.setSource(source);
-                Files[] files1 = reqMsgAlarmVo.getFiles();
-                if (files1.length > 0) {
-                    for (int i = 0; i < files1.length; i++) {
-                        if (ObjectUtils.isEmpty(files1[i].fileUrl)) {
-                            AjaxResults1 = new AjaxResults(0, "上传文件地址不能为空!!!");
-                            return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
-                        }
-                        if (files1[i].fileType < 1 || files1[i].fileType > 3) {
-                            AjaxResults1 = new AjaxResults(0, "文件类型填写错误!!!");
-                            return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
+                if (!ObjectUtils.isEmpty(reqMsgAlarmVo.getFiles())) {
+                    Files[] files1 = reqMsgAlarmVo.getFiles();
+                    if (files1.length > 0) {
+                        for (int i = 0; i < files1.length; i++) {
+                            if (ObjectUtils.isEmpty(files1[i].fileUrl)) {
+                                AjaxResults1 = new AjaxResults(0, "上传文件地址不能为空!!!");
+                                return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
+                            }
+                            if (files1[i].fileType < 1 || files1[i].fileType > 3) {
+                                AjaxResults1 = new AjaxResults(0, "文件类型填写错误!!!");
+                                return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
+                            }
+                            MsgAlarmExt msgAlarmExt = new MsgAlarmExt();
+                            msgAlarmExt.setAlarmId(msgAlarm.getAlarmId());
+                            msgAlarmExt.setAlarmAttPath(files1[i].fileUrl);
+                            msgAlarmExt.setAlarmAttType(files1[i].fileType);
+                            msgAlarmExt.setCreateTime(new Date());
+                            stringList.add(files1[i].fileUrl);
+                            msgAlarmExtService.save(msgAlarmExt);
                         }
-                        MsgAlarmExt msgAlarmExt = new MsgAlarmExt();
-                        msgAlarmExt.setAlarmId(msgAlarm.getAlarmId());
-                        msgAlarmExt.setAlarmAttPath(files1[i].fileUrl);
-                        msgAlarmExt.setAlarmAttType(files1[i].fileType);
-                        msgAlarmExt.setCreateTime(new Date());
-                        stringList.add(files1[i].fileUrl);
-                        msgAlarmExtService.save(msgAlarmExt);
                     }
                 }
                 msgAlarm.setImageUrls(stringList);