Browse Source

感知事件相关接口,机构接口修改

develop
zhao-meiyu 1 year ago
parent
commit
b7b532bfc5
  1. 78
      zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java
  2. 10
      zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java
  3. 20
      zc-business/src/main/java/com/zc/business/domain/DcOrganization.java
  4. 45
      zc-business/src/main/java/com/zc/business/domain/DcWarning.java
  5. 9
      zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java
  6. 43
      zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java
  7. 27
      zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java
  8. 5
      zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java
  9. 28
      zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java
  10. 151
      zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java
  11. 15
      zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml
  12. 151
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

78
zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java

@ -4,12 +4,16 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcWarning; import com.zc.business.domain.DcWarning;
import com.zc.business.service.IDCPerceivedEventsWarningService; import com.zc.business.service.IDCPerceivedEventsWarningService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.HashMap;
/** /**
* @author 王思祥 * @author 王思祥
* @ClassName DCPerceivedEventsWarningController * @ClassName DCPerceivedEventsWarningController
@ -42,5 +46,79 @@ public class DCPerceivedEventsWarningController extends BaseController {
public AjaxResult getPerceivedEventsList(@RequestBody DcWarning dcWarning){ public AjaxResult getPerceivedEventsList(@RequestBody DcWarning dcWarning){
return AjaxResult.success(perceivedEventsWarningService.selectPerceivedEventsList(dcWarning)); return AjaxResult.success(perceivedEventsWarningService.selectPerceivedEventsList(dcWarning));
} }
//查询感知数量按照路段数量进行排名
@PostMapping("/sectionPerceivedList")
public AjaxResult getSectionPerceivedEventsList( ){
return AjaxResult.success(perceivedEventsWarningService.selectSectionPerceivedEventsList());
}
//查询感知数量按照路段进行区分
@PostMapping("/sectionPerceivedNumber")
public AjaxResult getSectionPerceivedNumber(){
return AjaxResult.success(perceivedEventsWarningService.selectSectionPerceivedNumber());
}
//查询当前日,日累计感知事件,按照小时进行分组
@PostMapping("/dailyCumulative")
public AjaxResult getDailyCumulative(){
return AjaxResult.success(perceivedEventsWarningService.selectDailyCumulative());
}
//查询当前月,月累计感知事件,按照小时段进行分组
@PostMapping("/dailyCumulativeMonth")
public AjaxResult getDailyCumulativeMonth(){
return AjaxResult.success(perceivedEventsWarningService.selectDailyCumulativeMonth());
}
//按事件源统计感知事件统计信息
@PostMapping("/warningSourceGroup")
public AjaxResult getWarningSourceGroup(){
return AjaxResult.success(perceivedEventsWarningService.selectWarningSourceGroup());
}
//当日感知事件的处置情况占比
@PostMapping("/warningStateDay")
public AjaxResult getWarningStateDay(){
return AjaxResult.success(perceivedEventsWarningService.selectWarningStateDay());
}
//感知事件类型占比
@PostMapping("/warningTypeDay")
public AjaxResult getWarningTypeDay(){
return AjaxResult.success(perceivedEventsWarningService.selectWarningTypeDay());
}
//某一路段某一时间段的感知事件趋势
@PostMapping("/warningTrend")
public AjaxResult getWarningTrend(@RequestBody DcWarning dcWarning){
String type = dcWarning.getType();//类型
String sectionId = dcWarning.getSectionId();//桩号id
Date createTime = dcWarning.getCreateTime();//时间参数,参数根据类型配置,比如2022年,传值2022-00-00 00:00:00
if (StringUtils.isBlank(type)||StringUtils.isBlank(sectionId)||createTime==null){
return AjaxResult.error("参数数据异常");
}
return AjaxResult.success(perceivedEventsWarningService.selectWarningTrend(dcWarning));
}
//某一路段某一时间段的感知事件类型占比
@PostMapping("/warningSectionType")
public AjaxResult getWarningSectionType(@RequestBody DcWarning dcWarning){
String type = dcWarning.getType();//类型
String sectionId = dcWarning.getSectionId();//路段所属桩号id
Date createTime = dcWarning.getCreateTime();//时间参数,参数根据类型配置,比如2022年,传值2022-00-00 00:00:00
if (StringUtils.isBlank(type)||StringUtils.isBlank(sectionId)||createTime==null){
return AjaxResult.error("参数数据异常");
}
return AjaxResult.success(perceivedEventsWarningService.selectWarningSectionType(dcWarning));
}
//查询某个路段下的全部桩号
@PostMapping("/sectionMarkNumber")
public AjaxResult getSectionMark(@RequestBody DcWarning dcWarning){
String sectionId = dcWarning.getSectionId();
if (StringUtils.isBlank(sectionId)){
return AjaxResult.error("参数异常");
}
return AjaxResult.success(perceivedEventsWarningService.selectSectionMark(dcWarning));
}
//感知事件类型占比
@PostMapping("/selectMarkId")
public AjaxResult selectMarkId(){
return AjaxResult.success(perceivedEventsWarningService.selectMarkId());
}
} }

10
zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java

@ -1,5 +1,7 @@
package com.zc.business.controller; package com.zc.business.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -46,8 +48,8 @@ public class DcOrganizationController extends BaseController
public AjaxResult list(DcOrganization dcOrganization) public AjaxResult list(DcOrganization dcOrganization)
{ {
List<DcOrganization> list = dcOrganizationService.selectDcOrganizationList(dcOrganization); ArrayList<HashMap> hashMaps = dcOrganizationService.selectDcOrganizationList(dcOrganization);
return AjaxResult.success(list); return AjaxResult.success(hashMaps);
} }
/** /**
@ -59,7 +61,7 @@ public class DcOrganizationController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, DcOrganization dcOrganization) public void export(HttpServletResponse response, DcOrganization dcOrganization)
{ {
List<DcOrganization> list = dcOrganizationService.selectDcOrganizationList(dcOrganization); List<DcOrganization> list = dcOrganizationService.selectDcOrganizationListExport(dcOrganization);
ExcelUtil<DcOrganization> util = new ExcelUtil<>(DcOrganization.class); ExcelUtil<DcOrganization> util = new ExcelUtil<>(DcOrganization.class);
util.exportExcel(response, list, "机构管理数据"); util.exportExcel(response, list, "机构管理数据");
} }
@ -68,7 +70,7 @@ public class DcOrganizationController extends BaseController
* 获取机构管理详细信息 * 获取机构管理详细信息
*/ */
@ApiOperation("获取机构管理详细信息") @ApiOperation("获取机构管理详细信息")
@PreAuthorize("@ss.hasPermi('business:organization:query')") @PreAuthorize("@ss.hasPerm('business:organization:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {

20
zc-business/src/main/java/com/zc/business/domain/DcOrganization.java

@ -55,6 +55,26 @@ public class DcOrganization extends TreeEntity
@Excel(name = "方向") @Excel(name = "方向")
private String direction; private String direction;
private String vehicleType;
private String number;
public String getVehicleType() {
return vehicleType;
}
public void setVehicleType(String vehicleType) {
this.vehicleType = vehicleType;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getDirection() { public String getDirection() {
return direction; return direction;
} }

45
zc-business/src/main/java/com/zc/business/domain/DcWarning.java

@ -89,15 +89,60 @@ public class DcWarning extends BaseEntity
@Excel(name = "事件标题") @Excel(name = "事件标题")
private String warningTitle; private String warningTitle;
/** $column.columnComment */ /** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String otherConfig; private String otherConfig;
/** 所属辖区路段名称 */
@Excel(name = "所属辖区路段名称")
private String sectionName;
/** 数量 */
@Excel(name = "数量")
private int number;
private String type;
private String sectionId;
public String getSectionId() {
return sectionId;
}
public void setSectionId(String sectionId) {
this.sectionId = sectionId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
} }
public String getSectionName() {
return sectionName;
}
public void setSectionName(String sectionName) {
this.sectionName = sectionName;
}
public Long getId() public Long getId()
{ {
return id; return id;

9
zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java

@ -1,6 +1,9 @@
package com.zc.business.mapper; package com.zc.business.mapper;
import java.util.HashMap;
import java.util.List; import java.util.List;
import cn.hutool.core.lang.hash.Hash;
import com.zc.business.domain.DcOrganization; import com.zc.business.domain.DcOrganization;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -61,4 +64,10 @@ public interface DcOrganizationMapper
int deleteDcOrganizationByIds(Long[] ids); int deleteDcOrganizationByIds(Long[] ids);
//查询是否存在下级 //查询是否存在下级
public Long selectParen(@Param("id") Long id); public Long selectParen(@Param("id") Long id);
//查询机构的关联的车辆数据
List<HashMap> selectDcOrganizationCar(Long id);
//计算机构人数
String selectEmployeesNum(Long id);
} }

43
zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java

@ -3,6 +3,7 @@ package com.zc.business.mapper;
import cn.hutool.core.lang.hash.Hash; import cn.hutool.core.lang.hash.Hash;
import com.zc.business.domain.DcEventType; import com.zc.business.domain.DcEventType;
import com.zc.business.domain.DcWarning; import com.zc.business.domain.DcWarning;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -16,12 +17,50 @@ public interface DcPerceivedEventsWarningMapper {
//查询预警信息表数量 //查询预警信息表数量
int perceivedEventsWarningNum(); int perceivedEventsWarningNum();
//查询历史预警信息表数量
int perceivedEventsWarningHistoryNum();
//感知事件类型 //感知事件类型
List<DcEventType> selectEventTypeList(); List<DcEventType> selectEventTypeList();
//查询预警感知事件类型 //查询预警感知事件类型
List<HashMap<String,Object>> selectWarningTypeList(); List<HashMap<String,Object>> selectWarningTypeList();
//根据类型查询预计事件 //根据类型查询预计事件
List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning); List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning);
//查询感知数量按照路段进行排名
List<HashMap<String,Object>> selectSectionPerceivedEventsList(DcWarning dcWarning);
//查询感知数量按照路段进行区分
List<HashMap<String,Object>> selectSectionPerceivedNumber(DcWarning dcWarning);
//查询当前日,日累计感知事件,按照小时进行分组
List<HashMap<String,Object>> selectDailyCumulative();
//查询当前月,月累计感知事件,按照小时进行分组
List<HashMap<String,Object>> selectDailyCumulativeMonth();
//按事件源统计感知事件统计信息
List<HashMap<String,Object>> selectWarningSourceGroup(DcWarning dcWarning);
//当日感知事件的处置情况占比
List<HashMap<String,Object>> selectWarningStateDay(DcWarning dcWarning);
//感知事件类型占比
List<HashMap<String,Object>> selectWarningTypeDay(DcWarning dcWarning);
//感知事件日趋势,传入某天的具体时间,结果按照那一天的小时分组
List<HashMap<String,Object>> selectWarningTrendDay(DcWarning dcWarning);
//感知事件月趋势,传入某月的具体时间,结果按照那一天分组
List<HashMap<String,Object>> selectWarningTrendMonth(DcWarning dcWarning);
//感知事件季度趋势,按照季度查询,按照月出结果
List<HashMap<String,Object>> selectWarningTrendQuarter(DcWarning dcWarning);
//感知事件年趋势,查询全部按照年进行分组
List<HashMap<String,Object>> selectWarningTrendYear(DcWarning dcWarning);
//感知事件某路段类型日占比
List<HashMap<String,Object>> selectWarningSectionTypeDay(DcWarning dcWarning);
//感知事件某路段类型月占比
List<HashMap<String,Object>> selectWarningSectionTypeMonth(DcWarning dcWarning);
//感知事件某路段类型季占比
List<HashMap<String,Object>> selectWarningSectionTypeQuarter(DcWarning dcWarning);
//感知事件某路段类型年占比
List<HashMap<String,Object>> selectWarningSectionTypeYear(DcWarning dcWarning);
//查询某个路段下的全部桩号
List<HashMap<String,Object>> selectSectionMark(DcWarning dcWarning);
//根据桩号查询条数
String selectSectionNumber(@Param("stakeMarkId") String markId);
List<HashMap<String,String>> selectMarkId();
int updateMarkId(@Param("id")String id,@Param("markIdTail")String markIdTail);
} }

