Commit 0628166fe8a6ee19d8b144bc2174987ccaec91f6

Authored by guzijian
1 parent afe58e25

fix: 修复异常打卡通知空指针异常,完善获取排班日志。

Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
@@ -595,6 +595,9 @@ public class DriverServiceImpl implements IDriverService { @@ -595,6 +595,9 @@ public class DriverServiceImpl implements IDriverService {
595 public void computedExceptionScheduling() { 595 public void computedExceptionScheduling() {
596 // 从当前缓存种读取所有的签到数据 遍历每个工号的打卡集合 596 // 从当前缓存种读取所有的签到数据 遍历每个工号的打卡集合
597 Map<String, List<DriverScheduling>> map = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(new Date())); 597 Map<String, List<DriverScheduling>> map = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(new Date()));
  598 + if (CollectionUtil.isEmpty(map)) {
  599 + return;
  600 + }
598 List<DriverSignInRecommendation> nowTimerList = new ArrayList<>(); 601 List<DriverSignInRecommendation> nowTimerList = new ArrayList<>();
599 Long now = System.currentTimeMillis(); 602 Long now = System.currentTimeMillis();
600 for (Map.Entry<String, List<DriverScheduling>> entry : map.entrySet()) { 603 for (Map.Entry<String, List<DriverScheduling>> entry : map.entrySet()) {
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
@@ -406,14 +406,17 @@ public class ThreadJobService { @@ -406,14 +406,17 @@ public class ThreadJobService {
406 } 406 }
407 } 407 }
408 //查询当天是否保存过考情表 如果不存在则保存 408 //查询当天是否保存过考情表 如果不存在则保存
  409 + List<DriverScheduling> bcList = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null, null, null);
409 Map<String, List<DriverScheduling>> dto = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(new Date())); 410 Map<String, List<DriverScheduling>> dto = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(new Date()));
410 - if (!CollectionUtil.isEmpty(dto) || originSchedulingMap.size() == 0) {  
411 - log.info("已有数据,当天排班数据长度:{}", originSchedulingMap.size()); 411 + // 当天已有记录则不在保存 或者 调度记录为空则不在保存
  412 + if ((CollectionUtil.isNotEmpty(dto) && CollectionUtil.isNotEmpty(bcList)) || originSchedulingMap.size() == 0) {
  413 + log.info("调度最新数据:{}", originSchedulingMap.size());
  414 + log.info("当天获取数据:{}", bcList.size());
412 return; 415 return;
413 } 416 }
414 // TODO maybe delete 417 // TODO maybe delete
415 TempCache.resetMapStatus(); 418 TempCache.resetMapStatus();
416 - List<DriverScheduling> bcList = getBcList(originSchedulingMap); 419 + bcList = getBcList(originSchedulingMap);
417 420
418 // 处理非司售人员的排班明细 421 // 处理非司售人员的排班明细
419 bcList.addAll(handleOtherPostsScheduling()); 422 bcList.addAll(handleOtherPostsScheduling());
@@ -433,6 +436,7 @@ public class ThreadJobService { @@ -433,6 +436,7 @@ public class ThreadJobService {
433 // 插入错误排班 436 // 插入错误排班
434 errorJobcodeService.insertBatchErrorJobcode(errorScheduling); 437 errorJobcodeService.insertBatchErrorJobcode(errorScheduling);
435 } 438 }
  439 + log.info("当天排班数据获取完毕,共:{}条", bcList.size());
436 } 440 }
437 441
438 private List<DriverScheduling> handleOtherPostsScheduling() { 442 private List<DriverScheduling> handleOtherPostsScheduling() {
@@ -531,7 +535,7 @@ public class ThreadJobService { @@ -531,7 +535,7 @@ public class ThreadJobService {
531 log.error("特殊处理失败:{}", e.getMessage()); 535 log.error("特殊处理失败:{}", e.getMessage());
532 } 536 }
533 // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错 537 // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错
534 - if (nowScheduling.get(0).getLineName().startsWith("青蒸线")) { 538 + if (CollectionUtil.isNotEmpty(nowScheduling) && nowScheduling.get(0).getLineName().startsWith("青蒸线")) {
535 nowScheduling = handleQinZhengLine(nowScheduling); 539 nowScheduling = handleQinZhengLine(nowScheduling);
536 } 540 }
537 // ------|结束处理|------ 541 // ------|结束处理|------
Bsth-admin/src/main/resources/mapper/driver/DriverMapper.xml
@@ -211,7 +211,8 @@ @@ -211,7 +211,8 @@
211 ) d1 211 ) d1
212 </select> 212 </select>
213 <select id="selectDriverListAll" resultType="com.ruoyi.driver.domain.Driver"> 213 <select id="selectDriverListAll" resultType="com.ruoyi.driver.domain.Driver">
214 - select job_code, line_name, personnel_name, posts, fleet_name from driver 214 + select job_code, line_name, personnel_name, posts, fleet_name
  215 + from driver
215 </select> 216 </select>
216 217
217 <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> 218 <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id">
Bsth-admin/src/main/resources/mapper/equipment/EquipmentMapper.xml
@@ -165,7 +165,6 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -165,7 +165,6 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
165 <if test="status != null">status = #{status},</if> 165 <if test="status != null">status = #{status},</if>
166 <if test="promise != null and promise != ''">promise = #{promise},</if> 166 <if test="promise != null and promise != ''">promise = #{promise},</if>
167 <if test="image != null">image = #{image},</if> 167 <if test="image != null">image = #{image},</if>
168 - <if test="deviceId != null">device_id = #{deviceId},</if>  
169 <if test="createTime != null">create_time = #{createTime},</if> 168 <if test="createTime != null">create_time = #{createTime},</if>
170 <if test="updateTime != null">update_time = #{updateTime},</if> 169 <if test="updateTime != null">update_time = #{updateTime},</if>
171 <if test="createBy != null">create_by = #{createBy},</if> 170 <if test="createBy != null">create_by = #{createBy},</if>