diff --git a/zc-business/src/main/java/com/zc/business/controller/AESEncryptionController.java b/zc-business/src/main/java/com/zc/business/controller/AESEncryptionController.java new file mode 100644 index 00000000..9d2cf0b0 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/AESEncryptionController.java @@ -0,0 +1,53 @@ +package com.zc.business.controller; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.system.service.ISysConfigService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; +import java.util.Base64; + +/** + * + */ +@Api(tags = "收费运营接口") +@RestController +@RequestMapping("/AESEncryption") +public class AESEncryptionController extends BaseController { + @Autowired + private ISysConfigService configService; + + @GetMapping() + public AjaxResult AESEncryption() throws Exception{ + String secretKey= configService.selectConfigByKey("AESKey");//密钥 + String iv= configService.selectConfigByKey("AESIv");// 偏移量(初始化向量) + String plainText = SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey(); // 要加密的文本 + // 转换密钥和IV为字节数组 + byte[] keyBytes = secretKey.getBytes(StandardCharsets.UTF_8); + byte[] ivBytes = iv.getBytes(StandardCharsets.UTF_8); + // 创建密钥规格 + SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES"); + // 创建初始化向量规格 + IvParameterSpec ivSpec = new IvParameterSpec(ivBytes); + // 创建并初始化Cipher对象,指定为AES/CBC/PKCS5Padding模式 + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); + // 将要加密的文本转换为字节数组 + byte[] plainBytes = plainText.getBytes(StandardCharsets.UTF_8); + // 执行加密操作 + byte[] encryptedBytes = cipher.doFinal(plainBytes); + // 将加密后的字节数组使用Base64编码,并输出为字符串 + String encryptedBase64 = Base64.getEncoder().encodeToString(encryptedBytes); + String url=configService.selectConfigByKey("AESEncryption")+encryptedBase64; + return AjaxResult.success(url); + } +} diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index bb41e2b5..4feddd9e 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -11,6 +11,7 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.zc.business.constant.DeviceTypeConstants; import com.zc.business.domain.DcDevice; import com.zc.business.interfaces.OperationLog; @@ -30,6 +31,7 @@ import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.util.*; @@ -182,6 +184,20 @@ public class DcDeviceController extends BaseController { } + /** + * 导出 + * @param response 响应 + * @param iotDevice 导入数据结果 + */ + @PreAuthorize("@ss.hasPermi('iot:device:export')") + @Log(title = "导出设备", businessType = BusinessType.EXPORT) + @PostMapping("export") + public void exportDevice(HttpServletResponse response, DcDevice iotDevice) { + List list = dcDeviceService.listDevice(iotDevice); + ExcelUtil util = new ExcelUtil<>(DcDevice.class); + util.exportExcel(response, list, "设备数据"); + } + //***********************************物联设备接口************************************** @@ -444,6 +460,7 @@ public class DcDeviceController extends BaseController { @PathVariable String deviceId, @PathVariable String functionId, @RequestBody HashMap props) throws HttpException, IOException { + //public AjaxResult invokedFunction(@PathVariable String deviceId,@PathVariable String functionId,@RequestBody HashMap props,int operType) throws HttpException, IOException { todo return getAjaxResult(deviceId, functionId, props); @@ -481,6 +498,7 @@ public class DcDeviceController extends BaseController { @ApiOperation("批量设备功能调用") @PostMapping("/batchFunctions") @OperationLog(operUrl = "/business/device/batchFunctions") + //public AjaxResult batchInvokedFunction(@RequestBody Map props,int operType) throws HttpException, IOException, InterruptedException { todo public AjaxResult batchInvokedFunction(@RequestBody Map props) throws HttpException, IOException, InterruptedException { ArrayList devices = (ArrayList) props.get("devices"); ArrayList functions = (ArrayList) props.get("functions"); @@ -499,9 +517,12 @@ public class DcDeviceController extends BaseController { resultArray.add(result); AjaxResult ajaxResult = (AjaxResult) result.get("result"); if (!Objects.equals(String.valueOf(ajaxResult.get("code")), "200")) { - return AjaxResult.error(); + if (Objects.equals(device.getString("deviceType"), "15")) { + return AjaxResult.error(200, "500"); + } else { + return AjaxResult.error(); + } } - } } return AjaxResult.success(resultArray); @@ -512,9 +533,16 @@ public class DcDeviceController extends BaseController { }); JSONObject result = new JSONObject(); result.put("device", device.getString("id")); - result.put("functionId",functionId); + result.put("functionId", functionId); if (device.getInteger("deviceType").equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING)) { - result.put("result", broadcastController.nearCamListDistance(jsonObject)); + JSONObject value = broadcastController.nearCamListDistance(jsonObject); + AjaxResult ajaxResult = new AjaxResult(); + value.keySet().forEach(item -> { + ajaxResult.put(item, value.getString(item)); + }); + ajaxResult.put("code", 200); + + result.put("result", ajaxResult); } else { result.put("result", getAjaxResult(iotDeviceId, functionId, params)); } @@ -614,6 +642,7 @@ public class DcDeviceController extends BaseController { @OperationLog(operUrl = "/business/device/batchFunctions") public AjaxResult batchInvokedFunction(Object object) throws HttpException, IOException, InterruptedException { + //public AjaxResult batchInvokedFunction(Object object,int operType) throws HttpException, IOException, InterruptedException { todo Map map = new ObjectMapper().convertValue(object, Map.class); return batchInvokedFunction(map); } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java b/zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java index 9f5b213f..e21493ce 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEmergencyPlansController.java @@ -132,10 +132,19 @@ public class DcEmergencyPlansController extends BaseController { */ @ApiOperation("根据事件id-查询预案事件关联表") @GetMapping("/event/assoc/{id}") - public AjaxResult eventConfirm(@PathVariable("id") String id) { + public AjaxResult eventConfirmByEventId(@PathVariable("id") String id) { return AjaxResult.success(dcEmergencyPlansService.selectEventPlanAssocByEventId(id)); } + /** + * 根据id-查询预案事件关联表 + */ + @ApiOperation("根据id-查询预案事件关联表") + @GetMapping("/event/assocId/{assocId}") + public AjaxResult eventConfirmById(@PathVariable("assocId") Long assocId) { + return AjaxResult.success(dcEmergencyPlansService.selectEventPlanAssocById(assocId)); + } + /** * 感知事件确定 */ diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java index 0428137a..629bf40c 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java @@ -98,15 +98,12 @@ public class DcEventController extends BaseController @ApiOperation("获取事件以及子类详细信息") //@PreAuthorize("@ss.hasPermi('system:event:query')") - @GetMapping( "/eventSubclass/{eventType}/{id}") - @ApiImplicitParams({ - @ApiImplicitParam(name = "eventType", value = "事件类型", dataType = "int"), - @ApiImplicitParam(name = "id", value = "事件id", dataType = "String"), - }) + @GetMapping( "/eventSubclass/{id}") + @ApiImplicitParams(@ApiImplicitParam(name = "id", value = "事件id", dataType = "String")) - public AjaxResult getEventById(@PathVariable int eventType,@PathVariable("id") String id) + public AjaxResult getEventById(@PathVariable("id") String id) { - DcEvent dcEvent = dcEventService.selectEventSubclassById(eventType,id); + DcEvent dcEvent = dcEventService.selectEventSubclassById(id); return AjaxResult.success(dcEvent); } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventImportantFileController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventImportantFileController.java index 2ea37c94..e276c604 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventImportantFileController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventImportantFileController.java @@ -9,16 +9,10 @@ import javax.servlet.http.HttpServletResponse; import com.zc.business.utils.PoiUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -86,7 +80,7 @@ public class DcEventImportantFileController extends BaseController { InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("wordTemplate/importantTemplate.docx"); - XWPFDocument document = null; + XWPFDocument document = null; try { @@ -138,7 +132,7 @@ public class DcEventImportantFileController extends BaseController @PostMapping public AjaxResult add(@RequestBody DcEventImportantFile dcEventImportantFile) { - return toAjax(dcEventImportantFileService.insertDcEventImportantFile(dcEventImportantFile)); + return dcEventImportantFileService.insertDcEventImportantFile(dcEventImportantFile); } /** @@ -149,7 +143,7 @@ public class DcEventImportantFileController extends BaseController @PutMapping public AjaxResult edit(@RequestBody DcEventImportantFile dcEventImportantFile) { - return toAjax(dcEventImportantFileService.updateDcEventImportantFile(dcEventImportantFile)); + return dcEventImportantFileService.updateDcEventImportantFile(dcEventImportantFile); } /** @@ -171,4 +165,12 @@ public class DcEventImportantFileController extends BaseController public AjaxResult getImportantFileStatus(@PathVariable("eventId") String eventId){ return dcEventImportantFileService.getImportantFileStatus(eventId); } + + @ApiOperation("生成重要事件文件内容") + @PostMapping("/generate") + public AjaxResult generate(@ApiParam(value="事件id", name="eventId", required=true) @RequestParam("eventId") String eventId, + @ApiParam(value="类型 1:初报,2续报,3终报", name="type", required=true) @RequestParam("type") String type){ + return dcEventImportantFileService.generate(eventId,type); + } + } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java index 79e0fcf7..08f1bf54 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java @@ -2,6 +2,7 @@ package com.zc.business.controller; import java.io.IOException; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.config.RuoYiConfig; @@ -100,6 +101,12 @@ public class DcEventProcessController extends BaseController @Log(title = "事件处理流程", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcEventProcess dcEventProcess){ + if (dcEventProcess.getProcessType() != null && dcEventProcess.getProcessType() == 1){ + int status = dcEventProcessService.selectPreviousNodeStatus(dcEventProcess.getEventId(),dcEventProcess.getProcessId()); + if (status < 1){ + return AjaxResult.error("前置节点未点亮!"); + } + } return toAjax(dcEventProcessService.insertDcEventProcess(dcEventProcess)); } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcMeteorologicalDetectorController.java b/zc-business/src/main/java/com/zc/business/controller/DcMeteorologicalDetectorController.java index 4eaaf8d2..8e29a03a 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcMeteorologicalDetectorController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcMeteorologicalDetectorController.java @@ -32,6 +32,13 @@ public class DcMeteorologicalDetectorController extends BaseController { List> list = dcMeteorologicalDetectorDataService.selectStatistics(deviceName); return getDataTable(list); } + @ApiOperation("根据设备名称查询详细信息列表") + @GetMapping("/device/{deviceName}") + public TableDataInfo deviceNameList(@PathVariable("deviceName") String deviceName) + { + List list = dcMeteorologicalDetectorDataService.selectDeviceNameList(deviceName); + return getDataTable(list); + } @ApiOperation("统计气象设备当天最新信息列表") @GetMapping("/listLatest") public TableDataInfo listAll(DcMeteorologicalDetectorData dcMeteorologicalDetectorData) @@ -46,5 +53,25 @@ public class DcMeteorologicalDetectorController extends BaseController { List list = dcMeteorologicalDetectorDataService.selectlistVisibility(dcMeteorologicalDetectorData); return getDataTable(list); } - + @ApiOperation("每小时统计气象设备信息列表") + @GetMapping("/deviceHour") + public TableDataInfo deviceHour(String deviceName,String specificDate) + { + List> list = dcMeteorologicalDetectorDataService.selectStatisticsTime(deviceName,specificDate); + return getDataTable(list); + } + @ApiOperation("按月统计每天气象设备信息列表") + @GetMapping("/deviceDay") + public TableDataInfo deviceDay(String deviceName,String specificDate) + { + List> list = dcMeteorologicalDetectorDataService.selectStatisticsDay(deviceName,specificDate); + return getDataTable(list); + } + @ApiOperation("按年统计每月气象设备信息列表") + @GetMapping("/deviceYears") + public TableDataInfo deviceYears(String deviceName,String specificDate) + { + List> list = dcMeteorologicalDetectorDataService.selectStatisticsYears(deviceName,specificDate); + return getDataTable(list); + } } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcOperLogController.java b/zc-business/src/main/java/com/zc/business/controller/DcOperLogController.java index 789580f5..451a612a 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcOperLogController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcOperLogController.java @@ -40,7 +40,7 @@ public class DcOperLogController extends BaseController { @ApiOperation("分页查询列表") @PreAuthorize("@ss.hasPermi('iot:facility:list')") @GetMapping("list") - public TableDataInfo listFacility(DcOperLog dcOperLog,@RequestParam(value = "endTime", required = false)Date endTime,@RequestParam(value = "startTime", required = false)Date startTime) { + public TableDataInfo listFacility( DcOperLog dcOperLog,@RequestParam(value = "endTime", required = false)Date endTime,@RequestParam(value = "startTime", required = false)Date startTime) { return getDataTable(dcOperLogService.pageDcOperLog(dcOperLog,endTime,startTime)); } @@ -53,7 +53,7 @@ public class DcOperLogController extends BaseController { @ApiOperation("无分页查询列表") @PreAuthorize("@ss.hasPermi('iot:facility:query')") @GetMapping("query") - public AjaxResult queryFacility(DcOperLog dcOperLog, @RequestParam(value = "endTime", required = false) Date endTime, @RequestParam(value = "startTime", required = false)Date startTime) { + public AjaxResult queryFacility( DcOperLog dcOperLog, @RequestParam(value = "endTime", required = false) Date endTime, @RequestParam(value = "startTime", required = false)Date startTime) { return AjaxResult.success(dcOperLogService.listDcOperLog(dcOperLog,endTime,startTime)); } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java b/zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java index 94908506..ad006952 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java @@ -1,5 +1,6 @@ package com.zc.business.controller; +import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpServletResponse; @@ -25,7 +26,7 @@ import com.ruoyi.common.core.page.TableDataInfo; /** * 信息发布管理记录Controller - * + * * @author ruoyi * @date 2024-04-19 */ @@ -59,18 +60,7 @@ public class DcPublishManageController extends BaseController } return AjaxResult.success(dcPublishManageService.selectEventDcPublishManageList(dcPublishManage)); } - /** - * 导出信息发布管理记录列表 - */ - @PreAuthorize("@ss.hasPermi('business:manage:export')") - @Log(title = "信息发布管理记录", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, DcPublishManage dcPublishManage) - { - List list = dcPublishManageService.selectDcPublishManageList(dcPublishManage); - ExcelUtil util = new ExcelUtil<>(DcPublishManage.class); - util.exportExcel(response, list, "信息发布管理记录数据"); - } + /** * 获取信息发布管理记录详细信息 @@ -114,4 +104,69 @@ public class DcPublishManageController extends BaseController { return toAjax(dcPublishManageService.deleteDcPublishManageByIds(ids)); } + //统计服务,今日发布渠道分析 + @PostMapping("/statisticsPublishManage") + public AjaxResult statisticsPublishManage() + { + return AjaxResult.success(dcPublishManageService.statisticsPublishManage()); + } + //统计服务,今日发布事件类型分析 + @PostMapping("/eventTypePublishManage") + public AjaxResult eventTypePublishManage() + { + return AjaxResult.success(dcPublishManageService.eventTypePublishManage()); + } + //统计服务,今日发布趋势分析 + @PostMapping("/trendsPublishManage") + public AjaxResult releaseTrendsPublishManage() + { + return AjaxResult.success(dcPublishManageService.releaseTrendsPublishManage()); + } + //统计服务,月发布渠道趋势分析 + @PostMapping("/monthTrendsPublishManage") + public AjaxResult monthTrendsPublishManage(@RequestBody DcPublishManage dcPublishManage) + { + if (dcPublishManage==null||dcPublishManage.getPublishTime()==null){ + return AjaxResult.error("参数错误"); + } + return AjaxResult.success(dcPublishManageService.monthTrendsPublishManage(dcPublishManage)); + } + //统计服务,事件类型对应的发布渠道发布的数量 + @PostMapping("/eventTypePublishManageSum") + public AjaxResult eventTypePublishManageSum() + { + return AjaxResult.success(dcPublishManageService.eventTypePublishManageSum()); + } + //统计服务,事件类型对应的发布渠道发布的数量按月统计 + @PostMapping("/eventTypePublishManageMonth") + public AjaxResult eventTypePublishManageMonth(@RequestBody DcPublishManage dcPublishManage) + { + if (dcPublishManage==null||dcPublishManage.getPublishTime()==null){ + return AjaxResult.error("参数错误"); + } + return AjaxResult.success(dcPublishManageService.eventTypePublishManageMonth(dcPublishManage)); + } + /** + * 公众服务统计查询 + */ + @PostMapping("/statisticsList") + public TableDataInfo statisticsList(@RequestBody DcPublishManage dcPublishManage) + { + startPage(); + List list = dcPublishManageService.selectDcPublishManageStatistics(dcPublishManage); + return getDataTable(list); + } + /** + * 公众服务统计导出 + */ + @PreAuthorize("@ss.hasPermi('business:manage:export')") + @Log(title = "信息发布管理记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcPublishManage dcPublishManage) + { + List list = dcPublishManageService.selectDcPublishManageStatistics(dcPublishManage); + ExcelUtil util = new ExcelUtil<>(DcPublishManage.class); + util.exportExcel(response, list, "信息发布管理记录数据"); + } + } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java b/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java index c7ccae60..afe6ae94 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java @@ -1,7 +1,11 @@ package com.zc.business.controller; +import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.utils.DateUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -38,8 +42,8 @@ public class DcPublishingChannelsController extends BaseController * 查询发布渠道列表 */ @PreAuthorize("@ss.hasPermi('business:channels:list')") - @GetMapping("/list") - public TableDataInfo list(DcPublishingChannels dcPublishingChannels) + @PostMapping("/list") + public TableDataInfo list(@RequestBody DcPublishingChannels dcPublishingChannels) { startPage(); List list = dcPublishingChannelsService.selectDcPublishingChannelsList(dcPublishingChannels); @@ -96,11 +100,7 @@ public class DcPublishingChannelsController extends BaseController @PutMapping public AjaxResult edit(@RequestBody DcPublishingChannels dcPublishingChannels) { - List channelsList = dcPublishingChannelsService. - selectChannelsDataCategory(dcPublishingChannels.getDataCategory()); - if (channelsList!=null&&channelsList.size()>0){ - return AjaxResult.error("事件类型已存在"); - } + return toAjax(dcPublishingChannelsService.updateDcPublishingChannels(dcPublishingChannels)); } @@ -114,4 +114,32 @@ public class DcPublishingChannelsController extends BaseController { return toAjax(dcPublishingChannelsService.deleteDcPublishingChannelsByIds(ids)); } + /** + * 修改启用停用 + */ + @PostMapping("/updateEnabled") + public AjaxResult updateEnabled(@RequestBody DcPublishingChannels dcPublishingChannels) + { + Integer enabled = dcPublishingChannels.getEnabled();//状态 + if (enabled==null){ + return AjaxResult.error("参数错误"); + } + if (enabled==2){ //启用状态,修改启用时间 + dcPublishingChannels.setEnableDate(DateUtils.getNowDate()); + } + return toAjax(dcPublishingChannelsService.updateEnabled(dcPublishingChannels)); + } + //事件调度处置事件推送发布渠道 + @PostMapping("/eventPublishChannels") + public AjaxResult eventPublishChannels(@RequestBody HashMap map) + { + if (map==null||map.size()==0){ + return AjaxResult.error("参数错误"); + } + String eventId = map.get("eventId").toString(); + if (StringUtils.isBlank(eventId)){ + return AjaxResult.error("参数错误"); + } + return AjaxResult.success(dcPublishingChannelsService.eventPublishChannels(eventId)); + } } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcRegionController.java b/zc-business/src/main/java/com/zc/business/controller/DcRegionController.java new file mode 100644 index 00000000..4e9c1032 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcRegionController.java @@ -0,0 +1,118 @@ +package com.zc.business.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.zc.business.domain.DcRegion; +import com.zc.business.service.impl.DcRegionServiceImpl; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +/** + * 地区信息Controller + * + * @author zhaoxianglong + */ +@Api(tags = {"地区信息"}) +@RestController +@RequestMapping("/business/region") +public class DcRegionController extends BaseController { + @Resource + private DcRegionServiceImpl dcRegionService; + + //*********************************道路增删改查****************************************** + + /** + * 分页查询道路列表 + * + * @param dcRegion 请求参数 + * @return 分页查询结果 + */ + @ApiOperation("分页查询道路列表") + @PreAuthorize("@ss.hasPermi('iot:road:list')") + @GetMapping("list") + public TableDataInfo listRoad(DcRegion dcRegion) { + return getDataTable(dcRegionService.list()); + } + + /** + * 无分页查询道路列表 + * + * @param dcRegion 请求参数 + * @return 查询结果 + */ + @ApiOperation("无分页查询道路列表") + @PreAuthorize("@ss.hasPermi('iot:road:query')") + @GetMapping("query") + public AjaxResult queryRoad(DcRegion dcRegion) { + return AjaxResult.success(dcRegionService.list()); + } + + /** + * 根据id查询道路信息 + * + * @param id id + * @return 查询结果 + */ + @ApiOperation("根据id查询道路信息") + @PreAuthorize("@ss.hasPermi('iot:road:query')") + @GetMapping("{id}") + public AjaxResult getRoad(@PathVariable String id) { + return AjaxResult.success(dcRegionService.getById(id)); + } + + + /** + * 新增 + * + * @param dcRegion 新增参数 + * @return 新增操作结果 + */ + @ApiOperation("新增") + @PreAuthorize("@ss.hasPermi('iot:road:add')") + @Log(title = "新增道路", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult addRoad(@Valid @RequestBody DcRegion dcRegion) { + return toAjax(dcRegionService.save(dcRegion)); + } + + /** + * 修改 + * + * @param dcRegion 修改参数 + * @return 修改操作结果 + */ + @ApiOperation("修改") + @PreAuthorize("@ss.hasPermi('iot:road:edit')") + @Log(title = "修改道路", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult editRoad(@Valid @RequestBody DcRegion dcRegion) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(DcRegion::getId,dcRegion.getId()); + return toAjax(dcRegionService.update(dcRegion,lambdaQueryWrapper)); + } + + /** + * 删除 + * + * @param ids id集 + * @return 删除操作结果 + */ + @ApiOperation("删除") + @PreAuthorize("@ss.hasPermi('iot:road:remove')") + @Log(title = "删除", businessType = BusinessType.DELETE) + @DeleteMapping("{ids}") + public AjaxResult removeRoad(@PathVariable List ids) { + return toAjax(dcRegionService.removeByIds(ids)); + } + +} diff --git a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java index 1cb74c8c..74cc2479 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java @@ -174,4 +174,13 @@ public class DcWarningController extends BaseController } return toAjax(dcWarningService.insertDispatchSource(map)); } + //感知事件误报 + @PostMapping("/falseAlarm") + public AjaxResult falseAlarmResolution(@RequestBody DcWarning dcWarning){ + if (dcWarning==null||dcWarning.getRelieveType()==null||StringUtils.isBlank(dcWarning.getId())){ + return AjaxResult.error("参数错误"); + } + return toAjax(dcWarningService.falseAlarmResolution(dcWarning)); + } + } diff --git a/zc-business/src/main/java/com/zc/business/controller/StatusController.java b/zc-business/src/main/java/com/zc/business/controller/StatusController.java index 957be29a..c86f20f8 100644 --- a/zc-business/src/main/java/com/zc/business/controller/StatusController.java +++ b/zc-business/src/main/java/com/zc/business/controller/StatusController.java @@ -1,4 +1,5 @@ package com.zc.business.controller; + import com.github.pagehelper.util.StringUtil; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -21,7 +22,10 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; @@ -130,19 +134,27 @@ public class StatusController extends BaseController { List listStatus = statusService.deviceStatusListById(status); // Calculate average successRate by day - Map averageSuccessRateByDay = listStatus.stream() - .collect(Collectors.groupingBy(s -> s.getTime().getDayOfMonth(), + Map averageSuccessRateByDay = listStatus.stream() + .collect(Collectors.groupingBy(s -> { + // 使用 DateTimeFormatter 格式化日期 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String formattedDate = s.getTime().format(formatter); + return formattedDate; + }, Collectors.averagingDouble(s -> Double.parseDouble(s.getSuccessRate().replace("%", ""))))); if (averageSuccessRateByDay.isEmpty()) { return AjaxResult.success("暂无数据"); } - // Round average successRate to two decimal places - Map roundedAverageSuccessRateByDay = averageSuccessRateByDay.entrySet().stream() - .collect(Collectors.toMap(Map.Entry::getKey, entry -> Math.round(entry.getValue() * 100.0) / 100.0)); + averageSuccessRateByDay.keySet().forEach(item -> { + + BigDecimal bigDecimal = new BigDecimal(averageSuccessRateByDay.get(item)); + averageSuccessRateByDay.put(item, bigDecimal.setScale(2, RoundingMode.HALF_UP).doubleValue()); + + }); - return AjaxResult.success(roundedAverageSuccessRateByDay); + return AjaxResult.success(new TreeMap<>(averageSuccessRateByDay)); } //按类型划分设备 diff --git a/zc-business/src/main/java/com/zc/business/domain/DcBatchFunctionsJob.java b/zc-business/src/main/java/com/zc/business/domain/DcBatchFunctionsJob.java index ea43a28f..3b896fb1 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcBatchFunctionsJob.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcBatchFunctionsJob.java @@ -1,6 +1,7 @@ package com.zc.business.domain; import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -15,8 +16,8 @@ public class DcBatchFunctionsJob { private Long jobId; @ApiModelProperty("任务组ID") private String jobGroup; - //@Excel(name = "任务名称") - @TableField(exist = false) + @Excel(name = "任务名称") + //@TableField(exist = false) private String jobName; @ApiModelProperty("调用目标字符串") private String invokeTarget; diff --git a/zc-business/src/main/java/com/zc/business/domain/DcDevice.java b/zc-business/src/main/java/com/zc/business/domain/DcDevice.java index ed37f702..0bd60eb7 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcDevice.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcDevice.java @@ -3,6 +3,7 @@ package com.zc.business.domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.ruoyi.common.annotation.Excel; import com.zc.business.utils.StakeMarkUtils; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -28,55 +29,80 @@ public class DcDevice { public static final String ONLINE = "1"; @ApiModelProperty("ID") + @Excel(name = "设备ID") @TableId(value = "id", type = IdType.AUTO) private Long id; @ApiModelProperty("物联设备ID") + @Excel(name = "物联设备ID") private String iotDeviceId; @ApiModelProperty("组ID") + @Excel(name = "组ID") private Long groupId; @ApiModelProperty("产品ID") + @Excel(name = "产品ID") private Long productId; @ApiModelProperty("桩号") + @Excel(name = "桩号") private String stakeMark; @ApiModelProperty("方向1-上行(菏泽方向),2-中,3-下行(济南方向)") + @Excel(name = "方向") private String direction; @ApiModelProperty("设备名称") + @Excel(name = "设备名称") private String deviceName; @ApiModelProperty("设备编号") + @Excel(name = "设备编号") private String deviceCode; @ApiModelProperty("设备类型") + @Excel(name = "设备类型") private String deviceType; @ApiModelProperty("所属网段") + @Excel(name = "所属网段") private String networkSegment; @ApiModelProperty("设备图片") + @Excel(name = "设备图片") private String deviceImg; @ApiModelProperty("安装日期") + @Excel(name = "安装日期") private Date installationDate; @ApiModelProperty("生产日期") + @Excel(name = "生产日期") private Date productionDate; @ApiModelProperty("使用年限") + @Excel(name = "使用年限") private String durableYears; @ApiModelProperty("安装位置") + @Excel(name = "安装位置") private String installationSite; @ApiModelProperty("设备状态") + @Excel(name = "设备状态") private String deviceState; @ApiModelProperty("使用状态") + @Excel(name = "使用状态") private Integer useState; @ApiModelProperty("其他配置") + @Excel(name = "其他配置") private String otherConfig; @ApiModelProperty("备注") + @Excel(name = "备注") private String remark; @ApiModelProperty("设施归属类型(0:默认1: 道路沿线2:桥梁3: 隧道4:收费广场5: 收费站6: 服务区等") + @Excel(name = "设施归属类型") private String facilitiesType; @ApiModelProperty("设备ip") + @Excel(name = "设备ip") private String deviceIp; @ApiModelProperty("范围桩号") + @Excel(name = "范围桩号") private String stakeMarkRange; @ApiModelProperty("创建时间") + @Excel(name = "创建时间") private Date createTime; @ApiModelProperty("修改时间") + @Excel(name = "修改时间") private Date updateTime; @ApiModelProperty("子类型") + @Excel(name = "子类型") private String childType; @TableField(exist = false) private String longitude; diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java index aa171517..cb481f77 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEvent.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEvent.java @@ -69,6 +69,9 @@ public class DcEvent { @ApiModelProperty("处理人员") private Long userId; + @ApiModelProperty("事件子类") + private String eventSubclas; + /** * 开始时间 */ @@ -133,7 +136,7 @@ public class DcEvent { * 3-3 立交封闭和限行 * 3-4 服务区封闭和限行 */ - @Excel(name = "事件类型") + @Excel(name = "事件类型字符串") @ApiModelProperty("事件子类 例:事件子类:* 1-1 追尾* 1-2 侧翻* 1-3 撞护栏* 1-4 自然* 1-5 其他事故* 2-1 车辆故障") private String eventSubclass; diff --git a/zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java b/zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java index a3608d70..1aea8102 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcMeteorologicalDetectorData.java @@ -125,6 +125,16 @@ public class DcMeteorologicalDetectorData extends BaseEntity @TableField(exist = false) private String stakeMarkRange; + @ApiModelProperty("安装位置") + @TableField(exist = false) + private String installationSite; + @ApiModelProperty("其他配置")//USRegal + @TableField(exist = false) + private String otherConfig; + @ApiModelProperty("所属网段")//USRegal + @TableField(exist = false) + private String networkSegment; + // "rainfall": 0, // "visibility": "05.000", // "remoteRoadSurfaceTemperature": 11.5, diff --git a/zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java b/zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java index 89524611..ea80eeac 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java @@ -10,7 +10,7 @@ import org.omg.CORBA.INTERNAL; /** * 信息发布管理记录对象 dc_publish_manage - * + * * @author ruoyi * @date 2024-04-19 */ @@ -22,27 +22,27 @@ public class DcPublishManage extends BaseEntity private Long id; /** 事件编号 */ - @Excel(name = "事件编号") + //@Excel(name = "事件编号") private String eventId; /** 所属机构 */ - @Excel(name = "所属机构") + //@Excel(name = "所属机构") private Long deptId; /** 发布渠道ID */ - @Excel(name = "发布渠道ID") + //@Excel(name = "发布渠道ID") private Long publishChannelsId; /** 标题 */ - @Excel(name = "标题") + //@Excel(name = "标题") private String title; /** 发布渠道:多选用逗号隔开1-手机短信2-微信公众号3-微博4-情报板5-服务网站6-微信小程序 */ - @Excel(name = "发布渠道",readConverterExp="1=手机短信,2=微信公众号,3=微博,4=情报板,5=服务网站,6=微信小程序") + @Excel(name = "发布渠道",readConverterExp="1=手机短信,2=微信公众号,3=微博,4=情报板,5=服务网站,6=微信小程序,7=语音广播") private Integer publishChannels; /** 审核状态:0-待审核1-已审核2-未通过 */ - @Excel(name = "审核状态: 0-待审核 1-已审核 2-未通过") + //@Excel(name = "审核状态: 0-待审核 1-已审核 2-未通过") private Integer isverify; /** 发布者 */ @@ -50,51 +50,51 @@ public class DcPublishManage extends BaseEntity private String publisher; /** 审核者1 */ - @Excel(name = "审核者1") + //@Excel(name = "审核者1") private String auditor1; /** 审核者1 */ - @Excel(name = "审核者1") + //@Excel(name = "审核者1") private String auditor2; /** 审核时间1 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd") + //@Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd") private Date auditTime1; /** 审核时间1 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd") + //@Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd") private Date auditTime2; /** 审核者1意见 */ - @Excel(name = "审核者1意见") + //@Excel(name = "审核者1意见") private String auditComment1; /** 审核者2意见 */ - @Excel(name = "审核者2意见") + //@Excel(name = "审核者2意见") private String auditComment2; /** 发布时间 */ - @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd") + @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date publishTime; /** 发布状态:1-成功2-失败3-草稿 */ - @Excel(name = "发布状态: 1-成功 2-失败 3-草稿") + @Excel(name = "发布状态",readConverterExp="1=成功,2=失败,3=草稿") private Integer publishStatus; /** 事件详情 */ - @Excel(name = "事件详情") + @Excel(name = "内容") private String contentDetails; - @Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向") + //@Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向") private String direction; - @Excel(name = "桩号") + //@Excel(name = "桩号") private String stakeMark; - @Excel(name = "事件主类",readConverterExp = "1=交通事故,2=车辆故障,3=交通管制,4=交通拥堵,5=非法上路,6=路障清除,7=施工建设,8=服务区异常,9=设施设备隐患,10=异常天气,11=其他事件") + //@Excel(name = "事件主类",readConverterExp = "1=交通事故,2=车辆故障,3=交通管制,4=交通拥堵,5=非法上路,6=路障清除,7=施工建设,8=服务区异常,9=设施设备隐患,10=异常天气,11=其他事件") private String eventType; - @Excel(name = "事件子类", readConverterExp = "1-1=追尾,1-2=侧翻,1-3=撞护栏,1-4=自然,1-5=其他事故,2-1=车辆故障,3-1=主线封闭和限行,3-2=收费站封闭和限行,3-3=立交封闭和限行,3-4=服务区封闭和限行,4-1=道路拥堵,4-2=立交拥堵,4-3=收费站拥堵,4-4=服务区拥堵,5-1=行人,5-2=非机动车,5-3=摩托车,5-4=其他,6-1=烟雾,6-2=倒伏树木,6-3=撒落物,6-4=动物,6-5=其他,7-1=道路养护施工,7-2=收费站养护施工,7-3=服务区养护施工,7-4=枢纽立交匝道养护施工,7-5=地方道路养护施工,7-6=道路工程建设施工,7-7=收费站工程建设施工,7-8=服务区工程建设施工,7-9=枢纽立交匝道工程建设施工,7-10=地方道路工程建设施工,8-1=封闭、暂停营业,8-2=重要设施停用,8-3=服务区其他异常,9-1=摄像机,9-2=护栏,9-3=隔离栅") + //@Excel(name = "事件子类", readConverterExp = "1-1=追尾,1-2=侧翻,1-3=撞护栏,1-4=自然,1-5=其他事故,2-1=车辆故障,3-1=主线封闭和限行,3-2=收费站封闭和限行,3-3=立交封闭和限行,3-4=服务区封闭和限行,4-1=道路拥堵,4-2=立交拥堵,4-3=收费站拥堵,4-4=服务区拥堵,5-1=行人,5-2=非机动车,5-3=摩托车,5-4=其他,6-1=烟雾,6-2=倒伏树木,6-3=撒落物,6-4=动物,6-5=其他,7-1=道路养护施工,7-2=收费站养护施工,7-3=服务区养护施工,7-4=枢纽立交匝道养护施工,7-5=地方道路养护施工,7-6=道路工程建设施工,7-7=收费站工程建设施工,7-8=服务区工程建设施工,7-9=枢纽立交匝道工程建设施工,7-10=地方道路工程建设施工,8-1=封闭、暂停营业,8-2=重要设施停用,8-3=服务区其他异常,9-1=摄像机,9-2=护栏,9-3=隔离栅") private String eventSubclass; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @@ -118,6 +118,21 @@ public class DcPublishManage extends BaseEntity private String facilityName; //事件状态:0-待确认1-处理中2-已完成 private Integer eventState; + //关联情报板id + private Long logId; + //位置 + @Excel(name = "位置/设备") + private String position; + + public Long getLogId() { + return logId; + } + + public void setLogId(Long logId) { + this.logId = logId; + } + + public Integer getEventState() { return eventState; @@ -228,151 +243,151 @@ public class DcPublishManage extends BaseEntity this.id = id; } - public Long getId() + public Long getId() { return id; } - public void setEventId(String eventId) + public void setEventId(String eventId) { this.eventId = eventId; } - public String getEventId() + public String getEventId() { return eventId; } - public void setDeptId(Long deptId) + public void setDeptId(Long deptId) { this.deptId = deptId; } - public Long getDeptId() + public Long getDeptId() { return deptId; } - public void setPublishChannelsId(Long publishChannelsId) + public void setPublishChannelsId(Long publishChannelsId) { this.publishChannelsId = publishChannelsId; } - public Long getPublishChannelsId() + public Long getPublishChannelsId() { return publishChannelsId; } - public void setTitle(String title) + public void setTitle(String title) { this.title = title; } - public String getTitle() + public String getTitle() { return title; } - public void setPublishChannels(Integer publishChannels) + public void setPublishChannels(Integer publishChannels) { this.publishChannels = publishChannels; } - public Integer getPublishChannels() + public Integer getPublishChannels() { return publishChannels; } - public void setIsverify(Integer isverify) + public void setIsverify(Integer isverify) { this.isverify = isverify; } - public Integer getIsverify() + public Integer getIsverify() { return isverify; } - public void setPublisher(String publisher) + public void setPublisher(String publisher) { this.publisher = publisher; } - public String getPublisher() + public String getPublisher() { return publisher; } - public void setAuditor1(String auditor1) + public void setAuditor1(String auditor1) { this.auditor1 = auditor1; } - public String getAuditor1() + public String getAuditor1() { return auditor1; } - public void setAuditor2(String auditor2) + public void setAuditor2(String auditor2) { this.auditor2 = auditor2; } - public String getAuditor2() + public String getAuditor2() { return auditor2; } - public void setAuditTime1(Date auditTime1) + public void setAuditTime1(Date auditTime1) { this.auditTime1 = auditTime1; } - public Date getAuditTime1() + public Date getAuditTime1() { return auditTime1; } - public void setAuditTime2(Date auditTime2) + public void setAuditTime2(Date auditTime2) { this.auditTime2 = auditTime2; } - public Date getAuditTime2() + public Date getAuditTime2() { return auditTime2; } - public void setAuditComment1(String auditComment1) + public void setAuditComment1(String auditComment1) { this.auditComment1 = auditComment1; } - public String getAuditComment1() + public String getAuditComment1() { return auditComment1; } - public void setAuditComment2(String auditComment2) + public void setAuditComment2(String auditComment2) { this.auditComment2 = auditComment2; } - public String getAuditComment2() + public String getAuditComment2() { return auditComment2; } - public void setPublishTime(Date publishTime) + public void setPublishTime(Date publishTime) { this.publishTime = publishTime; } - public Date getPublishTime() + public Date getPublishTime() { return publishTime; } - public void setPublishStatus(Integer publishStatus) + public void setPublishStatus(Integer publishStatus) { this.publishStatus = publishStatus; } - public Integer getPublishStatus() + public Integer getPublishStatus() { return publishStatus; } - public void setContentDetails(String contentDetails) + public void setContentDetails(String contentDetails) { this.contentDetails = contentDetails; } - public String getContentDetails() + public String getContentDetails() { return contentDetails; } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java b/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java index adb0a72f..d3e8a928 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java @@ -43,13 +43,34 @@ public class DcPublishingChannels extends BaseEntity @Excel(name = "启用日期", readConverterExp = "$column.readConverterExp()") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date enableDate; - + //查询参数 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date startDate; + //查询参数 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date endDate; public void setId(Long id) { this.id = id; } - public Long getId() + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Long getId() { return id; } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcVoiceBroadcast.java b/zc-business/src/main/java/com/zc/business/domain/DcVoiceBroadcast.java index 51cfc018..33e6ab75 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcVoiceBroadcast.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcVoiceBroadcast.java @@ -2,6 +2,9 @@ package com.zc.business.domain; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -13,7 +16,10 @@ import com.ruoyi.common.core.domain.BaseEntity; * @author ruoyi * @date 2024-04-19 */ +@Data @ApiModel("语音广播预发布对象") +@NoArgsConstructor +@AllArgsConstructor public class DcVoiceBroadcast extends BaseEntity { private static final long serialVersionUID = 1L; @@ -29,44 +35,8 @@ public class DcVoiceBroadcast extends BaseEntity /** 内容 */ @Excel(name = "内容") private String content; +private String repeatTimes; +private String priority; +private String outVol; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCategory(String category) - { - this.category = category; - } - - public String getCategory() - { - return category; - } - public void setContent(String content) - { - this.content = content; - } - - public String getContent() - { - return content; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("category", getCategory()) - .append("content", getContent()) - .append("remark", getRemark()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .toString(); - } } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcWarning.java b/zc-business/src/main/java/com/zc/business/domain/DcWarning.java index 311ca679..ad73d6c4 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcWarning.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcWarning.java @@ -59,6 +59,14 @@ public class DcWarning extends BaseEntity @Excel(name = "事件子类", readConverterExp ="1-1-拥堵,1-2=缓行,2-1=普通行人,2-2=工作人员,3-1=摩托车,3-2=自行车,3-3=三轮车,4-1=非工程车,4-2=工程车,4-3=主路有车,4-4=匝道有车,4-5=车辆故障(弃用),4-6=交通事故(弃用),4-7=应急车道被占用,4-8=车离开应急车道,4-9=其他,4-10=未知车辆,5-1=倒车/逆行,5-2=压线,5-3=掉头,5-4=超速,5-5=低速,5-6=违规变道,5-7=未保持安全距离,6-1=烟火,6-2=火灾,6-3=障碍物,6-4=抛洒物,7-1=道路施工,8-1=雨,8-2=冰雹,8-3=风,8-4=雾,8-5=高温,8-6=积水,8-7=路面湿滑,8-8=路面结冰,8-9=道路能见度低,8-10=道路团雾,9-1=只碰撞不倾斜,9-2=只倾斜无碰撞,9-3=碰撞后倾斜,10-1=未知,10-2单车事故,10-3=多车事故,11-1=车辆抛锚,11-2=车辆炸胎(有备胎),11-2=车辆炸胎(无备胎),99-1=其它") private String warningSubclass; + /** 事件解除原因 */ + @Excel(name = "事件解除原因") + private String relieveReason; + /** 事件解除类型: 1-误报解除2-事件已结束3-无需处理事件4-其它 */ + @Excel(name = "信息来源", readConverterExp = "1=误报解除2,2=事件已结束3,3=无需处理事件,4=其它") + private Integer relieveType; + + /** 事件标题 */ @Excel(name = "事件标题") private String warningTitle; @@ -113,6 +121,23 @@ public class DcWarning extends BaseEntity private String endDate; //收费站 private String facilityName; + + public String getRelieveReason() { + return relieveReason; + } + + public void setRelieveReason(String relieveReason) { + this.relieveReason = relieveReason; + } + + public Integer getRelieveType() { + return relieveType; + } + + public void setRelieveType(Integer relieveType) { + this.relieveType = relieveType; + } + public String getStartStakeMark() { return startStakeMark; } diff --git a/zc-business/src/main/java/com/zc/business/domain/EventPlanAssoc.java b/zc-business/src/main/java/com/zc/business/domain/EventPlanAssoc.java index d41b8c5d..50a71e48 100644 --- a/zc-business/src/main/java/com/zc/business/domain/EventPlanAssoc.java +++ b/zc-business/src/main/java/com/zc/business/domain/EventPlanAssoc.java @@ -22,7 +22,7 @@ import java.util.Date; public class EventPlanAssoc { @ApiModelProperty("预案事件关联id") - private String id; + private Long id; /** * 所属事件编号 */ @@ -58,4 +58,10 @@ public class EventPlanAssoc { */ @ApiModelProperty("执行操作结果") private String controlResult; + + /** + * 执行操作 + */ + @ApiModelProperty("执行操作") + private String control; } diff --git a/zc-business/src/main/java/com/zc/business/enums/EventSource.java b/zc-business/src/main/java/com/zc/business/enums/EventSource.java new file mode 100644 index 00000000..b03a4a02 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/enums/EventSource.java @@ -0,0 +1,31 @@ +package com.zc.business.enums; + +/** + * + */ +//事件来源枚举 +public enum EventSource { + VIDEO(1, "96656"), + TRAFFIC_POLICE(2,"交警转接"), + ROAD_PATROL(3,"道路巡查"), + VIDEO_INSPECTION(4,"视频巡查"), + VIDEO_AI(5,"视频AI"), + ONE_CLICK_RESCUE(6,"一键救援"), + REST(7,"其他"); + private final Integer code; + private final String description; + + EventSource(Integer code, String description) { + this.code = code; + this.description = description; + } + + public Integer getCode() + { + return code; + } + + public String getDescription() { + return description; + } +} diff --git a/zc-business/src/main/java/com/zc/business/enums/EventSubclass.java b/zc-business/src/main/java/com/zc/business/enums/EventSubclass.java new file mode 100644 index 00000000..3c3721f5 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/enums/EventSubclass.java @@ -0,0 +1,75 @@ +package com.zc.business.enums; + +/** + * + */ +public enum EventSubclass { + REAR_END ("1-1","追尾"), + TURN_ON_ONE_S_SIDE ("1-2","侧翻"), + CRASH_INTO_THE_BARRIER ("1-3","撞护栏"), + NATURE ("1-4","自燃"), + OTHER_ACCIDENTS ("1-5","其他事故"), + VEHICLE_FAULT ("2-1","车辆故障"), + THE_MAIN_LINE_IS_CLOSED_AND_RESTRICTED ("3-1","主线封闭和限行"), + TOLL_BOOTHS_ARE_CLOSED_AND_RESTRICTED ("3-2","收费站封闭和限行"), + THE_INTERCHANGE_IS_CLOSED_AND_RESTRICTED ("3-3","立交封闭和限行"), + THE_SERVICE_AREA_IS_CLOSED_AND_RESTRICTED ("3-4","服务区封闭和限行"), + ROAD_CONGESTION ("4-1","道路拥堵"), + INTERCHANGE_CONGESTION ("4-2","立交拥堵"), + TOLL_BOOTHS_ARE_CONGESTED ("4-3","收费站拥堵"), + SERVICE_AREA_CONGESTION ("4-4","服务区拥堵"), + PEDESTRIAN ("5-1","行人"), + NON_MOTOR_VEHICLE ("5-2","非机动车"), + MOTORCYCLE("5-3","摩托车"), + ELSE ("5-4","其他"), + SMOKE ("6-1","烟雾"), + FALLEN_TREE ("6-2","倒伏树木"), + OUTFALL ("6-3","撒落物"), + ZOON ("6-4","动物"), + OTHER ("6-5","其他"), + ROAD_MAINTENANCE_CONSTRUCTION ("7-1","道路养护施工"), + TOLL_STATION_MAINTENANCE_AND_CONSTRUCTION ("7-2","收费站养护施工"), + MAINTENANCE_CONSTRUCTION_OF_SERVICE_AREA ("7-3","服务区养护施工"), + MAINTENANCE_AND_CONSTRUCTION_OF_INTERCHANGE_RAMP ("7-4","枢纽立交匝道养护施工"), + LOCAL_ROAD_MAINTENANCE_CONSTRUCTION ("7-5","地方道路养护施工"), + ROAD_ENGINEERING_CONSTRUCTION ("7-6","道路工程建设施工"), + TOLL_STATION_CONSTRUCTION ("7-7","收费站工程建设施工"), + SERVICE_AREA_PROJECT_CONSTRUCTION ("7-8","服务区工程建设施工"), + JUNCTION_INTERCHANGE_RAMP_PROJECT_CONSTRUCTION ("7-9","枢纽立交匝道工程建设施工"), + LOCAL_ROAD_ENGINEERING_CONSTRUCTION ("7-10", "地方道路工程建设施工"), + SUSPEND_BUSINESS ("8-1","封闭、暂停营业"), + SHUTDOWN_OF_CRITICAL_FACILITIES ("8-2","重要设施停用"), + OTHERS_IN_THE_SERVICE_AREA_ARE_ABNORMAL ("8-3","服务区其他异常"), + CAMERA ("9-1","摄像机"), + GUARDRAIL ("9-2","护栏"), + ISOLATING_GRID ("9-3","隔离栅"), + INTEL_BOARD ("9-4","情报板"), + ANTI_GLARE_PLATE ("9-5","防炫板"), + REST1 ("9-6","其他"), + THE_RAIN ("10-1", "雨"), + SNOW ("10-2", "雪"), + THE_FOG ("10-3", "雾"), + GALE ("10-4", "大风"), + LOW_TEMPERATURE_COLD_WAVE ("10-5", "低温寒潮"), + SNOW_ON_PAVEMENT ("10-6", "路面积雪"), + ICY_ROAD ("10-7", "路面结冰"), + ROAD_WATER ("10-8", "路面积水"), + RESTS ("10-9", "其他"), + OTHER_EVENTS ("11-1", "其他事件"); + private final String code; + private final String description; + + EventSubclass(String code, String description) { + this.code = code; + this.description = description; + } + + public String getCode() + { + return code; + } + + public String getDescription() { + return description; + } +} diff --git a/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java b/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java index 5af2c2d5..8778d92e 100644 --- a/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java +++ b/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java @@ -125,6 +125,7 @@ public class ValueConverter { eventLabel.put("estimatedEndTime","预计解除时间"); eventLabel.put("eventLevel","事件等级"); // eventLabel.put("eventType","事件类型"); + eventLabel.put("eventSubclass","事件子类"); eventLabel.put("eventCause","事件原因"); eventLabel.put("description","描述"); eventLabel.put("eventState","状态"); @@ -210,7 +211,7 @@ public class ValueConverter { eventLabel.put("dcEventVehicleAccident.seriousInjuries","重伤(人)"); eventLabel.put("dcEventVehicleAccident.fatalities","死亡(人)"); eventLabel.put("dcEventVehicleAccident.isPrivate","私密事件"); - eventLabel.put("dcEventVehicleAccident.facilityId","设施id"); + eventLabel.put("dcEventVehicleAccident.facilityId","地点"); eventLabel.put("dcEventVehicleAccident.rampId","匝道"); eventLabel.put("dcEventVehicleAccident.location","地点"); eventLabel.put("dcEventTrafficControl.controlType","管制分类"); @@ -279,7 +280,7 @@ public class ValueConverter { } public static String eventLabel(String inputValue) { Map mapping = getEventLabel(); - return mapping.getOrDefault(inputValue, inputValue); + return mapping.getOrDefault(inputValue, ""); } //测试 diff --git a/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java b/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java index d2b38529..be5d0d17 100644 --- a/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java +++ b/zc-business/src/main/java/com/zc/business/interfaces/OperationLogAspect.java @@ -14,8 +14,10 @@ import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.service.ISysDeptService; import com.zc.business.domain.DcDevice; import com.zc.business.domain.DcOperLog; +import com.zc.business.domain.DcPublishManage; import com.zc.business.service.IDcDeviceService; import com.zc.business.service.IDcOperLogService; +import com.zc.business.service.IDcPublishManageService; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; @@ -24,6 +26,7 @@ import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.*; +import java.util.stream.Collectors; @Aspect @Component @@ -108,6 +111,7 @@ public class OperationLogAspect { ISysDeptService deptService = SpringUtils.getBean(ISysDeptService.class); IDcOperLogService dcOperLogService = SpringUtils.getBean(IDcOperLogService.class); IDcDeviceService dcDeviceService = SpringUtils.getBean(IDcDeviceService.class); + IDcPublishManageService dcPublishManageService = SpringUtils.getBean(IDcPublishManageService.class); try { DcOperLog operLog = new DcOperLog(); @@ -121,6 +125,11 @@ public class OperationLogAspect { } Object[] pointArgs = joinPoint.getArgs(); + + //String operType = String.valueOf(pointArgs[pointArgs.length - 1]); + //operLog.setOperType(operType); + + HttpServletRequest request; try { @@ -129,34 +138,13 @@ public class OperationLogAspect { request = null; } - AjaxResult proceed = (AjaxResult) joinPoint.proceed(pointArgs); - //String jsonResultString = ""; - //JSONArray jsonArray = (JSONArray) proceed; - //for (Object o : jsonArray) { - // JSONObject jsonObject = (JSONObject) o; - // if (Objects.equals(jsonObject.getString("code"), "200")) { - // JSONArray data = jsonObject.getJSONArray("data"); - // for (Object datum : data) { - // JSONObject results = (JSONObject) datum; - // JSONObject result = results.getJSONObject("result"); - // if (Objects.equals(result.getString("code"), "200")) { - // jsonResultString = "设备"+d+""; - // } - // } - // } - //} SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = df.format(new Date()); String sta = ""; - if (Objects.equals(state, "0")&&Objects.equals(String.valueOf(proceed.get("code")), "200")) { - //if (Objects.equals(String.valueOf(proceed.get("code")), "200")) { - operLog.setStatus(0); - sta = "成功"; - //} else { - // operLog.setStatus(1); - // sta = "失败"; - //} + if (Objects.equals(state, "0") && Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("code")), "200") && !Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("msg")), "500") ) { + operLog.setStatus(0); + sta = "成功"; } else { operLog.setStatus(1); sta = "失败"; @@ -164,26 +152,18 @@ public class OperationLogAspect { ArrayList deviceIds = new ArrayList<>(); ArrayList deviceNames = new ArrayList<>(); - //ArrayList functionIds = new ArrayList<>(); String deviceType = ""; StringBuilder remark = new StringBuilder("在" + date + "调用"); if (operUrl.contains("batchFunctions")) { //批量调用 + JSONObject pointArg = null; + if (pointArgs[0] instanceof JSONObject) { + pointArg = (JSONObject) pointArgs[0]; + } else { + pointArg = (JSONObject) JSON.toJSON(pointArgs[0]); + } + String contentDetails = ""; - //if (loginUser != null) { - // SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId()); - // - // dcOperLog.setOperName(loginUser.getUsername()); - // dcOperLog.setDeptName(sysDept.getDeptName()); - // dcOperLog.setOperLocation(loginUser.getLoginLocation()); - // dcOperLog.setOperType("2"); - //} else { - // dcOperLog.setOperType("1"); - //} - //dcOperLog.setOperIp(IpUtils.getIpAddr(request)); - //dcOperLog.setOperTime(new Date()); - - JSONObject pointArg = (JSONObject) pointArgs[0]; JSONArray devices = pointArg.getJSONArray("devices"); JSONArray functions = pointArg.getJSONArray("functions"); @@ -201,6 +181,7 @@ public class OperationLogAspect { deviceType = dcDevice.getDeviceType(); + deviceIds.add(String.valueOf(deviceId)); deviceNames.add(deviceName); @@ -214,13 +195,29 @@ public class OperationLogAspect { "发布语音广播" : String.valueOf( ((HashMap) (DEVICEFUNCTIONNAME.get(deviceType))) - .get(function.getString("functionId"))); + .get(function.getString("functionId")) == null ? + "未知方法" : + ((HashMap) (DEVICEFUNCTIONNAME.get(deviceType))) + .get(function.getString("functionId"))); remark.append("调用").append(hashMap).append("功能").append(sta); if (i1 < functions.size() - 1) { remark.append("、"); } + + + + if (Objects.equals(function.getString("functionId"), "13")&&Objects.equals(deviceType,"2")){ + JSONArray parameters = function.getJSONObject("params").getJSONArray("parameters"); + List content = parameters.stream().map(item->((JSONObject)item).getString("CONTENT")).collect(Collectors.toList()); + contentDetails = content.toString().replace("[", "").replace("]", ""); + } + + + if (Objects.equals(deviceType,"5")){ + contentDetails = function.getJSONObject("params").getString("text"); + } } if (i < (devices.size() - 1)) { @@ -230,7 +227,6 @@ public class OperationLogAspect { } } - if (loginUser != null) { SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId()); @@ -241,21 +237,56 @@ public class OperationLogAspect { } else { operLog.setOperType("1"); } - operLog.setOperParam((Arrays.toString(pointArgs))); + + JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs); + + operLog.setOperParam(String.valueOf(jsonArray)); operLog.setDcDeviceId(deviceIds.toString()); operLog.setDcDeviceName(deviceNames.toString()); operLog.setOperIp(IpUtils.getIpAddr(request)); operLog.setOperTime(new Date()); operLog.setDcDeviceType(deviceType); operLog.setRemark(remark.toString()); - operLog.setJsonResult(String.valueOf(proceed)); - dcOperLogService.addDcOperLog(operLog); + operLog.setJsonResult(jsonResult.toString()); + dcOperLogService.save(operLog); + + + if ((Objects.equals(deviceType, "2") || Objects.equals(deviceType, "5")) && Objects.nonNull(operLog.getId())) { + DcPublishManage dcPublishManage = new DcPublishManage(); + + if (Objects.equals(state, "0") && Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("code")), "200")) { + dcPublishManage.setPublishStatus(1);//发布状态1-成功2-失败 + } else { + dcPublishManage.setPublishStatus(2);//发布状态1-成功2-失败 + } + + if (loginUser != null) { + dcPublishManage.setPublisher(loginUser.getUsername());//发布人 + } else { + dcPublishManage.setPublisher("系统定时调用");//发布人 + } + dcPublishManage.setPublishTime(new Date());//发布时间 + dcPublishManage.setCreateTime(new Date());//创建时间 + + dcPublishManage.setLogId(Long.valueOf(operLog.getId()));//发布的如果的情报板传对应id + if (Objects.equals(deviceType, "2")) { + dcPublishManage.setPublishChannels(4); + } else { + dcPublishManage.setPublishChannels(7); + } + + dcPublishManage.setContentDetails(contentDetails); + dcPublishManageService.insertDcPublishManage(dcPublishManage); + } } else if (operUrl.contains("functions")) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(DcDevice::getIotDeviceId, pointArgs[0]); - DcDevice dcDevice = dcDeviceService.getById(Long.valueOf(String.valueOf(pointArgs[0]))); + List list = dcDeviceService.list(lambdaQueryWrapper); + DcDevice dcDevice = list.get(0); + if (!Objects.isNull(dcDevice)) { Long deviceId = dcDevice.getId(); @@ -271,73 +302,56 @@ public class OperationLogAspect { remark.append(deviceName).append("的").append(hashMap).append("功能并且调用").append(sta).append("了"); - if (loginUser != null) { SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId()); operLog.setOperName(loginUser.getUsername()); operLog.setDeptName(sysDept.getDeptName()); operLog.setOperLocation(loginUser.getLoginLocation()); - operLog.setOperType("2"); + operLog.setOperType("0"); } else { operLog.setOperType("1"); } - operLog.setOperParam((Arrays.toString(pointArgs))); + + JSONArray jsonArray = (JSONArray) JSON.toJSON(pointArgs); + + operLog.setOperParam(String.valueOf(jsonArray)); operLog.setDcDeviceId(deviceIds.toString()); operLog.setDcDeviceName(deviceNames.toString()); operLog.setOperIp(IpUtils.getIpAddr(request)); operLog.setOperTime(new Date()); operLog.setDcDeviceType(deviceType); - operLog.setJsonResult(remark.toString()); - dcOperLogService.addDcOperLog(operLog); + operLog.setRemark(remark.toString()); + operLog.setJsonResult(jsonResult.toString()); + dcOperLogService.save(operLog); + //if ((Objects.equals(deviceType, "2") || Objects.equals(deviceType, "5")) && Objects.nonNull(operLog.getId())) { + // DcPublishManage dcPublishManage = new DcPublishManage(); // - ////DcDevice dcDevice = list.get(0); - //operLog.setDcDeviceId(String.valueOf(dcDevice.getId())); - //operLog.setDcDeviceName(dcDevice.getDeviceName()); - //deviceType = dcDevice.getDeviceType(); - //operLog.setDcDeviceType(deviceType); - //if (loginUser != null) { - // SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId()); + // if (Objects.equals(state, "0") && Objects.equals(String.valueOf(((AjaxResult) jsonResult).get("code")), "200")) { + // dcPublishManage.setPublishStatus(1);//发布状态1-成功2-失败 + // } else { + // dcPublishManage.setPublishStatus(2);//发布状态1-成功2-失败 + // } // - // dcOperLog.setOperName(loginUser.getUsername()); - // dcOperLog.setDeptName(sysDept.getDeptName()); - // dcOperLog.setOperLocation(loginUser.getLoginLocation()); - // dcOperLog.setOperType("0"); - //} else { - // dcOperLog.setOperType("1"); - //} - //dcOperLog.setOperIp(IpUtils.getIpAddr(request)); - //dcOperLog.setOperParam(Arrays.toString(pointArgs)); - //dcOperLog.setJsonResult("设备" + dcDevice.getDeviceName() + "在" + date + "调用了" + hashMap + "功能并且调用" + sta + "了"); - ////dcOperLog.setJsonResult(dcDevice.getDeviceName() + "设备在" + date + "调用" + sta + "ID为" + dcDevice.getId() + "的设备功能标识为" + pointArgs[1].toString() + "的方法"); - //dcOperLog.setOperTime(new Date()); - //dcOperLogService.addDcOperLog(dcOperLog); + // if (loginUser != null) { + // dcPublishManage.setPublisher(loginUser.getUsername());//发布人 + // } else { + // dcPublishManage.setPublisher("系统定时调用");//发布人 + // } + // dcPublishManage.setPublishTime(new Date());//发布时间 + // dcPublishManage.setCreateTime(new Date());//创建时间 // + // dcPublishManage.setLogId(Long.valueOf(operLog.getId()));//发布的如果的情报板传对应id + // if (Objects.equals(deviceType, "2")) { + // dcPublishManage.setPublishChannels(4); + // } else { + // dcPublishManage.setPublishChannels(7); + // } // - //String remark = "设备在" + date + "调用" + sta + "ID为" + deviceIds + "的设备功能标识为" + functionIds + "的方法"; - //System.out.println(remark); - //System.out.println(deviceIds.toString()); - //System.out.println(functionIds.toString()); - //DcOperLog operLog = new DcOperLog(); - //SysDept sysDept = deptService.selectDeptById(loginUser.getDeptId()); - //operLog.setOperParam((Arrays.toString(pointArgs))); - //operLog.setOperLocation(loginUser.getLoginLocation()); - //operLog.setOperName(loginUser.getUsername()); - //operLog.setDeptName(sysDept.getDeptName()); - //operLog.setDcDeviceId(deviceIds.toString()); - //operLog.setOperType("2"); - //operLog.setOperIp(IpUtils.getIpAddr(request)); - //operLog.setOperTime(new Date()); - //operLog.setDcDeviceType(deviceType); - //operLog.setJsonResult(remark); - //if (Objects.equals(state, "0")) { - // operLog.setStatus(0); - //} else { - // operLog.setStatus(1); + // dcPublishManage.setContentDetails(remark.toString()); + // dcPublishManageService.insertDcPublishManage(dcPublishManage); //} - //dcOperLogService.addDcOperLog(operLog); - } } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java index d512e150..4a00c447 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java @@ -2,6 +2,7 @@ package com.zc.business.mapper; import java.util.List; import com.zc.business.domain.DcEventProcess; +import org.apache.ibatis.annotations.Param; /** * 事件处理流程Mapper接口 @@ -75,4 +76,15 @@ public interface DcEventProcessMapper List selectDcDispatchByEventId(String id); int selectFinalNode(String eventId); + + /** + * @Description 查询前置节点状态 + * + * @author liuwenge + * @date 2024/5/13 16:08 + * @param eventId 事件id + * @param processId 节点id + * @return 状态 0未完成 1已完成 + */ + int selectPreviousNodeStatus(@Param("eventId") String eventId, @Param("processId") Long processId); } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java index 50cbebc2..a3387bdd 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java @@ -5,6 +5,7 @@ import java.util.Map; import com.zc.business.domain.DcMeteorologicalDetectorData; import com.zc.business.domain.MdDeviceData; +import org.apache.ibatis.annotations.Param; /** * 气象检测器数据Mapper接口 @@ -63,8 +64,20 @@ public interface DcMeteorologicalDetectorDataMapper int deleteDcMeteorologicalDetectorDataByIds(Long[] ids); //统计 List> selectStatistics(String deviceName); + List> selectStatisticsTime(@Param("deviceName") String deviceName ,@Param("specificDate") String specificDate); List selectlistAll(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); List selectlistVisibility(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); + + /** + * 根据设备名称查询详细信息列表 + * @param deviceName + * @return + */ + List selectDeviceNameList(String deviceName); + + List> selectStatisticsDay(@Param("deviceName") String deviceName,@Param("specificDate") String specificDate); + + List> selectStatisticsYears(@Param("deviceName") String deviceName,@Param("specificDate") String specificDate); } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java index 07853632..8a2f318f 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java @@ -53,7 +53,12 @@ public interface DcPublishManageMapper * @return 结果 */ int deleteDcPublishManageById(Long id); - + //删除事件发布记录 params 事件id + int deleteDcPublishManageEventId(String eventId); + //删除调度记录资源记录 + int deleteDisPathSource(String eventId); + //删除调度记录 + int deleteDisPath(String eventId); /** * 批量删除信息发布管理记录 * @@ -67,4 +72,18 @@ public interface DcPublishManageMapper public DcPublishManage selectPublishManage(@Param("dataCategory")Integer dataCategory); //查询信息发布列表 public List> selectDcPublishManageListMap(DcPublishManage dcPublishManage); + //统计今日发布渠道分析 + public List> statisticsPublishManage(); + //统计今日发布事件类型分析 + public List> eventTypePublishManage(); + //统计今日发布趋势分析 + public List> releaseTrendsPublishManage(); + //统计月发布趋势分析 + public List> monthTrendsPublishManage(DcPublishManage dcPublishManage); + //统计不同事件的发布渠道数量 + public List> eventTypePublishManageSum(); + //统计不同事件的发布渠道数量(月统计) + public List> eventTypePublishManageMonth(DcPublishManage dcPublishManage); + //公众服务统计查询 + public List selectDcPublishManageStatistics(DcPublishManage dcPublishManage); } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java index d08e2fe4..96557b9c 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java @@ -1,7 +1,9 @@ package com.zc.business.mapper; +import java.util.HashMap; import java.util.List; import com.zc.business.domain.DcPublishingChannels; +import org.apache.ibatis.annotations.Param; /** * 发布渠道Mapper接口 @@ -60,4 +62,11 @@ public interface DcPublishingChannelsMapper int deleteDcPublishingChannelsByIds(Long[] ids); //查询数据类型是否已经存在 public List selectChannelsDataCategory(Integer dataCategory); + //修改启用停用 + int updateEnabled(DcPublishingChannels dcPublishingChannels); + //查询事件类型 + public String eventType(@Param("id")String id); + //事件调度处置事件推送发布渠道 + public DcPublishingChannels eventPublishChannels(@Param("dataCategory") String dataCategory); + } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java index 2e6e4af2..7f07269b 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java @@ -130,5 +130,6 @@ public interface DcWarningMapper public Integer deleteDispatchResource(@Param("dispatchId")Long dispatchId); DcDispatch selectDcDispatchById(@Param("id") Long id); - + //误报解除 + public Integer falseAlarmResolution(DcWarning dcWarning); } diff --git a/zc-business/src/main/java/com/zc/business/mapper/EventPlanAssocMapper.java b/zc-business/src/main/java/com/zc/business/mapper/EventPlanAssocMapper.java index 15c13da3..411a1c9c 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/EventPlanAssocMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/EventPlanAssocMapper.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.zc.business.domain.EventPlanAssoc; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 预案事件关联Mapper接口 * @@ -19,12 +21,19 @@ public interface EventPlanAssocMapper extends BaseMapper { */ int insertEventPlanAssoc(EventPlanAssoc eventPlanAssoc); + /** + * 根据id查询事件预案关联 + * @param eventPlanAssoc + * @return + */ + EventPlanAssoc selectById(EventPlanAssoc eventPlanAssoc); + /** * 根据事件id查询事件预案关联 * @param eventPlanAssoc * @return */ - EventPlanAssoc selectByEventId(EventPlanAssoc eventPlanAssoc); + List selectByEvent(EventPlanAssoc eventPlanAssoc); /** * 修改事件预案关联 diff --git a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java index 9b3ac787..030098bd 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java +++ b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java @@ -16,10 +16,12 @@ import com.zc.business.enums.WarningSourceEnum; import com.zc.business.enums.WarningStateEnum; import com.zc.business.enums.WarningSubclassEnum; import com.zc.business.service.*; +import com.zc.common.core.websocket.WebSocketService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; import javax.annotation.Resource; import java.text.ParseException; @@ -38,6 +40,8 @@ public class DeviceMessageHandler { private final int EVENT_STATE = 1; private final int EVENTEND_STATE = 4; private final int VISIBILITY_LEVEL = 8; + private final String DEVICE_STATE = "deviceState"; + private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Resource @@ -76,7 +80,14 @@ public class DeviceMessageHandler { // 批量更新设备状态 dcDeviceService.batchUpdate(dcDevices); + dcDevices.forEach(dcDevice -> { + DcDevice device = redisCache.getCacheMapValue(RedisKeyConstants.DC_DEVICES, dcDevice.getIotDeviceId()); + if (!ObjectUtils.isEmpty(device)) { + dcDevice.setId(device.getId()); + } + }); + WebSocketService.broadcast(DEVICE_STATE, dcDevices); //推送设备状态更新 // 批量更新中间库设备状态 middleDatabaseService.updateMiddleDatabaseDeviceByList(dcDevices); } @@ -238,8 +249,15 @@ public class DeviceMessageHandler { /* JSONObject combinedData = new JSONObject(); combinedData.put("address", otherConfig);*/ dcWarning.setOtherConfig(otherConfig.toString()); - - dcWarningService.insertDcWarning(dcWarning); + //异常天气等级 过滤 + if (data.getInteger("warningType") == VISIBILITY_LEVEL) { + int WarningLevel=data.getInteger("visibilityLevel"); + if (WarningLevel !=0){ + dcWarningService.insertDcWarning(dcWarning); + } + }else { + dcWarningService.insertDcWarning(dcWarning); + } } //无法判定事件结束上报的类型有:占用应急车道,路障,逆行,机占非 diff --git a/zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java b/zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java index 02d4d32a..7a1687a8 100644 --- a/zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java +++ b/zc-business/src/main/java/com/zc/business/service/DcEmergencyPlansService.java @@ -76,7 +76,15 @@ public interface DcEmergencyPlansService { * @param eventId 事件id * @return 结果 */ - EventPlanAssoc selectEventPlanAssocByEventId(String eventId); + List selectEventPlanAssocByEventId(String eventId); + + /** + * 根据id-查询预案事件关联表 + * + * @param id id + * @return 结果 + */ + EventPlanAssoc selectEventPlanAssocById(Long id); /** * 感知事件确定 diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventImportantFileService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventImportantFileService.java index 223b11de..b1653132 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventImportantFileService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventImportantFileService.java @@ -35,7 +35,7 @@ public interface IDcEventImportantFileService * @param dcEventImportantFile 重要事件文件内容 * @return 结果 */ - int insertDcEventImportantFile(DcEventImportantFile dcEventImportantFile); + AjaxResult insertDcEventImportantFile(DcEventImportantFile dcEventImportantFile); /** * 修改重要事件文件内容 @@ -43,7 +43,7 @@ public interface IDcEventImportantFileService * @param dcEventImportantFile 重要事件文件内容 * @return 结果 */ - int updateDcEventImportantFile(DcEventImportantFile dcEventImportantFile); + AjaxResult updateDcEventImportantFile(DcEventImportantFile dcEventImportantFile); /** * 批量删除重要事件文件内容 @@ -68,4 +68,15 @@ public interface IDcEventImportantFileService * @return 结果 */ AjaxResult getImportantFileStatus(String eventId); + + /** + * @Description 生成重要事件文件内容 + * + * @author liuwenge + * @date 2024/5/8 15:50 + * @param eventId 事件id + * @param type 类型 1:初报,2续报,3终报 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult generate(String eventId,String type); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java index f0023517..3d261edd 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java @@ -2,6 +2,7 @@ package com.zc.business.service; import java.io.IOException; import java.util.List; +import java.util.Map; import com.ruoyi.common.exception.file.InvalidExtensionException; import com.zc.business.domain.DcEventProcess; @@ -71,4 +72,15 @@ public interface IDcEventProcessService int deleteDcEventProcessById(Long id); List selectDcEventProcessListById(String id); + + /** + * @Description 查询前置节点状态 + * + * @author liuwenge + * @date 2024/5/13 15:57 + * @param eventId 事件id + * @param processId 节点id + * @return status 0未完成 1已完成 + */ + int selectPreviousNodeStatus(String eventId, Long processId); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventService.java index 8bebab43..058a6469 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventService.java @@ -90,7 +90,7 @@ public interface IDcEventService * @param id * @return */ - DcEvent selectEventSubclassById(int eventType, String id); + DcEvent selectEventSubclassById(String id); Map selectCount(); diff --git a/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java b/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java index ca7cb92a..6a56af4d 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcMeteorologicalDetectorDataService.java @@ -64,7 +64,26 @@ public interface IDcMeteorologicalDetectorDataService //统计当天 没小时温度 List> selectStatistics(String deviceName); + /** + * 按时间统计气象设备信息列表 + * @param deviceName + * @param specificDate + * @return + */ + List> selectStatisticsTime(String deviceName,String specificDate); + List selectlistAll(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); List selectlistVisibility(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); + + /** + * 根据设备名称查询详细信息列表 + * @param deviceName + * @return + */ + List selectDeviceNameList(String deviceName); + + List> selectStatisticsDay(String deviceName, String specificDate); + + List> selectStatisticsYears(String deviceName, String specificDate); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java b/zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java index e2d48f76..71f5f2eb 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java @@ -1,5 +1,6 @@ package com.zc.business.service; +import java.util.HashMap; import java.util.List; import com.zc.business.domain.DcPublishManage; @@ -59,4 +60,18 @@ public interface IDcPublishManageService * @return 结果 */ int deleteDcPublishManageById(Long id); + //统计今日发布渠道分析 + public List> statisticsPublishManage(); + //统计今日发布事件类型分析 + public List> eventTypePublishManage(); + //统计今日发布趋势分析 + public List> releaseTrendsPublishManage(); + //统计月发布趋势分析 + public List> monthTrendsPublishManage(DcPublishManage dcPublishManage); + //统计不同事件的发布渠道数量 + public List> eventTypePublishManageSum(); + //统计不同事件的发布渠道数量(月统计) + public List> eventTypePublishManageMonth(DcPublishManage dcPublishManage); + //公众服务统计查询 + public List selectDcPublishManageStatistics(DcPublishManage dcPublishManage); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java b/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java index 70d73cbd..8488a4a3 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java @@ -1,7 +1,9 @@ package com.zc.business.service; +import java.util.HashMap; import java.util.List; import com.zc.business.domain.DcPublishingChannels; +import org.apache.ibatis.annotations.Param; /** * 发布渠道Service接口 @@ -60,4 +62,8 @@ public interface IDcPublishingChannelsService int deleteDcPublishingChannelsById(Long id); //查询数据类型是否已经存在 public List selectChannelsDataCategory(Integer dataCategory); + //修改启用停用 + int updateEnabled(DcPublishingChannels dcPublishingChannels); + //事件调度处置事件推送发布渠道 + public DcPublishingChannels eventPublishChannels(String eventId); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java index 93af5845..2200db6f 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java @@ -92,4 +92,6 @@ public interface IDcWarningService public Integer insertDispatch(DcDispatch dcDispatch); //新增指挥调度资源记录 public Integer insertDispatchSource(HashMap map); + //误报解除 + public Integer falseAlarmResolution(DcWarning dcWarning); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java index 46f8bc39..43642183 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java @@ -113,6 +113,7 @@ public class DcBatchFunctionsJobGroupServiceImpl extends ServiceImpl dcBatchFunctionsJobs = dcBatchFunctionsJobService.listDcBatchFunctionsJob(dcBatchFunctionsJob); for (DcBatchFunctionsJob batchFunctionsJob : dcBatchFunctionsJobs) { + batchFunctionsJob.setJobName(dcBatchFunctionsJobGroup.getGroupName()); boolean changeStatus = dcBatchFunctionsJobService.changeStatus(batchFunctionsJob, dcBatchFunctionsJobGroup.getStatus()); if (!changeStatus) { return false; diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java index 02f366f3..1f001728 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java @@ -62,6 +62,7 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl detaileds = detailedConfigurations.stream().filter(detailed -> Objects.equals((String) ((JSONObject) detailed).get("time"), time) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java index 6a61c259..ee191c68 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java @@ -170,12 +170,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { dcExecuteActions.forEach(dcExecuteAction -> { JSONObject executeConfig = JSON.parseObject(dcExecuteAction.getExecuteConfig()); if (dcExecuteAction.getDeviceType() == DeviceTypeEnum.ROAD_SECTION_VOICE_BROADCASTING.getCode() - && executeConfig.get("operationType").equals("2")) { + && executeConfig.getString("operationType").equals("2")) { // 执行操作中智能发布语音广播 String content = intelligentPublishingOfInformation(dcEvent); updateIntelligentPublishingContent(dcExecuteAction,markArray,dcEvent,content,dcEvent.getDirection()); } else if (dcExecuteAction.getDeviceType() == DeviceTypeEnum.VARIABLE_INFORMATION_FLAG.getCode() - && executeConfig.get("operationType").equals("2")) { + && executeConfig.getString("operationType").equals("2")) { // 执行操作中智能发布情报板 String content = intelligentPublishingOfInformation(dcEvent); updateIntelligentPublishingContent(dcExecuteAction,markArray,dcEvent,content,dcEvent.getDirection()); @@ -557,10 +557,22 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { * @return */ @Override - public EventPlanAssoc selectEventPlanAssocByEventId(String eventId) { + public List selectEventPlanAssocByEventId(String eventId) { EventPlanAssoc eventPlanAssoc = new EventPlanAssoc(); eventPlanAssoc.setEventId(eventId); - return eventPlanAssocMapper.selectByEventId(eventPlanAssoc); + return eventPlanAssocMapper.selectByEvent(eventPlanAssoc); + } + + /** + * 根据id-查询预案事件关联表 + * @param id id + * @return + */ + @Override + public EventPlanAssoc selectEventPlanAssocById(Long id) { + EventPlanAssoc eventPlanAssoc = new EventPlanAssoc(); + eventPlanAssoc.setId(id); + return eventPlanAssocMapper.selectById(eventPlanAssoc); } /** @@ -735,26 +747,16 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { // 事件编号 eventPlanAssoc.setEventId(id); eventPlanAssoc.setOperationType(dcEventAnDcEmergencyPlans.getOperationType()); - EventPlanAssoc selectEventPlanAssoc = eventPlanAssocMapper.selectByEventId(eventPlanAssoc); - - if (selectEventPlanAssoc == null) { - // 执行新增 - eventPlanAssoc.setEmergencyPlansId(dcEmergencyPlans.getId()); - eventPlanAssoc.setControlDevice(deviceIds.toString().replaceFirst(";", "")); - eventPlanAssoc.setControlResult(resultArray.toJSONString()); - eventPlanAssoc.setCreateTime(DateUtils.getNowDate()); - // IdUtils.fastSimpleUUID() - eventPlanAssoc.setId(IdUtils.fastSimpleUUID()); - eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc); - resultObject.put("eventPlanAssocId",eventPlanAssoc.getId()); - }else { - // 执行修改操作 - selectEventPlanAssoc.setUpdateTime(DateUtils.getNowDate()); - selectEventPlanAssoc.setControlDevice(deviceIds.toString().replaceFirst(";", "")); - selectEventPlanAssoc.setControlResult(resultArray.toJSONString()); - eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc); - resultObject.put("eventPlanAssocId",selectEventPlanAssoc.getId()); - } + + // 新增事件预案关联表数据 + eventPlanAssoc.setEmergencyPlansId(dcEmergencyPlans.getId()); + eventPlanAssoc.setControlDevice(deviceIds.toString().replaceFirst(";", "")); + eventPlanAssoc.setControlResult(resultArray.toJSONString()); + eventPlanAssoc.setCreateTime(DateUtils.getNowDate()); + eventPlanAssoc.setControl(JSON.toJSONString(dcEmergencyPlans.getDcExecuteAction())); + eventPlanAssocMapper.insertEventPlanAssoc(eventPlanAssoc); + resultObject.put("eventPlanAssocId",eventPlanAssoc.getId()); + DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setEventId(id); dcEventProcess.setSource(1); @@ -818,7 +820,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { else if (device.getDeviceType().equals(DeviceTypeConstants.VARIABLE_INFORMATION_FLAG.toString())) { if (operationType == 1) { // 情报板发布全流程 - if (otherConfig.get("operationType").equals("2")) { + if (otherConfig.getString("operationType").equals("2")) { JSONArray contentList = JSON.parseArray(otherConfig.get("contentList").toString()); JSONObject foundContent = contentList.stream() .map(content -> JSON.parseObject(content.toString())) @@ -842,7 +844,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { } else { // 恢复操作 - if (otherConfig.get("operationType").equals("2")) { + if (otherConfig.getString("operationType").equals("2")) { // 还原上次 props.put("fileId", "10"); functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_1B; @@ -868,7 +870,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { params.put("name", "task-event"); params.put("outVVol", "8"); params.put("priority", "1"); - if (otherConfig.get("operationType").equals("2")) { + if (otherConfig.getString("operationType").equals("2")) { // 智能发布 JSONArray contentList = JSON.parseArray(otherConfig.get("contentList").toString()); JSONObject foundContent = contentList.stream() @@ -1050,23 +1052,17 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { public int updateDcEmergencyPlans(DcEmergencyPlans dcEmergencyPlans) { dcEmergencyPlans.setUpdateTime(DateUtils.getNowDate()); List dcExecuteActionList = dataProcessing(dcEmergencyPlans); - // 修改事件预案表数据 - dcEmergencyPlansMapper.updateDcEmergencyPlans(dcEmergencyPlans); // 修改执行操作表数据 - dcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setUpdateTime(DateUtils.getNowDate())); - // 过滤出删除掉的操作 - String dcExecuteActionId = dcExecuteActionList.stream() + dcExecuteActionList.stream() .filter(dcExecuteAction -> dcExecuteAction.getId() != null) - .map(DcExecuteAction::getEmergencyPlansId) - .map(String::valueOf) - .findFirst() - .orElse(null); + .forEach(dcExecuteAction -> dcExecuteAction.setUpdateTime(DateUtils.getNowDate())); + // 过滤出删除掉的操作 List ids = dcExecuteActionList.stream() .filter(dcExecuteAction -> dcExecuteAction.getId() != null) .map(DcExecuteAction::getId) .collect(Collectors.toList()); // 查询出事件预案关联的操作 - List dcExecuteActionIdList = dcExecuteActionService.selectDcExecuteActionByEmergencyPlansId(dcExecuteActionId); + List dcExecuteActionIdList = dcExecuteActionService.selectDcExecuteActionByEmergencyPlansId(dcEmergencyPlans.getId().toString()); List commonIds = new ArrayList<>(ids); commonIds.retainAll(dcExecuteActionIdList); @@ -1086,8 +1082,15 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { insertDcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setCreateTime(DateUtils.getNowDate())); dcExecuteActionService.insertDcExecuteActionBatch(insertDcExecuteActionList); } + List updateDcExecuteAction = dcExecuteActionList.stream() + .filter(dcExecuteAction -> dcExecuteAction.getId() != null) + .collect(Collectors.toList()); + if (updateDcExecuteAction.size() > 0) { + dcExecuteActionService.updateDcExecuteActionBatch(updateDcExecuteAction); + } - return dcExecuteActionService.updateDcExecuteActionBatch(dcExecuteActionList); + // 修改事件预案表数据 + return dcEmergencyPlansMapper.updateDcEmergencyPlans(dcEmergencyPlans); } /** @@ -1167,7 +1170,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { }else if (dcExecuteAction.getDeviceType() == DeviceTypeConstants.VARIABLE_INFORMATION_FLAG || dcExecuteAction.getDeviceType() == DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING) { // 情报板/语音广播 - if (jsonObject.get("operationType").equals("1")) { + if (jsonObject.getString("operationType").equals("1")) { config.put("content",jsonObject.get("content")); }else { config.put("operationType","智能发布"); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java index 12513d6c..799dadea 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java @@ -1,17 +1,20 @@ package com.zc.business.service.impl; +import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.Date; +import java.util.HashSet; import java.util.List; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; -import com.zc.business.domain.DcEventProcess; +import com.zc.business.domain.*; +import com.zc.business.mapper.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.zc.business.mapper.DcEventImportantFileMapper; -import com.zc.business.domain.DcEventImportantFile; import com.zc.business.service.IDcEventImportantFileService; /** @@ -27,6 +30,16 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer private DcEventImportantFileMapper dcEventImportantFileMapper; @Autowired private DcEventProcessServiceImpl dcEventProcessService; + @Autowired + private DcEventServiceImpl dcEventService; + @Autowired + private DcEventMapper dcEventMapper; + @Autowired + private DcEventAccidentMapper dcEventAccidentMapper; + @Autowired + private DcEventTrafficCongestionMapper dcEventTrafficCongestionMapper; + @Autowired + private DcEventImportantMapper dcEventImportantMapper; /** * 查询重要事件文件内容 @@ -59,8 +72,11 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer * @return 结果 */ @Override - public int insertDcEventImportantFile(DcEventImportantFile dcEventImportantFile) + public AjaxResult insertDcEventImportantFile(DcEventImportantFile dcEventImportantFile) { + if (StringUtils.isEmpty(dcEventImportantFile.getEventId())){ + return AjaxResult.error("事件id不能为空!"); + } int i = dcEventImportantFileMapper.insertDcEventImportantFile(dcEventImportantFile); if (i > 0){ if (StringUtils.isNotEmpty(dcEventImportantFile.getStatus()) && "1".equals(dcEventImportantFile.getStatus())) { @@ -81,8 +97,9 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer dcEventProcess.setContext(context); dcEventProcessService.insertDcEventProcess(dcEventProcess); } + return AjaxResult.success("新增成功!"); } - return i; + return AjaxResult.error("新增失败!"); } /** @@ -92,8 +109,11 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer * @return 结果 */ @Override - public int updateDcEventImportantFile(DcEventImportantFile dcEventImportantFile) + public AjaxResult updateDcEventImportantFile(DcEventImportantFile dcEventImportantFile) { + if (dcEventImportantFile.getId() == null || StringUtils.isEmpty(dcEventImportantFile.getEventId())){ + return AjaxResult.error("参数错误!"); + } int i = dcEventImportantFileMapper.updateDcEventImportantFile(dcEventImportantFile); if (i > 0){ if (StringUtils.isNotEmpty(dcEventImportantFile.getStatus()) && "1".equals(dcEventImportantFile.getStatus())){ @@ -113,8 +133,10 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer dcEventProcess.setContext(context); dcEventProcessService.insertDcEventProcess(dcEventProcess); } + return AjaxResult.success("修改成功"); + } - return i; + return AjaxResult.error("修改失败"); } /** @@ -153,4 +175,226 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer return AjaxResult.success(num); } + /** + * @Description 生成重要事件文件内容 + * + * @author liuwenge + * @date 2024/5/8 15:51 + * @param eventId 事件id + * @param type 类型 1:初报,2续报,3终报 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult generate(String eventId,String type){ + + if (StringUtils.isEmpty(eventId) || StringUtils.isEmpty(type)){ + return AjaxResult.error("参数错误!"); + } + DcEvent dcEvent = dcEventMapper.selectDcEventById(eventId); + if (dcEvent == null){ + return AjaxResult.error("事件查询失败,请检查事件id是否正确!"); + } + String eventType = dcEvent.getEventType().toString(); + if ("1".equals(eventType) && "4".equals(eventType)){ + return AjaxResult.error("事件类型错误!"); + } + + DcEventImportantFile dcEventImportantFile = new DcEventImportantFile(); + dcEventImportantFile.setFromDept("齐鲁高速股份有限公司"); + SimpleDateFormat df = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分"); + String createTime = df.format(new Date()); + dcEventImportantFile.setCreateTime(createTime); + + String title = "关于G35济菏高速" + dcEvent.getStakeMark() + dcEvent.getStringEventType(); + if ("1".equals(type)){ + title += "的初报"; + } else if ("2".equals(type)){ + title += "的续报"; + } else if ("3".equals(type)){ + title += "的终报"; + } + dcEventImportantFile.setTitle(title); + + dcEventImportantFile.setToDept("智慧管理中心:"); + + String content = "\t" + df.format(dcEvent.getOccurrenceTime()) + ",G35济菏高速" + dcEvent.getStakeMark(); + if ("1".equals(dcEvent.getDirection()) || "菏泽方向".equals(dcEvent.getDirection())) { + content += "菏泽方向"; + } else if ("3".equals(dcEvent.getDirection()) || "济南方向".equals(dcEvent.getDirection())) { + content += "济南方向"; + } + content += "发生"; + if ("1-1".equals(dcEvent.getEventSubclass()) || "追尾".equals(dcEvent.getEventSubclass())) { + content += "追尾"; + } else if ("1-2".equals(dcEvent.getEventSubclass()) || "侧翻".equals(dcEvent.getEventSubclass())) { + content += "侧翻"; + } else if ("1-3".equals(dcEvent.getEventSubclass()) || "撞护栏".equals(dcEvent.getEventSubclass())) { + content += "撞护栏"; + } else if ("1-4".equals(dcEvent.getEventSubclass()) || "自燃".equals(dcEvent.getEventSubclass())) { + content += "自燃"; + } else if ("1-5".equals(dcEvent.getEventSubclass()) || "其他事故".equals(dcEvent.getEventSubclass())){ + content += "其他"; + } else if ("4-1".equals(dcEvent.getEventSubclass()) || "道路拥堵".equals(dcEvent.getEventSubclass())){ + content += "道路拥堵"; + } else if ("4-2".equals(dcEvent.getEventSubclass()) || "立交拥堵".equals(dcEvent.getEventSubclass())){ + content += "立交拥堵"; + } else if ("4-3".equals(dcEvent.getEventSubclass()) || "收费站拥堵".equals(dcEvent.getEventSubclass())){ + content += "收费站拥堵"; + } else if ("4-4".equals(dcEvent.getEventSubclass()) || "服务区拥堵".equals(dcEvent.getEventSubclass())){ + content += "服务区拥堵"; + } + content += "事故。"; + + if ("1".equals(type) || "2".equals(type)) { + + //占用车道 + if (StringUtils.isNotEmpty(dcEvent.getLang())) { + String[] langArr = dcEvent.getLang().split(","); + content += "事故占用"; + for (String lang : langArr) { + if ("0".equals(lang)) { + content += "应急车道、"; + } else if ("1".equals(lang)) { + content += "行1车道、"; + } else if ("2".equals(lang)) { + content += "行2车道、"; + } else if ("3".equals(lang)) { + content += "行3车道、"; + } else if ("4".equals(lang)) { + content += "行4车道、"; + } + } + content = content.substring(0, content.length() - 1); + content += ","; + + String[] langAll = {"1", "2", "3", "4", "0"}; + HashSet diff = new HashSet<>(Arrays.asList(langAll)); + diff.removeAll(Arrays.asList(langArr)); + for (String s : diff) { + if ("0".equals(s)) { + content += "应急车道、"; + } else if ("1".equals(s)) { + content += "行1车道、"; + } else if ("2".equals(s)) { + content += "行2车道、"; + } else if ("3".equals(s)) { + content += "行3车道、"; + } else if ("4".equals(s)) { + content += "行4车道、"; + } + } + content = content.substring(0, content.length() - 1); + content += "正常通行,"; + + + } else { + content += "行1车道、行2车道、行3车道、行4车道、应急车道正常通行,"; + } + + //压车情况 + if ("1".equals(eventType)) { + DcEventAccident dcEventAccident = dcEventAccidentMapper.selectDcEventAccidentById(eventId); + if (dcEventAccident != null && dcEventAccident.getTrafficJam() != null && dcEventAccident.getTrafficJam() > 0f) { + content += "压车" + dcEventAccident.getTrafficJam() + "公里。\n\t"; + } else { + content += "无压车。\n\t"; + } + } else if ("4".equals(eventType)){ + DcEventTrafficCongestion dcEventTrafficCongestion = dcEventTrafficCongestionMapper.selectDcEventTrafficCongestionById(eventId); + if (dcEventTrafficCongestion != null && dcEventTrafficCongestion.getCongestionMileage() != null && dcEventTrafficCongestion.getCongestionMileage() > 0f) { + content += "压车" + dcEventTrafficCongestion.getCongestionMileage() + "公里。\n\t"; + } else { + content += "无压车。\n\t"; + } + } + + //到达现场情况 + DcEventImportant dcEventImportant = dcEventImportantMapper.selectDcEventImportantByEventId(eventId); + if (dcEventImportant == null){ + dcEventImportant = new DcEventImportant(); + dcEventImportant.setEventId(eventId); + dcEventImportant.setTrafficPoliceStatus(0); + dcEventImportant.setMedicalStatus(0); + dcEventImportant.setFireStatus(0); + dcEventImportant.setBoardStatus(0); + dcEventImportantMapper.insertDcEventImportant(dcEventImportant); + } + if (StringUtils.isNotEmpty(dcEventImportant.getPlateNumber())) { + content += "现场事故车辆及车牌号信息:" + dcEventImportant.getPlateNumber() + "。"; + } + + String arrived = ""; + String notArrived = "路管、"; + if (dcEventImportant.getTrafficPoliceStatus() == 1) { + arrived += "交警、"; + } else { + notArrived += "交警、"; + } + if (dcEventImportant.getMedicalStatus() == 1) { + arrived += "医疗、"; + } else { + notArrived += "医疗、"; + } + if (dcEventImportant.getFireStatus() == 1) { + arrived += "消防、"; + } else { + notArrived += "消防、"; + } + if (arrived.length() > 0) { + arrived = arrived.substring(0, arrived.length() - 1); + content += arrived + "等单位已到达现场。"; + } + + + if (StringUtils.isNotEmpty(dcEventImportant.getCurrentProgress())) { + content += "事故目前处置进度为" + dcEventImportant.getCurrentProgress() + "。"; + } + if (StringUtils.isNotEmpty(dcEventImportant.getTakeSteps())) { + content += "已采取的措施:" + dcEventImportant.getTakeSteps() + "。"; + } + if (StringUtils.isNotEmpty(dcEventImportant.getDiversionPoint())) { + content += "在" + dcEventImportant.getDiversionPoint() + "进行分流。"; + } + + if (dcEventImportant.getBoardStatus() == 1) { + content += "事故点后方情报板已经做好信息提示。"; + } + content += "\n"; + + notArrived = notArrived.substring(0, notArrived.length() - 1); + content += "\t" + notArrived + "等单位正在赶往现场。"; + + if ("1".equals(type)) { + content += "具体情况稍后报告。"; + } else if ("2".equals(type)) { + if (dcEvent.getEstimatedEndTime() != null) { + SimpleDateFormat dateFormat = new SimpleDateFormat("HH时mm分"); + content += "预计结束时间为" + dateFormat.format(dcEvent.getEstimatedEndTime()) + "。"; + } + } + + dcEventImportantFile.setContent(content); + + + } else if ("3".equals(type)){ + content += "\n\t"; + SimpleDateFormat dateFormat = new SimpleDateFormat("HH时mm分"); + content += dateFormat.format(new Date()) + ",事故处理完毕,道路恢复畅通。"; + dcEventImportantFile.setContent(content); + + } else { + return AjaxResult.error("文件类型错误!"); + } + + + SysUser user = SecurityUtils.getLoginUser().getUser(); + dcEventImportantFile.setCreateName(user.getNickName()); + dcEventImportantFile.setPhoneNumber(user.getPhonenumber()); + dcEventImportantFile.setType(type); + dcEventImportantFile.setStatus("0"); + dcEventImportantFile.setEventId(eventId); + + return AjaxResult.success(dcEventImportantFile); + } + } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java index a097984a..6dd2a68c 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java @@ -148,4 +148,19 @@ public class DcEventProcessServiceImpl implements IDcEventProcessService public List selectDcEventProcessListById(String id) { return dcEventProcessMapper.selectDcDispatchByEventId(id); } + + /** + * @Description 查询前置节点状态 + * + * @author liuwenge + * @date 2024/5/13 16:07 + * @param eventId 事件id + * @param processId 节点id + * @return 状态 0未完成 1已完成 + */ + @Override + public int selectPreviousNodeStatus(String eventId, Long processId){ + return dcEventProcessMapper.selectPreviousNodeStatus(eventId,processId); + } + } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index 3feebbaf..f83a4235 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -6,11 +6,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StakeMarkUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.system.service.ISysDeptService; import com.zc.business.domain.*; -import com.zc.business.enums.EventSubclassEnum; -import com.zc.business.enums.ValueConverter; +import com.zc.business.enums.*; import com.zc.business.mapper.*; import com.zc.business.service.IDcEventProcessService; import com.zc.business.service.IDcEventService; @@ -77,6 +78,9 @@ public class DcEventServiceImpl extends ServiceImpl impl @Autowired private IDcEventProcessService dcEventProcessService; + @Autowired + private DcPublishManageMapper dcPublishManageMapper; + private final String HAPPEN = "发生"; private final String EVENT = "事件"; private final String SUBEVENT = "0"; @@ -136,7 +140,6 @@ public class DcEventServiceImpl extends ServiceImpl impl String dcEventId = dcEvent.getId(); - //获取事件类型 int eventType = Math.toIntExact(dcEvent.getEventType()); @@ -216,10 +219,10 @@ public class DcEventServiceImpl extends ServiceImpl impl //交通管制 case 3: if (dcEvent.getDcEventTrafficControl() != null) { - //TODO 插入多个收费站 + // 插入多个收费站 if (dcEvent.getDcEventTrafficControl().getFacilityIds().length == 1) {//facilityIds==1 说明只选择了一个收费站 - if (dcEventId != null) {//不等于空 事件处置页面 修改 + if (dcEventId != null && !dcEventId.equals("")) {//不等于空 事件处置页面 修改 dcEventMapper.deleteDcEventById(uuid);//删除添加的事件主类 DcEvent dcEvent1 = new DcEvent(); dcEvent1.setId(dcEventId);//事件id @@ -662,7 +665,36 @@ public class DcEventServiceImpl extends ServiceImpl impl */ @Override public int updateDcEvent(DcEvent dcEvent) { - DcEvent oldEvent = selectEventSubclassById(dcEvent.getEventType().intValue(), dcEvent.getId()); +/* + //事件类型校验 + for (EventTypeEnum value : EventTypeEnum.values()) { + if (dcEvent.getEventType().toString().equals(value.getInfo())){ + dcEvent.setEventType(Long.valueOf(value.getCode())); + } + } +*/ + + // 事件子类校验 + for (EventSubclass value : EventSubclass.values()) { + if (value.getDescription().equals(dcEvent.getEventSubclass())){ + dcEvent.setEventSubclass(value.getCode()); + } + } + /*//事件来源校验 + for (EventSource value : EventSource.values()) { + if (value.getDescription().equals(dcEvent.getEventSource())){ + dcEvent.setEventSource(Long.valueOf(value.getCode())); + } + }*/ + +//事件方向 + if (dcEvent.getDirection().equals("菏泽方向")){ + dcEvent.setDirection("1"); + } if (dcEvent.getDirection().equals("济南方向")){ + dcEvent.setDirection("3"); + } + + DcEvent oldEvent = selectEventSubclassById(dcEvent.getId()); dcEvent.setUpdateTime(DateUtils.getNowDate()); int i7 = dcEventMapper.updateDcEvent(dcEvent); if (i7 > 0) { @@ -745,6 +777,15 @@ public class DcEventServiceImpl extends ServiceImpl impl int i7 = -1; for (String id : ids) { DcEvent dcEvent = dcEventMapper.selectDcEventMainById(id); + if (dcEvent==null){ + continue; + } + // todo 删除信息发布记录 + dcPublishManageMapper.deleteDcPublishManageEventId(id); + // 删除调度记录资源 + dcPublishManageMapper.deleteDisPathSource(id); + //删除调度记录 + dcPublishManageMapper.deleteDisPath(id); int eventType = Math.toIntExact(dcEvent.getEventType()); i7 = dcEventMapper.deleteDcEventById(id); @@ -821,14 +862,15 @@ public class DcEventServiceImpl extends ServiceImpl impl /** * 获取事件以及子类详细信息 * - * @param eventType + * @param * @param id * @return */ @Override - public DcEvent selectEventSubclassById(int eventType, String id) { - //todo + public DcEvent selectEventSubclassById(String id) { + // DcEvent dcEvent = dcEventMapper.selectDcEventById(id); + int eventType = Math.toIntExact(dcEvent.getEventType()); List processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType())); dcEvent.setProcessConfigList(processConfigList); switch (eventType) { @@ -951,8 +993,18 @@ public class DcEventServiceImpl extends ServiceImpl impl @Override public int updateDcEventState(String id, int state) { + //多次修改请求 + DcEvent dcEvent1 = dcEventMapper.selectDcEventById(id); + //事件删除 后 返回成功 + if (dcEvent1 ==null){ + return 1; + } + //事件状态已被修改 返回成功 + if (dcEvent1.getEventState()==state){ + return 1; + } - int i = dcEventMapper.updateDcEventState(id, state); + int i = dcEventMapper.updateDcEventState(id, state); if (i > 0) { DcEvent dcEvent = dcEventMapper.selectDcEventMainById(id); @@ -1027,6 +1079,112 @@ public class DcEventServiceImpl extends ServiceImpl impl } else if ("3".equals(result.getRight())) { result.setRight("下行"); } + } else if ("eventSubclass".equals(result.getRightPath())) { + if ("1-1".equals(result.getRight())) { + result.setRight("追尾"); + } else if ("1-2".equals(result.getRight())) { + result.setRight("侧翻"); + } else if ("1-3".equals(result.getRight())) { + result.setRight("撞护栏"); + } else if ("1-4".equals(result.getRight())) { + result.setRight("自燃"); + } else if ("1-5".equals(result.getRight())) { + result.setRight("其他事故"); + } else if ("2-1".equals(result.getRight())) { + result.setRight("车辆故障"); + } else if ("3-1".equals(result.getRight())) { + result.setRight("主线封闭和限行"); + } else if ("3-2".equals(result.getRight())) { + result.setRight("收费站封闭和限行"); + } else if ("3-3".equals(result.getRight())) { + result.setRight("立交封闭和限行"); + } else if ("3-4".equals(result.getRight())) { + result.setRight("服务区封闭和限行"); + } else if ("4-1".equals(result.getRight())) { + result.setRight("道路拥堵"); + } else if ("4-2".equals(result.getRight())) { + result.setRight("立交拥堵"); + } else if ("4-3".equals(result.getRight())) { + result.setRight("收费站拥堵"); + } else if ("4-4".equals(result.getRight())) { + result.setRight("服务区拥堵"); + } else if ("5-1".equals(result.getRight())) { + result.setRight("行人"); + } else if ("5-2".equals(result.getRight())) { + result.setRight("非机动车"); + } else if ("5-3".equals(result.getRight())) { + result.setRight("摩托车"); + } else if ("5-4".equals(result.getRight())) { + result.setRight("其他"); + } else if ("6-1".equals(result.getRight())) { + result.setRight("烟雾"); + } else if ("6-2".equals(result.getRight())) { + result.setRight("倒伏树木"); + } else if ("6-3".equals(result.getRight())) { + result.setRight("撒落物"); + } else if ("6-4".equals(result.getRight())) { + result.setRight("动物"); + } else if ("6-5".equals(result.getRight())) { + result.setRight("其他"); + } else if ("7-1".equals(result.getRight())) { + result.setRight("道路养护施工"); + } else if ("7-2".equals(result.getRight())) { + result.setRight("收费站养护施工"); + } else if ("7-3".equals(result.getRight())) { + result.setRight("服务区养护施工"); + } else if ("7-4".equals(result.getRight())) { + result.setRight("枢纽立交匝道养护施工"); + } else if ("7-5".equals(result.getRight())) { + result.setRight("地方道路养护施工"); + } else if ("7-6".equals(result.getRight())) { + result.setRight("道路工程建设施工"); + } else if ("7-7".equals(result.getRight())) { + result.setRight("收费站工程建设施工"); + } else if ("7-8".equals(result.getRight())) { + result.setRight("服务区工程建设施工"); + } else if ("7-9".equals(result.getRight())) { + result.setRight("枢纽立交匝道工程建设施工"); + } else if ("7-10".equals(result.getRight())) { + result.setRight("地方道路工程建设施工"); + } else if ("8-1".equals(result.getRight())) { + result.setRight("封闭、暂停营业"); + } else if ("8-2".equals(result.getRight())) { + result.setRight("重要设施停用"); + } else if ("8-3".equals(result.getRight())) { + result.setRight("服务区其他异常"); + } else if ("9-1".equals(result.getRight())) { + result.setRight("摄像机"); + } else if ("9-2".equals(result.getRight())) { + result.setRight("护栏"); + } else if ("9-3".equals(result.getRight())) { + result.setRight("隔离栅"); + } else if ("9-4".equals(result.getRight())) { + result.setRight("情报板"); + } else if ("9-5".equals(result.getRight())) { + result.setRight("防炫板"); + } else if ("9-6".equals(result.getRight())) { + result.setRight("其他"); + } else if ("10-1".equals(result.getRight())) { + result.setRight("雨"); + } else if ("10-2".equals(result.getRight())) { + result.setRight("雪"); + } else if ("10-3".equals(result.getRight())) { + result.setRight("雾"); + } else if ("10-4".equals(result.getRight())) { + result.setRight("大风"); + } else if ("10-5".equals(result.getRight())) { + result.setRight("低温寒潮"); + } else if ("10-6".equals(result.getRight())) { + result.setRight("路面积雪"); + } else if ("10-7".equals(result.getRight())) { + result.setRight("路面结冰"); + } else if ("10-8".equals(result.getRight())) { + result.setRight("路面积水"); + } else if ("10-9".equals(result.getRight())) { + result.setRight("其他"); + } else if ("11-1".equals(result.getRight())) { + result.setRight("其他事件"); + } } else if ("eventState".equals(result.getRightPath())) { if ("0".equals(result.getRight())) { result.setRight("待确认"); @@ -1099,7 +1257,9 @@ public class DcEventServiceImpl extends ServiceImpl impl } else if ("2".equals(result.getRight())) { result.setRight("紧急"); } - } else if ("dcEventAccident.locationType".equals(result.getRightPath())) { + } else if ("dcEventAccident.locationType".equals(result.getRightPath()) + || "dcEventTrafficCongestion.locationType".equals(result.getRightPath()) + || "dcEventVehicleAccident.locationType".equals(result.getRightPath())) { if ("1".equals(result.getRight())) { result.setRight("高速主线"); } else if ("2".equals(result.getRight())) { @@ -1109,7 +1269,8 @@ public class DcEventServiceImpl extends ServiceImpl impl } else if ("4".equals(result.getRight())) { result.setRight("收费站"); } - } else if ("dcEventAccident.weatherCondition".equals(result.getRightPath())) { + } else if ("dcEventAccident.weatherCondition".equals(result.getRightPath()) + || "dcEventVehicleAccident.weatherCondition".equals(result.getRightPath())) { if ("1".equals(result.getRight())) { result.setRight("晴"); } else if ("2".equals(result.getRight())) { @@ -1238,17 +1399,6 @@ public class DcEventServiceImpl extends ServiceImpl impl } else if ("9".equals(result.getRight())) { result.setRight("出口匝道"); } - } else if ("dcEventTrafficCongestion.locationType".equals(result.getRightPath()) - || "dcEventVehicleAccident.locationType".equals(result.getRightPath())) { - if ("1".equals(result.getRight())) { - result.setRight("高速主线"); - } else if ("2".equals(result.getRight())) { - result.setRight("服务区"); - } else if ("3".equals(result.getRight())) { - result.setRight("立交桥"); - } else if ("4".equals(result.getRight())) { - result.setRight("收费站"); - } } else if ("dcEventTrafficCongestion.weatherCondition".equals(result.getRightPath())) { if ("1".equals(result.getRight())) { result.setRight("晴"); @@ -1339,7 +1489,9 @@ public class DcEventServiceImpl extends ServiceImpl impl } } String label = ValueConverter.eventLabel(result.getRightPath()); - context = context + label + "修改为:" + result.getRight() + ","; + if (StringUtils.isNotEmpty(label)){ + context = context + label + "修改为:" + result.getRight() + ","; + } } } @@ -1414,9 +1566,17 @@ public class DcEventServiceImpl extends ServiceImpl impl @Override public AjaxResult skipClear(String eventId) { + + DcEvent dcEvent = dcEventMapper.selectDcEventById(eventId); + if (dcEvent.getEventType() == null || (dcEvent.getEventType() != 1 && dcEvent.getEventType() != 2 && dcEvent.getEventType() != 6)){ + return AjaxResult.error("该事件类型无需清障!"); + } + if (dcEvent.getEventState() != null && dcEvent.getEventState() == 2){ + return AjaxResult.error("该事件已结束,无法进行操作!"); + } int i = dcEventMapper.selectClearInfo(eventId); if (i > 0) { - return AjaxResult.error("已跳过清障,无法重复操作!"); + return AjaxResult.error("该事件已清障结束,无法进行操作!"); } //事件处置流程记录 @@ -1427,7 +1587,7 @@ public class DcEventServiceImpl extends ServiceImpl impl dcEventProcess.setProcessId(6L); dcEventProcess.setProcessName("清障结束"); - dcEventProcess.setContext("选择不需要清障"); + dcEventProcess.setContext("选择无需清障"); dcEventProcessService.insertDcEventProcess(dcEventProcess); return AjaxResult.success("无需清障成功"); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java index 887d86a2..29188473 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcMeteorologicalDetectorDataServiceImpl.java @@ -105,6 +105,15 @@ public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologica public List> selectStatistics(String deviceName) { return dcMeteorologicalDetectorDataMapper.selectStatistics(deviceName); } + /** + * 按时间统计气象设备信息列表 + * @param deviceName + * @param specificDate + * @return + */ + public List> selectStatisticsTime(String deviceName,String specificDate) { + return dcMeteorologicalDetectorDataMapper.selectStatisticsTime(deviceName,specificDate); + } @Override public List selectlistAll(DcMeteorologicalDetectorData dcMeteorologicalDetectorData) { @@ -115,4 +124,30 @@ public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologica public List selectlistVisibility(DcMeteorologicalDetectorData dcMeteorologicalDetectorData) { return dcMeteorologicalDetectorDataMapper.selectlistVisibility(dcMeteorologicalDetectorData); } + + /** + * 根据设备名称查询详细信息列表 + * @param deviceName + * @return + */ + @Override + public List selectDeviceNameList(String deviceName) { + return dcMeteorologicalDetectorDataMapper.selectDeviceNameList(deviceName); + } + + @Override + public List> selectStatisticsDay(String deviceName, String specificDate) { + if (specificDate==null || specificDate.equals("")){ + specificDate=DateUtils.getDate(); + } + return dcMeteorologicalDetectorDataMapper.selectStatisticsDay(deviceName,specificDate); + } + + @Override + public List> selectStatisticsYears(String deviceName, String specificDate) { + if (specificDate==null || specificDate.equals("")){ + specificDate=DateUtils.getDate(); + } + return dcMeteorologicalDetectorDataMapper.selectStatisticsYears(deviceName,specificDate); + } } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcOperLogServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcOperLogServiceImpl.java index 4972cf88..a7ca7493 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcOperLogServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcOperLogServiceImpl.java @@ -69,6 +69,9 @@ public class DcOperLogServiceImpl extends ServiceImpl> statisticsPublishManage() { + return dcPublishManageMapper.statisticsPublishManage(); + } + //统计今日发布事件类型分析 + @Override + public List> eventTypePublishManage() { + return dcPublishManageMapper.eventTypePublishManage(); + } + //统计今日发布趋势分析 + @Override + public List> releaseTrendsPublishManage() { + return dcPublishManageMapper.releaseTrendsPublishManage(); + } + //统计月发布趋势分析 + @Override + public List> monthTrendsPublishManage(DcPublishManage dcPublishManage) { + return dcPublishManageMapper.monthTrendsPublishManage(dcPublishManage); + } + //统计不同事件的发布渠道数量 + @Override + public List> eventTypePublishManageSum() { + return dcPublishManageMapper.eventTypePublishManageSum(); + } + //统计不同事件的发布渠道数量(月统计) + @Override + public List> eventTypePublishManageMonth(DcPublishManage dcPublishManage) { + return dcPublishManageMapper.eventTypePublishManageMonth(dcPublishManage); + } + //公众服务统计查询 + @Override + public List selectDcPublishManageStatistics(DcPublishManage dcPublishManage) { + return dcPublishManageMapper.selectDcPublishManageStatistics(dcPublishManage); + } } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java index f9e8f5ab..fa1461a0 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java @@ -1,7 +1,9 @@ package com.zc.business.service.impl; +import java.util.HashMap; import java.util.List; import com.ruoyi.common.utils.DateUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zc.business.mapper.DcPublishingChannelsMapper; @@ -54,6 +56,7 @@ public class DcPublishingChannelsServiceImpl implements IDcPublishingChannelsSer public int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels) { dcPublishingChannels.setCreateTime(DateUtils.getNowDate()); + dcPublishingChannels.setEnabled(0);//新增时默认状态为停用 return dcPublishingChannelsMapper.insertDcPublishingChannels(dcPublishingChannels); } @@ -98,4 +101,18 @@ public class DcPublishingChannelsServiceImpl implements IDcPublishingChannelsSer public List selectChannelsDataCategory(Integer dataCategory) { return dcPublishingChannelsMapper.selectChannelsDataCategory(dataCategory); } + //修改启用停用 + @Override + public int updateEnabled(DcPublishingChannels dcPublishingChannels) { + return dcPublishingChannelsMapper.updateEnabled(dcPublishingChannels); + } + //事件调度处置事件推送发布渠道 + @Override + public DcPublishingChannels eventPublishChannels(String eventId) { + String type = dcPublishingChannelsMapper.eventType(eventId);//事件类型 + if (StringUtils.isBlank(type)){ + return null; + } + return dcPublishingChannelsMapper.eventPublishChannels(type); + } } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 092a3abe..0004b57a 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -183,6 +183,9 @@ public class DcWarningServiceImpl implements IDcWarningService redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间 return dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString(),dcWarning.getEndTime());//修改数据库配置 } + if (redisValueTwo==null){ //如果传进来的事件未配置策略,在这里出入默认的过去时间值 + dcWarning.setEndTime(DateUtils.getObtainDateAfter(60));//注入过期时间(默认值为60分钟) + } //事件推送至 Websocket extracted(dcWarning); return dcWarningMapper.insertDcWarning(dcWarning);//如果没有配置策略直接加入数据库; @@ -716,8 +719,9 @@ public class DcWarningServiceImpl implements IDcWarningService dcWarningMapper.deleteDispatchResource(dispatchId);//删除全部属于该调度记录下的全部资源 ArrayList> employeesArray = (ArrayList>) map.get("employees");//取出人员 - String context = "路管人员"; + String context = ""; if (employeesArray!=null&&employeesArray.size()>0) { + context += "路管人员"; for (Map array : employeesArray) { dcDispatchResource.setDispatchType(1);//类型 dcDispatchResource.setResourceId(Long.valueOf(array.get("id").toString()));//资源id @@ -733,7 +737,10 @@ public class DcWarningServiceImpl implements IDcWarningService } ArrayList> vehicleArray = (ArrayList>) map.get("vehicle");////取出车辆 if (vehicleArray!=null&&vehicleArray.size()>0) { - context += ",救援车辆"; + if (context.length() > 0){ + context += ","; + } + context += "救援车辆"; for (Map array : vehicleArray) { dcDispatchResource.setDispatchType(2); dcDispatchResource.setResourceId(Long.valueOf(array.get("id").toString())); @@ -757,5 +764,11 @@ public class DcWarningServiceImpl implements IDcWarningService dcEventProcessService.insertDcEventProcess(dcEventProcess); return 1; } + //误报解除 + @Override + public Integer falseAlarmResolution(DcWarning dcWarning) { + dcWarning.setUpdateTime(DateUtils.getNowDate()); + return dcWarningMapper.falseAlarmResolution(dcWarning); + } } diff --git a/zc-business/src/main/java/com/zc/business/task/ScheduledTaskSchedulingTask.java b/zc-business/src/main/java/com/zc/business/task/ScheduledTaskSchedulingTask.java index 8c17d150..445df902 100644 --- a/zc-business/src/main/java/com/zc/business/task/ScheduledTaskSchedulingTask.java +++ b/zc-business/src/main/java/com/zc/business/task/ScheduledTaskSchedulingTask.java @@ -29,6 +29,7 @@ public class ScheduledTaskSchedulingTask { JSONArray jsonArray = JSONArray.parseArray(job.getCallParameter()); for (Object o : jsonArray) { deviceController.batchInvokedFunction(o); + //deviceController.batchInvokedFunction(o,1); todo } } } diff --git a/zc-business/src/main/java/com/zc/business/utils/PoiUtil.java b/zc-business/src/main/java/com/zc/business/utils/PoiUtil.java index 5727021c..a85915f2 100644 --- a/zc-business/src/main/java/com/zc/business/utils/PoiUtil.java +++ b/zc-business/src/main/java/com/zc/business/utils/PoiUtil.java @@ -516,7 +516,17 @@ public class PoiUtil { //判断key在Map中是否存在 if (textMap.containsKey(runsText)) { if (value != null) { - run.setText(value.toString(), 0); + String valueStr = value.toString().replaceAll("\\\\t"," "); + String[] valueArr = valueStr.split("\\\\n"); + if (valueArr.length > 1) { + for (int index = 0; index < valueArr.length; index++) { + run.setText(valueArr[index], index); + run.addCarriageReturn(); + } + } else { + run.setText(valueStr,0); + } + } else { run.setText("", 0); } diff --git a/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml b/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml index 7be095d3..697be257 100644 --- a/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml @@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t1.device_id = #{deviceId} + and t2.direction = #{direction} and t2.device_name like concat('%', #{deviceName}, '%') and t1.release_content = #{releaseContent} and t1.release_status = #{releaseStatus} diff --git a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml index 9add2632..ea6f3cf6 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml @@ -36,6 +36,7 @@ + @@ -166,6 +167,7 @@ longitude, dimension, event_title, + event_subclass as event_subclas, link_id, is_perceived, CASE event_type @@ -396,8 +398,6 @@ WHEN '3' THEN '济南方向' END AS direction, dc_event.user_id, - dc_event.dimension, - dc_event.longitude, dc_event.is_perceived, dc_event.user_id as user_id, sys_user.nick_name as nickName, @@ -408,6 +408,7 @@ dc_event.event_title, dc_event.occurrence_time, dc_event.event_type AS event_type, + dc_event.event_subclass AS event_subclas, CASE dc_event.event_type WHEN '1' THEN '交通事故' WHEN '2' THEN '车辆故障' @@ -486,6 +487,7 @@ WHEN '2' THEN '已完成' WHEN '3' THEN '已撤销' END AS stringEventState, + dc_event.event_source, CASE dc_event.event_source WHEN '1' THEN '96659' WHEN '2' THEN '交警转接' @@ -504,12 +506,17 @@ dc_event.lang as lang, dc_event_type.event_name AS event_name, sys_dept.dept_name as organization_name, + + dc_stake_mark.latitude AS dimension, + dc_stake_mark.longitude AS longitude, dc_road.road_name as road_name + FROM dc_event LEFT JOIN dc_event_type ON dc_event_type.event_type = dc_event.event_type LEFT JOIN sys_dept ON dc_event.dept_id = sys_dept.dept_id LEFT JOIN dc_road ON dc_event.road_id = dc_road.id LEFT JOIN sys_user on dc_event.user_id = sys_user.user_id + LEFT JOIN dc_stake_mark ON dc_event.stake_mark=dc_stake_mark.stake_mark AND dc_event.direction=dc_stake_mark.direction where dc_event.id = #{id} @@ -674,7 +681,7 @@ event_source_tips = #{eventSourceTips}, in_tunnel = #{inTunnel}, road_id = #{roadId}, - road_id = #{lang}, + lang = #{lang}, event_title = #{eventTitle}, occurrence_time = #{occurrenceTime}, is_perceived = #{isPerceived}, @@ -708,12 +715,11 @@ event_source_tips = #{eventSourceTips}, in_tunnel = #{inTunnel}, road_id = #{roadId}, - road_id = #{lang}, + lang = #{lang}, event_title = #{eventTitle}, occurrence_time = #{occurrenceTime}, is_perceived = #{isPerceived}, dimension = #{dimension}, - event_nature = #{eventNature}, link_id = #{linkId}, @@ -775,7 +781,7 @@ ORDER BY nodeNode diff --git a/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml index cab4e024..6a7ea7fb 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml @@ -145,4 +145,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where t1.id = #{eventId}; + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml b/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml index 7250028c..a68051b1 100644 --- a/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml @@ -26,12 +26,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + select id, iot_device_id, rainfall, visibility_type, visibility, atmospheric_pressure, temperature, humidity, wind_direction, wind_speed, precipitation_type, wet_slippery_coefficient,remote_road_surface_temperature, remote_road_surface_status, water_film_ice_snow_value,create_time,stake_mark,device_name,direction from dc_meteorological_detector_data @@ -151,23 +157,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" COALESCE(ROUND(AVG(dc.visibility), 2), 0) AS avg_visibility FROM ( - SELECT 0 AS time_slot UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 - UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 - UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL SELECT 13 - UNION ALL SELECT 14 UNION ALL SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17 - UNION ALL SELECT 18 UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21 - UNION ALL SELECT 22 UNION ALL SELECT 23 + SELECT 0 AS time_slot UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 + UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 + UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL SELECT 13 + UNION ALL SELECT 14 UNION ALL SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17 + UNION ALL SELECT 18 UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21 + UNION ALL SELECT 22 UNION ALL SELECT 23 ) AS h - LEFT JOIN + LEFT JOIN dc_meteorological_detector_data dc - ON - DATE(dc.create_time) = CURDATE() - AND HOUR(dc.create_time) = h.time_slot - AND dc.device_name = #{deviceName} + ON + DATE(dc.create_time) = CURDATE() + AND HOUR(dc.create_time) = h.time_slot + AND dc.device_name = #{deviceName} GROUP BY h.time_slot, date; + + + + + + + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml b/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml index e9341438..9ec470fe 100644 --- a/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -32,6 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -43,7 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from dc_publish_manage as manage LEFT JOIN dc_event as event on event.id=manage.event_id LEFT JOIN dc_event_traffic_control as traffic on event.id=traffic.id - LEFT JOIN dc_facility as facility ON traffic.facility_id=facility.id + manage.event_id is not null and event.event_state = #{eventState} and event.event_type = #{eventType} - and manage.publish_status = #{publishStatus} + and manage.publish_status = #{publishStatus} and manage.create_time between #{startTime} and #{endTime} @@ -76,9 +78,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP BY manage.event_id - ORDER BY manage.create_time + ORDER BY event.create_time desc - + + insert into dc_publish_manage @@ -123,6 +126,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, update_time, create_time, + log_id, + #{eventId}, @@ -144,6 +149,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{remark}, #{updateTime}, #{createTime}, + #{logId}, + @@ -169,6 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark = #{remark}, update_time = #{updateTime}, create_time = #{createTime}, + log_id = #{logId}, where id = #{id} @@ -176,11 +184,187 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from dc_publish_manage where id = #{id} - + + delete from dc_publish_manage where event_id = #{eventId} + - delete from dc_publish_manage where id in + delete from dc_publish_manage where id in #{id} - \ No newline at end of file + + DELETE FROM dc_dispatch_resource WHERE dispatch_id IN ( + SELECT id FROM dc_dispatch WHERE event_id = #{eventId} + ) + + + DELETE FROM dc_dispatch WHERE event_id = #{eventId} + + + + + + + + + + diff --git a/zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml b/zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml index c08b0ce4..25b43302 100644 --- a/zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml @@ -25,6 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id from dc_publishing_channels where data_category=#{dataCategory} + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml index 4bb2278e..f4695f04 100644 --- a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml @@ -186,7 +186,7 @@ ifNull(t2.buses,0) buses, ifNull(t2.tankers,0) tankers from dc_event t1 - left join dc_event_vehicle_accident t2 on t1.id = t2.id + left join dc_event_accident t2 on t1.id = t2.id where t1.event_type = '1' and t1.direction = #{direction} and DATE_FORMAT(t1.start_time,'%Y%m%d') = DATE_FORMAT(#{startTime},'%Y%m%d') @@ -326,13 +326,13 @@ where t1.event_type = '1' and t1.direction = #{direction} - and DATE_FORMAT(t1.start_time,'%Y%m%d') = DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 1 DAY),'%Y%m%d') + and DATE_FORMAT(t1.start_time,'%Y%m%d') = DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 1 YEAR),'%Y%m%d') - and DATE_FORMAT(t1.start_time,'%Y%m') = DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 1 MONTH),'%Y%m') + and DATE_FORMAT(t1.start_time,'%Y%m') = DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 1 YEAR),'%Y%m') - and YEAR(t1.start_time) = YEAR(DATE_SUB(#{startTime},INTERVAL 1 QUARTER)) and QUARTER(t1.start_time) = QUARTER(DATE_SUB(#{startTime},INTERVAL 1 QUARTER)) + and YEAR(t1.start_time) = YEAR(DATE_SUB(#{startTime},INTERVAL 1 YEAR)) and QUARTER(t1.start_time) = QUARTER(#{startTime}) and YEAR(t1.start_time) = YEAR(DATE_SUB(#{startTime},INTERVAL 1 YEAR)) @@ -384,13 +384,13 @@ from dc_event where event_type = '1' and direction = #{direction} - and DATE_FORMAT(start_time,'%Y%m%d') = DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 1 DAY),'%Y%m%d') + and DATE_FORMAT(start_time,'%Y%m%d') = DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 1 YEAR),'%Y%m%d') - and DATE_FORMAT(start_time,'%Y%m') = DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 1 MONTH),'%Y%m') + and DATE_FORMAT(start_time,'%Y%m') = DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 1 YEAR),'%Y%m') - and YEAR(start_time) = YEAR(DATE_SUB(#{startTime},INTERVAL 1 QUARTER)) and QUARTER(start_time) = QUARTER(DATE_SUB(#{startTime},INTERVAL 1 QUARTER)) + and YEAR(start_time) = YEAR(DATE_SUB(#{startTime},INTERVAL 1 YEAR)) and QUARTER(start_time) = QUARTER(#{startTime}) and YEAR(start_time) = YEAR(DATE_SUB(#{startTime},INTERVAL 1 YEAR)) diff --git a/zc-business/src/main/resources/mapper/business/DcVoiceBroadcastMapper.xml b/zc-business/src/main/resources/mapper/business/DcVoiceBroadcastMapper.xml index 45b14aa3..2551fa05 100644 --- a/zc-business/src/main/resources/mapper/business/DcVoiceBroadcastMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcVoiceBroadcastMapper.xml @@ -11,10 +11,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + - select id, category, content, remark, create_time, update_time from dc_voice_broadcast + select id, category, content, remark, create_time, update_time,priority,outVol,repeat_times from dc_voice_broadcast + + +