27
zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java

@ -13,11 +13,36 @@ import java.util.List;
public interface IDCPerceivedEventsWarningService { public interface IDCPerceivedEventsWarningService {
//查询预警表所有感知事件的数量 //查询预警表所有感知事件的数量
int perceivedEventsWarningNum(); HashMap<String,Object> perceivedEventsWarningNum();
//感知事件类型 //感知事件类型
List<DcEventType> selectEventTypeList(); List<DcEventType> selectEventTypeList();
//查询预警感知事件类型 //查询预警感知事件类型
List<HashMap<String,Object>> selectWarningTypeList(); List<HashMap<String,Object>> selectWarningTypeList();
//根据类型查询预计事件 //根据类型查询预计事件
List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning); List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning);
//查询感知数量按照路段进行排名
List<HashMap<String,Object>> selectSectionPerceivedEventsList ();
//查询感知数量按照路段进行区分
List<HashMap<String,Object>> selectSectionPerceivedNumber();
//查询当前日,日累计感知事件,按照小时进行分组
List<HashMap<String,Object>> selectDailyCumulative();
//查询当前月,月累计感知事件,按照小时进行分组
List<HashMap<String,Object>> selectDailyCumulativeMonth();
//按事件源统计感知事件统计信息
List<HashMap<String,Object>> selectWarningSourceGroup();
//当日感知事件的处置情况占比
List<HashMap<String,Object>> selectWarningStateDay();
//感知事件类型占比
List<HashMap<String,Object>> selectWarningTypeDay();
//感知事件趋势
List<HashMap<String,Object>> selectWarningTrend(DcWarning dcWarning);
//感知事件某路段类型占比
List<HashMap<String,Object>> selectWarningSectionType(DcWarning dcWarning);
//查询某个路段下的全部桩号
List<HashMap<String,Object>> selectSectionMark(DcWarning dcWarning);
int selectMarkId();
} }

