|
@@ -0,0 +1,61 @@
|
|
|
+package com.ozs.web.controller.accountmanagment;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.ozs.common.annotation.Log;
|
|
|
+import com.ozs.common.core.controller.BaseController;
|
|
|
+import com.ozs.common.core.domain.AjaxResult;
|
|
|
+import com.ozs.common.enums.BusinessType;
|
|
|
+import com.ozs.common.utils.IdempotenceUtils;
|
|
|
+import com.ozs.common.utils.StringUtils;
|
|
|
+import com.ozs.entity.BaseRailwayManagement;
|
|
|
+import com.ozs.entity.vo.MsgAlarmTemporary;
|
|
|
+import com.ozs.service.MsgAlarmTemporaryService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author Administrator
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/service/msgAlarmTemporary")
|
|
|
+public class MsgAlarmTemporaryController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IdempotenceUtils idempotenceUtils;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MsgAlarmTemporaryService msgAlarmTemporaryService;
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/saveMsgAlarmTemporary")
|
|
|
+ @ApiOperation("新增报警信息临时表信息")
|
|
|
+ @Log(title = "报警信息临时表管理", businessType = BusinessType.INSERT)
|
|
|
+ public AjaxResult saveMsgAlarmTemporary(@RequestBody MsgAlarmTemporary msgAlarmTemporary) {
|
|
|
+ String idempotence = idempotenceUtils.getIdempotence(msgAlarmTemporary.getAlarmId());
|
|
|
+ if (StringUtils.isNotEmpty(idempotence)) {
|
|
|
+ return error("你的网络卡顿,请不要一直添加!!!");
|
|
|
+ }
|
|
|
+ idempotenceUtils.createIdempotence(msgAlarmTemporary.getAlarmId());
|
|
|
+ LambdaQueryWrapper<MsgAlarmTemporary> lw = new LambdaQueryWrapper<>();
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmTemporary.getAlarmId())) {
|
|
|
+ lw.eq(MsgAlarmTemporary::getAlarmId, msgAlarmTemporary.getAlarmId());
|
|
|
+ MsgAlarmTemporary msgAlarmTemporary1 = msgAlarmTemporaryService.getOne(lw);
|
|
|
+ if (!ObjectUtils.isEmpty(msgAlarmTemporary1)) {
|
|
|
+ idempotenceUtils.deleteIdempotence(msgAlarmTemporary.getAlarmId());
|
|
|
+ return error("报警唯一标识已存在,不能重复添加");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (msgAlarmTemporaryService.save(msgAlarmTemporary)) {
|
|
|
+ idempotenceUtils.deleteIdempotence(msgAlarmTemporary.getAlarmId());
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ idempotenceUtils.deleteIdempotence(msgAlarmTemporary.getAlarmId());
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+}
|