Browse Source

扫码报警事件对接

develop
lau572 4 months ago
parent
commit
3c754d37c2
  1. 7
      zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java

7
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.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -44,7 +45,9 @@ public class CodeScanningAlarmController extends BaseController {
DcWarning dcWarning = new DcWarning(); DcWarning dcWarning = new DcWarning();
dcWarning.setId(id); dcWarning.setId(id);
dcWarning.setOtherConfig(String.valueOf(JSONObject.parseObject(JSONObject.toJSONString(returnParameters)))); dcWarning.setOtherConfig(String.valueOf(JSONObject.parseObject(JSONObject.toJSONString(returnParameters))));
if (dcWarningService.selectAlarmById(id) == null) {
HashMap<String, Object> oldData = dcWarningService.selectAlarmById(id);
if (oldData == null) {
dcWarning.setStakeMark(String.valueOf(returnParameters.get("stakeNum"))); dcWarning.setStakeMark(String.valueOf(returnParameters.get("stakeNum")));
String roadCode = String.valueOf(returnParameters.get("roadCode")); String roadCode = String.valueOf(returnParameters.get("roadCode"));
dcWarning.setDirection(Objects.equals(roadCode, UniversalEnum.ONE.getValue()) ? UniversalEnum.THREE.getValue() : UniversalEnum.ONE.getValue()); 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()); dcWarning.setWarningState(UniversalEnum.ONE.getNumber());
return AjaxResult.success(dcWarningService.insertDcWarning(dcWarning)); return AjaxResult.success(dcWarningService.insertDcWarning(dcWarning));
} else { } else {
dcWarning.setId(oldData.get("id").toString());
return AjaxResult.success(dcWarningService.updateDcWarning(dcWarning)); return AjaxResult.success(dcWarningService.updateDcWarning(dcWarning));
} }
} }

Loading…
Cancel
Save