Commit 09599febea19bd377d5b30080956f744f4b3444f

Authored by guzijian
1 parent c3754053

fix: 修改签到报表获取接口,使用左连接保证签到报表数据完整性

Bsth-admin/src/main/java/com/ruoyi/driver/mapper/DriverMapper.java
@@ -127,4 +127,11 @@ public interface DriverMapper @@ -127,4 +127,11 @@ public interface DriverMapper
127 * @param list 127 * @param list
128 */ 128 */
129 void deleteNotEmptyJob(List<String> list); 129 void deleteNotEmptyJob(List<String> list);
  130 +
  131 + /**
  132 + * 获取已经存在的工号
  133 + * @param list
  134 + * @return
  135 + */
  136 + List<String> queryEmptyJob(List<String> list);
130 } 137 }
Bsth-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
@@ -112,4 +112,11 @@ public interface IDriverService @@ -112,4 +112,11 @@ public interface IDriverService
112 * 计算异常班次 112 * 计算异常班次
113 */ 113 */
114 void computedExceptionScheduling(); 114 void computedExceptionScheduling();
  115 +
  116 + /**
  117 + * 获取已经存在的工号
  118 + * @param jobList
  119 + * @return
  120 + */
  121 + List<String> queryEmptyJob(List<String> jobList);
115 } 122 }
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
@@ -547,6 +547,11 @@ public class DriverServiceImpl implements IDriverService { @@ -547,6 +547,11 @@ public class DriverServiceImpl implements IDriverService {
547 sendNotice(nowTimerList); 547 sendNotice(nowTimerList);
548 } 548 }
549 549
  550 + @Override
  551 + public List<String> queryEmptyJob(List<String> jobList) {
  552 + return driverMapper.queryEmptyJob(jobList);
  553 + }
  554 +
