Browse Source

去除多余新增

develop
wangsixiang 3 months ago
parent
commit
36661a6d53
  1. 2
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  2. 6
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  3. 3
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

2
zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java

@ -159,4 +159,6 @@ public interface DcWarningMapper
public HashMap selectDispatchId(@Param("eventId")String eventId);
Long selectWarningNum();
//事件验证是否存在
public String selectEventId(@Param("eventId")String eventId);
}

6
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -564,11 +564,15 @@ public class DcWarningServiceImpl implements IDcWarningService {
if (UniversalEnum.SIX.getValue().equals(dcWarning.getWarningSource().toString())) {
return AjaxResult.error("非机预警无需转换");
}
String selectEventId = dcWarningMapper.selectEventId(dcWarning.getId());//验证转换的对象是否已经在事件表中存在
if (StringUtils.isNotBlank(selectEventId)){
return AjaxResult.success();
}
ArrayList<HashMap<String, Object>> hashMaps = new ArrayList<>();
dcWarning.setUserId(SecurityUtils.getUserId());
int updateState = dcWarningMapper.updateState(dcWarning);//感知事件状态改变为已完成
if (updateState == UniversalEnum.ZERO.getNumber()) {
return AjaxResult.error(UniversalEnum.OPERATION_FAILURE.getValue());
return AjaxResult.success();
}
String stakeMark = dcWarning.getStakeMark();
DcEvent dcEvent = new DcEvent();

3
zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

@ -444,5 +444,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWarningNum" resultType="java.lang.Long">
select count(*) from dc_warning where warning_state = 1 and warning_source != 6
</select>
<select id="selectEventId" resultType="java.lang.String">
select id from dc_event where id=#{eventId}
</select>
</mapper>

Loading…
Cancel
Save