Commit 38c1231ef7fb37805693c300d20db4ffc4ef7e4b
1 parent
488d5554
fix: 更新排班数据
Showing
5 changed files
with
40 additions
and
2 deletions
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import java.io.File; |
| 4 | 4 | import java.io.IOException; |
| 5 | 5 | import java.io.InputStream; |
| 6 | 6 | import java.nio.file.Paths; |
| 7 | +import java.time.LocalDate; | |
| 7 | 8 | import java.time.LocalDateTime; |
| 8 | 9 | import java.time.temporal.ChronoUnit; |
| 9 | 10 | import java.util.*; |
| ... | ... | @@ -11,6 +12,8 @@ import java.util.stream.Collectors; |
| 11 | 12 | |
| 12 | 13 | import cn.hutool.core.collection.CollectionUtil; |
| 13 | 14 | import cn.hutool.http.HttpUtil; |
| 15 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 16 | +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | |
| 14 | 17 | import com.github.pagehelper.util.StringUtil; |
| 15 | 18 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 16 | 19 | import com.ruoyi.common.cache.SchedulingCache; |
| ... | ... | @@ -24,6 +27,7 @@ import com.ruoyi.common.utils.DateUtils; |
| 24 | 27 | import com.ruoyi.common.utils.file.FileUploadUtils; |
| 25 | 28 | import com.ruoyi.common.utils.file.FileUtils; |
| 26 | 29 | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| 30 | +import com.ruoyi.domain.RuleAttendanceMain; | |
| 27 | 31 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 28 | 32 | import com.ruoyi.framework.config.ServerConfig; |
| 29 | 33 | import com.ruoyi.job.DriverJob; |
| ... | ... | @@ -37,6 +41,8 @@ import com.ruoyi.pojo.response.DriverResponseVo; |
| 37 | 41 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 38 | 42 | import com.ruoyi.pojo.response.personnel.PersonnelResultResponseVo; |
| 39 | 43 | import com.ruoyi.pojo.response.personnel.TokenResponseVo; |
| 44 | +import com.ruoyi.service.AttendanceService; | |
| 45 | +import com.ruoyi.service.RuleAttendanceMainService; | |
| 40 | 46 | import com.ruoyi.service.SchedulingService; |
| 41 | 47 | import com.ruoyi.service.ThreadJobService; |
| 42 | 48 | import com.ruoyi.system.domain.SysNotice; |
| ... | ... | @@ -63,6 +69,7 @@ import javax.servlet.http.HttpServletResponse; |
| 63 | 69 | import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; |
| 64 | 70 | import static com.ruoyi.common.ConstDriverProperties.*; |
| 65 | 71 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; |
| 72 | +import static com.ruoyi.common.RuleSchedulingProperties.WORK_FLAG; | |
| 66 | 73 | import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; |
| 67 | 74 | import static com.ruoyi.common.redispre.GlobalRedisPreName.REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW; |
| 68 | 75 | |
| ... | ... | @@ -102,8 +109,6 @@ public class DriverServiceImpl implements IDriverService { |
| 102 | 109 | private NowSchedulingCache nowSchedulingCache; |
| 103 | 110 | @Autowired |
| 104 | 111 | private EquipmentMapper equipmentMapper; |
| 105 | - @Autowired | |
| 106 | - private DriverJob driverJob; | |
| 107 | 112 | |
| 108 | 113 | @Autowired |
| 109 | 114 | private ServerConfig serverConfig; |
| ... | ... | @@ -119,6 +124,9 @@ public class DriverServiceImpl implements IDriverService { |
| 119 | 124 | @Value("${api.headImage}") |
| 120 | 125 | private String headImagePre; |
| 121 | 126 | |
| 127 | + @Autowired | |
| 128 | + private RuleAttendanceMainService attendanceMainService; | |
| 129 | + | |
| 122 | 130 | /** |
| 123 | 131 | * 查询驾驶员信息 |
| 124 | 132 | * |
| ... | ... | @@ -468,6 +476,7 @@ public class DriverServiceImpl implements IDriverService { |
| 468 | 476 | // 数据更新 更新人脸注册标识 更新基本数据 |
| 469 | 477 | for (List<Driver> list : lists) { |
| 470 | 478 | driverMapper.updateDriverBaseInfoByJobCodes(list, 0); |
| 479 | + attendanceMainService.updateAttendanceMainByJobCode(list); | |
| 471 | 480 | } |
| 472 | 481 | if (insertDrivers.size() > 0) driverMapper.saveDrivers(insertDrivers); |
| 473 | 482 | |
| ... | ... | @@ -611,6 +620,7 @@ public class DriverServiceImpl implements IDriverService { |
| 611 | 620 | } |
| 612 | 621 | if (CollectionUtil.isNotEmpty(drivers)) { |
| 613 | 622 | driverMapper.updateDriverBaseInfoByJobCodes(drivers, 1); |
| 623 | + attendanceMainService.updateAttendanceMainByJobCode(drivers); | |
| 614 | 624 | } |
| 615 | 625 | return AjaxResult.success(); |
| 616 | 626 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/mapper/RuleAttendanceMainMapper.java
| ... | ... | @@ -2,6 +2,7 @@ package com.ruoyi.mapper; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 4 | 4 | import com.ruoyi.domain.RuleAttendanceMain; |
| 5 | +import com.ruoyi.driver.domain.Driver; | |
| 5 | 6 | import com.ruoyi.pojo.vo.DeleteAttendanceVo; |
| 6 | 7 | import com.ruoyi.pojo.vo.PeopleRequestVo; |
| 7 | 8 | import com.ruoyi.pojo.vo.UpdateAttendanceVo; |
| ... | ... | @@ -39,6 +40,8 @@ public interface RuleAttendanceMainMapper extends BaseMapper<RuleAttendanceMain> |
| 39 | 40 | * @return |
| 40 | 41 | */ |
| 41 | 42 | List<RuleAttendanceMain> queryNowMonthDate(@Param("vo") PeopleRequestVo vo, @Param("jobCodes") List<String> jobCodes); |
| 43 | + | |
| 44 | + void updateAttendanceMainByJobCode(@Param("list") List<Driver> drivers); | |
| 42 | 45 | } |
| 43 | 46 | |
| 44 | 47 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/RuleAttendanceMainService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.ruoyi.service; |
| 3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
| 4 | 4 | import com.ruoyi.domain.RuleAttendanceMain; |
| 5 | 5 | import com.ruoyi.domain.RuleAttendanceMainHelp; |
| 6 | +import com.ruoyi.driver.domain.Driver; | |
| 6 | 7 | import com.ruoyi.pojo.vo.DeleteAttendanceVo; |
| 7 | 8 | import com.ruoyi.pojo.vo.PeopleRequestVo; |
| 8 | 9 | import com.ruoyi.pojo.vo.UpdateAttendanceVo; |
| ... | ... | @@ -46,4 +47,5 @@ public interface RuleAttendanceMainService extends IService<RuleAttendanceMain> |
| 46 | 47 | List<RuleAttendanceMain> queryNowMonthDate(PeopleRequestVo vo, List<String> jobCodes); |
| 47 | 48 | |
| 48 | 49 | |
| 50 | + void updateAttendanceMainByJobCode(List<Driver> drivers); | |
| 49 | 51 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/RuleAttendanceMainServiceImpl.java
| ... | ... | @@ -3,6 +3,7 @@ package com.ruoyi.service.impl; |
| 3 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 4 | 4 | import com.ruoyi.domain.RuleAttendanceMain; |
| 5 | 5 | import com.ruoyi.domain.RuleAttendanceMainHelp; |
| 6 | +import com.ruoyi.driver.domain.Driver; | |
| 6 | 7 | import com.ruoyi.mapper.RuleAttendanceMainMapper; |
| 7 | 8 | import com.ruoyi.pojo.vo.DeleteAttendanceVo; |
| 8 | 9 | import com.ruoyi.pojo.vo.PeopleRequestVo; |
| ... | ... | @@ -45,6 +46,11 @@ public class RuleAttendanceMainServiceImpl extends ServiceImpl<RuleAttendanceMai |
| 45 | 46 | public List<RuleAttendanceMain> queryNowMonthDate(PeopleRequestVo vo, List<String> jobCodes) { |
| 46 | 47 | return baseMapper.queryNowMonthDate(vo, jobCodes); |
| 47 | 48 | } |
| 49 | + | |
| 50 | + @Override | |
| 51 | + public void updateAttendanceMainByJobCode(List<Driver> drivers) { | |
| 52 | + baseMapper.updateAttendanceMainByJobCode(drivers); | |
| 53 | + } | |
| 48 | 54 | } |
| 49 | 55 | |
| 50 | 56 | ... | ... |
Bsth-admin/src/main/resources/mapper/RuleAttendanceMainMapper.xml
| ... | ... | @@ -55,6 +55,23 @@ |
| 55 | 55 | and scheduling_date = #{main.schedulingDate} |
| 56 | 56 | </foreach> |
| 57 | 57 | </update> |
| 58 | + <update id="updateAttendanceMainByJobCode"> | |
| 59 | + <foreach collection="list" item="item" separator=";"> | |
| 60 | + update rule_attendance_main | |
| 61 | + <trim prefix="set" suffixOverrides=","> | |
| 62 | + <if test="item.fleetName != null and item.fleetName != ''"> | |
| 63 | + fleet_name =#{item.fleetName}, | |
| 64 | + </if> | |
| 65 | + <if test="item.posts != null and item.posts != ''"> | |
| 66 | + `posts` =#{item.posts}, | |
| 67 | + </if> | |
| 68 | + <if test="item.personnelName != null and item.personnelName != ''"> | |
| 69 | + `name` =#{item.personnelName}, | |
| 70 | + </if> | |
| 71 | + </trim> | |
| 72 | + where job_code = #{item.jobCode} and scheduling_date > NOW() | |
| 73 | + </foreach> | |
| 74 | + </update> | |
| 58 | 75 | <delete id="deleteByJobCodeTotalRecord"> |
| 59 | 76 | delete from rule_attendance_main |
| 60 | 77 | where job_code IN | ... | ... |