Browse Source

辖区桩号范围搜索优化,值班列表人员搜索优化

develop
wangsixiang 9 months ago
parent
commit
7dc1563261
  1. 2
      zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java
  2. 43
      zc-business/src/main/java/com/zc/business/service/impl/DcRoadSectionServiceImpl.java
  3. 22
      zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java
  4. 20
      zc-business/src/main/resources/mapper/business/DcRoadSectionMapper.xml
  5. 4
      zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

2
zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java

@ -84,7 +84,7 @@ public interface DcShiftsMapper
public List<DcShiftsRecord> selectDcShiftsRecord(DcShifts dcShifts);
//根据驻点和时间查询人员
public List<HashMap<String,Object>> selectStation(@Param("station") String station,@Param("date") Date date);
public List<DcShiftsList> selectStationDate(@Param("station") Long station, @Param("date") Date date);
public List<DcShiftsList> selectStationDate(@Param("station") Long station, @Param("date") Date date,@Param("name")String name);
//新增时查看是否存在
Long selectExist(DcShifts dcShifts);
//查看部分信息,删除使用

43
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<DcRoadSection> 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);
}

22
zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java

@ -67,27 +67,17 @@ public class DcShiftsServiceImpl implements IDcShiftsService
@Override
public List<DcShifts> selectDcShiftsList(DcShifts dcShifts)
{
// ArrayList<HashMap> objects = new ArrayList<>();
ArrayList<DcShifts> objects = new ArrayList<>();
List<DcShifts> list = dcShiftsMapper.selectDcShiftsList(dcShifts);
for (DcShifts shifts:list ){
String name="";
Date date = shifts.getDate();
Long station = shifts.getStation();
List<DcShiftsList> organizationName = dcShiftsMapper.selectStationDate(station, date);
if (org.apache.commons.lang3.StringUtils.isNotBlank(dcShifts.getName())){
name=dcShifts.getName();
}
List<DcShiftsList> organizationName = dcShiftsMapper.selectStationDate(station, date,name);
shifts.setShiftsList(organizationName);
objects.add(shifts);
}
// for (DcShifts shifts:list){
// HashMap<String, Object> map = new HashMap<String, Object>();
// Date date = shifts.getDate();
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
// String formattedDate = formatter.format(date);
// String station = shifts.getStation();
// List<HashMap<String, Object>> name = dcShiftsMapper.selectStation(station, date);
// map.put("date",formattedDate);
// map.put("organizationName",name);
// objects.add(map);
// }
}
return list;
}

20
zc-business/src/main/resources/mapper/business/DcRoadSectionMapper.xml

@ -34,8 +34,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="deptId != null "> and section.dept_id = #{deptId}</if>
<if test="roadId != null "> and section.road_id = #{roadId}</if>
<if test="startStakeMark != null and startStakeMark != ''"> and section.start_stake_mark = #{startStakeMark}</if>
<if test="endStakeMark != null and endStakeMark != ''"> and section.end_stake_mark = #{endStakeMark}</if>
<if test="startStakeMark != null and startStakeMark != ''
and endStakeMark != null and endStakeMark != ''">
CAST(SUBSTRING(SUBSTRING_INDEX(start_stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(start_stake_mark, '+', -1) AS UNSIGNED)&gt;#{startStakeMark}
and
CAST(SUBSTRING(SUBSTRING_INDEX(end_stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(end_stake_mark, '+', -1) AS UNSIGNED)&lt;#{endStakeMark}
</if>
<if test="startStakeMark != null and startStakeMark != ''
and endStakeMark == null ">
CAST(SUBSTRING(SUBSTRING_INDEX(start_stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(start_stake_mark, '+', -1) AS UNSIGNED)&gt;#{startStakeMark}
</if>
<if test=" endStakeMark != null and endStakeMark != ''
and startStakeMark == null ">
CAST(SUBSTRING(SUBSTRING_INDEX(end_stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(end_stake_mark, '+', -1) AS UNSIGNED)&lt;#{endStakeMark}
</if>
<if test="sectionName != null and sectionName != ''"> and section.section_name like concat('%', #{sectionName}, '%')</if>
<if test="roadCode != null and roadCode != ''"> and section.road_code = #{roadCode}</if>
</where>

4
zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

@ -40,9 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="employeesId != null "> and shifts.employees_id = #{employeesId}</if>
<if test="date != null "> and shifts.date = #{date}</if>
<if test="name != null and name != ''"> and CONCAT(employees.name,employees.contact_number) like concat('%', #{name}, '%')</if>
</where>
GROUP BY shifts.date,shifts.station
order by date desc
order by shifts.date desc
</select>
<select id="selectDcShiftsById" parameterType="Long" resultMap="DcShiftsResult">
@ -94,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join dc_employees as employees on shifts.employees_id=employees.id
left join dc_organization as organization on organization.id=shifts.station
where shifts.date=#{date} and station=#{station}
<if test="name != null and name != ''"> and CONCAT(employees.name,employees.contact_number) like concat('%', #{name}, '%')</if>
</select>
<select id="selectExist" resultType="java.lang.Long">
select count(1) from dc_shifts where date=#{date}

Loading…
Cancel
Save