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