diff --git a/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java b/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java index 6f25528c..a639c2fc 100644 --- a/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java +++ b/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java @@ -92,7 +92,7 @@ public class BroadcastController extends BaseController { jsonResult = JSONObject.parseObject(response.body().string()); } } catch (SocketTimeoutException e) { - if (numberOfReconnections >3){ + if (numberOfReconnections <3){ numberOfReconnections += 1; getToken(); return nearCamListDistance(params); @@ -100,9 +100,9 @@ public class BroadcastController extends BaseController { jsonResult = new JSONObject(); jsonResult.put("code","400"); jsonResult.put("msg","语音广播连接错误"); - return jsonResult; } } + numberOfReconnections = 0; return jsonResult; } diff --git a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java index 0cb175de..1bc47768 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java @@ -3,19 +3,20 @@ package com.zc.business.controller; 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.utils.poi.ExcelUtil; +import com.zc.business.domain.DcDispatch; import com.zc.business.domain.DcWarning; +import com.zc.business.domain.export.*; import com.zc.business.service.IDCPerceivedEventsWarningService; +import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -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 java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; /** * @author 王思祥 @@ -253,6 +254,44 @@ public class DCPerceivedEventsWarningController extends BaseController { } return AjaxResult.success(perceivedEventsWarningService.selectManyTimesInterval(dcWarning)); } + + /** + * @Description 导出感知事件多发时段 + * + * @author liuwenge + * @date 2024/6/25 10:34 + * @param response + * @param dcWarning + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation(value = "导出感知事件多发时段",tags = {"ECharts导出"}) + @GetMapping("/exportManyTimesInterval") + public AjaxResult exportManyTimesInterval(HttpServletResponse response,DcWarning dcWarning){ + if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null + ||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark()) + ||StringUtils.isBlank(dcWarning.getDirection())){ + return AjaxResult.error("参数错误"); + } + HashMap map = perceivedEventsWarningService.selectManyTimesInterval(dcWarning); + List list = new ArrayList<>(); + if (map != null){ + List> currentlyMap = (List>) map.get("currentlyMap"); + List> lastYearMap = (List>) map.get("lastYearMap"); + for (int i = 0; i < currentlyMap.size(); i++) { + ManyTimesInterval manyTimesInterval = new ManyTimesInterval(); + int time = Integer.parseInt(currentlyMap.get(i).get("time").toString()); + manyTimesInterval.setTime(time + "点至" + (time +1) + "点"); + manyTimesInterval.setCurrentData(currentlyMap.get(i).get("number").toString()); + manyTimesInterval.setContemporaneousData(lastYearMap.get(i).get("number").toString()); + list.add(manyTimesInterval); + } + } + ExcelUtil util = new ExcelUtil<>(ManyTimesInterval.class); + util.exportExcel(response, list, "感知事件多发时段"); + + return AjaxResult.success("导出感知事件多发时段成功"); + } + //新-感知事件类型分析 @PostMapping("/selectWarningType") public AjaxResult selectWarningType(@RequestBody DcWarning dcWarning){ @@ -263,6 +302,36 @@ public class DCPerceivedEventsWarningController extends BaseController { } return AjaxResult.success(perceivedEventsWarningService.newSelectWarningType(dcWarning)); } + @ApiOperation(value = "导出感知事件类型分析",tags = {"ECharts导出"}) + @GetMapping("/exportSelectWarningType") + public AjaxResult exportSelectWarningType(HttpServletResponse response,DcWarning dcWarning){ + if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null + ||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark()) + ||StringUtils.isBlank(dcWarning.getDirection())){ + return AjaxResult.error("参数错误"); + } + HashMap map = perceivedEventsWarningService.newSelectWarningType(dcWarning); + List list = new ArrayList<>(); + if (map != null){ + List> currentlyMap = (List>) map.get("currentlyMap"); + Integer total = 0; + for (HashMap stringObjectHashMap : currentlyMap) { + total += Integer.parseInt(stringObjectHashMap.get("number").toString()); + } + for (int i = 0; i < currentlyMap.size(); i++) { + SelectWarningType selectWarningType = new SelectWarningType(); + selectWarningType.setWarningType(currentlyMap.get(i).get("warningType").toString()); + selectWarningType.setNumber(currentlyMap.get(i).get("number").toString()); + double ratio = Double.parseDouble(currentlyMap.get(i).get("number").toString()) / total * 100; + selectWarningType.setRatio(String.format("%.2f", ratio) + "%"); + list.add(selectWarningType); + } + } + ExcelUtil util = new ExcelUtil<>(SelectWarningType.class); + util.exportExcel(response, list, "感知事件类型分析"); + + return AjaxResult.success("导出感知事件类型分析成功"); + } //新-感知事件桩号范围内事件分析 @PostMapping("/selectSection") public AjaxResult selectSection(@RequestBody DcWarning dcWarning){ @@ -273,6 +342,42 @@ public class DCPerceivedEventsWarningController extends BaseController { } return AjaxResult.success(perceivedEventsWarningService.newSelectSection(dcWarning)); } + + @ApiOperation(value = "导出桩号范围内事件分析",tags = {"ECharts导出"}) + @GetMapping("/exportSelectSection") + public AjaxResult exportSelectSection(HttpServletResponse response,DcWarning dcWarning){ + if (dcWarning==null||StringUtils.isBlank(dcWarning.getType())||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null + ||StringUtils.isBlank(dcWarning.getStartStakeMark())||StringUtils.isBlank(dcWarning.getEndStakeMark()) + ||StringUtils.isBlank(dcWarning.getDirection())){ + return AjaxResult.error("参数错误"); + } + HashMap map = perceivedEventsWarningService.newSelectSection(dcWarning); + List list = new ArrayList<>(); + if (map != null){ + HashMap currentlyMap = (HashMap) map.get("currentlyMap"); + HashMap lastYearMap = (HashMap) map.get("lastYearMap"); + + Set allKeys = new HashSet<>(currentlyMap.keySet()); + allKeys.addAll(lastYearMap.keySet()); + for (String key : allKeys) { + SelectSection selectSection = new SelectSection(); + selectSection.setStakeMark(key); + if (currentlyMap.containsKey(key)){ + selectSection.setCurrentData(currentlyMap.get(key).toString()); + } + if (lastYearMap.containsKey(key)){ + selectSection.setContemporaneousData(lastYearMap.get(key).toString()); + } + + list.add(selectSection); + } + + } + ExcelUtil util = new ExcelUtil<>(SelectSection.class); + util.exportExcel(response, list, "桩号范围内事件分析"); + + return AjaxResult.success("导出桩号范围内事件分析成功"); + } //新-感知事件路段处置类型分析 @PostMapping("/selectStateType") public AjaxResult selectStateType(@RequestBody DcWarning dcWarning){ @@ -281,9 +386,88 @@ public class DCPerceivedEventsWarningController extends BaseController { } return AjaxResult.success(perceivedEventsWarningService.newSelectStateType(dcWarning)); } + @ApiOperation(value = "导出感知事件路段分析",tags = {"ECharts导出"}) + @GetMapping("/exportSelectStateType") + public AjaxResult exportSelectStateType(HttpServletResponse response, DcWarning dcWarning){ + if (dcWarning==null||dcWarning.getCurrently()==null||dcWarning.getLastYear()==null){ + return AjaxResult.error("参数错误"); + } + List list = new ArrayList<>(); + + HashMap map = perceivedEventsWarningService.newSelectStateType(dcWarning); + List> currentlyMap = (List>) map.get("currentlyMap"); + List> lastYearMap = (List>) map.get("lastYearMap"); + List> stateDuration = (List>) map.get("stateDuration"); + + Map>> currentlyData = currentlyMap.stream().collect(Collectors.groupingBy(item -> item.get("sectionName").toString())); + Map>> lastYearData = lastYearMap.stream().collect(Collectors.groupingBy(item -> item.get("sectionName").toString())); + Map>> stateDurationData = stateDuration.stream().collect(Collectors.groupingBy(item -> item.get("sectionName").toString())); + + Set allKeys = new HashSet<>(currentlyData.keySet()); + allKeys.addAll(lastYearData.keySet()); + allKeys.addAll(stateDurationData.keySet()); + for (String key : allKeys) { + SelectStateType selectStateType = new SelectStateType(); + selectStateType.setSectionName(key); + selectStateType.setSectionName(key); + if (currentlyData.containsKey(key)){ + List> sectionData = currentlyData.get(key); + for (int i = 0; i < sectionData.size(); i++) { + if ("1".equals(sectionData.get(i).get("warningState").toString())){ + selectStateType.setReporting(sectionData.get(i).get("num").toString()); + } else if ("2".equals(sectionData.get(i).get("warningState").toString())){ + selectStateType.setCompleted(sectionData.get(i).get("num").toString()); + } else if ("3".equals(sectionData.get(i).get("warningState").toString())){ + selectStateType.setTerminated(sectionData.get(i).get("num").toString()); + } else if ("4".equals(sectionData.get(i).get("warningState").toString())){ + selectStateType.setAutomaticTermination(sectionData.get(i).get("num").toString()); + } + } + } + if (lastYearData.containsKey(key)){ + List> sectionData = lastYearData.get(key); + Integer total = 0; + for (Map sectionDatum : sectionData) { + total += Integer.parseInt(sectionDatum.get("num").toString()); + } + selectStateType.setContemporaneousData(total.toString()); + } + if (stateDurationData.containsKey(key)){ + List> sectionData = stateDurationData.get(key); + selectStateType.setAverageDuration(sectionData.get(0).get("avg").toString()); + } + + list.add(selectStateType); + } + + ExcelUtil util = new ExcelUtil<>(SelectStateType.class); + util.exportExcel(response, list, "感知事件路段分析"); + + return AjaxResult.success("导出感知事件路段分析成功"); + } //查询感知数量按照路段数量进行排名 @PostMapping("/sectionPerceivedList") public AjaxResult getSectionPerceivedEventsList(){ return AjaxResult.success(perceivedEventsWarningService.selectSectionPerceivedEventsList()); } + + @ApiOperation(value = "导出感知事件路段排名",tags = {"ECharts导出"}) + @GetMapping("/exportSectionPerceivedList") + public AjaxResult exportSectionPerceivedList(HttpServletResponse response){ + List> dataList = perceivedEventsWarningService.selectSectionPerceivedEventsList(); + List list = new ArrayList<>(); + if (dataList != null && dataList.size() > 0){ + for (int i = 0; i < dataList.size(); i++) { + SectionPerceivedList sectionPerceivedList = new SectionPerceivedList(); + sectionPerceivedList.setRank(i+1); + sectionPerceivedList.setSectionName(dataList.get(i).get("sectionName").toString()); + sectionPerceivedList.setNumber(dataList.get(i).get("number").toString()); + list.add(sectionPerceivedList); + } + } + ExcelUtil util = new ExcelUtil<>(SectionPerceivedList.class); + util.exportExcel(response, list, "感知事件路段排名"); + + return AjaxResult.success("导出感知事件路段排名成功"); + } } 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 f37c41de..6536358a 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 @@ -199,7 +199,7 @@ public class DcDeviceController extends BaseController { * @param response 响应 * @param iotDevice 导入数据结果 */ - @PreAuthorize("@ss.hasPermi('iot:device:export')") + // @PreAuthorize("@ss.hasPermi('iot:device:export')") @Log(title = "导出设备", businessType = BusinessType.EXPORT) @PostMapping("export") public void exportDevice(HttpServletResponse response, DcDevice iotDevice) { diff --git a/zc-business/src/main/java/com/zc/business/domain/export/ManyTimesInterval.java b/zc-business/src/main/java/com/zc/business/domain/export/ManyTimesInterval.java new file mode 100644 index 00000000..6eff5897 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/ManyTimesInterval.java @@ -0,0 +1,65 @@ +package com.zc.business.domain.export; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 导出感知事件多发时段对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class ManyTimesInterval extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 时段 */ + @Excel(name = "时段") + private String time; + + /** 本期事件 */ + @Excel(name = "本期事件") + private String currentData; + /** 去年同期 */ + @Excel(name = "去年同期") + private String contemporaneousData; + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getCurrentData() { + return currentData; + } + + public void setCurrentData(String currentData) { + this.currentData = currentData; + } + + public String getContemporaneousData() { + return contemporaneousData; + } + + public void setContemporaneousData(String contemporaneousData) { + this.contemporaneousData = contemporaneousData; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("time", getTime()) + .append("currentData", getCurrentData()) + .append("contemporaneousData", getContemporaneousData()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/SectionPerceivedList.java b/zc-business/src/main/java/com/zc/business/domain/export/SectionPerceivedList.java new file mode 100644 index 00000000..2e5fb669 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/SectionPerceivedList.java @@ -0,0 +1,62 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 导出感知事件路段排名对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class SectionPerceivedList extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 排名 */ + @Excel(name = "排名") + private Integer rank; + + /** 路段名称 */ + @Excel(name = "路段名称") + private String sectionName; + /** 事件数量 */ + @Excel(name = "事件数量") + private String number; + + public Integer getRank() { + return rank; + } + + public void setRank(Integer rank) { + this.rank = rank; + } + + public String getSectionName() { + return sectionName; + } + + public void setSectionName(String sectionName) { + this.sectionName = sectionName; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("rank", getRank()) + .append("sectionName", getSectionName()) + .append("number", getNumber()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/SelectSection.java b/zc-business/src/main/java/com/zc/business/domain/export/SelectSection.java new file mode 100644 index 00000000..4e17c9a2 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/SelectSection.java @@ -0,0 +1,62 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 导出桩号范围内事件分析对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class SelectSection extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 桩号 */ + @Excel(name = "桩号") + private String stakeMark; + + /** 本期事件 */ + @Excel(name = "本期事件") + private String currentData; + /** 去年同期 */ + @Excel(name = "去年同期") + private String contemporaneousData; + + public String getStakeMark() { + return stakeMark; + } + + public void setStakeMark(String stakeMark) { + this.stakeMark = stakeMark; + } + + public String getCurrentData() { + return currentData; + } + + public void setCurrentData(String currentData) { + this.currentData = currentData; + } + + public String getContemporaneousData() { + return contemporaneousData; + } + + public void setContemporaneousData(String contemporaneousData) { + this.contemporaneousData = contemporaneousData; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("stakeMark", getStakeMark()) + .append("currentData", getCurrentData()) + .append("contemporaneousData", getContemporaneousData()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/SelectStateType.java b/zc-business/src/main/java/com/zc/business/domain/export/SelectStateType.java new file mode 100644 index 00000000..1f3c22ca --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/SelectStateType.java @@ -0,0 +1,115 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 导出感知事件路段分析对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class SelectStateType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 路段 */ + @Excel(name = "路段") + private String sectionName; + + /** 上报 */ + @Excel(name = "上报") + private String reporting; + + /** 已完成 */ + @Excel(name = "已完成") + private String completed; + + /** 已终止 */ + @Excel(name = "已终止") + private String terminated; + + /** 自动结束 */ + @Excel(name = "自动结束") + private String automaticTermination; + + /** 去年同期 */ + @Excel(name = "去年同期") + private String contemporaneousData; + + /** 平均时长 */ + @Excel(name = "平均时长") + private String averageDuration; + + public String getSectionName() { + return sectionName; + } + + public void setSectionName(String sectionName) { + this.sectionName = sectionName; + } + + public String getReporting() { + return reporting; + } + + public void setReporting(String reporting) { + this.reporting = reporting; + } + + public String getCompleted() { + return completed; + } + + public void setCompleted(String completed) { + this.completed = completed; + } + + public String getTerminated() { + return terminated; + } + + public void setTerminated(String terminated) { + this.terminated = terminated; + } + + public String getAutomaticTermination() { + return automaticTermination; + } + + public void setAutomaticTermination(String automaticTermination) { + this.automaticTermination = automaticTermination; + } + + public String getContemporaneousData() { + return contemporaneousData; + } + + public void setContemporaneousData(String contemporaneousData) { + this.contemporaneousData = contemporaneousData; + } + + public String getAverageDuration() { + return averageDuration; + } + + public void setAverageDuration(String averageDuration) { + this.averageDuration = averageDuration; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("sectionName", getSectionName()) + .append("reporting", getReporting()) + .append("completed", getCompleted()) + .append("terminated", getTerminated()) + .append("automaticTermination", getAutomaticTermination()) + .append("contemporaneousData", getContemporaneousData()) + .append("averageDuration", getAverageDuration()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/SelectWarningType.java b/zc-business/src/main/java/com/zc/business/domain/export/SelectWarningType.java new file mode 100644 index 00000000..9d49eeab --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/SelectWarningType.java @@ -0,0 +1,63 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 导出感知事件类型分析对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class SelectWarningType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 事件类型 */ + @Excel(name = "事件类型",readConverterExp = "1=交通拥堵,2=行人,3=非机动车,4=停车,5=倒车/逆行,6=烟火,7=撒落物,8=异常天气,9=护栏碰撞,10=交通事故,11=车辆故障,99=其他") + private String warningType; + + /** 数量 */ + @Excel(name = "数量") + private String number; + + /** 占比 */ + @Excel(name = "占比") + private String ratio; + + public String getWarningType() { + return warningType; + } + + public void setWarningType(String warningType) { + this.warningType = warningType; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + public String getRatio() { + return ratio; + } + + public void setRatio(String ratio) { + this.ratio = ratio; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("warningType", getWarningType()) + .append("number", getNumber()) + .append("ratio", getRatio()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java index 2f7cba6c..6398fec8 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java @@ -427,10 +427,10 @@ public class DcDeviceServiceImpl extends ServiceImpl i String childType = String.valueOf(parameter.get("childType")); String deviceState = String.valueOf(parameter.get("deviceState")); String direction = String.valueOf(parameter.get("direction")); - Integer useState = Integer.parseInt(parameter.get("useState").toString()); + String useState = String.valueOf(parameter.get("useState")); DcDevice device = new DcDevice(); if (!Objects.equals(useState, "null")) { - device.setUseState(useState); + device.setUseState(Integer.parseInt(useState)); } if (!Objects.equals(childType, "null")) { device.setChildType(childType); 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 a913e615..52e79f10 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 @@ -957,7 +957,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { JSONObject errorResult = new JSONObject(); errorResult.put("device", device.getId()); errorResult.put("content", "未匹配到对应的模板内容"); - resultArray.add(errorResult); + errorResult.put("deviceName", device.getDeviceName()); + JSONObject result = new JSONObject(); + result.put("result",errorResult); + result.put("code",500); + result.put("msg","操作失败"); + resultArray.add(result); status = 1; remark.append("失败"); } else { @@ -1064,7 +1069,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { } proDevice.put("functions", functionList); propsList.add(proDevice); - insertEquipmentControlRecordTable(device, propsList, resultArray, status, remark.toString(),eventId); + // 语音广播恢复操作不存记录 + if (!(device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString()) + && operationType.equals(2))) { + insertEquipmentControlRecordTable(device, propsList, resultArray, status, remark.toString(),eventId); + } + } catch (HttpException | IOException e) { log.error(e.toString()); throw new RuntimeException(e); @@ -1108,39 +1118,40 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { processingDeviceParameters(functionId, functionList, props); AjaxResult ajaxResult11 = dcDeviceController.getAjaxResult(iotDeviceId, functionId, props); + + // 13功能码执行参数构造 + DcInfoBoardTemplate dcInfoBoardTemplate = JSON.parseObject( + JSON.toJSONString(otherConfig.get("dcInfoBoardTemplate")), + DcInfoBoardTemplate.class); + HashMap props11 = new HashMap<>(); + functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13; + List> list = new ArrayList<>(); + Map parameters = new HashMap<>(); + // stopTime + parameters.put("STAY", dcInfoBoardTemplate.getStopTime()); + // inScreenMode + parameters.put("ACTION", dcInfoBoardTemplate.getInScreenMode()); + // fontSpacing + parameters.put("SPEED", dcInfoBoardTemplate.getFontSpacing()); + // fontColor + parameters.put("COLOR", dcInfoBoardTemplate.getFontColor()); + // fontType + parameters.put("FONT", dcInfoBoardTemplate.getFontType()); + // fontSize + parameters.put("FONT_SIZE", dcInfoBoardTemplate.getFontSize()); + // content + parameters.put("CONTENT", dcInfoBoardTemplate.getContent()); + // screenSize 768*64 宽度和高度 + parameters.put("width", dcInfoBoardTemplate.getScreenSize().split("\\*")[0]); + parameters.put("height", dcInfoBoardTemplate.getScreenSize().split("\\*")[1]); + // formatStyle + parameters.put("formatStyle", dcInfoBoardTemplate.getFormatStyle()); + list.add(parameters); + props11.put("parameters", list); + + processingDeviceParameters(functionId, functionList, props11); if (ajaxResult11.get("code").equals(200)) { // 2:执行13功能码 - HashMap props11 = new HashMap<>(); - functionId = DeviceFunctionIdConstants.VARIABLE_INFORMATION_FLAG_13; - List> list = new ArrayList<>(); - Map parameters = new HashMap<>(); - DcInfoBoardTemplate dcInfoBoardTemplate = JSON.parseObject( - JSON.toJSONString(otherConfig.get("dcInfoBoardTemplate")), - DcInfoBoardTemplate.class); - // stopTime - parameters.put("STAY", dcInfoBoardTemplate.getStopTime()); - // inScreenMode - parameters.put("ACTION", dcInfoBoardTemplate.getInScreenMode()); - // fontSpacing - parameters.put("SPEED", dcInfoBoardTemplate.getFontSpacing()); - // fontColor - parameters.put("COLOR", dcInfoBoardTemplate.getFontColor()); - // fontType - parameters.put("FONT", dcInfoBoardTemplate.getFontType()); - // fontSize - parameters.put("FONT_SIZE", dcInfoBoardTemplate.getFontSize()); - // content - parameters.put("CONTENT", dcInfoBoardTemplate.getContent()); - // screenSize 768*64 宽度和高度 - parameters.put("width", dcInfoBoardTemplate.getScreenSize().split("\\*")[0]); - parameters.put("height", dcInfoBoardTemplate.getScreenSize().split("\\*")[1]); - // formatStyle - parameters.put("formatStyle", dcInfoBoardTemplate.getFormatStyle()); - list.add(parameters); - props11.put("parameters", list); - - processingDeviceParameters(functionId, functionList, props11); - AjaxResult ajaxResult13 = dcDeviceController.getAjaxResult(iotDeviceId, functionId, props11); JSONObject result = new JSONObject(); result.put("device", device.getId()); @@ -1168,7 +1179,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { } resultArray.add(result); } else { - resultArray.add(ajaxResult11); + JSONObject error = new JSONObject(); + error.put("result",ajaxResult11); + error.put("deviceName",device.getDeviceName()); + error.put("device",device.getId()); + error.put("content",dcInfoBoardTemplate.getContent()); + resultArray.add(error); status = 1; } return status; 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 2c61d4ff..e22a4166 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 @@ -298,26 +298,26 @@ public class DcEventServiceImpl extends ServiceImpl impl dcEventProcess.setEventId(dcEventId); dcEventProcess.setSource(1); String context = "新增管制事件:"; - if ("3-1".equals(dcEvent.getSubclass())){ + if ("3-1".equals(dcEvent.getEventSubclass())){ context += dcEvent.getStakeMark(); if ("1".equals(dcEvent.getDirection())){ context += "菏泽方向"; } else if ("3".equals(dcEvent.getDirection())){ - context += "菏泽方向"; + context += "济南方向"; } if (dcEvent.getDcEventTrafficControl().getControlType() == 1){ context += "主线封闭"; } else { context += "主线限行"; } - } else if ("3-3".equals(dcEvent.getSubclass()) || "3-4".equals(dcEvent.getSubclass())){ + } else if ("3-3".equals(dcEvent.getEventSubclass()) || "3-4".equals(dcEvent.getEventSubclass())){ String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityId()); DcFacility facility = dcFacilityService.getFacility(facilityId); context += facility.getFacilityName(); if ("1".equals(dcEvent.getDirection())){ context += "菏泽方向"; } else if ("3".equals(dcEvent.getDirection())){ - context += "菏泽方向"; + context += "济南方向"; } if (dcEvent.getDcEventTrafficControl().getControlType() == 1){ context += "封闭"; @@ -365,7 +365,7 @@ public class DcEventServiceImpl extends ServiceImpl impl if ("1".equals(dcEvent.getDirection())){ context += "菏泽方向"; } else if ("3".equals(dcEvent.getDirection())){ - context += "菏泽方向"; + context += "济南方向"; } if (dcEvent.getDcEventTrafficControl().getControlType() == 1){ context += "封闭"; @@ -474,7 +474,7 @@ public class DcEventServiceImpl extends ServiceImpl impl if ("1".equals(dcEvent.getDirection())){ context += "菏泽方向"; } else if ("3".equals(dcEvent.getDirection())){ - context += "菏泽方向"; + context += "济南方向"; } if (dcEvent.getDcEventTrafficControl().getControlType() == 1){ context += "封闭"; diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java index 320b654a..88761dfd 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java @@ -165,7 +165,7 @@ public class DcGantryStatisticsDataImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcGantryStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.DAY); + queryWrapper.eq(DcGantryStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.DAY.getCode()); queryWrapper.between(DcGantryStatisticsData::getStatisticalDate, DateUtil.beginOfMonth(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每日数据添加到每月门架统计缓存中 @@ -179,7 +179,7 @@ public class DcGantryStatisticsDataImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcGantryStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.MONTH); + queryWrapper.eq(DcGantryStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.MONTH.getCode()); queryWrapper.between(DcGantryStatisticsData::getStatisticalDate, DateUtil.beginOfQuarter(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每月数据添加到每季度门架统计缓存 @@ -193,7 +193,7 @@ public class DcGantryStatisticsDataImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcGantryStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.QUARTER); + queryWrapper.eq(DcGantryStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.QUARTER.getCode()); queryWrapper.between(DcGantryStatisticsData::getStatisticalDate, DateUtil.beginOfYear(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每季度数据添加到每年门架统计缓存 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcTollStationStatisticsDataImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcTollStationStatisticsDataImpl.java index 27aed6bb..41e83743 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcTollStationStatisticsDataImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcTollStationStatisticsDataImpl.java @@ -262,7 +262,7 @@ public class DcTollStationStatisticsDataImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcTollStationStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.DAY); + queryWrapper.eq(DcTollStationStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.DAY.getCode()); queryWrapper.between(DcTollStationStatisticsData::getStatisticalDate, DateUtil.beginOfMonth(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每日数据添加到每月交通收费站统计缓存中 @@ -276,7 +276,7 @@ public class DcTollStationStatisticsDataImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcTollStationStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.MONTH); + queryWrapper.eq(DcTollStationStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.MONTH.getCode()); queryWrapper.between(DcTollStationStatisticsData::getStatisticalDate, DateUtil.beginOfQuarter(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每月数据添加到每季度交通收费站统计缓存 @@ -290,7 +290,7 @@ public class DcTollStationStatisticsDataImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcTollStationStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.QUARTER); + queryWrapper.eq(DcTollStationStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.QUARTER.getCode()); queryWrapper.between(DcTollStationStatisticsData::getStatisticalDate, DateUtil.beginOfYear(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每季度数据添加到每年交通收费站统计缓存 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSectionStatisticsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSectionStatisticsServiceImpl.java index 3af297bb..fb55f927 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSectionStatisticsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSectionStatisticsServiceImpl.java @@ -291,7 +291,7 @@ public class DcTrafficSectionStatisticsServiceImpl private void recoveryMonthlyCache() { // 构建查询条件,查询当前月份至今的每日交通数据 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcTrafficSectionData::getPeriodType, TrafficDataPeriodTypeEnum.DAY); + queryWrapper.eq(DcTrafficSectionData::getPeriodType, TrafficDataPeriodTypeEnum.DAY.getCode()); queryWrapper.between(DcTrafficSectionData::getStatisticalDate, DateUtil.beginOfMonth(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每日数据添加到每月交通统计缓存 @@ -305,7 +305,7 @@ public class DcTrafficSectionStatisticsServiceImpl private void recoveryQuarterlyCache() { // 构建查询条件,查询当前季度至今的每月交通数据 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcTrafficSectionData::getPeriodType, TrafficDataPeriodTypeEnum.MONTH); + queryWrapper.eq(DcTrafficSectionData::getPeriodType, TrafficDataPeriodTypeEnum.MONTH.getCode()); queryWrapper.between(DcTrafficSectionData::getStatisticalDate, DateUtil.beginOfQuarter(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每月数据添加到每季度交通统计缓存 @@ -319,7 +319,7 @@ public class DcTrafficSectionStatisticsServiceImpl private void recoveryYearlyCache() { // 构建查询条件,查询当前年份至今的每季度交通数据 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcTrafficSectionData::getPeriodType, TrafficDataPeriodTypeEnum.QUARTER); + queryWrapper.eq(DcTrafficSectionData::getPeriodType, TrafficDataPeriodTypeEnum.QUARTER.getCode()); queryWrapper.between(DcTrafficSectionData::getStatisticalDate, DateUtil.beginOfYear(new Date()), new Date()); List dcTrafficSectionDataList = this.list(queryWrapper); // 遍历查询结果,将每季度数据添加到每年交通统计缓存 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/IDcGantryMetricsStatisticsDataServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/IDcGantryMetricsStatisticsDataServiceImpl.java index fb17a98b..411f74cc 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/IDcGantryMetricsStatisticsDataServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/IDcGantryMetricsStatisticsDataServiceImpl.java @@ -434,7 +434,7 @@ public class IDcGantryMetricsStatisticsDataServiceImpl private void recoveryMonthlyCache() { // 构建查询条件,查询当前月份至今的每日交通数据 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcGantryMetricsStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.DAY); + queryWrapper.eq(DcGantryMetricsStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.DAY.getCode()); queryWrapper.between(DcGantryMetricsStatisticsData::getStatisticalDate, DateUtil.beginOfMonth(new Date()), new Date()); List dcGantryMetricsStatisticsDataList = this.list(queryWrapper); // 遍历查询结果,将每日数据添加到每月门架指标统计缓存中 @@ -448,7 +448,7 @@ public class IDcGantryMetricsStatisticsDataServiceImpl private void recoveryQuarterlyCache() { // 构建查询条件,查询当前季度至今的每月交通数据 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcGantryMetricsStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.MONTH); + queryWrapper.eq(DcGantryMetricsStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.MONTH.getCode()); queryWrapper.between(DcGantryMetricsStatisticsData::getStatisticalDate, DateUtil.beginOfQuarter(new Date()), new Date()); List dcGantryMetricsStatisticsDataList = this.list(queryWrapper); // 遍历查询结果,将每月数据添加到每季度门架指标统计缓存 @@ -462,7 +462,7 @@ public class IDcGantryMetricsStatisticsDataServiceImpl private void recoveryYearlyCache() { // 构建查询条件,查询当前年份至今的每季度交通数据 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DcGantryMetricsStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.QUARTER); + queryWrapper.eq(DcGantryMetricsStatisticsData::getPeriodType, TrafficDataPeriodTypeEnum.QUARTER.getCode()); queryWrapper.between(DcGantryMetricsStatisticsData::getStatisticalDate, DateUtil.beginOfYear(new Date()), new Date()); List dcGantryMetricsStatisticsDataList = this.list(queryWrapper); // 遍历查询结果,将每季度数据添加到每年门架指标统计缓存