550 private void sendNotice(List<DriverSignInRecommendation> nowTimerList) { 555 private void sendNotice(List<DriverSignInRecommendation> nowTimerList) {
551 List<SysNotice> noticeList = new ArrayList<>(nowTimerList.size()); 556 List<SysNotice> noticeList = new ArrayList<>(nowTimerList.size());
552 for (DriverSignInRecommendation item : nowTimerList) { 557 for (DriverSignInRecommendation item : nowTimerList) {
Bsth-admin/src/main/java/com/ruoyi/job/DriverJob.java
@@ -410,8 +410,11 @@ public class DriverJob implements InitializingBean { @@ -410,8 +410,11 @@ public class DriverJob implements InitializingBean {
410 for (int i = 2; i <= countPage; i++) { 410 for (int i = 2; i <= countPage; i++) {
411 drivers.addAll(getDrivers(date, getPersonInfo(accessToken, 100, i))); 411 drivers.addAll(getDrivers(date, getPersonInfo(accessToken, 100, i)));
412 } 412 }
413 - List<String> jobList = drivers.stream().map(driver -> driver.getJobCode()).collect(Collectors.toList()); 413 + List<String> jobList = drivers.stream().map(Driver::getJobCode).collect(Collectors.toList());
  414 + // 删除离职员工
414 handleNotEmptyJob(jobList); 415 handleNotEmptyJob(jobList);
  416 + // 过滤已经存在的员工工号
  417 + drivers = filterEmptyJob(drivers, jobList);
415 // updateDrivers(drivers); 418 // updateDrivers(drivers);
416 List<List<Driver>> splitList = ListUtils.splitList(drivers, 200); 419 List<List<Driver>> splitList = ListUtils.splitList(drivers, 200);
417 for (List<Driver> driverList : splitList) { 420 for (List<Driver> driverList : splitList) {
@@ -427,6 +430,17 @@ public class DriverJob implements InitializingBean { @@ -427,6 +430,17 @@ public class DriverJob implements InitializingBean {
427 // } 430 // }
428 } 431 }
429 432
  433 + private static List<Driver> filterEmptyJob(List<Driver> drivers, List<String> jobList) {
  434 + List<String> jobs = DRIVER_SERVICE.queryEmptyJob(jobList);
  435 + Map<String, String> jobMap = new HashMap<>(jobs.size());
  436 + for (String job : jobs) {
  437 + jobMap.put(job, job);
  438 + }
  439 +
  440 + // 过滤
  441 + return drivers.stream().filter(item -> StringUtils.isEmpty(jobMap.get(item.getJobCode()))).collect(Collectors.toList());
  442 + }
  443 +
430 private static void handleNotEmptyJob(List<String> jobList) { 444 private static void handleNotEmptyJob(List<String> jobList) {
431 DRIVER_SERVICE.deleteNotEmptyJob(jobList); 445 DRIVER_SERVICE.deleteNotEmptyJob(jobList);
432 } 446 }
Bsth-admin/src/main/java/com/ruoyi/pojo/response/ExportReportViewResponseVo.java
@@ -39,6 +39,10 @@ public class ExportReportViewResponseVo { @@ -39,6 +39,10 @@ public class ExportReportViewResponseVo {
39 @ExcelProperty(value = "线路") 39 @ExcelProperty(value = "线路")
40 private String lineName; 40 private String lineName;
41 41
  42 + @ApiModelProperty("路牌")
  43 + @ExcelProperty(value = "路牌")
  44 + private String lpName;
  45 +
42 @ApiModelProperty("部门") 46 @ApiModelProperty("部门")
43 @ExcelProperty(value = "部门") 47 @ExcelProperty(value = "部门")
44 @ColumnWidth(12) 48 @ColumnWidth(12)
Bsth-admin/src/main/java/com/ruoyi/pojo/response/ReportViewResponseVo.java
@@ -34,7 +34,7 @@ public class ReportViewResponseVo { @@ -34,7 +34,7 @@ public class ReportViewResponseVo {
34 @ApiModelProperty("车辆自编号") 34 @ApiModelProperty("车辆自编号")
35 private String nbbm; 35 private String nbbm;
36 36
37 - @ApiModelProperty("车辆自编号") 37 + @ApiModelProperty("路牌")
38 private String lpName; 38 private String lpName;
39 39
40 40
Bsth-admin/src/main/resources/mapper/driver/DriverMapper.xml
@@ -199,6 +199,17 @@ @@ -199,6 +199,17 @@
199 FROM driver 199 FROM driver
200 -- WHERE driver.posts != "驾驶员" and driver.posts != "售票员" 200 -- WHERE driver.posts != "驾驶员" and driver.posts != "售票员"
201 </select> 201 </select>
  202 + <select id="queryEmptyJob" resultType="java.lang.String">
  203 + SELECT
  204 + d1.job_code
  205 + FROM
  206 + (
  207 + SELECT job_code FROM driver WHERE job_code IN
  208 + <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  209 + #{item}
  210 + </foreach>
  211 + ) d1
  212 + </select>
202 213
203 <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> 214 <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id">
204 insert into driver 215 insert into driver
@@ -309,9 +320,9 @@ @@ -309,9 +320,9 @@
309 <update id="updateSignStatusDriversByJobCodes"> 320 <update id="updateSignStatusDriversByJobCodes">
310 <foreach collection="list" item="item" separator=";"> 321 <foreach collection="list" item="item" separator=";">
311 update driver set face_sign_in = 1,update_time = #{item.updateTime} 322 update driver set face_sign_in = 1,update_time = #{item.updateTime}
312 - <if test="item.image != null and item.image != ''">  
313 - ,image = #{item.image}  
314 - </if> 323 + <if test="item.image != null and item.image != ''">
  324 + ,image = #{item.image}
  325 + </if>
315 where job_code = #{item.jobCode,jdbcType=VARCHAR} 326 where job_code = #{item.jobCode,jdbcType=VARCHAR}
316 </foreach> 327 </foreach>
317 </update> 328 </update>
@@ -346,16 +357,16 @@ @@ -346,16 +357,16 @@
346 <delete id="deleteNotEmptyJob"> 357 <delete id="deleteNotEmptyJob">
347 DELETE 358 DELETE
348 FROM driver WHERE job_code NOT IN ( 359 FROM driver WHERE job_code NOT IN (
349 - SELECT  
350 - d1.job_code  
351 - FROM  
352 - (  
353 - SELECT job_code FROM driver WHERE job_code IN  
354 - <foreach collection="list" index="index" item="item" open="(" separator="," close=")">  
355 - #{item}  
356 - </foreach>  
357 - ) d1  
358 - ) 360 + SELECT
  361 + d1.job_code
  362 + FROM
  363 + (
  364 + SELECT job_code FROM driver WHERE job_code IN
  365 + <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  366 + #{item}
  367 + </foreach>
  368 + ) d1
  369 + )
359 </delete> 370 </delete>
360 371
361 372
Bsth-admin/src/main/resources/mapper/driver_scheduling/DriverSchedulingMapper.xml
@@ -57,10 +57,10 @@ @@ -57,10 +57,10 @@
57 57
58 <select id="queryToDay" resultType="com.ruoyi.domain.DriverScheduling" resultMap="Scheduling"> 58 <select id="queryToDay" resultType="com.ruoyi.domain.DriverScheduling" resultMap="Scheduling">
59 select scheduling.*,driver.fleet_name fleetName from 59 select scheduling.*,driver.fleet_name fleetName from
60 - scheduling join driver on driver.job_code = scheduling.job_code 60 + scheduling left join driver on driver.job_code = scheduling.job_code
61 where schedule_date = #{date} 61 where schedule_date = #{date}
62 <if test="jobCode !=null and jobCode != ''"> 62 <if test="jobCode !=null and jobCode != ''">
63 - and driver.job_code = #{jobCode} 63 + and scheduling.job_code = #{jobCode}
64 </if> 64 </if>
65 <if test="name !=null and name != ''"> 65 <if test="name !=null and name != ''">
66 and `name` = #{name} 66 and `name` = #{name}