5
zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java

@ -1,5 +1,7 @@
package com.zc.business.service; package com.zc.business.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import com.zc.business.domain.DcOrganization; import com.zc.business.domain.DcOrganization;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -26,8 +28,9 @@ public interface IDcOrganizationService
* @param dcOrganization 机构管理 * @param dcOrganization 机构管理
* @return 机构管理集合 * @return 机构管理集合
*/ */
List<DcOrganization> selectDcOrganizationList(DcOrganization dcOrganization); ArrayList<HashMap> selectDcOrganizationList(DcOrganization dcOrganization);
List<DcOrganization> selectDcOrganizationListExport(DcOrganization dcOrganization);
/** /**
* 新增机构管理 * 新增机构管理
* *

28
zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java

@ -1,8 +1,13 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Scanner;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.checkerframework.framework.qual.FromByteCode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zc.business.mapper.DcOrganizationMapper; import com.zc.business.mapper.DcOrganizationMapper;
@ -40,9 +45,30 @@ public class DcOrganizationServiceImpl implements IDcOrganizationService
* @return 机构管理 * @return 机构管理
*/ */
@Override @Override
public List<DcOrganization> selectDcOrganizationList(DcOrganization dcOrganization) public ArrayList<HashMap> selectDcOrganizationList(DcOrganization dcOrganization)
{ {
ArrayList<HashMap> objects = new ArrayList<>();
List<DcOrganization> dcOrganizationsList = dcOrganizationMapper.selectDcOrganizationList(dcOrganization);
if (dcOrganizationsList==null){
return null;
}
for (DcOrganization dcOrganizations:dcOrganizationsList){
Long id = dcOrganizations.getId();
List<HashMap> car = dcOrganizationMapper.selectDcOrganizationCar(id);
String employeesNum = dcOrganizationMapper.selectEmployeesNum(id);
HashMap<String, Object> map = new HashMap<>();
map.put("car",car);
map.put("dcOrganizations",dcOrganizations);
map.put("employeesNum",employeesNum);
objects.add(map);
}
return objects;
}
@Override
public List<DcOrganization> selectDcOrganizationListExport(DcOrganization dcOrganization) {
return dcOrganizationMapper.selectDcOrganizationList(dcOrganization); return dcOrganizationMapper.selectDcOrganizationList(dcOrganization);
} }
/** /**

151
zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java

@ -1,14 +1,27 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import cn.hutool.core.io.unit.DataUnit;
import cn.hutool.core.lang.hash.Hash;
import com.ruoyi.common.utils.DateUtils;
import com.zc.business.domain.DcEventType; import com.zc.business.domain.DcEventType;
import com.zc.business.domain.DcWarning; import com.zc.business.domain.DcWarning;
import com.zc.business.mapper.DcPerceivedEventsWarningMapper; import com.zc.business.mapper.DcPerceivedEventsWarningMapper;
import com.zc.business.service.IDCPerceivedEventsWarningService; import com.zc.business.service.IDCPerceivedEventsWarningService;
import lombok.val;
import org.checkerframework.framework.qual.FromByteCode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @author 王思祥 * @author 王思祥
@ -21,10 +34,11 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa
@Override @Override
public int perceivedEventsWarningNum() { public HashMap<String,Object> perceivedEventsWarningNum() {
int warningNum = perceivedEventsWarningMapper.perceivedEventsWarningNum();//预警表数量 int number = perceivedEventsWarningMapper.perceivedEventsWarningNum();//预警表数量
int warningHistoryNum = perceivedEventsWarningMapper.perceivedEventsWarningHistoryNum();//历史预警数量 HashMap<String, Object> map = new HashMap<>();
return warningNum+warningHistoryNum; map.put("number",number);
return map;
} }
//感知事件类型 //感知事件类型
@Override @Override
@ -41,4 +55,133 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa
public List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning) { public List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning) {
return perceivedEventsWarningMapper.selectPerceivedEventsList(dcWarning); return perceivedEventsWarningMapper.selectPerceivedEventsList(dcWarning);
} }
@Override
public List<HashMap<String,Object>> selectSectionPerceivedEventsList( ) {
DcWarning dcWarning = new DcWarning();
Date nowDate = DateUtils.getNowDate();
dcWarning.setCreateTime(nowDate);
List<HashMap<String,Object>> dcWarnings = perceivedEventsWarningMapper.selectSectionPerceivedEventsList(dcWarning);
return dcWarnings;
}
//查询感知数量按照路段进行区分
@Override
public List<HashMap<String, Object>> selectSectionPerceivedNumber( ) {
DcWarning dcWarning = new DcWarning();
Date nowDate = DateUtils.getNowDate();
dcWarning.setCreateTime(nowDate);
return perceivedEventsWarningMapper.selectSectionPerceivedNumber(dcWarning);
}
//查询当前日,日累计感知事件,按照小时进行分组
@Override
public List<HashMap<String, Object>> selectDailyCumulative() {
return perceivedEventsWarningMapper.selectDailyCumulative();
}
//查询当前月,月累计感知事件,按照小时进行分组
@Override
public List<HashMap<String, Object>> selectDailyCumulativeMonth() {
return perceivedEventsWarningMapper.selectDailyCumulativeMonth();
}
//按事件源统计感知事件统计信息
@Override
public List<HashMap<String, Object>> selectWarningSourceGroup() {
DcWarning dcWarning = new DcWarning();
Date nowDate = DateUtils.getNowDate();
dcWarning.setCreateTime(nowDate);
return perceivedEventsWarningMapper.selectWarningSourceGroup(dcWarning);
}
//当日感知事件的处置情况占比
@Override
public List<HashMap<String, Object>> selectWarningStateDay() {
DcWarning dcWarning = new DcWarning();
Date nowDate = DateUtils.getNowDate();
dcWarning.setCreateTime(nowDate);
return perceivedEventsWarningMapper.selectWarningStateDay(dcWarning);
}
//感知事件类型占比
@Override
public List<HashMap<String, Object>> selectWarningTypeDay() {
DcWarning dcWarning = new DcWarning();
Date nowDate = DateUtils.getNowDate();
dcWarning.setCreateTime(nowDate);
return perceivedEventsWarningMapper.selectWarningTypeDay(dcWarning);
}
//感知事件趋势
@Override
public List<HashMap<String, Object>> selectWarningTrend(DcWarning dcWarning) {
String type = dcWarning.getType();
switch (type) {
case "day":
return perceivedEventsWarningMapper.selectWarningTrendDay(dcWarning);
case "month":
return perceivedEventsWarningMapper.selectWarningTrendMonth(dcWarning);
case "quarter":
return perceivedEventsWarningMapper.selectWarningTrendQuarter(dcWarning);
case "year":
return perceivedEventsWarningMapper.selectWarningTrendYear(dcWarning);
default:
return null;
}
}
//感知事件某路段类型占比
@Override
public List<HashMap<String, Object>> selectWarningSectionType(DcWarning dcWarning) {
String type = dcWarning.getType();
switch (type){
case "day":
return perceivedEventsWarningMapper.selectWarningSectionTypeDay(dcWarning);
case "month":
return perceivedEventsWarningMapper.selectWarningSectionTypeMonth(dcWarning);
case "quarter":
return perceivedEventsWarningMapper.selectWarningSectionTypeQuarter(dcWarning);
case "year":
return perceivedEventsWarningMapper.selectWarningSectionTypeYear(dcWarning);
default:
return null;
}
}
//查询某个路段下的全部桩号
@Override
public List<HashMap<String, Object>> selectSectionMark(DcWarning dcWarning) {
ArrayList numList = new ArrayList<>();
List<HashMap<String, Object>> mapList = perceivedEventsWarningMapper.selectSectionMark(dcWarning);
for (HashMap<String,Object> list:mapList){
HashMap<String, Object> mapNum = new HashMap<>();
String id = (String) list.get("id");
String sectionNumber = perceivedEventsWarningMapper.selectSectionNumber(id);
mapNum.put("markId",id);
mapNum.put("sectionNumber",sectionNumber);
numList.add(mapNum);
}
return numList;
}
@Override
public int selectMarkId() {
List<HashMap<String, String>> mapList = perceivedEventsWarningMapper.selectMarkId();
for (HashMap<String,String>map:mapList){
String id = map.get("id");
String[] split = id.split("\\+");
String markIdHead=split[0];
String markIdTail=split[1];
if (markIdTail.length()<3){
int i=3-markIdTail.length();
for (int i1 = 0; i1 < i; i1++) {
markIdTail = "0" + markIdTail;
}
String markIdValue=markIdHead+"+"+markIdTail;
perceivedEventsWarningMapper.updateMarkId(id,markIdValue);
}
}
return 1;
}
} }

15
zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml

@ -19,7 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectDcOrganizationVo"> <sql id="selectDcOrganizationVo">
select id,direction, parent_id, organization_type, organization_name, organization_address, stake_mark_id, rescue_unit, description, create_time, update_time from dc_organization select id,direction, parent_id,
organization_type, organization_name,
organization_address, stake_mark_id,
rescue_unit, description, create_time,
update_time from dc_organization
</sql> </sql>
<select id="selectDcOrganizationList" parameterType="DcOrganization" resultMap="DcOrganizationResult"> <select id="selectDcOrganizationList" parameterType="DcOrganization" resultMap="DcOrganizationResult">
@ -39,6 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(1) from dc_organization where parent_id=#{id} select count(1) from dc_organization where parent_id=#{id}
</select> </select>
<insert id="insertDcOrganization" parameterType="DcOrganization"> <insert id="insertDcOrganization" parameterType="DcOrganization">
insert into dc_organization insert into dc_organization
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -96,4 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectDcOrganizationCar" resultType="java.util.HashMap">
SELECT vehicle_type vehicleType, COUNT(vehicle_type) carNum FROM dc_vehicles WHERE organization_id=#{id}
GROUP BY vehicle_type
</select>
<select id="selectEmployeesNum" resultType="java.lang.String">
select count(1) from dc_employees where organization_id=#{id}
</select>
</mapper> </mapper>

151
zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

@ -5,12 +5,11 @@
<mapper namespace="com.zc.business.mapper.DcPerceivedEventsWarningMapper"> <mapper namespace="com.zc.business.mapper.DcPerceivedEventsWarningMapper">
<select id="perceivedEventsWarningNum" resultType="java.lang.Integer"> <select id="perceivedEventsWarningNum" resultType="java.lang.Integer">
select count(1) from dc_warning select count(1) from dc_warning
</select> </select>
<select id="perceivedEventsWarningHistoryNum" resultType="java.lang.Integer">
select count(1) from dc_warning_history
</select>
<select id="selectEventTypeList" resultType="com.zc.business.domain.DcEventType"> <select id="selectEventTypeList" resultType="com.zc.business.domain.DcEventType">
select event_type, event_name from dc_event_type select event_type, event_name from dc_event_type
</select> </select>
@ -26,5 +25,151 @@
<if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if> <if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if>
</where> </where>
</select> </select>
<select id="selectSectionPerceivedEventsList" resultType="hashmap">
SELECT COUNT(1) as number,section.section_name sectionName FROM dc_warning AS warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.id
LEFT JOIN dc_road_section AS section ON mark.section_id=section.id
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
group by section.section_name
order by number desc
</select>
<select id="selectSectionPerceivedNumber" resultType="java.util.HashMap">
SELECT COUNT(1) as number,section.section_name sectionName FROM dc_warning AS warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.id
LEFT JOIN dc_road_section AS section ON mark.section_id=section.id
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
group by section.section_name
</select>
<select id="selectDailyCumulative" resultType="java.util.HashMap">
SELECT DATE_FORMAT(create_time, '%Y-%m-%d %H') AS HOUR, COUNT(*) AS COUNT
FROM dc_warning
WHERE create_time >= CURDATE() AND create_time <![CDATA[<]]> CURDATE() + INTERVAL 1 DAY
GROUP BY HOUR
ORDER BY HOUR
</select>
<select id="selectDailyCumulativeMonth" resultType="java.util.HashMap">
SELECT DATE_FORMAT(create_time, '%H') AS HOUR, COUNT(*) AS COUNT
FROM dc_warning
WHERE MONTH(create_time) = MONTH(CURDATE()) AND YEAR(create_time) = YEAR(CURDATE())
GROUP BY HOUR
ORDER BY HOUR;
</select>
<select id="selectWarningSourceGroup" resultType="java.util.HashMap">
SELECT warning_source warningSource,COUNT(*) AS COUNT FROM dc_warning
where DATE_FORMAT(create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
GROUP BY warning_source
</select>
<select id="selectWarningStateDay" resultType="java.util.HashMap">
SELECT warning_state warningState,COUNT(*) AS COUNT FROM dc_warning
where DATE_FORMAT(create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
GROUP BY warning_state
</select>
<select id="selectWarningTypeDay" resultType="java.util.HashMap">
SELECT warning_type warningType,COUNT(*) AS COUNT FROM dc_warning
GROUP BY warning_type
ORDER BY COUNT DESC
</select>
<select id="selectWarningTrendDay" resultType="java.util.HashMap">
SELECT DATE_FORMAT(warning.create_time, '%Y-%m-%d %H') AS HOUR, COUNT(*) AS COUNT
FROM dc_warning AS warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.id
WHERE DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
AND mark.`section_id`=#{sectionId}
GROUP BY HOUR
</select>
<select id="selectWarningTrendMonth" resultType="java.util.HashMap">
SELECT DATE(warning.create_time) AS DAY, COUNT(*) AS COUNT
FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.id
WHERE DATE_FORMAT(warning.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m')
and mark.`section_id`=#{sectionId}
GROUP BY DAY
ORDER BY DAY
</select>
<select id="selectWarningTrendQuarter" resultType="java.util.HashMap">
SELECT
CASE
WHEN MONTH(warning.create_time) BETWEEN 1 AND 3 THEN '第一季度'
WHEN MONTH(warning.create_time) BETWEEN 4 AND 6 THEN '第二季度'
WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度'
ELSE '第四季度'
END AS QUARTER,
MONTH(warning.create_time) AS MONTH,
COUNT(*) AS COUNT
FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.id
WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y')
and mark.`section_id`=#{sectionId}
GROUP BY QUARTER, MONTH
ORDER BY QUARTER, MONTH;
</select>
<select id="selectWarningTrendYear" resultType="java.util.HashMap">
SELECT YEAR(warning.create_time) AS YEAR, COUNT(*) AS COUNT
FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.id
where mark.`section_id`=#{sectionId}
GROUP BY YEAR
</select>
<select id="selectWarningSectionTypeDay" resultType="java.util.HashMap">
SELECT warning.warning_type warningType,COUNT(*) AS COUNT
FROM dc_warning as warning
LEFT JOIN dc_stake_mark as mark on warning.stake_mark_id=mark.id
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
and mark.`section_id`=#{sectionId}
GROUP BY warning_type
ORDER BY COUNT DESC
</select>
<select id="selectWarningSectionTypeMonth" resultType="java.util.HashMap">
SELECT warning.warning_type warningType,COUNT(*) AS COUNT
FROM dc_warning as warning
LEFT JOIN dc_stake_mark as mark on warning.stake_mark_id=mark.id
where DATE_FORMAT(warning.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m')
and mark.`section_id`=#{sectionId}
GROUP BY warning_type
ORDER BY COUNT DESC
</select>
<select id="selectWarningSectionTypeQuarter" resultType="java.util.HashMap">
SELECT
CASE
WHEN MONTH(warning.create_time) BETWEEN 3 AND 5 THEN '春季'
WHEN MONTH(warning.create_time) BETWEEN 6 AND 8 THEN '夏季'
WHEN MONTH(warning.create_time) BETWEEN 9 AND 11 THEN '秋季'
ELSE '冬季'
END AS QUARTER,
MONTH(warning.create_time) AS MONTH,
warning.warning_type warningType,
COUNT(*) AS COUNT
FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.id
WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y')
and mark.`section_id`=#{sectionId}
GROUP BY QUARTER, warningType
ORDER BY QUARTER, MONTH;
</select>
<select id="selectWarningSectionTypeYear" resultType="java.util.HashMap">
SELECT warning.warning_type warningType, COUNT(*) AS COUNT,
DATE_FORMAT(warning.create_time, '%Y') as createTime
FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.id
where mark.`section_id`=#{sectionId}
GROUP BY warningType
</select>
<select id="selectSectionMark" resultType="java.util.HashMap">
SELECT id FROM dc_stake_mark AS mark WHERE mark.section_id=#{sectionId}
</select>
<select id="selectSectionNumber" resultType="java.lang.String">
select count(1) from dc_warning where stake_mark_id=#{stakeMarkId}
</select>
<select id="selectMarkId" resultType="java.util.HashMap">
select id from dc_stake_mark where id!='222' and section_id='0'
</select>
<update id="updateMarkId">
update dc_stake_mark set id=#{markIdTail} where id=#{id}
</update>
</mapper> </mapper>
Loading…
Cancel
Save