diff --git a/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java b/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java index f6037af8..a0ae62d8 100644 --- a/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java +++ b/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java @@ -16,6 +16,7 @@ import javax.annotation.Resource; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -44,7 +45,9 @@ public class CodeScanningAlarmController extends BaseController { DcWarning dcWarning = new DcWarning(); dcWarning.setId(id); dcWarning.setOtherConfig(String.valueOf(JSONObject.parseObject(JSONObject.toJSONString(returnParameters)))); - if (dcWarningService.selectAlarmById(id) == null) { + + HashMap oldData = dcWarningService.selectAlarmById(id); + if (oldData == null) { dcWarning.setStakeMark(String.valueOf(returnParameters.get("stakeNum"))); String roadCode = String.valueOf(returnParameters.get("roadCode")); dcWarning.setDirection(Objects.equals(roadCode, UniversalEnum.ONE.getValue()) ? UniversalEnum.THREE.getValue() : UniversalEnum.ONE.getValue()); @@ -89,6 +92,8 @@ public class CodeScanningAlarmController extends BaseController { dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); return AjaxResult.success(dcWarningService.insertDcWarning(dcWarning)); } else { + dcWarning.setId(oldData.get("id").toString()); + return AjaxResult.success(dcWarningService.updateDcWarning(dcWarning)); } }