소스 검색

报警信息临时表分页修改

gao.qiang 1 년 전
부모
커밋
d6ee6deab1
1개의 변경된 파일36개의 추가작업 그리고 3개의 파일을 삭제
  1. 36 3
      vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmTemporaryController.java

+ 36 - 3
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmTemporaryController.java

@@ -2,6 +2,7 @@ package com.ozs.web.controller.accountmanagment;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ozs.common.annotation.Log;
@@ -17,7 +18,6 @@ import com.ozs.common.utils.stateSecrets.SM4Utils;
 import com.ozs.entity.BaseCameraManagement;
 import com.ozs.entity.BaseRailwayManagement;
 import com.ozs.entity.BaseUser;
-import com.ozs.entity.MonitorSystem;
 import com.ozs.entity.MsgAlarm;
 import com.ozs.entity.MsgAlarmExt;
 import com.ozs.entity.MsgAlarmFrequency;
@@ -44,11 +44,10 @@ import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -143,6 +142,10 @@ public class MsgAlarmTemporaryController extends BaseController {
             return error("你的网络卡顿,请不要一直添加!!!");
         }
         idempotenceUtils.createIdempotence(msgAlarmTemporary.getAlarmId());
+        if (!msgAlarmTemporary.getAlarmMile().toString().matches(PATTERNS)) {
+            idempotenceUtils.deleteIdempotence(msgAlarmTemporary.getAlarmId());
+            return error("里程位置填写格式不正确,请填写数字");
+        }
         LambdaQueryWrapper<MsgAlarmTemporary> lw = new LambdaQueryWrapper<>();
         if (!ObjectUtils.isEmpty(msgAlarmTemporary.getAlarmId())) {
             lw.eq(MsgAlarmTemporary::getAlarmId, msgAlarmTemporary.getAlarmId());
@@ -161,6 +164,36 @@ public class MsgAlarmTemporaryController extends BaseController {
     }
 
 
+    /**
+     * 修改报警信息临时表信息
+     *
+     * @param msgAlarmTemporary
+     * @return
+     */
+    @PutMapping("/editMsgAlarmTemporary")
+    @ApiOperation("修改报警信息临时表信息")
+    @Log(title = "报警信息临时表管理", businessType = BusinessType.UPDATE)
+    public AjaxResult editMsgAlarmTemporary(@RequestBody MsgAlarmTemporary msgAlarmTemporary) {
+        MsgAlarmTemporary msgAlarmTemporary1 = msgAlarmTemporaryService.getById(msgAlarmTemporary.getId());
+        if (ObjectUtils.isEmpty(msgAlarmTemporary1)) {
+            return error("主键不存在");
+        }
+        if (!msgAlarmTemporary.getAlarmMile().toString().matches(PATTERNS)) {
+            return error("里程位置填写格式不正确,请填写数字");
+        }
+        QueryWrapper<MsgAlarmTemporary> wrapper=new QueryWrapper<>();
+        wrapper.eq("alarm_id",msgAlarmTemporary.getAlarmId());
+        MsgAlarmTemporary one = msgAlarmTemporaryService.getOne(wrapper);
+        if (!ObjectUtils.isEmpty(one) && !one.getId().equals(msgAlarmTemporary.getId())) {
+            return error("报警唯一标识已存在,不能进行修改操作");
+        }
+        if (msgAlarmTemporaryService.updateById(msgAlarmTemporary)) {
+            return AjaxResult.success();
+        }
+        return AjaxResult.error();
+    }
+
+
     @GetMapping("/alarm/{id}")
     @ApiOperation("报警推送假数据")
     public String alarm(@PathVariable Long id) {