Commit bf6c26e7d22e87f79265902b42eb909a4ada3bcc
1 parent
af59a5ee
fix: 添加测试人员
Showing
19 changed files
with
300 additions
and
113 deletions
ruoyi-admin/src/main/java/com/ruoyi/driver/mapper/DriverMapper.java
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| ... | ... | @@ -150,14 +150,14 @@ public class DriverServiceImpl implements IDriverService { |
| 150 | 150 | LocalDateTime signTime = ConstDateUtil.getLocalDateTimeByLongTime(timeMap.get(index).getTimestamps()); |
| 151 | 151 | long range = ChronoUnit.MINUTES.between(signTime, nowTime); |
| 152 | 152 | // 如果当前记录靠近签退,但是未到签退小于合法范围 上一次记录未签到,则返回签到记录 |
| 153 | - if ( dto.size() > 1 | |
| 154 | - && BC_TYPE_IN.equals(timeMap.get(index).getBcType()) | |
| 155 | - && range < -60L | |
| 156 | - && Objects.isNull(timeMap.get(index).getSignInId()) | |
| 157 | - && Objects.isNull(timeMap.get(index - 1).getSignInId())) { | |
| 158 | - // 定位上次操作 | |
| 159 | - index = index - 1; | |
| 160 | - } | |
| 153 | + if (dto.size() > 1 | |
| 154 | + && BC_TYPE_IN.equals(timeMap.get(index).getBcType()) | |
| 155 | + && range < -60L | |
| 156 | + && Objects.isNull(timeMap.get(index).getSignInId()) | |
| 157 | + && Objects.isNull(timeMap.get(index - 1).getSignInId())) { | |
| 158 | + // 定位上次操作 | |
| 159 | + index = index - 1; | |
| 160 | + } | |
| 161 | 161 | |
| 162 | 162 | // 如果当前记录是异常的记录且还在目前还在签到范围内 |
| 163 | 163 | if (!Objects.isNull(timeMap.get(index).getSignInId()) && dto.size() > 1) { |
| ... | ... | @@ -232,6 +232,12 @@ public class DriverServiceImpl implements IDriverService { |
| 232 | 232 | // 获取考勤表进行比对,因为排班数据是会变化的 |
| 233 | 233 | List<DriverScheduling> dto = schedulingService.queryScheduling(jobCode, now); |
| 234 | 234 | log.info("获取到排班数据:{}", cacheMapValue); |
| 235 | + if (jobCode.equals("722717")){ | |
| 236 | + return AjaxResult.success(""); | |
| 237 | + } | |
| 238 | + if (jobCode.equals("700001")){ | |
| 239 | + return AjaxResult.success(""); | |
| 240 | + } | |
| 235 | 241 | // 优先从缓存中读取 |
| 236 | 242 | if (!CollectionUtil.isEmpty(cacheMapValue) && !CollectionUtil.isEmpty(dto)) { |
| 237 | 243 | return AjaxResult.success(cacheMapValue); |
| ... | ... | @@ -336,6 +342,12 @@ public class DriverServiceImpl implements IDriverService { |
| 336 | 342 | } else { |
| 337 | 343 | vos.add(vo); |
| 338 | 344 | } |
| 345 | + if (item.getJobCode().equals("722717")) { | |
| 346 | + vos.add(DriverResponseVo.createDriverResponseVo(null, item, null, true, true, "测试", "测试", "测试")); | |
| 347 | + } | |
| 348 | + if (item.getJobCode().equals("700001")) { | |
| 349 | + vos.add(DriverResponseVo.createDriverResponseVo(null, item, null, true, true, "测试", "测试", "测试")); | |
| 350 | + } | |
| 339 | 351 | } |
| 340 | 352 | return vos; |
| 341 | 353 | } |
| ... | ... | @@ -352,7 +364,7 @@ public class DriverServiceImpl implements IDriverService { |
| 352 | 364 | else |
| 353 | 365 | vo = DriverResponseVo.createDriverResponseVo(recommendation.getTimestamps(), driver, SIGN_IN_STRING, !alcoholFlag, schedulingFlag, recommendation.getNbbm(), recommendation.getLpName(), recommendation.getLineName()); |
| 354 | 366 | } else if (BC_TYPE_IN.equals(recommendation.getBcType())) { |
| 355 | - vo= DriverResponseVo.createDriverResponseVo(recommendation.getTimestamps(), driver, SIGN_IN_OUT_STRING, !alcoholFlag, schedulingFlag, recommendation.getNbbm(), recommendation.getLpName(), recommendation.getLineName()); | |
| 367 | + vo = DriverResponseVo.createDriverResponseVo(recommendation.getTimestamps(), driver, SIGN_IN_OUT_STRING, !alcoholFlag, schedulingFlag, recommendation.getNbbm(), recommendation.getLpName(), recommendation.getLineName()); | |
| 356 | 368 | } |
| 357 | 369 | } |
| 358 | 370 | return vo; |
| ... | ... | @@ -480,6 +492,11 @@ public class DriverServiceImpl implements IDriverService { |
| 480 | 492 | redisCache.deleteCacheMapValue(dateKey, jobCode); |
| 481 | 493 | } |
| 482 | 494 | |
| 495 | + @Override | |
| 496 | + public void deleteNotEmptyJob(List<String> jobList) { | |
| 497 | + driverMapper.deleteNotEmptyJob(jobList); | |
| 498 | + } | |
| 499 | + | |
| 483 | 500 | /** |
| 484 | 501 | * 获取新的imageUrl |
| 485 | 502 | * | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/eexception/domain/EquipmentException.java
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| ... | ... | @@ -223,7 +223,7 @@ public class SignInServiceImpl implements ISignInService { |
| 223 | 223 | schedulingService.computedSignInBySignIn(dto, signIn, globalIndex); |
| 224 | 224 | |
| 225 | 225 | // 异常保存到异常异常中 |
| 226 | - threadJobService.asyncInsertExceptionRecord(signIn); | |
| 226 | + threadJobService.asyncInsertExceptionRecord(signIn,driver,dto,globalIndex); | |
| 227 | 227 | |
| 228 | 228 | // 驾驶人员二次签到酒精测试异常 |
| 229 | 229 | if (PERSONNEL_POSTS_DRIVER.equals(driver.getPosts()) && SIGN_IN_FAIL.equals(signIn.getStatus()) && signIn.getRemark().contains(ALCOHOL_SIGN_IN_ERROR)) { | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| ... | ... | @@ -359,16 +359,28 @@ public class DriverJob implements InitializingBean { |
| 359 | 359 | int countPage = vo.getTotalCount() / pageSize; |
| 360 | 360 | countPage = vo.getTotalCount() % pageSize == 0 ? countPage : countPage + 1; |
| 361 | 361 | List<Driver> drivers = getDrivers(date, vo); |
| 362 | + for (int i = 2; i <= countPage; i++ ) { | |
| 363 | + drivers.addAll(getDrivers(date, getPersonInfo(accessToken, 100, i))); | |
| 364 | + } | |
| 365 | + List<String> jobList = drivers.stream().map(driver -> driver.getJobCode()).collect(Collectors.toList()); | |
| 366 | + handleNotEmptyJob(jobList); | |
| 362 | 367 | // updateDrivers(drivers); |
| 363 | - saveDrivers(drivers, accessToken); | |
| 364 | - for (int i = 1; i <= countPage; ) { | |
| 365 | - if (++i <= countPage) { | |
| 366 | - vo = getPersonInfo(accessToken, 100, i); | |
| 367 | - drivers = getDrivers(date, vo); | |
| 368 | -// updateDrivers(drivers); | |
| 369 | - saveDrivers(drivers, accessToken); | |
| 370 | - } | |
| 368 | + List<List<Driver>> splitList = ListUtils.splitList(drivers, 200); | |
| 369 | + for (List<Driver> driverList : splitList) { | |
| 370 | + saveDrivers(driverList, accessToken); | |
| 371 | 371 | } |
| 372 | +// for (int i = 1; i <= countPage; ) { | |
| 373 | +// if (++i <= countPage) { | |
| 374 | +//// vo = getPersonInfo(accessToken, 100, i); | |
| 375 | +//// drivers = getDrivers(date, vo); | |
| 376 | +//// updateDrivers(drivers); | |
| 377 | +// saveDrivers(drivers, accessToken); | |
| 378 | +// } | |
| 379 | +// } | |
| 380 | + } | |
| 381 | + | |
| 382 | + private static void handleNotEmptyJob(List<String> jobList) { | |
| 383 | + DRIVER_SERVICE.deleteNotEmptyJob(jobList); | |
| 372 | 384 | } |
| 373 | 385 | |
| 374 | 386 | private static void updateDrivers(List<Driver> drivers) { | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/mapper/RuleAttendanceMainMapper.java
| ... | ... | @@ -10,7 +10,11 @@ import com.ruoyi.domain.RuleAttendanceMain; |
| 10 | 10 | * @Entity .domain.RuleAttendanceMain |
| 11 | 11 | */ |
| 12 | 12 | public interface RuleAttendanceMainMapper extends BaseMapper<RuleAttendanceMain> { |
| 13 | - | |
| 13 | + /** | |
| 14 | + * 全量更新 | |
| 15 | + * @param main | |
| 16 | + */ | |
| 17 | + void updateByIdTotalQuantity(RuleAttendanceMain main); | |
| 14 | 18 | } |
| 15 | 19 | |
| 16 | 20 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/converter/ErrorTypeConverter.java
0 → 100644
| 1 | +package com.ruoyi.pojo.converter; | |
| 2 | + | |
| 3 | +import com.alibaba.excel.converters.Converter; | |
| 4 | +import com.alibaba.excel.enums.CellDataTypeEnum; | |
| 5 | +import com.alibaba.excel.metadata.CellData; | |
| 6 | +import com.alibaba.excel.metadata.GlobalConfiguration; | |
| 7 | +import com.alibaba.excel.metadata.property.ExcelContentProperty; | |
| 8 | + | |
| 9 | +import static com.ruoyi.common.ConstSignInConstSignInProperties.*; | |
| 10 | +import static com.ruoyi.common.ConstSignInConstSignInProperties.SIGN_IN_OUT_STRING; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 异常类型 | |
| 14 | + * @author 20412 | |
| 15 | + */ | |
| 16 | +public class ErrorTypeConverter implements Converter<Integer> { | |
| 17 | + @Override | |
| 18 | + public Class supportJavaTypeKey() { | |
| 19 | + return null; | |
| 20 | + } | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public CellDataTypeEnum supportExcelTypeKey() { | |
| 24 | + return null; | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public Integer convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { | |
| 29 | + return null; | |
| 30 | + } | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + public CellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { | |
| 34 | + String str = ""; | |
| 35 | + if (SIGN_TIME_OUT_EX_NUM.equals(value)){ | |
| 36 | + str = SIGN_TIME_OUT_EX_NUM_STRING; | |
| 37 | + } | |
| 38 | + if (SIGN_NO_SCHEDULING_EX_NUM.equals(value)){ | |
| 39 | + str = SIGN_NO_SCHEDULING_EX_NUM_STRING; | |
| 40 | + } | |
| 41 | + if (SIGN_ALCOHOL_EX_NUM.equals(value)){ | |
| 42 | + str = SIGN_ALCOHOL_EX_NUM_STRING; | |
| 43 | + } | |
| 44 | + if (EQUIPMENT_ALCOHOL_EX_NUM.equals(value)){ | |
| 45 | + str = EQUIPMENT_ALCOHOL_EX_NUM_STRING; | |
| 46 | + } | |
| 47 | + return new CellData(str); | |
| 48 | + } | |
| 49 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportErrorResponseVo.java
| 1 | 1 | package com.ruoyi.pojo.response; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.excel.annotation.ExcelProperty; |
| 4 | +import com.alibaba.excel.annotation.write.style.ColumnWidth; | |
| 5 | +import com.alibaba.excel.annotation.write.style.HeadFontStyle; | |
| 4 | 6 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 7 | +import com.ruoyi.pojo.converter.ErrorTypeConverter; | |
| 5 | 8 | import io.swagger.annotations.ApiModel; |
| 6 | 9 | import io.swagger.annotations.ApiModelProperty; |
| 7 | 10 | import lombok.Data; |
| ... | ... | @@ -15,34 +18,43 @@ import java.util.Date; |
| 15 | 18 | */ |
| 16 | 19 | @Data |
| 17 | 20 | @ApiModel("异常报表对象") |
| 18 | -public class ReportErrorResponseVo {; | |
| 19 | - @ApiModelProperty("异常类型") | |
| 20 | - @ExcelProperty(value = "异常类型") | |
| 21 | - private Integer exType; | |
| 22 | - @ApiModelProperty("姓名") | |
| 23 | - @ExcelProperty(value = "姓名") | |
| 24 | - private String name; | |
| 21 | +@HeadFontStyle(fontHeightInPoints = 10,fontName = "黑体") | |
| 22 | +public class ReportErrorResponseVo { | |
| 25 | 23 | @ApiModelProperty("工号") |
| 26 | 24 | @ExcelProperty(value = "工号") |
| 27 | 25 | private String jobCode; |
| 26 | + @ApiModelProperty("姓名") | |
| 27 | + @ExcelProperty(value = "姓名") | |
| 28 | + private String name; | |
| 29 | + @ApiModelProperty("异常类型") | |
| 30 | + @ExcelProperty(value = "异常类型" , converter = ErrorTypeConverter.class) | |
| 31 | + private Integer exType; | |
| 28 | 32 | @ApiModelProperty("图片") |
| 29 | - @ExcelProperty(value = "图片") | |
| 30 | 33 | private String image; |
| 31 | 34 | @ApiModelProperty("设备id") |
| 32 | - @ExcelProperty(value = "设备id") | |
| 33 | 35 | private String deviceId; |
| 34 | 36 | @ExcelProperty(value = "场地名称") |
| 37 | + @ColumnWidth(20) | |
| 35 | 38 | private String siteName; |
| 36 | - @ApiModelProperty("发生时间") | |
| 37 | - @ExcelProperty(value = "发生时间") | |
| 38 | - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |
| 39 | - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") | |
| 40 | - private Date createTime; | |
| 41 | - | |
| 39 | + @ExcelProperty(value = "部门") | |
| 40 | + private String fleetName; | |
| 41 | + @ExcelProperty(value = "线路名称") | |
| 42 | + @ColumnWidth(20) | |
| 43 | + private String lineName; | |
| 44 | + @ExcelProperty(value = "车辆自编号") | |
| 45 | + @ColumnWidth(20) | |
| 46 | + private String nbbm; | |
| 42 | 47 | @ApiModelProperty("标题") |
| 43 | 48 | @ExcelProperty(value = "标题") |
| 44 | 49 | private String title; |
| 45 | 50 | @ApiModelProperty("详情") |
| 46 | 51 | @ExcelProperty(value = "详情") |
| 52 | + @ColumnWidth(30) | |
| 47 | 53 | private String remark; |
| 54 | + @ApiModelProperty("发生时间") | |
| 55 | + @ExcelProperty(value = "发生时间") | |
| 56 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |
| 57 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") | |
| 58 | + @ColumnWidth(20) | |
| 59 | + private Date createTime; | |
| 48 | 60 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/ReportService.java
| ... | ... | @@ -68,6 +68,9 @@ public class ReportService { |
| 68 | 68 | vo.setExType(item.getExType()); |
| 69 | 69 | vo.setCreateTime(item.getCreateTime()); |
| 70 | 70 | vo.setTitle(item.getTitle()); |
| 71 | + vo.setNbbm(item.getNbbm()); | |
| 72 | + vo.setFleetName(item.getFleetName()); | |
| 73 | + vo.setLineName(item.getLineName()); | |
| 71 | 74 | return vo; |
| 72 | 75 | }).collect(Collectors.toList()); |
| 73 | 76 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/RuleAttendanceMainService.java
ruoyi-admin/src/main/java/com/ruoyi/service/SchedulingService.java
| ... | ... | @@ -54,6 +54,7 @@ public class SchedulingService { |
| 54 | 54 | * @return |
| 55 | 55 | */ |
| 56 | 56 | public List<DriverScheduling> queryScheduling(String jobCode, Long now) { |
| 57 | + | |
| 57 | 58 | List<DriverScheduling> dto = null; |
| 58 | 59 | for (int i = 0; i > -2; i--) { |
| 59 | 60 | dto = nowSchedulingCache.getCacheSchedulingMapValueByHKey(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)),jobCode); | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -21,6 +21,7 @@ import com.ruoyi.errorScheduling.service.IErrorJobcodeService; |
| 21 | 21 | import com.ruoyi.in.domain.SignIn; |
| 22 | 22 | import com.ruoyi.job.DriverJob; |
| 23 | 23 | import com.ruoyi.domain.DriverScheduling; |
| 24 | +import com.ruoyi.pojo.GlobalIndex; | |
| 24 | 25 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 25 | 26 | import com.ruoyi.utils.ConstDateUtil; |
| 26 | 27 | import lombok.extern.slf4j.Slf4j; |
| ... | ... | @@ -142,7 +143,7 @@ public class ThreadJobService { |
| 142 | 143 | } |
| 143 | 144 | |
| 144 | 145 | @Async |
| 145 | - public void asyncInsertExceptionRecord(SignIn signIn) { | |
| 146 | + public void asyncInsertExceptionRecord(SignIn signIn, Driver driver, List<DriverScheduling> dto, GlobalIndex globalIndex) { | |
| 146 | 147 | if (!SIGN_NO_EX_NUM.equals(signIn.getExType())) { |
| 147 | 148 | EquipmentException exception = new EquipmentException(); |
| 148 | 149 | exception.setExType(signIn.getExType()); |
| ... | ... | @@ -153,6 +154,11 @@ public class ThreadJobService { |
| 153 | 154 | exception.setTitle("打卡异常"); |
| 154 | 155 | exception.setRemark(signIn.getRemark()); |
| 155 | 156 | exception.setCreateTime(signIn.getCreateTime()); |
| 157 | + exception.setFleetName(driver.getFleetName()); | |
| 158 | + if (CollectionUtil.isNotEmpty(dto)) { | |
| 159 | + exception.setNbbm(dto.get(globalIndex.getIndex()).getNbbm()); | |
| 160 | + exception.setLineName(dto.get(globalIndex.getIndex()).getLineName()); | |
| 161 | + } | |
| 156 | 162 | exceptionMapper.insertEquipmentException(exception); |
| 157 | 163 | } |
| 158 | 164 | } |
| ... | ... | @@ -225,26 +231,26 @@ public class ThreadJobService { |
| 225 | 231 | } |
| 226 | 232 | int result = driverMapper.insertDriver(driver); |
| 227 | 233 | log.debug("插入完毕"); |
| 228 | - if (result == 0) { | |
| 229 | - return; | |
| 230 | - } | |
| 231 | - log.info("图片开始上传"); | |
| 232 | - // 获取图片数据 | |
| 233 | - InputStream is = getImageInputStreamByUrl(imageUrl); | |
| 234 | - // 上传图片 | |
| 235 | - try { | |
| 236 | - uploadImage(is, filePath); | |
| 237 | - } catch (IOException e) { | |
| 238 | - log.error("工号:{}的人脸图像,上传失败:{}", driver.getJobCode(), e.getMessage()); | |
| 239 | - is = getImageInputStreamByUrl(imageUrl); | |
| 234 | + if (result != 0) { | |
| 235 | + log.info("图片开始上传"); | |
| 236 | + // 获取图片数据 | |
| 237 | + InputStream is = getImageInputStreamByUrl(imageUrl); | |
| 238 | + // 上传图片 | |
| 240 | 239 | try { |
| 241 | 240 | uploadImage(is, filePath); |
| 242 | - } catch (IOException ex) { | |
| 243 | - log.error("工号:{}的人脸图像,再次上传失败:{}", driver.getJobCode(), e.getMessage()); | |
| 244 | - throw new RuntimeException(ex); | |
| 241 | + } catch (IOException e) { | |
| 242 | + log.error("工号:{}的人脸图像,上传失败:{}", driver.getJobCode(), e.getMessage()); | |
| 243 | + is = getImageInputStreamByUrl(imageUrl); | |
| 244 | + try { | |
| 245 | + uploadImage(is, filePath); | |
| 246 | + } catch (IOException ex) { | |
| 247 | + log.error("工号:{}的人脸图像,再次上传失败:{}", driver.getJobCode(), e.getMessage()); | |
| 248 | + throw new RuntimeException(ex); | |
| 249 | + } | |
| 245 | 250 | } |
| 251 | + log.info("图片上传完毕"); | |
| 246 | 252 | } |
| 247 | - log.info("图片上传完毕"); | |
| 253 | + | |
| 248 | 254 | } |
| 249 | 255 | |
| 250 | 256 | private InputStream getImageInputStreamByUrl(String imageUrl) { |
| ... | ... | @@ -323,12 +329,12 @@ public class ThreadJobService { |
| 323 | 329 | @Async |
| 324 | 330 | @Transactional(rollbackFor = {Exception.class}) |
| 325 | 331 | public void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, String timeOut) { |
| 326 | - if (StringUtils.isNotEmpty(timeOut)){ | |
| 332 | + if (StringUtils.isNotEmpty(timeOut)) { | |
| 327 | 333 | LocalDate date = LocalDate.now(); |
| 328 | 334 | Date date2 = ConstDateUtil.dateAddition(date.toString(), timeOut); |
| 329 | 335 | Date date1 = new Date(); |
| 330 | 336 | // 如果当前日期小于设定时间就不获取固定排班 |
| 331 | - if (date1.compareTo(date2) < 0){ | |
| 337 | + if (date1.compareTo(date2) < 0) { | |
| 332 | 338 | return; |
| 333 | 339 | } |
| 334 | 340 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/AttendanceServiceImpl.java
| ... | ... | @@ -161,23 +161,28 @@ public class AttendanceServiceImpl implements AttendanceService { |
| 161 | 161 | @Override |
| 162 | 162 | public void updateAttendance(UpdateAttendanceVo vo) { |
| 163 | 163 | RuleAttendanceMain main = attendanceMainService.getById(vo.getId()); |
| 164 | - RuleScheduling ruleScheduling = ruleSchedulingService.selectRuleSchedulingById(vo.getId().longValue()); | |
| 165 | - BeanUtils.copyProperties(ruleScheduling,main); | |
| 164 | + RuleScheduling ruleScheduling = ruleSchedulingService.selectRuleSchedulingById(vo.getRuleId().longValue()); | |
| 165 | + BeanUtils.copyProperties(ruleScheduling, main); | |
| 166 | 166 | main.setFirstWorkSignInTime(ConstDateUtil.dateAddition(LocalDate.now().toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstWorkSignInTime()))); |
| 167 | - if (HAVE_SEGMENTATION.equals(ruleScheduling.getSecondFlag())){ | |
| 167 | + if (HAVE_SEGMENTATION.equals(ruleScheduling.getSecondFlag())) { | |
| 168 | 168 | main.setFirstQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstQuittingSignInTime()))); |
| 169 | 169 | main.setSecondWorkSignInTime(ConstDateUtil.dateAddition(LocalDate.now().toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getSecondWorkSignInTime()))); |
| 170 | 170 | // 处理隔天 |
| 171 | - if (TOMORROW_YES.equals(ruleScheduling.getFirstSignInDayTomorrow())){ | |
| 172 | - main.setSecondQuittingSignInTime( ConstDateUtil.dateAddition(LocalDate.now().plusDays(1).toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstQuittingSignInTime()))); | |
| 171 | + if (TOMORROW_YES.equals(ruleScheduling.getFirstSignInDayTomorrow())) { | |
| 172 | + main.setSecondQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().plusDays(1).toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getSecondQuittingSignInTime()))); | |
| 173 | + }else { | |
| 174 | + main.setSecondQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getSecondQuittingSignInTime()))); | |
| 173 | 175 | } |
| 174 | - }else { | |
| 175 | - | |
| 176 | + } else { | |
| 176 | 177 | // 处理隔天 |
| 177 | - if (TOMORROW_YES.equals(ruleScheduling.getFirstSignInDayTomorrow())){ | |
| 178 | - main.setFirstQuittingSignInTime( ConstDateUtil.dateAddition(LocalDate.now().plusDays(1).toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstQuittingSignInTime()))); | |
| 178 | + if (TOMORROW_YES.equals(ruleScheduling.getFirstSignInDayTomorrow())) { | |
| 179 | + main.setFirstQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().plusDays(1).toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstQuittingSignInTime()))); | |
| 180 | + }else { | |
| 181 | + main.setFirstQuittingSignInTime(ConstDateUtil.dateAddition(LocalDate.now().toString(), ConstDateUtil.formatDate("HH:mm:ss", main.getFirstQuittingSignInTime()))); | |
| 179 | 182 | } |
| 180 | 183 | } |
| 184 | + main.setWorkFlag(ruleScheduling.getId() == 0 ? FREE_FLAG : WORK_FLAG); | |
| 185 | + attendanceMainService.updateByIdTotalQuantity(main); | |
| 181 | 186 | } |
| 182 | 187 | |
| 183 | 188 | private static void getRumSettingByDto(SchedulingDto dto, RuleNumSetting setting) { | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/RuleAttendanceMainServiceImpl.java
| ... | ... | @@ -15,6 +15,10 @@ import org.springframework.stereotype.Service; |
| 15 | 15 | public class RuleAttendanceMainServiceImpl extends ServiceImpl<RuleAttendanceMainMapper, RuleAttendanceMain> |
| 16 | 16 | implements RuleAttendanceMainService { |
| 17 | 17 | |
| 18 | + @Override | |
| 19 | + public void updateByIdTotalQuantity(RuleAttendanceMain main) { | |
| 20 | + baseMapper.updateByIdTotalQuantity(main); | |
| 21 | + } | |
| 18 | 22 | } |
| 19 | 23 | |
| 20 | 24 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/RuleNumSettingServiceImpl.java
| ... | ... | @@ -108,6 +108,7 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 108 | 108 | main.setRuleDictName(ruleDictName); |
| 109 | 109 | RuleSchedulingDto dto = null; |
| 110 | 110 | dto = getRuleByWeek(main,ruleSchedulingDtoList, date,attendanceDto.getStartDate()); |
| 111 | + main.setWorkFlag(dto.getId() == 0 ? FREE_FLAG : WORK_FLAG); | |
| 111 | 112 | BeanUtils.copyProperties(dto, main); |
| 112 | 113 | main.setName(attendanceDto.getName()); |
| 113 | 114 | main.setJobCode(attendanceDto.getJobCode()); |
| ... | ... | @@ -166,7 +167,6 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 166 | 167 | if (daysDifference < 0) { |
| 167 | 168 | return getFreeRuleSchedulingDto(startDate); |
| 168 | 169 | } |
| 169 | - main.setWorkFlag(dto.getId() == 0 ? FREE_FLAG : WORK_FLAG); | |
| 170 | 170 | return dto; |
| 171 | 171 | } |
| 172 | 172 | ... | ... |
ruoyi-admin/src/main/resources/mapper/RuleAttendanceMainMapper.xml
| ... | ... | @@ -32,4 +32,20 @@ |
| 32 | 32 | sign_in_time_out_range,second_work_sign_in_time,second_sign_in_working_range, |
| 33 | 33 | second_quitting_sign_in_time,second_sign_in_quitting_range,scheduling_date,work_flag |
| 34 | 34 | </sql> |
| 35 | + <update id="updateByIdTotalQuantity"> | |
| 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} | |
| 50 | + </update> | |
| 35 | 51 | </mapper> | ... | ... |
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
| ... | ... | @@ -89,9 +89,9 @@ |
| 89 | 89 | driver.sign_in_equipment, |
| 90 | 90 | driver.fleet_name |
| 91 | 91 | from driver |
| 92 | - left join driver_face_device_id on driver.job_code = driver_face_device_id.job_code | |
| 92 | + left join driver_face_device_id on driver.job_code = driver_face_device_id.job_code | |
| 93 | 93 | <where> |
| 94 | - <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if> | |
| 94 | + <if test="deviceId != null and deviceId != ''">and device_id = #{deviceId}</if> | |
| 95 | 95 | <if test="jobCode != null and jobCode != ''">and driver.job_code = #{jobCode}</if> |
| 96 | 96 | <if test="companyCode != null and companyCode != ''">and driver.company_code = #{companyCode}</if> |
| 97 | 97 | <if test="brancheCompanyCode != null and brancheCompanyCode != ''">and driver.branche_company_code = |
| ... | ... | @@ -122,24 +122,25 @@ |
| 122 | 122 | </select> |
| 123 | 123 | <select id="getNameByJobCode" resultMap="DriverResult"> |
| 124 | 124 | select personnel_name,job_code |
| 125 | - from driver | |
| 125 | + from driver | |
| 126 | 126 | |
| 127 | 127 | <if test="jobCodes != null and jobCodes.size() > 0"> |
| 128 | - <where> | |
| 129 | - job_code IN | |
| 130 | - <foreach collection="jobCodes" item="item" open="(" separator="," close=")" > | |
| 131 | - #{item} | |
| 132 | - </foreach> | |
| 133 | - </where> | |
| 128 | + <where> | |
| 129 | + job_code IN | |
| 130 | + <foreach collection="jobCodes" item="item" open="(" separator="," close=")"> | |
| 131 | + #{item} | |
| 132 | + </foreach> | |
| 133 | + </where> | |
| 134 | 134 | </if> |
| 135 | 135 | </select> |
| 136 | 136 | <select id="jobCodeIsEmpty" resultType="java.lang.Integer"> |
| 137 | 137 | select count(*) |
| 138 | - from driver | |
| 138 | + from driver | |
| 139 | 139 | where job_code = #{jobCode} |
| 140 | 140 | </select> |
| 141 | 141 | <select id="getDriverImageByJobCode" resultType="String"> |
| 142 | - select image from driver | |
| 142 | + select image | |
| 143 | + from driver | |
| 143 | 144 | where job_code = #{jobCode} |
| 144 | 145 | </select> |
| 145 | 146 | <select id="getDrivers" resultType="com.ruoyi.driver.domain.Driver"> |
| ... | ... | @@ -175,29 +176,27 @@ |
| 175 | 176 | select job_code |
| 176 | 177 | from driver |
| 177 | 178 | where job_code in |
| 178 | - <foreach collection="jobCodes" item="item" open="(" separator="," close=")"> | |
| 179 | - #{item} | |
| 180 | - </foreach> | |
| 179 | + <foreach collection="jobCodes" item="item" open="(" separator="," close=")"> | |
| 180 | + #{item} | |
| 181 | + </foreach> | |
| 181 | 182 | </select> |
| 182 | 183 | <select id="queryAttendanceInfoById" resultType="com.ruoyi.pojo.vo.PeopleResponseVo" resultMap="PeopleResult"> |
| 183 | - SELECT | |
| 184 | - driver.job_code, | |
| 185 | - driver.personnel_name, | |
| 186 | - driver.posts, | |
| 187 | - driver.fleet_name, | |
| 188 | - rule_setting_driver.start_date | |
| 189 | - FROM | |
| 190 | - driver,rule_setting_driver | |
| 191 | - WHERE driver.job_code = rule_setting_driver.job_code and rule_setting_driver.setting_id = #{id} | |
| 184 | + SELECT driver.job_code, | |
| 185 | + driver.personnel_name, | |
| 186 | + driver.posts, | |
| 187 | + driver.fleet_name, | |
| 188 | + rule_setting_driver.start_date | |
| 189 | + FROM driver, | |
| 190 | + rule_setting_driver | |
| 191 | + WHERE driver.job_code = rule_setting_driver.job_code | |
| 192 | + and rule_setting_driver.setting_id = #{id} | |
| 192 | 193 | </select> |
| 193 | 194 | <select id="queryAttendanceInfoAll" resultType="com.ruoyi.pojo.vo.PeopleResponseVo" resultMap="PeopleResult"> |
| 194 | - SELECT | |
| 195 | - job_code, | |
| 196 | - personnel_name, | |
| 197 | - posts, | |
| 198 | - fleet_name | |
| 199 | - FROM | |
| 200 | - driver | |
| 195 | + SELECT job_code, | |
| 196 | + personnel_name, | |
| 197 | + posts, | |
| 198 | + fleet_name | |
| 199 | + FROM driver | |
| 201 | 200 | WHERE driver.posts != "驾驶员" and driver.posts != "售票员" |
| 202 | 201 | </select> |
| 203 | 202 | |
| ... | ... | @@ -278,30 +277,34 @@ |
| 278 | 277 | where id = #{id} |
| 279 | 278 | </update> |
| 280 | 279 | <update id="updateDriverByComputed"> |
| 281 | - update driver set face_sign_in = 0 | |
| 280 | + update driver | |
| 281 | + set face_sign_in = 0 | |
| 282 | 282 | WHERE face_sign_in != 1 and job_code in ( |
| 283 | 283 | SELECT job_code |
| 284 | 284 | FROM driver_face_device_id,equipment |
| 285 | 285 | WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id |
| 286 | 286 | GROUP BY job_code |
| 287 | 287 | HAVING COUNT(*) = #{count} |
| 288 | - ); | |
| 289 | - update driver set face_sign_in = 0 | |
| 290 | - WHERE face_sign_in = 1 and job_code in ( | |
| 291 | - SELECT job_code | |
| 292 | - FROM driver_face_device_id,equipment | |
| 293 | - WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id | |
| 294 | - GROUP BY job_code | |
| 295 | - HAVING COUNT(*) = #{count} | |
| 296 | - ); | |
| 297 | - update driver set face_sign_in = 2 | |
| 288 | + ); | |
| 289 | + update driver | |
| 290 | + set face_sign_in = 0 | |
| 291 | + WHERE face_sign_in = 1 | |
| 292 | + and job_code in (SELECT job_code | |
| 293 | + FROM driver_face_device_id, | |
| 294 | + equipment | |
| 295 | + WHERE equipment.`status` = 1 | |
| 296 | + and driver_face_device_id.device_id = equipment.device_id | |
| 297 | + GROUP BY job_code | |
| 298 | + HAVING COUNT(*) = #{count}); | |
| 299 | + update driver | |
| 300 | + set face_sign_in = 2 | |
| 298 | 301 | WHERE face_sign_in != 1 and job_code not in ( |
| 299 | 302 | SELECT job_code |
| 300 | 303 | FROM driver_face_device_id,equipment |
| 301 | 304 | WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id |
| 302 | 305 | GROUP BY job_code |
| 303 | 306 | HAVING COUNT(*) = #{count} |
| 304 | - ); | |
| 307 | + ); | |
| 305 | 308 | </update> |
| 306 | 309 | <update id="updateSignStatusDriversByJobCodes"> |
| 307 | 310 | <foreach collection="list" item="item" separator=";"> |
| ... | ... | @@ -312,7 +315,8 @@ |
| 312 | 315 | <update id="updateDriverInfoByJobCodes"> |
| 313 | 316 | <foreach collection="drivers" item="item" separator=";"> |
| 314 | 317 | update driver set |
| 315 | - line_name=#{item.lineName,jdbcType=VARCHAR},fleet_name=#{item.fleetName,jdbcType=VARCHAR},personnel_name = #{item.personnelName,jdbcType=VARCHAR},posts = #{item.posts,jdbcType=VARCHAR} | |
| 318 | + line_name=#{item.lineName,jdbcType=VARCHAR},fleet_name=#{item.fleetName,jdbcType=VARCHAR},personnel_name = | |
| 319 | + #{item.personnelName,jdbcType=VARCHAR},posts = #{item.posts,jdbcType=VARCHAR} | |
| 316 | 320 | where job_code = #{item.jobCode,jdbcType=VARCHAR} |
| 317 | 321 | </foreach> |
| 318 | 322 | </update> |
| ... | ... | @@ -331,10 +335,24 @@ |
| 331 | 335 | </delete> |
| 332 | 336 | <delete id="deleteDeviceIdAssociatedJobCode"> |
| 333 | 337 | delete from driver_face_device_id where |
| 334 | - job_code in | |
| 335 | - ( <foreach collection="jobCodes" item="item" separator=","> | |
| 336 | - #{item} | |
| 337 | - </foreach> ) | |
| 338 | + job_code in | |
| 339 | + ( <foreach collection="jobCodes" item="item" separator=","> | |
| 340 | + #{item} | |
| 341 | + </foreach> ) | |
| 342 | + </delete> | |
| 343 | + <delete id="deleteNotEmptyJob"> | |
| 344 | + DELETE | |
| 345 | + FROM driver WHERE job_code NOT IN ( | |
| 346 | + SELECT | |
| 347 | + d1.job_code | |
| 348 | + FROM | |
| 349 | + ( | |
| 350 | + SELECT job_code FROM driver WHERE job_code IN | |
| 351 | + <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> | |
| 352 | + #{item} | |
| 353 | + </foreach> | |
| 354 | + ) d1 | |
| 355 | + ) | |
| 338 | 356 | </delete> |
| 339 | 357 | |
| 340 | 358 | |
| ... | ... | @@ -366,7 +384,7 @@ |
| 366 | 384 | #{item.image}, |
| 367 | 385 | #{item.updateTime}, |
| 368 | 386 | #{item.signInEquipment}, |
| 369 | - #{item.fleetName} | |
| 387 | + #{item.fleetName} | |
| 370 | 388 | ) |
| 371 | 389 | </foreach> |
| 372 | 390 | on duplicate key update |
| ... | ... | @@ -386,7 +404,8 @@ |
| 386 | 404 | </insert> |
| 387 | 405 | <insert id="saveScheduling"> |
| 388 | 406 | insert into |
| 389 | - scheduling (id,schedule_date,line_name,line_code,job_code,posts,lp_name,nbbm,jsy,spy,up_down,qdz_code,qdz_name,zdz_code,zdz_name,fcsj_t,dfsj_t,zdsj_t,fcsj_actual_time,zdsj_actual_time,jhlc,jhlc_orig,bcsj,bc_type,`status`,adjust_exps,sflj,remarks) | |
| 407 | + scheduling | |
| 408 | + (id,schedule_date,line_name,line_code,job_code,posts,lp_name,nbbm,jsy,spy,up_down,qdz_code,qdz_name,zdz_code,zdz_name,fcsj_t,dfsj_t,zdsj_t,fcsj_actual_time,zdsj_actual_time,jhlc,jhlc_orig,bcsj,bc_type,`status`,adjust_exps,sflj,remarks) | |
| 390 | 409 | values |
| 391 | 410 | <foreach collection="responseSchedulingDto" item="item" open="(" separator="," close=")"> |
| 392 | 411 | #{item.id}, | ... | ... |
ruoyi-admin/src/main/resources/mapper/eexception/EquipmentExceptionMapper.xml
| ... | ... | @@ -16,6 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 16 | 16 | <result property="exType" column="ex_type" /> |
| 17 | 17 | <result property="personnelName" column="personnel_name" /> |
| 18 | 18 | <result property="siteName" column="site_name" /> |
| 19 | + <result property="fleetName" column="fleet_name" /> | |
| 20 | + <result property="nbbm" column="nbbm" /> | |
| 21 | + <result property="lineName" column="line_name" /> | |
| 19 | 22 | </resultMap> |
| 20 | 23 | <resultMap type="EquipmentException" id="EquipmentExceptionResult"> |
| 21 | 24 | <result property="id" column="id" /> |
| ... | ... | @@ -65,7 +68,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 65 | 68 | <select id="selectEquipmentExceptionListByVo" |
| 66 | 69 | resultType="com.ruoyi.pojo.response.EquipmentExceptionResponseVo" resultMap="EquipmentExceptionResponseResult"> |
| 67 | 70 | |
| 68 | - select equipment_exception.id, title, equipment.site_name , equipment_exception.device_id,driver.personnel_name,driver.job_code, equipment_exception.image, equipment_exception.status, equipment_exception.create_time, equipment_exception.ex_type,equipment_exception.remark | |
| 71 | + select equipment_exception.id, title, | |
| 72 | + equipment.site_name , | |
| 73 | + equipment_exception.device_id, | |
| 74 | + driver.personnel_name, | |
| 75 | + driver.job_code, | |
| 76 | + equipment_exception.image, | |
| 77 | + equipment_exception.status, | |
| 78 | + equipment_exception.create_time, | |
| 79 | + equipment_exception.ex_type, | |
| 80 | + equipment_exception.remark, | |
| 81 | + equipment_exception.fleet_name, | |
| 82 | + equipment_exception.nbbm, | |
| 83 | + equipment_exception.line_name | |
| 69 | 84 | from |
| 70 | 85 | equipment_exception join driver on driver.job_code = equipment_exception.job_code join equipment on equipment.device_id = equipment_exception.device_id |
| 71 | 86 | <where> |
| ... | ... | @@ -93,6 +108,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 93 | 108 | <if test="createTime != null">create_time,</if> |
| 94 | 109 | <if test="remark != null and remark != ''">remark,</if> |
| 95 | 110 | <if test="exType != null and exType != ''">ex_type,</if> |
| 111 | + <if test="fleetName != null and fleetName != ''">fleet_name,</if> | |
| 112 | + <if test="nbbm != null and nbbm != ''">nbbm,</if> | |
| 113 | + <if test="lineName != null and lineName != ''">line_name,</if> | |
| 96 | 114 | </trim> |
| 97 | 115 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 98 | 116 | <if test="title != null">#{title},</if> |
| ... | ... | @@ -103,6 +121,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 103 | 121 | <if test="createTime != null">#{createTime},</if> |
| 104 | 122 | <if test="remark != null and remark != ''">#{remark},</if> |
| 105 | 123 | <if test="exType != null and exType != ''">#{exType},</if> |
| 124 | + <if test="fleetName != null and fleetName != ''">#{fleetName},</if> | |
| 125 | + <if test="nbbm != null and nbbm != ''">#{nbbm},</if> | |
| 126 | + <if test="lineName != null and lineName != ''">#{lineName},</if> | |
| 106 | 127 | </trim> |
| 107 | 128 | </insert> |
| 108 | 129 | ... | ... |