Commit f140e57a9d9b26df9f869908ebe643c6ba1b852d
1 parent
088d8a89
fix: 添加调度考勤
Showing
28 changed files
with
607 additions
and
101 deletions
ruoyi-admin/src/main/java/com/ruoyi/controller/AttendanceController.java
| ... | ... | @@ -6,10 +6,7 @@ import com.ruoyi.common.global.Result; |
| 6 | 6 | import com.ruoyi.domain.RuleAttendanceMain; |
| 7 | 7 | import com.ruoyi.pojo.dto.SchedulingDto; |
| 8 | 8 | import com.ruoyi.pojo.dto.SchedulingSettingDto; |
| 9 | -import com.ruoyi.pojo.vo.RuleAttendanceMainRequestVo; | |
| 10 | -import com.ruoyi.pojo.vo.SchedulingRequestVo; | |
| 11 | -import com.ruoyi.pojo.vo.SchedulingResponseVo; | |
| 12 | -import com.ruoyi.pojo.vo.UpdateAttendanceVo; | |
| 9 | +import com.ruoyi.pojo.vo.*; | |
| 13 | 10 | import com.ruoyi.service.AttendanceService; |
| 14 | 11 | import io.swagger.annotations.Api; |
| 15 | 12 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -21,6 +18,7 @@ import java.util.List; |
| 21 | 18 | |
| 22 | 19 | /** |
| 23 | 20 | * 考勤表controller |
| 21 | + * | |
| 24 | 22 | * @author 20412 |
| 25 | 23 | */ |
| 26 | 24 | @RestController |
| ... | ... | @@ -37,7 +35,7 @@ public class AttendanceController extends BaseController { |
| 37 | 35 | */ |
| 38 | 36 | @ApiOperation("获取人员信息") |
| 39 | 37 | @GetMapping("/peoples") |
| 40 | - public Result<?> getPeopleInfo(@RequestParam(value = "id",required = false) Long id){ | |
| 38 | + public Result<?> getPeopleInfo(@RequestParam(value = "id", required = false) Long id) { | |
| 41 | 39 | return Result.OK(attendanceService.getDriverInfo(id)); |
| 42 | 40 | } |
| 43 | 41 | |
| ... | ... | @@ -46,7 +44,7 @@ public class AttendanceController extends BaseController { |
| 46 | 44 | */ |
| 47 | 45 | @ApiOperation("获取排班") |
| 48 | 46 | @GetMapping("/scheduling/list") |
| 49 | - public TableDataInfo getSchedulingList(@ModelAttribute SchedulingRequestVo vo){ | |
| 47 | + public TableDataInfo getSchedulingList(@ModelAttribute SchedulingRequestVo vo) { | |
| 50 | 48 | List<SchedulingResponseVo> list = attendanceService.getSchedulingList(vo); |
| 51 | 49 | return getDataTable(list); |
| 52 | 50 | } |
| ... | ... | @@ -56,7 +54,7 @@ public class AttendanceController extends BaseController { |
| 56 | 54 | */ |
| 57 | 55 | @ApiOperation("根据班次获取模板") |
| 58 | 56 | @GetMapping("/template/{id}") |
| 59 | - public Result<?> getTemplate(@PathVariable("id") Long id){ | |
| 57 | + public Result<?> getTemplate(@PathVariable("id") Long id) { | |
| 60 | 58 | return Result.OK(attendanceService.getTemplate(id)); |
| 61 | 59 | } |
| 62 | 60 | |
| ... | ... | @@ -66,7 +64,7 @@ public class AttendanceController extends BaseController { |
| 66 | 64 | */ |
| 67 | 65 | @ApiOperation("排班设置") |
| 68 | 66 | @PostMapping("/saveSchedulingSetting") |
| 69 | - public Result<?> saveSchedulingSetting(@RequestBody @Validated SchedulingSettingDto dto){ | |
| 67 | + public Result<?> saveSchedulingSetting(@RequestBody @Validated SchedulingSettingDto dto) { | |
| 70 | 68 | attendanceService.saveSchedulingSetting(dto); |
| 71 | 69 | return Result.OK("新增成功"); |
| 72 | 70 | } |
| ... | ... | @@ -76,7 +74,7 @@ public class AttendanceController extends BaseController { |
| 76 | 74 | */ |
| 77 | 75 | @ApiOperation("排班设置") |
| 78 | 76 | @PutMapping("/updateSchedulingSetting") |
| 79 | - public Result<?> updateSchedulingSetting(@RequestBody @Validated SchedulingDto dto){ | |
| 77 | + public Result<?> updateSchedulingSetting(@RequestBody @Validated SchedulingDto dto) { | |
| 80 | 78 | attendanceService.updateSchedulingSetting(dto); |
| 81 | 79 | return Result.OK("新增成功"); |
| 82 | 80 | } |
| ... | ... | @@ -86,7 +84,7 @@ public class AttendanceController extends BaseController { |
| 86 | 84 | */ |
| 87 | 85 | @ApiOperation("排班设置") |
| 88 | 86 | @DeleteMapping("/deleteSchedulingSetting/{settingId}") |
| 89 | - public Result<?> deleteSchedulingSetting(@PathVariable("settingId") Integer settingId){ | |
| 87 | + public Result<?> deleteSchedulingSetting(@PathVariable("settingId") Integer settingId) { | |
| 90 | 88 | attendanceService.deleteSchedulingSetting(settingId); |
| 91 | 89 | return Result.OK("删除成功"); |
| 92 | 90 | } |
| ... | ... | @@ -97,15 +95,36 @@ public class AttendanceController extends BaseController { |
| 97 | 95 | */ |
| 98 | 96 | @ApiOperation("获取考情表") |
| 99 | 97 | @GetMapping("/list/attendance") |
| 100 | - public TableDataInfo getAttendance(@ModelAttribute RuleAttendanceMainRequestVo vo){ | |
| 98 | + public TableDataInfo getAttendance(@ModelAttribute RuleAttendanceMainRequestVo vo) { | |
| 101 | 99 | List<RuleAttendanceMain> list = attendanceService.queryAttendanceMain(vo); |
| 102 | 100 | return getDataTable(list); |
| 103 | 101 | } |
| 104 | 102 | |
| 105 | 103 | @ApiOperation("修改考情表") |
| 106 | 104 | @PutMapping("/update/attendance") |
| 107 | - public Result<?> updateAttendance(@RequestBody @Validated UpdateAttendanceVo vo){ | |
| 108 | - attendanceService.updateAttendance(vo); | |
| 109 | - return Result.OK("规则修改成功"); | |
| 105 | + public Result<?> updateAttendance(@RequestBody @Validated UpdateAttendanceVo vo) { | |
| 106 | + try { | |
| 107 | + attendanceService.updateAttendance(vo); | |
| 108 | + return Result.OK("排班修改成功"); | |
| 109 | + } catch (Exception e) { | |
| 110 | + throw new RuntimeException("排班修改失败,请联系管理员" + e.getMessage()); | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + @ApiOperation("删除考勤表") | |
| 115 | + @PostMapping("/delete/attendance") | |
| 116 | + public Result<?> deleteAttendance(@RequestBody DeleteAttendanceVo vo) { | |
| 117 | + try { | |
| 118 | + attendanceService.deleteAttendance(vo); | |
| 119 | + return Result.OK("删除排班成功"); | |
| 120 | + } catch (Exception e) { | |
| 121 | + throw new RuntimeException("删除排班失败,请联系管理员" + e.getMessage()); | |
| 122 | + } | |
| 123 | + } | |
| 124 | + | |
| 125 | + @ApiOperation("获取排班表人员信息") | |
| 126 | + @GetMapping("/list/people") | |
| 127 | + public Result<?> getPeopleList(@ModelAttribute PeopleRequestVo vo){ | |
| 128 | + return Result.OK(attendanceService.getPeopleList(vo)); | |
| 110 | 129 | } |
| 111 | 130 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/domain/RuleAttendanceMain.java
| ... | ... | @@ -109,6 +109,8 @@ public class RuleAttendanceMain implements Serializable { |
| 109 | 109 | */ |
| 110 | 110 | private String ruleDictName; |
| 111 | 111 | |
| 112 | + private String fleetName; | |
| 113 | + | |
| 112 | 114 | @TableField(exist = false) |
| 113 | 115 | private static final long serialVersionUID = 1L; |
| 114 | 116 | } |
| 115 | 117 | \ No newline at end of file | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/domain/RuleAttendanceMainHelp.java
0 → 100644
| 1 | +package com.ruoyi.domain; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import java.io.Serializable; | |
| 8 | +import java.util.Date; | |
| 9 | + | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 考勤表 | |
| 14 | + * @author 20412 | |
| 15 | + * @TableName rule_attendance_main_help | |
| 16 | + */ | |
| 17 | +@TableName(value ="rule_attendance_main_help") | |
| 18 | +@Data | |
| 19 | +public class RuleAttendanceMainHelp implements Serializable { | |
| 20 | + /** | |
| 21 | + * 主键 | |
| 22 | + */ | |
| 23 | + @TableId(type = IdType.AUTO) | |
| 24 | + private Integer id; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 姓名 | |
| 28 | + */ | |
| 29 | + private String name; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 工号 | |
| 33 | + */ | |
| 34 | + private String jobCode; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 工种 | |
| 38 | + */ | |
| 39 | + private String posts; | |
| 40 | + | |
| 41 | + private Date dateFlag; | |
| 42 | + | |
| 43 | + private String fleetName; | |
| 44 | + | |
| 45 | + @TableField(exist = false) | |
| 46 | + private static final long serialVersionUID = 1L; | |
| 47 | +} | |
| 0 | 48 | \ No newline at end of file | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
| ... | ... | @@ -213,20 +213,10 @@ public class DriverController extends BaseController { |
| 213 | 213 | return driverService.faceRegistrationFeedback(vo.getDeviceId(), vo.getJobCodes()); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - /** | |
| 217 | - * 清除指定工号异常记录 | |
| 218 | - */ | |
| 219 | - @ApiOperation("清除指定工号异常记录") | |
| 220 | - @DeleteMapping("/clear/{jobCode}") | |
| 221 | - public AjaxResult clearExceptionRecordByJobCode(@PathVariable("jobCode") String jobCode) { | |
| 222 | - driverService.clearExceptionRecordByJobCode(jobCode); | |
| 223 | - return AjaxResult.success("清除成功"); | |
| 224 | - } | |
| 225 | - | |
| 226 | - @GetMapping("/questionFeedback") | |
| 227 | -// @ApiOperation("人脸识别反馈") | |
| 228 | - public Result<?> questionFeedback() { | |
| 229 | - | |
| 230 | - return null; | |
| 231 | - } | |
| 216 | +// @GetMapping("/questionFeedback") | |
| 217 | +//// @ApiOperation("人脸识别反馈") | |
| 218 | +// public Result<?> questionFeedback() { | |
| 219 | +// | |
| 220 | +// return null; | |
| 221 | +// } | |
| 232 | 222 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| ... | ... | @@ -194,6 +194,7 @@ public class DriverServiceImpl implements IDriverService { |
| 194 | 194 | */ |
| 195 | 195 | @Override |
| 196 | 196 | public int updateDriver(Driver driver) { |
| 197 | + driver.setUpdateTime(new Date()); | |
| 197 | 198 | return driverMapper.updateDriver(driver); |
| 198 | 199 | } |
| 199 | 200 | |
| ... | ... | @@ -331,13 +332,19 @@ public class DriverServiceImpl implements IDriverService { |
| 331 | 332 | List<DriverScheduling> dto = null; |
| 332 | 333 | Boolean schedulingFlag = true; |
| 333 | 334 | Boolean alcoholFlag = true; |
| 334 | - | |
| 335 | 335 | // 更新信息 |
| 336 | 336 | for (Driver item : drivers) { |
| 337 | 337 | dto = schedulingService.queryScheduling(item.getJobCode(), now); |
| 338 | 338 | DriverResponseVo vo = handlerRecommendation(item, now, dto, schedulingFlag, alcoholFlag); |
| 339 | - if (CollectionUtil.isEmpty(dto) && (item.getJobCode().equals("722717") || item.getJobCode().equals("700001"))) { | |
| 340 | - vos.add(DriverResponseVo.createDriverResponseVo(null, item, "签到", true, true, "测试", "测试", "测试")); | |
| 339 | + // 针对指定用户操作 | |
| 340 | + if ( item.getJobCode().equals("722717") || item.getJobCode().equals("700001")) { | |
| 341 | + if (!CollectionUtil.isEmpty(dto) && vo.getPlanAction().equals(SIGN_IN_STRING) ){ | |
| 342 | + vos.add(DriverResponseVo.createDriverResponseVo(null, item, SIGN_IN_STRING, true, true, "测试", "测试", "测试")); | |
| 343 | + }else if (!CollectionUtil.isEmpty(dto)){ | |
| 344 | + vos.add(vo); | |
| 345 | + }else { | |
| 346 | + vos.add(DriverResponseVo.createDriverResponseVo(null, item, SIGN_IN_STRING, true, true, "测试", "测试", "测试")); | |
| 347 | + } | |
| 341 | 348 | }else { |
| 342 | 349 | // 无排班 |
| 343 | 350 | if (Objects.isNull(vo)) { |
| ... | ... | @@ -346,7 +353,6 @@ public class DriverServiceImpl implements IDriverService { |
| 346 | 353 | vos.add(vo); |
| 347 | 354 | } |
| 348 | 355 | } |
| 349 | - | |
| 350 | 356 | } |
| 351 | 357 | return vos; |
| 352 | 358 | } |
| ... | ... | @@ -484,12 +490,6 @@ public class DriverServiceImpl implements IDriverService { |
| 484 | 490 | driverMapper.updateDriverInfoByJobCodes(drivers); |
| 485 | 491 | } |
| 486 | 492 | |
| 487 | - @Override | |
| 488 | - public void clearExceptionRecordByJobCode(String jobCode) { | |
| 489 | - String dateKey = REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW + ConstDateUtil.formatDate(new Date()); | |
| 490 | - log.info("在:{}时间工号:{}的异常记录被清除了", dateKey, jobCode); | |
| 491 | - redisCache.deleteCacheMapValue(dateKey, jobCode); | |
| 492 | - } | |
| 493 | 493 | |
| 494 | 494 | @Override |
| 495 | 495 | public void deleteNotEmptyJob(List<String> jobList) { | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/global/GlobalException.java
0 → 100644
| 1 | +package com.ruoyi.global; | |
| 2 | + | |
| 3 | +import com.ruoyi.common.global.Result; | |
| 4 | +import com.ruoyi.common.global.ResultCode; | |
| 5 | +import lombok.extern.slf4j.Slf4j; | |
| 6 | +import org.springframework.security.core.userdetails.UsernameNotFoundException; | |
| 7 | +import org.springframework.web.bind.annotation.ExceptionHandler; | |
| 8 | +import org.springframework.web.bind.annotation.RestControllerAdvice; | |
| 9 | + | |
| 10 | +import java.sql.SQLIntegrityConstraintViolationException; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * @author 20412 | |
| 14 | + */ | |
| 15 | +@Slf4j | |
| 16 | +@RestControllerAdvice | |
| 17 | +public class GlobalException { | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 处理sql完整性约束冲突 | |
| 21 | + * @param e | |
| 22 | + * @return | |
| 23 | + */ | |
| 24 | + @ExceptionHandler(SQLIntegrityConstraintViolationException.class) | |
| 25 | + public Result<?> uniqSqlHandler(SQLIntegrityConstraintViolationException e){ | |
| 26 | + // 唯一完成性约束冲突 | |
| 27 | + if (e.getMessage().contains("Duplicate entry")){ | |
| 28 | + String[] args = e.getMessage().split(" "); | |
| 29 | + String message = args[2] + "已存在"; | |
| 30 | + return Result.ERROR(message); | |
| 31 | + } | |
| 32 | + return Result.ERROR(e.getMessage()); | |
| 33 | + } | |
| 34 | + | |
| 35 | + @ExceptionHandler(UsernameNotFoundException.class) | |
| 36 | + public Result<?> userInfoIllegal(UsernameNotFoundException e){ | |
| 37 | + return Result.ERROR(e.getMessage()).code(ResultCode.CODE_401.getCode()); | |
| 38 | + } | |
| 39 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| ... | ... | @@ -396,14 +396,14 @@ public class SignInServiceImpl implements ISignInService { |
| 396 | 396 | |
| 397 | 397 | private AjaxResult getAjaxResultByDriverSignInfo(SignIn signIn, SignInResponseVo vo) { |
| 398 | 398 | // TODO 待更换 缓存更新为当天签到记录 |
| 399 | - String key = REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW + ConstDateUtil.formatDate("yyyyMMdd"); | |
| 399 | + String key = REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW + ConstDateUtil.formatDate("yyyyMMdd") + ":" + signIn.getJobCode(); | |
| 400 | 400 | // 驾驶员酒精测试连续超标两次则提示换人 |
| 401 | - Integer count = redisCache.getCacheMapValue(key, signIn.getJobCode()); | |
| 401 | + Integer count = redisCache.getCacheObject(key); | |
| 402 | 402 | if (Objects.isNull(count) || count.equals(0)) { |
| 403 | 403 | count = 1; |
| 404 | 404 | redisCache.setCacheMapValue(key, signIn.getJobCode(), count); |
| 405 | 405 | } else { |
| 406 | - count = redisCache.setIncrementMapValue(key, signIn.getJobCode(), 1); | |
| 406 | + redisCache.setCacheObject(key, ++count); | |
| 407 | 407 | } |
| 408 | 408 | if (SIGN_IN_ERROR_COUNT.compareTo(count) <= 0) { |
| 409 | 409 | return AjaxResult.success(SIGN_IN_ERROR + ": " + signIn.getRemark() + "酒精测试不通过" + count + "次请更换车辆驾驶员。", vo); |
| ... | ... | @@ -500,7 +500,7 @@ public class SignInServiceImpl implements ISignInService { |
| 500 | 500 | if (PERSONNEL_POSTS_DRIVER.equals(posts) || PERSONNEL_POSTS_SALES.equals(posts)) { |
| 501 | 501 | return driverCheckTimeOut(globalIndex, signIn, dto, now); |
| 502 | 502 | } else { |
| 503 | - return true; | |
| 503 | + return driverCheckTimeOut(globalIndex, signIn, dto, now); | |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| ... | ... | @@ -224,7 +224,7 @@ public class DriverJob implements InitializingBean { |
| 224 | 224 | throw new RuntimeException(e); |
| 225 | 225 | } |
| 226 | 226 | // 获取排班信息并存入redis |
| 227 | - saveSchedulingToRedis(getSchedulingInfoUrl, formatDate,timeOut); | |
| 227 | + saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut); | |
| 228 | 228 | // 删除两天前排班信息 |
| 229 | 229 | deleteScheduling(); |
| 230 | 230 | log.info("获取{}的排班数据完毕", formatDate); |
| ... | ... | @@ -243,14 +243,14 @@ public class DriverJob implements InitializingBean { |
| 243 | 243 | |
| 244 | 244 | // 删除实时排班 |
| 245 | 245 | for (int i = 0; i < keys.size(); i++) { |
| 246 | - if (nowKey.equals(keys.get(i)) || yesterdayKey.equals(keys.get(i))){ | |
| 246 | + if (nowKey.equals(keys.get(i)) || yesterdayKey.equals(keys.get(i))) { | |
| 247 | 247 | continue; |
| 248 | 248 | } |
| 249 | 249 | SCHEDULING_CACHE.removeCacheSchedulingByKey(keys.get(i)); |
| 250 | 250 | } |
| 251 | 251 | // 删除考勤 |
| 252 | 252 | for (int i = 0; i < nowKeys.size(); i++) { |
| 253 | - if (nowDate.equals(nowKeys.get(i)) || yesterdayDate.equals(nowKeys.get(i))){ | |
| 253 | + if (nowDate.equals(nowKeys.get(i)) || yesterdayDate.equals(nowKeys.get(i))) { | |
| 254 | 254 | continue; |
| 255 | 255 | } |
| 256 | 256 | NOW_SCHEDULING_CACHE.removeCacheSchedulingByKey(nowKeys.get(i)); |
| ... | ... | @@ -267,11 +267,18 @@ public class DriverJob implements InitializingBean { |
| 267 | 267 | /** |
| 268 | 268 | * 生成排班 |
| 269 | 269 | */ |
| 270 | - public void createAttendance(){ | |
| 270 | + public void createAttendance() { | |
| 271 | 271 | RULE_NUM_SETTING_SERVICE.createAttendance(); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | + * 工具任务 手动把非司售人员的排班加入到签到报表缓存 可以把当天生成的排班明细没有来得及加入签到报表的员工手动加入 | |
| 276 | + */ | |
| 277 | + public void manualAddBcCache(){ | |
| 278 | + RULE_NUM_SETTING_SERVICE.manualAddBcCache(); | |
| 279 | + } | |
| 280 | + | |
| 281 | + /** | |
| 275 | 282 | * 计算设备在线状态 5 分钟一次 |
| 276 | 283 | */ |
| 277 | 284 | public void computedDeviceOnlineStatus(String date) throws IOException, ClassNotFoundException { |
| ... | ... | @@ -293,7 +300,7 @@ public class DriverJob implements InitializingBean { |
| 293 | 300 | } |
| 294 | 301 | } |
| 295 | 302 | // 更新日志 |
| 296 | - THREAD_JOB_SERVICE.asyncInsertEquipmentLog(list,original); | |
| 303 | + THREAD_JOB_SERVICE.asyncInsertEquipmentLog(list, original); | |
| 297 | 304 | EQUIPMENT_MAPPER.updateEquipments(list); |
| 298 | 305 | } |
| 299 | 306 | |
| ... | ... | @@ -325,7 +332,7 @@ public class DriverJob implements InitializingBean { |
| 325 | 332 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); |
| 326 | 333 | } |
| 327 | 334 | // 存入签到报表 |
| 328 | - THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap,timeOut); | |
| 335 | + THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap, timeOut); | |
| 329 | 336 | // 实时排班直接存入缓存 |
| 330 | 337 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); |
| 331 | 338 | log.info("拉取排班完毕:{}", dateKey); |
| ... | ... | @@ -335,7 +342,7 @@ public class DriverJob implements InitializingBean { |
| 335 | 342 | private void splitSaveScheduling(Map<String, List<ResponseSchedulingDto>> driverSchedulingMap, String jobCode, String name, ResponseSchedulingDto item, String posts) { |
| 336 | 343 | if (!Objects.isNull(jobCode)) { |
| 337 | 344 | ResponseSchedulingDto scheduling = new ResponseSchedulingDto(); |
| 338 | - BeanUtils.copyProperties(item,scheduling); | |
| 345 | + BeanUtils.copyProperties(item, scheduling); | |
| 339 | 346 | scheduling.setPosts(posts); |
| 340 | 347 | scheduling.setJobCode(jobCode); |
| 341 | 348 | scheduling.setName(name); |
| ... | ... | @@ -359,7 +366,7 @@ public class DriverJob implements InitializingBean { |
| 359 | 366 | int countPage = vo.getTotalCount() / pageSize; |
| 360 | 367 | countPage = vo.getTotalCount() % pageSize == 0 ? countPage : countPage + 1; |
| 361 | 368 | List<Driver> drivers = getDrivers(date, vo); |
| 362 | - for (int i = 2; i <= countPage; i++ ) { | |
| 369 | + for (int i = 2; i <= countPage; i++) { | |
| 363 | 370 | drivers.addAll(getDrivers(date, getPersonInfo(accessToken, 100, i))); |
| 364 | 371 | } |
| 365 | 372 | List<String> jobList = drivers.stream().map(driver -> driver.getJobCode()).collect(Collectors.toList()); | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/mapper/RuleAttendanceMainHelpMapper.java
0 → 100644
| 1 | +package com.ruoyi.mapper; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 4 | +import com.ruoyi.domain.RuleAttendanceMainHelp; | |
| 5 | +import com.ruoyi.pojo.vo.PeopleRequestVo; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | +* @author 20412 | |
| 11 | +* @description 针对表【rule_attendance_main_help(考勤表)】的数据库操作Mapper | |
| 12 | +* @createDate 2023-09-05 15:39:18 | |
| 13 | +* @Entity .domain.RuleAttendanceMainHelp | |
| 14 | +*/ | |
| 15 | +public interface RuleAttendanceMainHelpMapper extends BaseMapper<RuleAttendanceMainHelp> { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 获取当月生成的人员信息 | |
| 19 | + * @param vo | |
| 20 | + * @return | |
| 21 | + */ | |
| 22 | + List<RuleAttendanceMainHelp> queryNowMonthPeople(PeopleRequestVo vo); | |
| 23 | +} | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/mapper/RuleAttendanceMainMapper.java
| ... | ... | @@ -2,6 +2,9 @@ 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.pojo.vo.DeleteAttendanceVo; | |
| 6 | +import com.ruoyi.pojo.vo.UpdateAttendanceVo; | |
| 7 | +import org.apache.ibatis.annotations.Param; | |
| 5 | 8 | |
| 6 | 9 | /** |
| 7 | 10 | * @author 20412 |
| ... | ... | @@ -11,10 +14,18 @@ import com.ruoyi.domain.RuleAttendanceMain; |
| 11 | 14 | */ |
| 12 | 15 | public interface RuleAttendanceMainMapper extends BaseMapper<RuleAttendanceMain> { |
| 13 | 16 | /** |
| 14 | - * 全量更新 | |
| 17 | + * 批量更新 | |
| 18 | + * | |
| 19 | + * @param vo | |
| 15 | 20 | * @param main |
| 16 | 21 | */ |
| 17 | - void updateByIdTotalQuantity(RuleAttendanceMain main); | |
| 22 | + void updateByIdTotalQuantity(@Param("vo") UpdateAttendanceVo vo,@Param("main") RuleAttendanceMain main); | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 批量删除 | |
| 26 | + * @param vo | |
| 27 | + */ | |
| 28 | + void deleteByJobCodeTotalRecord(DeleteAttendanceVo vo); | |
| 18 | 29 | } |
| 19 | 30 | |
| 20 | 31 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/dto/AttendanceDto.java
ruoyi-admin/src/main/java/com/ruoyi/pojo/vo/DeleteAttendanceVo.java
0 → 100644
ruoyi-admin/src/main/java/com/ruoyi/pojo/vo/PeopleRequestVo.java
0 → 100644
ruoyi-admin/src/main/java/com/ruoyi/pojo/vo/UpdateAttendanceVo.java
| 1 | 1 | package com.ruoyi.pojo.vo; |
| 2 | 2 | |
| 3 | -import com.ruoyi.scheduling.domain.RuleScheduling; | |
| 4 | 3 | import lombok.Data; |
| 5 | 4 | |
| 6 | -import javax.validation.constraints.NotNull; | |
| 7 | 5 | import java.util.List; |
| 8 | 6 | |
| 7 | + | |
| 9 | 8 | /** |
| 10 | 9 | * @author 20412 |
| 11 | 10 | */ |
| 12 | 11 | @Data |
| 13 | 12 | public class UpdateAttendanceVo { |
| 14 | - @NotNull | |
| 15 | - private Integer id; | |
| 16 | - @NotNull | |
| 13 | + private List<String> jobCode; | |
| 14 | + private String startDate; | |
| 15 | + private String endDate; | |
| 17 | 16 | private Integer ruleId; |
| 18 | 17 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/AttendanceService.java
| 1 | 1 | package com.ruoyi.service; |
| 2 | 2 | |
| 3 | 3 | import com.ruoyi.domain.RuleAttendanceMain; |
| 4 | +import com.ruoyi.domain.RuleAttendanceMainHelp; | |
| 4 | 5 | import com.ruoyi.pojo.dto.SchedulingDto; |
| 5 | 6 | import com.ruoyi.pojo.dto.SchedulingSettingDto; |
| 6 | 7 | import com.ruoyi.pojo.vo.*; |
| ... | ... | @@ -53,4 +54,8 @@ public interface AttendanceService { |
| 53 | 54 | List<RuleAttendanceMain> queryAttendanceMain(RuleAttendanceMainRequestVo vo); |
| 54 | 55 | |
| 55 | 56 | void updateAttendance(UpdateAttendanceVo vo); |
| 57 | + | |
| 58 | + void deleteAttendance(DeleteAttendanceVo vo); | |
| 59 | + | |
| 60 | + List<RuleAttendanceMainHelp> getPeopleList(PeopleRequestVo vo); | |
| 56 | 61 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/RuleAttendanceMainHelpService.java
0 → 100644
| 1 | +package com.ruoyi.service; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
| 4 | +import com.ruoyi.domain.RuleAttendanceMainHelp; | |
| 5 | +import com.ruoyi.pojo.vo.PeopleRequestVo; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | +* @author 20412 | |
| 11 | +* @description 针对表【rule_attendance_main_help(考勤表)】的数据库操作Service | |
| 12 | +* @createDate 2023-09-05 15:39:18 | |
| 13 | +*/ | |
| 14 | +public interface RuleAttendanceMainHelpService extends IService<RuleAttendanceMainHelp> { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 查询当月生成人员数据 | |
| 18 | + * @param vo | |
| 19 | + * @return | |
| 20 | + */ | |
| 21 | + List<RuleAttendanceMainHelp> queryNowMonthPeople(PeopleRequestVo vo); | |
| 22 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/RuleAttendanceMainService.java
| ... | ... | @@ -2,6 +2,14 @@ package com.ruoyi.service; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
| 4 | 4 | import com.ruoyi.domain.RuleAttendanceMain; |
| 5 | +import com.ruoyi.domain.RuleAttendanceMainHelp; | |
| 6 | +import com.ruoyi.pojo.vo.DeleteAttendanceVo; | |
| 7 | +import com.ruoyi.pojo.vo.PeopleRequestVo; | |
| 8 | +import com.ruoyi.pojo.vo.PeopleResponseVo; | |
| 9 | +import com.ruoyi.pojo.vo.UpdateAttendanceVo; | |
| 10 | +import org.apache.ibatis.annotations.Param; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 5 | 13 | |
| 6 | 14 | /** |
| 7 | 15 | * @author 20412 |
| ... | ... | @@ -10,5 +18,23 @@ import com.ruoyi.domain.RuleAttendanceMain; |
| 10 | 18 | */ |
| 11 | 19 | public interface RuleAttendanceMainService extends IService<RuleAttendanceMain> { |
| 12 | 20 | |
| 13 | - void updateByIdTotalQuantity(RuleAttendanceMain main); | |
| 21 | + /** | |
| 22 | + * 修改规则 | |
| 23 | + * @param vo | |
| 24 | + * @param main | |
| 25 | + */ | |
| 26 | + void updateByJobCodeTotalQuantity(@Param("vo") UpdateAttendanceVo vo, @Param("main") RuleAttendanceMain main); | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 删除排班 | |
| 30 | + * @param vo | |
| 31 | + */ | |
| 32 | + void deleteByJobCodeTotalRecord(DeleteAttendanceVo vo); | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 获取本月生成清单 | |
| 36 | + * @param vo | |
| 37 | + * @return | |
| 38 | + */ | |
| 39 | + List<RuleAttendanceMainHelp> queryPeopleList(PeopleRequestVo vo); | |
| 14 | 40 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/RuleNumSettingService.java
ruoyi-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -3,11 +3,13 @@ package com.ruoyi.service; |
| 3 | 3 | |
| 4 | 4 | import cn.hutool.core.collection.CollectionUtil; |
| 5 | 5 | import cn.hutool.http.HttpUtil; |
| 6 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 6 | 7 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 7 | 8 | import com.ruoyi.common.config.RuoYiConfig; |
| 8 | 9 | import com.ruoyi.common.exception.file.FileUploadException; |
| 9 | 10 | import com.ruoyi.common.utils.StringUtils; |
| 10 | 11 | import com.ruoyi.common.utils.file.FileUploadUtils; |
| 12 | +import com.ruoyi.domain.RuleAttendanceMain; | |
| 11 | 13 | import com.ruoyi.driver.domain.Driver; |
| 12 | 14 | import com.ruoyi.driver.mapper.DriverMapper; |
| 13 | 15 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| ... | ... | @@ -48,6 +50,7 @@ import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_IN; |
| 48 | 50 | import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; |
| 49 | 51 | import static com.ruoyi.common.ConstEquipmentProperties.*; |
| 50 | 52 | import static com.ruoyi.common.ConstSignInConstSignInProperties.SIGN_NO_EX_NUM; |
| 53 | +import static com.ruoyi.common.RuleSchedulingProperties.WORK_FLAG; | |
| 51 | 54 | |
| 52 | 55 | |
| 53 | 56 | /** |
| ... | ... | @@ -75,6 +78,9 @@ public class ThreadJobService { |
| 75 | 78 | @Resource |
| 76 | 79 | private NowSchedulingCache nowSchedulingCache; |
| 77 | 80 | |
| 81 | + @Autowired | |
| 82 | + private RuleAttendanceMainService attendanceMainService; | |
| 83 | + | |
| 78 | 84 | |
| 79 | 85 | @Autowired |
| 80 | 86 | private PlatformTransactionManager transactionManager; |
| ... | ... | @@ -344,6 +350,9 @@ public class ThreadJobService { |
| 344 | 350 | return; |
| 345 | 351 | } |
| 346 | 352 | List<DriverScheduling> bcList = getBcList(originSchedulingMap); |
| 353 | + | |
| 354 | + // 处理非司售人员的排班明细 | |
| 355 | + bcList.addAll(handleOtherPostsScheduling()); | |
| 347 | 356 | // 插入排班 |
| 348 | 357 | schedulingMapper.insertRoster(bcList); |
| 349 | 358 | // 异常数据过多,不通过自增获取id再次查询获取 |
| ... | ... | @@ -362,6 +371,57 @@ public class ThreadJobService { |
| 362 | 371 | } |
| 363 | 372 | } |
| 364 | 373 | |
| 374 | + private List<DriverScheduling> handleOtherPostsScheduling() { | |
| 375 | + QueryWrapper<RuleAttendanceMain> qw = new QueryWrapper<>(); | |
| 376 | + qw.lambda() | |
| 377 | + .eq(RuleAttendanceMain::getWorkFlag, WORK_FLAG) | |
| 378 | + .eq(RuleAttendanceMain::getSchedulingDate, LocalDate.now()); | |
| 379 | + List<RuleAttendanceMain> mainList = attendanceMainService.list(qw); | |
| 380 | + List<DriverScheduling> bcList = new ArrayList<>(mainList.size() * 2); | |
| 381 | + for (RuleAttendanceMain ruleAttendanceMain : mainList) { | |
| 382 | + // 第一段 | |
| 383 | + DriverScheduling scheduling = getDriverScheduling(ruleAttendanceMain); | |
| 384 | + scheduling.setFcsjT(ruleAttendanceMain.getFirstWorkSignInTime().getTime()); | |
| 385 | + scheduling.setBcType(BC_TYPE_OUT); | |
| 386 | + scheduling.setZdsjT(ruleAttendanceMain.getFirstWorkSignInTime().getTime()); | |
| 387 | + scheduling.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | |
| 388 | + bcList.add(scheduling); | |
| 389 | + | |
| 390 | + DriverScheduling scheduling1 = getDriverScheduling(ruleAttendanceMain); | |
| 391 | + scheduling1.setBcType(BC_TYPE_IN); | |
| 392 | + scheduling1.setZdsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); | |
| 393 | + scheduling1.setFcsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); | |
| 394 | + scheduling1.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | |
| 395 | + bcList.add(scheduling1); | |
| 396 | + // 第二段 | |
| 397 | + if (!Objects.isNull(ruleAttendanceMain.getSecondWorkSignInTime())) { | |
| 398 | + DriverScheduling scheduling2 = getDriverScheduling(ruleAttendanceMain); | |
| 399 | + scheduling2.setBcType(BC_TYPE_OUT); | |
| 400 | + scheduling2.setFcsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); | |
| 401 | + scheduling2.setZdsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); | |
| 402 | + scheduling2.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | |
| 403 | + bcList.add(scheduling2); | |
| 404 | + | |
| 405 | + DriverScheduling scheduling3 = getDriverScheduling(ruleAttendanceMain); | |
| 406 | + scheduling3.setBcType(BC_TYPE_IN); | |
| 407 | + scheduling3.setFcsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); | |
| 408 | + scheduling3.setZdsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); | |
| 409 | + scheduling3.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | |
| 410 | + bcList.add(scheduling3); | |
| 411 | + } | |
| 412 | + } | |
| 413 | + return bcList; | |
| 414 | + } | |
| 415 | + | |
| 416 | + private static DriverScheduling getDriverScheduling(RuleAttendanceMain ruleAttendanceMain) { | |
| 417 | + DriverScheduling scheduling = new DriverScheduling(); | |
| 418 | + scheduling.setPosts(ruleAttendanceMain.getPosts()); | |
| 419 | + scheduling.setJobCode(ruleAttendanceMain.getJobCode()); | |
| 420 | + scheduling.setName(ruleAttendanceMain.getName()); | |
| 421 | + scheduling.setFleetName(ruleAttendanceMain.getFleetName()); | |
| 422 | + return scheduling; | |
| 423 | + } | |
| 424 | + | |
| 365 | 425 | private List<DriverScheduling> getBcList(Map<String, List<ResponseSchedulingDto>> originSchedulingMap) { |
| 366 | 426 | List<DriverScheduling> bcList = new ArrayList<>(1000); |
| 367 | 427 | for (String key : originSchedulingMap.keySet()) { | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/AttendanceServiceImpl.java
| ... | ... | @@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 5 | 5 | import com.ruoyi.common.utils.DateUtils; |
| 6 | 6 | import com.ruoyi.common.utils.PageUtils; |
| 7 | 7 | import com.ruoyi.common.utils.SecurityUtils; |
| 8 | -import com.ruoyi.domain.RuleAttendanceMain; | |
| 9 | -import com.ruoyi.domain.RuleNumSetting; | |
| 10 | -import com.ruoyi.domain.RuleSettingDriver; | |
| 11 | -import com.ruoyi.domain.RuleSettingScheduling; | |
| 8 | +import com.ruoyi.domain.*; | |
| 12 | 9 | import com.ruoyi.driver.mapper.DriverMapper; |
| 13 | 10 | import com.ruoyi.num.domain.RuleNum; |
| 14 | 11 | import com.ruoyi.num.service.IRuleNumService; |
| ... | ... | @@ -24,7 +21,6 @@ import com.ruoyi.service.*; |
| 24 | 21 | import com.ruoyi.utils.ConstDateUtil; |
| 25 | 22 | import org.springframework.beans.BeanUtils; |
| 26 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| 27 | -import org.springframework.security.core.parameters.P; | |
| 28 | 24 | import org.springframework.stereotype.Service; |
| 29 | 25 | import org.springframework.transaction.annotation.Transactional; |
| 30 | 26 | |
| ... | ... | @@ -159,8 +155,9 @@ public class AttendanceServiceImpl implements AttendanceService { |
| 159 | 155 | } |
| 160 | 156 | |
| 161 | 157 | @Override |
| 158 | + @Transactional(rollbackFor = Exception.class) | |
| 162 | 159 | public void updateAttendance(UpdateAttendanceVo vo) { |
| 163 | - RuleAttendanceMain main = attendanceMainService.getById(vo.getId()); | |
| 160 | + RuleAttendanceMain main = new RuleAttendanceMain(); | |
| 164 | 161 | RuleScheduling ruleScheduling = ruleSchedulingService.selectRuleSchedulingById(vo.getRuleId().longValue()); |
| 165 | 162 | BeanUtils.copyProperties(ruleScheduling, main); |
| 166 | 163 | main.setFirstWorkSignInTime(ConstDateUtil.dateAddition(LocalDate.now().toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstWorkSignInTime()))); |
| ... | ... | @@ -170,19 +167,30 @@ public class AttendanceServiceImpl implements AttendanceService { |
| 170 | 167 | // 处理隔天 |
| 171 | 168 | if (TOMORROW_YES.equals(ruleScheduling.getFirstSignInDayTomorrow())) { |
| 172 | 169 | main.setSecondQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().plusDays(1).toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getSecondQuittingSignInTime()))); |
| 173 | - }else { | |
| 170 | + } else { | |
| 174 | 171 | main.setSecondQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getSecondQuittingSignInTime()))); |
| 175 | 172 | } |
| 176 | 173 | } else { |
| 177 | 174 | // 处理隔天 |
| 178 | 175 | if (TOMORROW_YES.equals(ruleScheduling.getFirstSignInDayTomorrow())) { |
| 179 | 176 | main.setFirstQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().plusDays(1).toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstQuittingSignInTime()))); |
| 180 | - }else { | |
| 177 | + } else { | |
| 181 | 178 | main.setFirstQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstQuittingSignInTime()))); |
| 182 | 179 | } |
| 183 | 180 | } |
| 184 | 181 | main.setWorkFlag(ruleScheduling.getId() == 0 ? FREE_FLAG : WORK_FLAG); |
| 185 | - attendanceMainService.updateByIdTotalQuantity(main); | |
| 182 | + attendanceMainService.updateByJobCodeTotalQuantity(vo, main); | |
| 183 | + } | |
| 184 | + | |
| 185 | + @Override | |
| 186 | + @Transactional(rollbackFor = Exception.class) | |
| 187 | + public void deleteAttendance(DeleteAttendanceVo vo) { | |
| 188 | + attendanceMainService.deleteByJobCodeTotalRecord(vo); | |
| 189 | + } | |
| 190 | + | |
| 191 | + @Override | |
| 192 | + public List<RuleAttendanceMainHelp> getPeopleList(PeopleRequestVo vo) { | |
| 193 | + return attendanceMainService.queryPeopleList(vo); | |
| 186 | 194 | } |
| 187 | 195 | |
| 188 | 196 | private static void getRumSettingByDto(SchedulingDto dto, RuleNumSetting setting) { | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/RuleAttendanceMainHelpServiceImpl.java
0 → 100644
| 1 | +package com.ruoyi.service.impl; | |
| 2 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
| 3 | +import com.ruoyi.domain.RuleAttendanceMainHelp; | |
| 4 | +import com.ruoyi.mapper.RuleAttendanceMainHelpMapper; | |
| 5 | +import com.ruoyi.pojo.vo.PeopleRequestVo; | |
| 6 | +import com.ruoyi.service.RuleAttendanceMainHelpService; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | +* @author 20412 | |
| 13 | +* @description 针对表【rule_attendance_main_help(考勤表)】的数据库操作Service实现 | |
| 14 | +* @createDate 2023-09-05 15:39:18 | |
| 15 | +*/ | |
| 16 | +@Service | |
| 17 | +public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanceMainHelpMapper, RuleAttendanceMainHelp> | |
| 18 | + implements RuleAttendanceMainHelpService { | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + public List<RuleAttendanceMainHelp> queryNowMonthPeople(PeopleRequestVo vo) { | |
| 22 | + return baseMapper.queryNowMonthPeople(vo); | |
| 23 | + } | |
| 24 | +} | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/RuleAttendanceMainServiceImpl.java
| ... | ... | @@ -2,10 +2,19 @@ package com.ruoyi.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 4 | 4 | import com.ruoyi.domain.RuleAttendanceMain; |
| 5 | +import com.ruoyi.domain.RuleAttendanceMainHelp; | |
| 5 | 6 | import com.ruoyi.mapper.RuleAttendanceMainMapper; |
| 7 | +import com.ruoyi.pojo.vo.DeleteAttendanceVo; | |
| 8 | +import com.ruoyi.pojo.vo.PeopleRequestVo; | |
| 9 | +import com.ruoyi.pojo.vo.PeopleResponseVo; | |
| 10 | +import com.ruoyi.pojo.vo.UpdateAttendanceVo; | |
| 11 | +import com.ruoyi.service.RuleAttendanceMainHelpService; | |
| 6 | 12 | import com.ruoyi.service.RuleAttendanceMainService; |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | 14 | import org.springframework.stereotype.Service; |
| 8 | 15 | |
| 16 | +import java.util.List; | |
| 17 | + | |
| 9 | 18 | /** |
| 10 | 19 | * @author 20412 |
| 11 | 20 | * @description 针对表【rule_attendance_main(考勤表)】的数据库操作Service实现 |
| ... | ... | @@ -15,9 +24,22 @@ import org.springframework.stereotype.Service; |
| 15 | 24 | public class RuleAttendanceMainServiceImpl extends ServiceImpl<RuleAttendanceMainMapper, RuleAttendanceMain> |
| 16 | 25 | implements RuleAttendanceMainService { |
| 17 | 26 | |
| 27 | + @Autowired | |
| 28 | + private RuleAttendanceMainHelpService helpService; | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + public void updateByJobCodeTotalQuantity(UpdateAttendanceVo vo, RuleAttendanceMain main) { | |
| 32 | + baseMapper.updateByIdTotalQuantity(vo,main); | |
| 33 | + } | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public void deleteByJobCodeTotalRecord(DeleteAttendanceVo vo) { | |
| 37 | + baseMapper.deleteByJobCodeTotalRecord(vo); | |
| 38 | + } | |
| 39 | + | |
| 18 | 40 | @Override |
| 19 | - public void updateByIdTotalQuantity(RuleAttendanceMain main) { | |
| 20 | - baseMapper.updateByIdTotalQuantity(main); | |
| 41 | + public List<RuleAttendanceMainHelp> queryPeopleList(PeopleRequestVo vo) { | |
| 42 | + return helpService.queryNowMonthPeople(vo); | |
| 21 | 43 | } |
| 22 | 44 | } |
| 23 | 45 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/RuleNumSettingServiceImpl.java
| 1 | 1 | package com.ruoyi.service.impl; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 4 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 6 | +import com.ruoyi.common.cache.NowSchedulingCache; | |
| 7 | +import com.ruoyi.domain.DriverScheduling; | |
| 5 | 8 | import com.ruoyi.domain.RuleAttendanceMain; |
| 9 | +import com.ruoyi.domain.RuleAttendanceMainHelp; | |
| 6 | 10 | import com.ruoyi.domain.RuleNumSetting; |
| 11 | +import com.ruoyi.driver.mapper.DriverSchedulingMapper; | |
| 7 | 12 | import com.ruoyi.mapper.RuleNumSettingMapper; |
| 8 | 13 | import com.ruoyi.num.service.IRuleNumService; |
| 9 | 14 | import com.ruoyi.pojo.dto.AttendanceDto; |
| ... | ... | @@ -12,19 +17,26 @@ import com.ruoyi.pojo.dto.RuleSchedulingDto; |
| 12 | 17 | import com.ruoyi.pojo.vo.SchedulingRequestVo; |
| 13 | 18 | import com.ruoyi.pojo.vo.SchedulingResponseVo; |
| 14 | 19 | import com.ruoyi.scheduling.service.IRuleSchedulingService; |
| 20 | +import com.ruoyi.service.RuleAttendanceMainHelpService; | |
| 15 | 21 | import com.ruoyi.service.RuleAttendanceMainService; |
| 16 | 22 | import com.ruoyi.service.RuleNumSettingService; |
| 17 | 23 | import com.ruoyi.utils.ConstDateUtil; |
| 24 | +import org.slf4j.Logger; | |
| 25 | +import org.slf4j.LoggerFactory; | |
| 18 | 26 | import org.springframework.beans.BeanUtils; |
| 19 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | 28 | import org.springframework.stereotype.Service; |
| 29 | +import org.springframework.transaction.annotation.Transactional; | |
| 21 | 30 | |
| 31 | +import javax.annotation.Resource; | |
| 22 | 32 | import java.time.LocalDate; |
| 23 | 33 | import java.time.ZoneId; |
| 24 | 34 | import java.time.temporal.ChronoUnit; |
| 25 | 35 | import java.util.*; |
| 26 | 36 | import java.util.stream.Collectors; |
| 27 | 37 | |
| 38 | +import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_IN; | |
| 39 | +import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; | |
| 28 | 40 | import static com.ruoyi.common.RuleSchedulingProperties.*; |
| 29 | 41 | |
| 30 | 42 | /** |
| ... | ... | @@ -36,6 +48,9 @@ import static com.ruoyi.common.RuleSchedulingProperties.*; |
| 36 | 48 | public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, RuleNumSetting> |
| 37 | 49 | implements RuleNumSettingService { |
| 38 | 50 | |
| 51 | + private final static Logger log = LoggerFactory.getLogger(RuleNumSettingServiceImpl.class); | |
| 52 | + @Autowired | |
| 53 | + private RuleAttendanceMainHelpService helpService; | |
| 39 | 54 | @Autowired |
| 40 | 55 | private IRuleSchedulingService schedulingService; |
| 41 | 56 | |
| ... | ... | @@ -48,26 +63,52 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 48 | 63 | @Autowired |
| 49 | 64 | private RuleAttendanceMainService attendanceMainService; |
| 50 | 65 | |
| 66 | + @Autowired | |
| 67 | + private DriverSchedulingMapper schedulingMapper; | |
| 68 | + | |
| 69 | + @Resource | |
| 70 | + private NowSchedulingCache nowSchedulingCache; | |
| 71 | + | |
| 51 | 72 | @Override |
| 52 | 73 | public List<SchedulingResponseVo> getSchedulingList(SchedulingRequestVo vo) { |
| 53 | 74 | return baseMapper.getSchedulingList(vo); |
| 54 | 75 | } |
| 55 | 76 | |
| 56 | 77 | @Override |
| 78 | + @Transactional(rollbackFor = Exception.class) | |
| 57 | 79 | public void createAttendance() { |
| 58 | - | |
| 59 | 80 | // 临时表根据工号生成一个月的模板,固定下来,每天生成一次,如果当前月内的工号已经生成了一次排班,则跳过生成 |
| 60 | 81 | // 用户可以修改临时排班表的数据,只能修改未来一个月内的数据 过一天后把数据存储到考勤表, |
| 61 | 82 | // 获取需要生成的人员工号 |
| 62 | - List<AttendanceDto> peopleList = baseMapper.getPeopleList(); | |
| 63 | - List<Integer> settingList = peopleList.stream().map(AttendanceDto::getSettingId).distinct().collect(Collectors.toList()); | |
| 64 | - // 获取规则集合 | |
| 65 | - List<RuleSchedulingDto> ruleList = schedulingService.selectRuleSchedulingListVoBySettingIds(settingList); | |
| 66 | - // 获取班次 | |
| 67 | - List<RuleNumDto> ruleNumDtoList = ruleNumSettingService.selectRuleNumBySettingId(settingList); | |
| 68 | - // 处理规则 | |
| 69 | - List<RuleAttendanceMain> attendanceMains = handleAttendanceMain(peopleList, ruleList, ruleNumDtoList); | |
| 70 | - attendanceMainService.saveBatch(attendanceMains); | |
| 83 | + try { | |
| 84 | + log.info("开始生成排班明细"); | |
| 85 | + List<AttendanceDto> peopleList = baseMapper.getPeopleList(); | |
| 86 | + List<Integer> settingList = peopleList.stream().map(AttendanceDto::getSettingId).distinct().collect(Collectors.toList()); | |
| 87 | + // 获取规则集合 | |
| 88 | + List<RuleSchedulingDto> ruleList = schedulingService.selectRuleSchedulingListVoBySettingIds(settingList); | |
| 89 | + // 获取班次 | |
| 90 | + List<RuleNumDto> ruleNumDtoList = ruleNumSettingService.selectRuleNumBySettingId(settingList); | |
| 91 | + // 处理规则 | |
| 92 | + List<RuleAttendanceMain> attendanceMains = handleAttendanceMain(peopleList, ruleList, ruleNumDtoList); | |
| 93 | + backCreatePeopleListLog(peopleList); | |
| 94 | + attendanceMainService.saveBatch(attendanceMains); | |
| 95 | + log.info("排班明细生成完毕"); | |
| 96 | + } catch (Exception e) { | |
| 97 | + log.error("排班明细生成失败,失败原因:{}", e.getMessage()); | |
| 98 | + throw new RuntimeException(e); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 102 | + private void backCreatePeopleListLog(List<AttendanceDto> peopleList) { | |
| 103 | + List<RuleAttendanceMainHelp> helpList = new ArrayList<>(peopleList.size()); | |
| 104 | + Date date = new Date(); | |
| 105 | + for (AttendanceDto dto : peopleList) { | |
| 106 | + RuleAttendanceMainHelp help = new RuleAttendanceMainHelp(); | |
| 107 | + BeanUtils.copyProperties(dto, help); | |
| 108 | + help.setDateFlag(date); | |
| 109 | + helpList.add(help); | |
| 110 | + } | |
| 111 | + helpService.saveBatch(helpList); | |
| 71 | 112 | } |
| 72 | 113 | |
| 73 | 114 | private List<RuleAttendanceMain> handleAttendanceMain(List<AttendanceDto> peopleList, List<RuleSchedulingDto> ruleList, List<RuleNumDto> ruleNumDtoList) { |
| ... | ... | @@ -88,11 +129,11 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 88 | 129 | for (LocalDate date : dateList) { |
| 89 | 130 | // 处理固定规则翻班 |
| 90 | 131 | if (RULE_TYPE_FIXED.equals(dto.getRuleType())) { |
| 91 | - handleFixed(date, mainList, ruleMap.get(settingId), attendanceDto,dto.getRuleDictName()); | |
| 132 | + handleFixed(date, mainList, ruleMap.get(settingId), attendanceDto, dto.getRuleDictName()); | |
| 92 | 133 | } |
| 93 | 134 | // 处理星期翻班 |
| 94 | 135 | else { |
| 95 | - handleWeek(date, mainList, ruleMap.get(settingId), attendanceDto,dto.getRuleDictName()); | |
| 136 | + handleWeek(date, mainList, ruleMap.get(settingId), attendanceDto, dto.getRuleDictName()); | |
| 96 | 137 | } |
| 97 | 138 | } |
| 98 | 139 | } |
| ... | ... | @@ -106,8 +147,9 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 106 | 147 | main.setSchedulingDate(Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant())); |
| 107 | 148 | main.setPosts(attendanceDto.getPosts()); |
| 108 | 149 | main.setRuleDictName(ruleDictName); |
| 150 | + main.setFleetName(attendanceDto.getFleetName()); | |
| 109 | 151 | RuleSchedulingDto dto = null; |
| 110 | - dto = getRuleByWeek(main,ruleSchedulingDtoList, date,attendanceDto.getStartDate()); | |
| 152 | + dto = getRuleByWeek(main, ruleSchedulingDtoList, date, attendanceDto.getStartDate()); | |
| 111 | 153 | main.setWorkFlag(dto.getId() == 0 ? FREE_FLAG : WORK_FLAG); |
| 112 | 154 | BeanUtils.copyProperties(dto, main); |
| 113 | 155 | main.setName(attendanceDto.getName()); |
| ... | ... | @@ -133,7 +175,7 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 133 | 175 | if (TOMORROW_YES.equals(dto.getFirstSignInDayTomorrow())) { |
| 134 | 176 | main.setSecondQuittingSignInTime(handleTimeTomorrowByRule(date, main.getSecondQuittingSignInTime())); |
| 135 | 177 | } else { |
| 136 | - main.setSecondWorkSignInTime(ConstDateUtil.dateAddition(date.toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getSecondQuittingSignInTime()))); | |
| 178 | + main.setSecondQuittingSignInTime(ConstDateUtil.dateAddition(date.toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getSecondQuittingSignInTime()))); | |
| 137 | 179 | } |
| 138 | 180 | } |
| 139 | 181 | } |
| ... | ... | @@ -176,6 +218,7 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 176 | 218 | main.setPosts(attendanceDto.getPosts()); |
| 177 | 219 | main.setRuleDictName(ruleDictName); |
| 178 | 220 | main.setSchedulingDate(Date.from(nowDate.atStartOfDay(ZoneId.systemDefault()).toInstant())); |
| 221 | + main.setFleetName(attendanceDto.getFleetName()); | |
| 179 | 222 | Date startDate = attendanceDto.getStartDate(); |
| 180 | 223 | // 匹配当天应设置的规则 |
| 181 | 224 | RuleSchedulingDto dto = getNowRuleByFixed(nowDate, startDate, ruleSchedulingDtoList); |
| ... | ... | @@ -266,6 +309,74 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 266 | 309 | return ruleNumService.selectRuleNumBySettingId(settingList); |
| 267 | 310 | } |
| 268 | 311 | |
| 312 | + @Override | |
| 313 | + public void manualAddBcCache() { | |
| 314 | + List<DriverScheduling> bcList = handleOtherPostsScheduling(); | |
| 315 | + schedulingMapper.insertRoster(bcList); | |
| 316 | + bcList = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null, null, null); | |
| 317 | + String date = ConstDateUtil.formatDate(new Date()); | |
| 318 | + Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | |
| 319 | + NowSchedulingCache.handlerResultMap(resultMap, bcList); | |
| 320 | + Map<String, List<DriverScheduling>> cacheScheduling = nowSchedulingCache.getCacheScheduling(date); | |
| 321 | + for (Map.Entry<String, List<DriverScheduling>> entry : cacheScheduling.entrySet()) { | |
| 322 | + String key = entry.getKey(); | |
| 323 | + if (!Objects.isNull(resultMap.get(key))) { | |
| 324 | + resultMap.remove(key); | |
| 325 | + } | |
| 326 | + } | |
| 327 | + cacheScheduling.putAll(resultMap); | |
| 328 | + } | |
| 329 | + | |
| 330 | + private List<DriverScheduling> handleOtherPostsScheduling() { | |
| 331 | + QueryWrapper<RuleAttendanceMain> qw = new QueryWrapper<>(); | |
| 332 | + qw.lambda() | |
| 333 | + .eq(RuleAttendanceMain::getWorkFlag, WORK_FLAG) | |
| 334 | + .eq(RuleAttendanceMain::getSchedulingDate, LocalDate.now()); | |
| 335 | + List<RuleAttendanceMain> mainList = attendanceMainService.list(qw); | |
| 336 | + List<DriverScheduling> bcList = new ArrayList<>(mainList.size() * 2); | |
| 337 | + for (RuleAttendanceMain ruleAttendanceMain : mainList) { | |
| 338 | + // 第一段 | |
| 339 | + DriverScheduling scheduling = getDriverScheduling(ruleAttendanceMain); | |
| 340 | + scheduling.setFcsjT(ruleAttendanceMain.getFirstWorkSignInTime().getTime()); | |
| 341 | + scheduling.setBcType(BC_TYPE_OUT); | |
| 342 | + scheduling.setZdsjT(ruleAttendanceMain.getFirstWorkSignInTime().getTime()); | |
| 343 | + scheduling.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | |
| 344 | + bcList.add(scheduling); | |
| 345 | + | |
| 346 | + DriverScheduling scheduling1 = getDriverScheduling(ruleAttendanceMain); | |
| 347 | + scheduling1.setBcType(BC_TYPE_IN); | |
| 348 | + scheduling1.setZdsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); | |
| 349 | + scheduling1.setFcsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); | |
| 350 | + scheduling1.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | |
| 351 | + bcList.add(scheduling1); | |
| 352 | + // 第二段 | |
| 353 | + if (!Objects.isNull(ruleAttendanceMain.getSecondWorkSignInTime())) { | |
| 354 | + DriverScheduling scheduling2 = getDriverScheduling(ruleAttendanceMain); | |
| 355 | + scheduling2.setBcType(BC_TYPE_OUT); | |
| 356 | + scheduling2.setFcsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); | |
| 357 | + scheduling2.setZdsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); | |
| 358 | + scheduling2.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | |
| 359 | + bcList.add(scheduling2); | |
| 360 | + | |
| 361 | + DriverScheduling scheduling3 = getDriverScheduling(ruleAttendanceMain); | |
| 362 | + scheduling3.setBcType(BC_TYPE_IN); | |
| 363 | + scheduling3.setFcsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); | |
| 364 | + scheduling3.setZdsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); | |
| 365 | + scheduling3.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | |
| 366 | + bcList.add(scheduling3); | |
| 367 | + } | |
| 368 | + } | |
| 369 | + return bcList; | |
| 370 | + } | |
| 371 | + | |
| 372 | + private static DriverScheduling getDriverScheduling(RuleAttendanceMain ruleAttendanceMain) { | |
| 373 | + DriverScheduling scheduling = new DriverScheduling(); | |
| 374 | + scheduling.setPosts(ruleAttendanceMain.getPosts()); | |
| 375 | + scheduling.setJobCode(ruleAttendanceMain.getJobCode()); | |
| 376 | + scheduling.setName(ruleAttendanceMain.getName()); | |
| 377 | + scheduling.setFleetName(ruleAttendanceMain.getFleetName()); | |
| 378 | + return scheduling; | |
| 379 | + } | |
| 269 | 380 | |
| 270 | 381 | } |
| 271 | 382 | ... | ... |
ruoyi-admin/src/main/resources/application-druid-prd.yml
ruoyi-admin/src/main/resources/mapper/RuleAttendanceMainHelpMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.ruoyi.mapper.RuleAttendanceMainHelpMapper"> | |
| 6 | + | |
| 7 | + <resultMap id="BaseResultMap" type="com.ruoyi.domain.RuleAttendanceMainHelp"> | |
| 8 | + <id property="id" column="id" jdbcType="INTEGER"/> | |
| 9 | + <result property="name" column="name" jdbcType="VARCHAR"/> | |
| 10 | + <result property="jobCode" column="job_code" jdbcType="VARCHAR"/> | |
| 11 | + <result property="posts" column="posts" jdbcType="VARCHAR"/> | |
| 12 | + <result property="dateFlag" column="dateFlag" jdbcType="DATE"/> | |
| 13 | + <result property="fleetName" column="fleet_name" jdbcType="VARCHAR"/> | |
| 14 | + </resultMap> | |
| 15 | + | |
| 16 | + <sql id="Base_Column_List"> | |
| 17 | + id,name,job_code, | |
| 18 | + posts,date_flag,fleet_name | |
| 19 | + </sql> | |
| 20 | + <select id="queryNowMonthPeople" resultMap="BaseResultMap" resultType="com.ruoyi.domain.RuleAttendanceMainHelp"> | |
| 21 | + SELECT * from rule_attendance_main_help WHERE DATE_FORMAT( date_flag, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' ) | |
| 22 | + <if test="jobCode != null and jobCode != ''"> | |
| 23 | + and job_code = #{jobCode} | |
| 24 | + </if> | |
| 25 | + <if test="posts != null and posts != ''"> | |
| 26 | + and posts = #{posts} | |
| 27 | + </if> | |
| 28 | + <if test="name != null and name != ''"> | |
| 29 | + and name = #{name} | |
| 30 | + </if> | |
| 31 | + </select> | |
| 32 | +</mapper> | ... | ... |
ruoyi-admin/src/main/resources/mapper/RuleAttendanceMainMapper.xml
| ... | ... | @@ -34,18 +34,32 @@ |
| 34 | 34 | </sql> |
| 35 | 35 | <update id="updateByIdTotalQuantity"> |
| 36 | 36 | update rule_attendance_main set |
| 37 | - working_hour_plan = #{workingHourPlan}, | |
| 38 | - working_hour_type = #{workingHourType}, | |
| 39 | - first_work_sign_in_time = #{firstWorkSignInTime}, | |
| 40 | - first_sign_in_working_range = #{firstSignInWorkingRange}, | |
| 41 | - first_quitting_sign_in_time = #{firstQuittingSignInTime}, | |
| 42 | - first_sign_in_quitting_range = #{firstSignInQuittingRange}, | |
| 43 | - sign_in_time_out_range = #{signInTimeOutRange}, | |
| 44 | - second_work_sign_in_time = #{secondWorkSignInTime}, | |
| 45 | - second_sign_in_working_range = #{secondSignInWorkingRange}, | |
| 46 | - second_quitting_sign_in_time = #{secondQuittingSignInTime}, | |
| 47 | - second_sign_in_quitting_range = #{secondSignInQuittingRange}, | |
| 48 | - work_flag = #{workFlag} | |
| 49 | - where id = #{id} | |
| 37 | + working_hour_plan = #{main.workingHourPlan}, | |
| 38 | + working_hour_type = #{main.workingHourType}, | |
| 39 | + first_work_sign_in_time = #{main.firstWorkSignInTime}, | |
| 40 | + first_sign_in_working_range = #{main.firstSignInWorkingRange}, | |
| 41 | + first_quitting_sign_in_time = #{main.firstQuittingSignInTime}, | |
| 42 | + first_sign_in_quitting_range = #{main.firstSignInQuittingRange}, | |
| 43 | + sign_in_time_out_range = #{main.signInTimeOutRange}, | |
| 44 | + second_work_sign_in_time = #{main.secondWorkSignInTime}, | |
| 45 | + second_sign_in_working_range = #{main.secondSignInWorkingRange}, | |
| 46 | + second_quitting_sign_in_time = #{main.secondQuittingSignInTime}, | |
| 47 | + second_sign_in_quitting_range = #{main.secondSignInQuittingRange}, | |
| 48 | + work_flag = #{main.workFlag} | |
| 49 | + where | |
| 50 | + job_code IN | |
| 51 | + <foreach collection="vo.jobCode" index="index" item="item" open="(" close=")" separator=","> | |
| 52 | + #{item} | |
| 53 | + </foreach> | |
| 54 | + and scheduling_date >= #{vo.startDate} and scheduling_date <= #{vo.endDate} | |
| 50 | 55 | </update> |
| 56 | + <delete id="deleteByJobCodeTotalRecord"> | |
| 57 | + delete from rule_attendance_main | |
| 58 | + where job_code IN | |
| 59 | + <foreach collection="jobCode" index="index" item="item" separator="," open="(" close=")"> | |
| 60 | + #{item} | |
| 61 | + </foreach> | |
| 62 | + and scheduling_date >= #{startDate} | |
| 63 | + and scheduling_date <= #{endDate} | |
| 64 | + </delete> | |
| 51 | 65 | </mapper> | ... | ... |
ruoyi-admin/src/main/resources/mapper/RuleNumSettingMapper.xml
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 | <result property="name" column="personnel_name" jdbcType="VARCHAR"/> |
| 23 | 23 | <result property="settingId" column="setting_id" jdbcType="INTEGER"/> |
| 24 | 24 | <result property="startDate" column="start_date" jdbcType="DATE"/> |
| 25 | + <result property="fleetName" column="fleet_name" jdbcType="VARCHAR"/> | |
| 25 | 26 | <!-- <collection property="ruleList" ofType="com.ruoyi.scheduling.domain.RuleScheduling">--> |
| 26 | 27 | <!-- <result column="working_hour_plan" property="workingHourPlan" jdbcType="INTEGER"/>--> |
| 27 | 28 | <!-- <result column="working_hour_type" property="workingHourType" jdbcType="INTEGER"/>--> |
| ... | ... | @@ -71,6 +72,7 @@ |
| 71 | 72 | SELECT |
| 72 | 73 | driver.job_code, |
| 73 | 74 | driver.personnel_name, |
| 75 | + driver.fleet_name, | |
| 74 | 76 | driver.posts, |
| 75 | 77 | rule_setting_driver.setting_id, |
| 76 | 78 | rule_setting_driver.start_date | ... | ... |