Browse Source

光纤报警存入

develop
王兴琳 3 weeks ago
parent
commit
d00309428b
  1. 15
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  2. 6
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

15
zc-business/src/main/java/com/zc/business/controller/DcEventController.java

@ -7,14 +7,17 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.DcEvent; import com.zc.business.domain.DcEvent;
import com.zc.business.domain.DcNoStakeWarningTable;
import com.zc.business.enums.UniversalEnum; import com.zc.business.enums.UniversalEnum;
import com.zc.business.service.IDcEventService; import com.zc.business.service.IDcEventService;
import com.zc.business.service.impl.DcNoStakeWarningTableServiceImpl;
import com.zc.common.core.websocket.WebSocketService; import com.zc.common.core.websocket.WebSocketService;
import com.zc.common.core.websocket.constant.WebSocketEvent; import com.zc.common.core.websocket.constant.WebSocketEvent;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -39,7 +42,8 @@ public class DcEventController extends BaseController
{ {
@Autowired @Autowired
private IDcEventService dcEventService; private IDcEventService dcEventService;
@Resource
private DcNoStakeWarningTableServiceImpl dcNoStakeWarningTableService;
/** /**
* 查询事件信息列表 * 查询事件信息列表
*/ */
@ -285,6 +289,15 @@ if (eventState==UniversalEnum.ZERO.getNumber()){
contentMap.put("contentType", title); contentMap.put("contentType", title);
contentMap.put("message", message); contentMap.put("message", message);
contentMap.put("warningTime", new Date()); contentMap.put("warningTime", new Date());
DcNoStakeWarningTable dcNoStakeWarningTable = new DcNoStakeWarningTable();
dcNoStakeWarningTable.setWarningDescription(message);
dcNoStakeWarningTable.setWarningType(UniversalEnum.FOUR.getValue());
dcNoStakeWarningTable.setOtherConfig(payload.toString());
dcNoStakeWarningTable.setWarningTime(new Date());
//存入记录
dcNoStakeWarningTableService.addDcNoStakeWarningTable(dcNoStakeWarningTable);
WebSocketService.broadcast("opticalFiberAlarm", contentMap); WebSocketService.broadcast("opticalFiberAlarm", contentMap);
return AjaxResult.success(); return AjaxResult.success();
} }

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

@ -460,6 +460,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE warning_type = 1 WHERE warning_type = 1
AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 14 DAY) AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 14 DAY)
UNION ALL UNION ALL
SELECT 'OpticalFiber' AS WarningTypeSource, id, warning_description, warning_type, warning_time, create_time, other_config
FROM dc_no_stake_warning_table
WHERE warning_type = 4
AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 3 DAY)
UNION ALL
SELECT 'Weather Warning' AS WarningTypeSource, id, warning_description, warning_type, warning_time, create_time, other_config SELECT 'Weather Warning' AS WarningTypeSource, id, warning_description, warning_type, warning_time, create_time, other_config
FROM dc_no_stake_warning_table FROM dc_no_stake_warning_table
WHERE warning_type = 2 AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 3 DAY) WHERE warning_type = 2 AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 3 DAY)
@ -469,6 +474,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE warning_type = 3 WHERE warning_type = 3
AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 2 DAY) AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 2 DAY)
ORDER BY warning_time DESC ORDER BY warning_time DESC
</select> </select>
<select id="selectVideoReviewEventTypeList" resultMap="DcWarningResult" parameterType="com.zc.business.domain.DcWarning"> <select id="selectVideoReviewEventTypeList" resultMap="DcWarningResult" parameterType="com.zc.business.domain.DcWarning">

Loading…
Cancel
Save