From 7dc156326128c830925a879eac718e5ae13367f4 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Thu, 22 Feb 2024 19:26:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=96=E5=8C=BA=E6=A1=A9=E5=8F=B7=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E6=90=9C=E7=B4=A2=E4=BC=98=E5=8C=96,=E5=80=BC?= =?UTF-8?q?=E7=8F=AD=E5=88=97=E8=A1=A8=E4=BA=BA=E5=91=98=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DCPerceivedEventsWarningController.java | 12 +++--- .../zc/business/mapper/DcShiftsMapper.java | 2 +- .../impl/DcRoadSectionServiceImpl.java | 43 +++++++++++++++++++ .../service/impl/DcShiftsServiceImpl.java | 20 +++------ .../mapper/business/DcRoadSectionMapper.xml | 20 ++++++++- .../mapper/business/DcShiftsMapper.xml | 4 +- 6 files changed, 76 insertions(+), 25 deletions(-) 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 968b7e82..9c780602 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 @@ -80,8 +80,8 @@ public class DCPerceivedEventsWarningController extends BaseController { HashMap map = new HashMap<>(); List> mapList = perceivedEventsWarningService.selectWarningSourceGroup(); String total = perceivedEventsWarningService.selectWarningSourceGroupCount(); - map.put("warningSourceList",mapList); - map.put("total",total); + map.put("warningSourceList", mapList); + map.put("total", total); return AjaxResult.success(map); } //当日感知事件的处置情况占比 @@ -98,9 +98,9 @@ public class DCPerceivedEventsWarningController extends BaseController { //某一路段某一时间段的感知事件趋势 @PostMapping("/warningTrend") public AjaxResult getWarningTrend(@RequestBody DcWarning dcWarning){ - String type = dcWarning.getType();//类型 - String sectionId = dcWarning.getSectionId();//路段辖区id - String direction = dcWarning.getDirection();//方向 + String type = dcWarning.getType();//类型 + String sectionId = dcWarning.getSectionId();//路段辖区id + String direction = dcWarning.getDirection();//方向 if (StringUtils.isBlank(type)||StringUtils.isBlank(sectionId)||StringUtils.isBlank(direction)){ return AjaxResult.error("参数数据异常"); } @@ -196,7 +196,7 @@ public class DCPerceivedEventsWarningController extends BaseController { public TableDataInfo getWarningEscalation(@RequestBody DcWarning dcWarning){ startPage(); List> list = perceivedEventsWarningService.selectWarningEscalation(dcWarning); - return getDataTable(list); + return getDataTable(list); } //修改感知事件信息 @PostMapping("/updateWarning") diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java index dff1b9d3..2e21c625 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java @@ -84,7 +84,7 @@ public interface DcShiftsMapper public List selectDcShiftsRecord(DcShifts dcShifts); //根据驻点和时间查询人员 public List> selectStation(@Param("station") String station,@Param("date") Date date); - public List selectStationDate(@Param("station") Long station, @Param("date") Date date); + public List selectStationDate(@Param("station") Long station, @Param("date") Date date,@Param("name")String name); //新增时查看是否存在 Long selectExist(DcShifts dcShifts); //查看部分信息,删除使用 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcRoadSectionServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcRoadSectionServiceImpl.java index dd88fa91..4a1ad991 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcRoadSectionServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcRoadSectionServiceImpl.java @@ -2,12 +2,17 @@ package com.zc.business.service.impl; import java.util.HashMap; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + 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.DcRoadSectionMapper; import com.zc.business.domain.DcRoadSection; import com.zc.business.service.IDcRoadSectionService; +import org.w3c.dom.CDATASection; /** * 辖区路段Service业务层处理 @@ -42,6 +47,44 @@ public class DcRoadSectionServiceImpl implements IDcRoadSectionService @Override public List selectDcRoadSectionList(DcRoadSection dcRoadSection) { + String startStakeMark = dcRoadSection.getStartStakeMark(); + String endStakeMark = dcRoadSection.getEndStakeMark(); + if (StringUtils.isNotBlank(startStakeMark)&&StringUtils.isNotBlank(endStakeMark)){ + String[] parts = startStakeMark.split("(?<=K)|(?=[+])"); + String startPartsValue=parts[1]; + String[] partsEnd = endStakeMark.split("(?<=K)|(?=[+])"); + String endPartsValue=partsEnd[1]; + Integer startParts = Integer.valueOf(startPartsValue)*1000; + Integer endParts = Integer.valueOf(endPartsValue)*1000; + String[] startRiceNumber = startStakeMark.split("\\+"); + String[] endRiceNumber = endStakeMark.split("\\+"); + String startRiceValue=startRiceNumber[1]; + String endRiceValue=endRiceNumber[1]; + Integer startRice = Integer.valueOf(startRiceValue); + Integer endRice = Integer.valueOf(endRiceValue); + Integer start=startParts+startRice; + Integer end=endParts+endRice; + dcRoadSection.setStartStakeMark(start.toString()); + dcRoadSection.setEndStakeMark(end.toString()); + }else if (StringUtils.isNotBlank(startStakeMark)&&endStakeMark==null){ + String[] parts = startStakeMark.split("(?<=K)|(?=[+])"); + String startPartsValue=parts[1]; + Integer startParts = Integer.valueOf(startPartsValue)*1000; + String[] startRiceNumber = startStakeMark.split("\\+"); + String startRiceValue=startRiceNumber[1]; + Integer startRice = Integer.valueOf(startRiceValue); + Integer start=startParts+startRice; + dcRoadSection.setStartStakeMark(start.toString()); + }else if (StringUtils.isNotBlank(endStakeMark)&&startStakeMark==null){ + String[] partsEnd = endStakeMark.split("(?<=K)|(?=[+])"); + String endPartsValue=partsEnd[1]; + Integer endParts = Integer.valueOf(endPartsValue)*1000; + String[] endRiceNumber = endStakeMark.split("\\+"); + String endRiceValue=endRiceNumber[1]; + Integer endRice = Integer.valueOf(endRiceValue); + Integer end=endParts+endRice; + dcRoadSection.setEndStakeMark(end.toString()); + } return dcRoadSectionMapper.selectDcRoadSectionList(dcRoadSection); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java index 10a4ceff..14fbcaa0 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java @@ -67,27 +67,17 @@ public class DcShiftsServiceImpl implements IDcShiftsService @Override public List selectDcShiftsList(DcShifts dcShifts) { -// ArrayList objects = new ArrayList<>(); - ArrayList objects = new ArrayList<>(); List list = dcShiftsMapper.selectDcShiftsList(dcShifts); for (DcShifts shifts:list ){ + String name=""; Date date = shifts.getDate(); Long station = shifts.getStation(); - List organizationName = dcShiftsMapper.selectStationDate(station, date); + if (org.apache.commons.lang3.StringUtils.isNotBlank(dcShifts.getName())){ + name=dcShifts.getName(); + } + List organizationName = dcShiftsMapper.selectStationDate(station, date,name); shifts.setShiftsList(organizationName); - objects.add(shifts); } -// for (DcShifts shifts:list){ -// HashMap map = new HashMap(); -// Date date = shifts.getDate(); -// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); -// String formattedDate = formatter.format(date); -// String station = shifts.getStation(); -// List> name = dcShiftsMapper.selectStation(station, date); -// map.put("date",formattedDate); -// map.put("organizationName",name); -// objects.add(map); -// } return list; } diff --git a/zc-business/src/main/resources/mapper/business/DcRoadSectionMapper.xml b/zc-business/src/main/resources/mapper/business/DcRoadSectionMapper.xml index ab7f253c..f0e6aa29 100644 --- a/zc-business/src/main/resources/mapper/business/DcRoadSectionMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcRoadSectionMapper.xml @@ -34,8 +34,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and section.dept_id = #{deptId} and section.road_id = #{roadId} - and section.start_stake_mark = #{startStakeMark} - and section.end_stake_mark = #{endStakeMark} + + CAST(SUBSTRING(SUBSTRING_INDEX(start_stake_mark,'+',1),2)AS UNSIGNED)*1000 + +CAST(SUBSTRING_INDEX(start_stake_mark, '+', -1) AS UNSIGNED)>#{startStakeMark} + and + CAST(SUBSTRING(SUBSTRING_INDEX(end_stake_mark,'+',1),2)AS UNSIGNED)*1000 + +CAST(SUBSTRING_INDEX(end_stake_mark, '+', -1) AS UNSIGNED)<#{endStakeMark} + + + CAST(SUBSTRING(SUBSTRING_INDEX(start_stake_mark,'+',1),2)AS UNSIGNED)*1000 + +CAST(SUBSTRING_INDEX(start_stake_mark, '+', -1) AS UNSIGNED)>#{startStakeMark} + + + CAST(SUBSTRING(SUBSTRING_INDEX(end_stake_mark,'+',1),2)AS UNSIGNED)*1000 + +CAST(SUBSTRING_INDEX(end_stake_mark, '+', -1) AS UNSIGNED)<#{endStakeMark} + and section.section_name like concat('%', #{sectionName}, '%') and section.road_code = #{roadCode} diff --git a/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml b/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml index d31e430c..b0c18e26 100644 --- a/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml @@ -40,9 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and shifts.employees_id = #{employeesId} and shifts.date = #{date} + and CONCAT(employees.name,employees.contact_number) like concat('%', #{name}, '%') GROUP BY shifts.date,shifts.station - order by date desc + order by shifts.date desc