Commit 8add210fd86192b021dbd502c4fba24e4caae0f7
1 parent
a239bf15
feat&fix: 新增测试demo,修改定时任务获取人员信息任务更新人事信息,修复重复打卡照成的打卡记录不匹配问题
Showing
11 changed files
with
221 additions
and
20 deletions
Bsth-admin/pom.xml
| @@ -16,6 +16,27 @@ | @@ -16,6 +16,27 @@ | ||
| 16 | </description> | 16 | </description> |
| 17 | 17 | ||
| 18 | <dependencies> | 18 | <dependencies> |
| 19 | + <dependency> | ||
| 20 | + <groupId>org.springframework.boot</groupId> | ||
| 21 | + <artifactId>spring-boot-starter-test</artifactId> | ||
| 22 | + <scope>test</scope> | ||
| 23 | + </dependency> | ||
| 24 | + <dependency> | ||
| 25 | + <groupId>junit</groupId> | ||
| 26 | + <artifactId>junit</artifactId> | ||
| 27 | + <version>4.12</version> | ||
| 28 | + <!--<scope>test</scope>--> | ||
| 29 | + </dependency> | ||
| 30 | + <dependency> | ||
| 31 | + <groupId>org.springframework</groupId> | ||
| 32 | + <artifactId>spring-test</artifactId> | ||
| 33 | + <version>5.3.1</version> | ||
| 34 | + </dependency> | ||
| 35 | + <dependency> | ||
| 36 | + <groupId>org.springframework.boot</groupId> | ||
| 37 | + <artifactId>spring-boot-test</artifactId> | ||
| 38 | + <version>2.0.0.RELEASE</version> | ||
| 39 | + </dependency> | ||
| 19 | <!-- 邮箱starter依赖--> | 40 | <!-- 邮箱starter依赖--> |
| 20 | <dependency> | 41 | <dependency> |
| 21 | <groupId>org.springframework.boot</groupId> | 42 | <groupId>org.springframework.boot</groupId> |
Bsth-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
| @@ -6,6 +6,10 @@ import io.swagger.annotations.ApiModelProperty; | @@ -6,6 +6,10 @@ import io.swagger.annotations.ApiModelProperty; | ||
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | import com.ruoyi.common.annotation.Excel; | 7 | import com.ruoyi.common.annotation.Excel; |
| 8 | import com.ruoyi.common.core.domain.BaseEntity; | 8 | import com.ruoyi.common.core.domain.BaseEntity; |
| 9 | +import lombok.Getter; | ||
| 10 | +import lombok.Setter; | ||
| 11 | +import org.apache.commons.lang3.builder.EqualsBuilder; | ||
| 12 | +import org.apache.commons.lang3.builder.HashCodeBuilder; | ||
| 9 | import org.springframework.format.annotation.DateTimeFormat; | 13 | import org.springframework.format.annotation.DateTimeFormat; |
| 10 | 14 | ||
| 11 | import java.io.Serializable; | 15 | import java.io.Serializable; |
| @@ -17,7 +21,8 @@ import java.util.Date; | @@ -17,7 +21,8 @@ import java.util.Date; | ||
| 17 | * @author 古自健 | 21 | * @author 古自健 |
| 18 | * @date 2023-07-04 | 22 | * @date 2023-07-04 |
| 19 | */ | 23 | */ |
| 20 | -@Data | 24 | +@Setter |
| 25 | +@Getter | ||
| 21 | @ApiModel("驾驶员信息对象") | 26 | @ApiModel("驾驶员信息对象") |
| 22 | public class Driver extends BaseEntity implements Serializable { | 27 | public class Driver extends BaseEntity implements Serializable { |
| 23 | private static final long serialVersionUID = 1L; | 28 | private static final long serialVersionUID = 1L; |
| @@ -136,4 +141,25 @@ public class Driver extends BaseEntity implements Serializable { | @@ -136,4 +141,25 @@ public class Driver extends BaseEntity implements Serializable { | ||
| 136 | @Excel( name ="车队名称") | 141 | @Excel( name ="车队名称") |
| 137 | private String fleetName; | 142 | private String fleetName; |
| 138 | 143 | ||
| 144 | + | ||
| 145 | + @Override | ||
| 146 | + public boolean equals(Object o) { | ||
| 147 | + if (this == o) return true; | ||
| 148 | + | ||
| 149 | + if (o == null || getClass() != o.getClass()) return false; | ||
| 150 | + | ||
| 151 | + Driver driver = (Driver) o; | ||
| 152 | + | ||
| 153 | + return new EqualsBuilder() | ||
| 154 | + .append(getJobCode(), driver.getJobCode()) | ||
| 155 | + .append(getPersonnelName(), driver.getPersonnelName()) | ||
| 156 | + .append(getPosts(), driver.getPosts()) | ||
| 157 | + .append(getLineName(), driver.getLineName()) | ||
| 158 | + .append(getFleetName(), driver.getFleetName()).isEquals(); | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + @Override | ||
| 162 | + public int hashCode() { | ||
| 163 | + return new HashCodeBuilder(17, 37).append(getId()).append(getJobCode()).append(getCompanyCode()).append(getBrancheCompanyCode()).append(getPersonnelName()).append(getPapersCode()).append(getIcCardCode()).append(getPersonnelType()).append(getPosts()).append(getCard()).append(getTelphone()).append(getIcRfid()).append(getIdRfid()).append(getTagRfid()).append(getLineName()).append(getLineCode()).append(getFaceSignIn()).append(getImage()).append(getUpdateTime()).append(getSignInEquipment()).append(getFleetName()).toHashCode(); | ||
| 164 | + } | ||
| 139 | } | 165 | } |
Bsth-admin/src/main/java/com/ruoyi/driver/mapper/DriverMapper.java
| @@ -136,4 +136,6 @@ public interface DriverMapper | @@ -136,4 +136,6 @@ public interface DriverMapper | ||
| 136 | List<String> queryEmptyJob(List<String> list); | 136 | List<String> queryEmptyJob(List<String> list); |
| 137 | 137 | ||
| 138 | void updateDriverBaseInfoByJobCodes(@Param("list") List<Driver> list,@Param("filterImage") Integer filterImage); | 138 | void updateDriverBaseInfoByJobCodes(@Param("list") List<Driver> list,@Param("filterImage") Integer filterImage); |
| 139 | + | ||
| 140 | + List<Driver> selectDriverListAll(); | ||
| 139 | } | 141 | } |
Bsth-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
| @@ -123,4 +123,6 @@ public interface IDriverService | @@ -123,4 +123,6 @@ public interface IDriverService | ||
| 123 | void updateDriverBaseInfoByJobCodes(List<Driver> drivers, int filterImage); | 123 | void updateDriverBaseInfoByJobCodes(List<Driver> drivers, int filterImage); |
| 124 | 124 | ||
| 125 | AjaxResult allUpdateDriverInfo(HttpServletRequest request); | 125 | AjaxResult allUpdateDriverInfo(HttpServletRequest request); |
| 126 | + | ||
| 127 | + List<Driver> selectDriverListAll(); | ||
| 126 | } | 128 | } |
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| @@ -632,6 +632,11 @@ public class DriverServiceImpl implements IDriverService { | @@ -632,6 +632,11 @@ public class DriverServiceImpl implements IDriverService { | ||
| 632 | return AjaxResult.success(); | 632 | return AjaxResult.success(); |
| 633 | } | 633 | } |
| 634 | 634 | ||
| 635 | + @Override | ||
| 636 | + public List<Driver> selectDriverListAll() { | ||
| 637 | + return driverMapper.selectDriverListAll(); | ||
| 638 | + } | ||
| 639 | + | ||
| 635 | private void sendNotice(List<DriverSignInRecommendation> nowTimerList) { | 640 | private void sendNotice(List<DriverSignInRecommendation> nowTimerList) { |
| 636 | List<SysNotice> noticeList = new ArrayList<>(nowTimerList.size()); | 641 | List<SysNotice> noticeList = new ArrayList<>(nowTimerList.size()); |
| 637 | for (DriverSignInRecommendation item : nowTimerList) { | 642 | for (DriverSignInRecommendation item : nowTimerList) { |
Bsth-admin/src/main/java/com/ruoyi/job/DriverJob.java
| @@ -19,6 +19,7 @@ import com.ruoyi.pojo.request.TokenRequestVo; | @@ -19,6 +19,7 @@ import com.ruoyi.pojo.request.TokenRequestVo; | ||
| 19 | import com.ruoyi.pojo.response.ResponseSchedulingDto; | 19 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 20 | import com.ruoyi.pojo.response.personnel.*; | 20 | import com.ruoyi.pojo.response.personnel.*; |
| 21 | import com.ruoyi.pojo.vo.ExpandResponseVo; | 21 | import com.ruoyi.pojo.vo.ExpandResponseVo; |
| 22 | +import com.ruoyi.service.RuleAttendanceMainService; | ||
| 22 | import com.ruoyi.service.RuleNumSettingService; | 23 | import com.ruoyi.service.RuleNumSettingService; |
| 23 | import com.ruoyi.service.ThreadJobService; | 24 | import com.ruoyi.service.ThreadJobService; |
| 24 | import com.ruoyi.utils.ConstDateUtil; | 25 | import com.ruoyi.utils.ConstDateUtil; |
| @@ -86,6 +87,9 @@ public class DriverJob implements InitializingBean { | @@ -86,6 +87,9 @@ public class DriverJob implements InitializingBean { | ||
| 86 | @Autowired | 87 | @Autowired |
| 87 | private IDriverService driverService; | 88 | private IDriverService driverService; |
| 88 | 89 | ||
| 90 | + @Autowired | ||
| 91 | + private RuleAttendanceMainService attendanceMainService; | ||
| 92 | + | ||
| 89 | @Value("${api.url.getDriverInfo}") | 93 | @Value("${api.url.getDriverInfo}") |
| 90 | private String getDriverInfoUrl; | 94 | private String getDriverInfoUrl; |
| 91 | 95 | ||
| @@ -111,6 +115,7 @@ public class DriverJob implements InitializingBean { | @@ -111,6 +115,7 @@ public class DriverJob implements InitializingBean { | ||
| 111 | 115 | ||
| 112 | private static DriverSchedulingExpandMapper EXPAND_MAPPER; | 116 | private static DriverSchedulingExpandMapper EXPAND_MAPPER; |
| 113 | private static RuleNumSettingService RULE_NUM_SETTING_SERVICE; | 117 | private static RuleNumSettingService RULE_NUM_SETTING_SERVICE; |
| 118 | + private static RuleAttendanceMainService ATTENDANCE_MAIN_SERVICE; | ||
| 114 | private static NowSchedulingCache NOW_SCHEDULING_CACHE; | 119 | private static NowSchedulingCache NOW_SCHEDULING_CACHE; |
| 115 | private static ThreadJobService THREAD_JOB_SERVICE; | 120 | private static ThreadJobService THREAD_JOB_SERVICE; |
| 116 | private static SchedulingCache SCHEDULING_CACHE; | 121 | private static SchedulingCache SCHEDULING_CACHE; |
| @@ -409,10 +414,11 @@ public class DriverJob implements InitializingBean { | @@ -409,10 +414,11 @@ public class DriverJob implements InitializingBean { | ||
| 409 | for (int i = 2; i <= countPage; i++) { | 414 | for (int i = 2; i <= countPage; i++) { |
| 410 | drivers.addAll(getDrivers(date, getPersonInfo(accessToken, 100, i))); | 415 | drivers.addAll(getDrivers(date, getPersonInfo(accessToken, 100, i))); |
| 411 | } | 416 | } |
| 412 | - List<String> jobList = drivers.stream().map(Driver::getJobCode).collect(Collectors.toList()); | ||
| 413 | -// DRIVER_SERVICE.updateDriverBaseInfoByJobCodes(drivers, 1); | 417 | + List<String> jobList = drivers.stream().map(Driver::getJobCode).distinct().collect(Collectors.toList()); |
| 414 | // 删除离职员工 | 418 | // 删除离职员工 |
| 415 | handleNotEmptyJob(jobList); | 419 | handleNotEmptyJob(jobList); |
| 420 | + // 更新人事人员信息 防止信息不匹配 | ||
| 421 | + updatePersonalInfo(drivers); | ||
| 416 | // 过滤已经存在的员工工号 | 422 | // 过滤已经存在的员工工号 |
| 417 | drivers = filterEmptyJob(drivers, jobList); | 423 | drivers = filterEmptyJob(drivers, jobList); |
| 418 | List<List<Driver>> splitList = ListUtils.splitList(drivers, 200); | 424 | List<List<Driver>> splitList = ListUtils.splitList(drivers, 200); |
| @@ -421,13 +427,45 @@ public class DriverJob implements InitializingBean { | @@ -421,13 +427,45 @@ public class DriverJob implements InitializingBean { | ||
| 421 | } | 427 | } |
| 422 | } | 428 | } |
| 423 | 429 | ||
| 430 | + private static void updatePersonalInfo(List<Driver> drivers) { | ||
| 431 | + // 查询现有信息 用stream过滤 筛选出需要更新的drivers | ||
| 432 | + List<Driver> allDriverList = DRIVER_SERVICE.selectDriverListAll(); | ||
| 433 | + Map<String, Driver> driverMap = new HashMap<>(); | ||
| 434 | + for (Driver driver : drivers) { | ||
| 435 | + if (driverMap.get(driver.getJobCode()) == null) { | ||
| 436 | + driverMap.put(driver.getJobCode(),driver); | ||
| 437 | + }else { | ||
| 438 | + System.out.println(driver); | ||
| 439 | + } | ||
| 440 | + } | ||
| 441 | + // 过滤出需要更新的driver | ||
| 442 | + List<Driver> updateDriverList = allDriverList.stream() | ||
| 443 | + // 过滤暂时没有保存的人员 | ||
| 444 | + .filter(item->driverMap.get(item.getJobCode()) != null) | ||
| 445 | + // 过滤全部一致的人员信息 | ||
| 446 | + .filter(item -> !item.equals(driverMap.get(item.getJobCode()))) | ||
| 447 | + .map(item -> { | ||
| 448 | + Driver driver = driverMap.get(item.getJobCode()); | ||
| 449 | + item.setLineName(driver.getLineName()); | ||
| 450 | + item.setPersonnelName(driver.getPersonnelName()); | ||
| 451 | + item.setFleetName(driver.getFleetName()); | ||
| 452 | + item.setPosts(driver.getPosts()); | ||
| 453 | + return item; | ||
| 454 | + }) | ||
| 455 | + // 保留需要更新的driver | ||
| 456 | + .collect(Collectors.toList()); | ||
| 457 | + // 更新表 | ||
| 458 | + ATTENDANCE_MAIN_SERVICE.updateAttendanceMainByJobCode(updateDriverList); | ||
| 459 | + DRIVER_SERVICE.updateDrivers(updateDriverList); | ||
| 460 | + | ||
| 461 | + } | ||
| 462 | + | ||
| 424 | private static List<Driver> filterEmptyJob(List<Driver> drivers, List<String> jobList) { | 463 | private static List<Driver> filterEmptyJob(List<Driver> drivers, List<String> jobList) { |
| 425 | List<String> jobs = DRIVER_SERVICE.queryEmptyJob(jobList); | 464 | List<String> jobs = DRIVER_SERVICE.queryEmptyJob(jobList); |
| 426 | Map<String, String> jobMap = new HashMap<>(jobs.size()); | 465 | Map<String, String> jobMap = new HashMap<>(jobs.size()); |
| 427 | for (String job : jobs) { | 466 | for (String job : jobs) { |
| 428 | jobMap.put(job, job); | 467 | jobMap.put(job, job); |
| 429 | } | 468 | } |
| 430 | - | ||
| 431 | // 过滤 | 469 | // 过滤 |
| 432 | return drivers.stream().filter(item -> StringUtils.isEmpty(jobMap.get(item.getJobCode()))).collect(Collectors.toList()); | 470 | return drivers.stream().filter(item -> StringUtils.isEmpty(jobMap.get(item.getJobCode()))).collect(Collectors.toList()); |
| 433 | } | 471 | } |
| @@ -436,12 +474,6 @@ public class DriverJob implements InitializingBean { | @@ -436,12 +474,6 @@ public class DriverJob implements InitializingBean { | ||
| 436 | DRIVER_SERVICE.deleteNotEmptyJob(jobList); | 474 | DRIVER_SERVICE.deleteNotEmptyJob(jobList); |
| 437 | } | 475 | } |
| 438 | 476 | ||
| 439 | - private static void updateDrivers(List<Driver> drivers) { | ||
| 440 | - log.info("开始更新人脸注册状态"); | ||
| 441 | - DRIVER_SERVICE.updateDrivers(drivers); | ||
| 442 | - log.info("更新人脸注册状态完毕"); | ||
| 443 | - } | ||
| 444 | - | ||
| 445 | public static List<Driver> getDrivers(Date date, PersonnelResultResponseVo vo) { | 477 | public static List<Driver> getDrivers(Date date, PersonnelResultResponseVo vo) { |
| 446 | List<Driver> drivers = vo.getData().stream().map(item -> { | 478 | List<Driver> drivers = vo.getData().stream().map(item -> { |
| 447 | Driver driver = new Driver(); | 479 | Driver driver = new Driver(); |
| @@ -568,5 +600,6 @@ public class DriverJob implements InitializingBean { | @@ -568,5 +600,6 @@ public class DriverJob implements InitializingBean { | ||
| 568 | NOW_SCHEDULING_CACHE = nowSchedulingCache; | 600 | NOW_SCHEDULING_CACHE = nowSchedulingCache; |
| 569 | RULE_NUM_SETTING_SERVICE = ruleNumSettingService; | 601 | RULE_NUM_SETTING_SERVICE = ruleNumSettingService; |
| 570 | EXPAND_MAPPER = expandMapper; | 602 | EXPAND_MAPPER = expandMapper; |
| 603 | + ATTENDANCE_MAIN_SERVICE = attendanceMainService; | ||
| 571 | } | 604 | } |
| 572 | } | 605 | } |
Bsth-admin/src/main/java/com/ruoyi/service/SchedulingService.java
| @@ -170,18 +170,21 @@ public class SchedulingService { | @@ -170,18 +170,21 @@ public class SchedulingService { | ||
| 170 | return; | 170 | return; |
| 171 | } | 171 | } |
| 172 | long timer = 1000 * 60 * 3; | 172 | long timer = 1000 * 60 * 3; |
| 173 | - // 有效的在一小时内内重复签到不做修改 | 173 | + // 有效的在三分钟内重复签到不做修改 |
| 174 | if (signIn.getExType().equals(SIGN_NO_EX_NUM) && (DateUtils.getNowDate().getTime() - dto.get(globalIndex.getIndex()).getSignTime().getTime()) <= timer) { | 174 | if (signIn.getExType().equals(SIGN_NO_EX_NUM) && (DateUtils.getNowDate().getTime() - dto.get(globalIndex.getIndex()).getSignTime().getTime()) <= timer) { |
| 175 | signIn.setRemark("您已经打卡过了,请勿在3分钟内重复打卡"); | 175 | signIn.setRemark("您已经打卡过了,请勿在3分钟内重复打卡"); |
| 176 | return; | 176 | return; |
| 177 | } | 177 | } |
| 178 | + // 目前也有效 -》 无需更新 || 目前无效 -》往后更新 TODO 判断时间 之前的有效 但是时间还在有效范围内打卡的话会导致排班表数据不匹配 | ||
| 179 | + if (signIn.getExType().equals(SIGN_NO_EX_NUM)) { | ||
| 180 | + return; | ||
| 181 | + } | ||
| 178 | int index = globalIndex.getIndex() + 1; | 182 | int index = globalIndex.getIndex() + 1; |
| 179 | DriverScheduling scheduling = dto.get(index); | 183 | DriverScheduling scheduling = dto.get(index); |
| 180 | long date = scheduling.getBcType().equals(BC_TYPE_IN) ? scheduling.getZdsjT() : scheduling.getFcsjT(); | 184 | long date = scheduling.getBcType().equals(BC_TYPE_IN) ? scheduling.getZdsjT() : scheduling.getFcsjT(); |
| 181 | String prompt = getPrompt(new Date(date), scheduling.getBcType()); | 185 | String prompt = getPrompt(new Date(date), scheduling.getBcType()); |
| 182 | signIn.setRemark((scheduling.getBcType().equals(BC_TYPE_IN) ? SIGN_OUT_TIMEOUT : SIGN_IN_TIMEOUT) + prompt); | 186 | signIn.setRemark((scheduling.getBcType().equals(BC_TYPE_IN) ? SIGN_OUT_TIMEOUT : SIGN_IN_TIMEOUT) + prompt); |
| 183 | signIn.setRemark(signIn.getRemark().replaceFirst(",$", "。")); | 187 | signIn.setRemark(signIn.getRemark().replaceFirst(",$", "。")); |
| 184 | - // 目前无效 -》往后更新 | ||
| 185 | String remark = getRemark(dto, signIn, index); | 188 | String remark = getRemark(dto, signIn, index); |
| 186 | schedulingMapper.updateRoster(scheduling, signIn.getId(), signIn.getExType(), signIn.getCreateTime(), remark, signIn.getType(), signIn.getAlcoholFlag(), signIn.getAlcoholIntake()); | 189 | schedulingMapper.updateRoster(scheduling, signIn.getId(), signIn.getExType(), signIn.getCreateTime(), remark, signIn.getType(), signIn.getAlcoholFlag(), signIn.getAlcoholIntake()); |
| 187 | nowSchedulingCache.updateCacheByJobCode(remark, ConstDateUtil.formatDate(dto.get(0).getScheduleDate()), globalIndex.getIndex() + 1, signIn); | 190 | nowSchedulingCache.updateCacheByJobCode(remark, ConstDateUtil.formatDate(dto.get(0).getScheduleDate()), globalIndex.getIndex() + 1, signIn); |
| @@ -203,13 +206,13 @@ public class SchedulingService { | @@ -203,13 +206,13 @@ public class SchedulingService { | ||
| 203 | public List<ReportViewResponseVo> queryReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) { | 206 | public List<ReportViewResponseVo> queryReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) { |
| 204 | // 处理天 | 207 | // 处理天 |
| 205 | if (requestVo.getExportFlag().equals(NOW)) { | 208 | if (requestVo.getExportFlag().equals(NOW)) { |
| 206 | - return getDayReportTableResponseVo(requestVo, response); | 209 | + return getDayReportTableResponseVo(requestVo); |
| 207 | } | 210 | } |
| 208 | return null; | 211 | return null; |
| 209 | } | 212 | } |
| 210 | 213 | ||
| 211 | 214 | ||
| 212 | - private List<ReportViewResponseVo> getDayReportTableResponseVo(ReportViewRequestVo vo, HttpServletResponse response) { | 215 | + private List<ReportViewResponseVo> getDayReportTableResponseVo(ReportViewRequestVo vo) { |
| 213 | // 签到数据 | 216 | // 签到数据 |
| 214 | List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); | 217 | List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); |
| 215 | toDay.sort(Comparator.comparing(DriverScheduling::getFcsjT)); | 218 | toDay.sort(Comparator.comparing(DriverScheduling::getFcsjT)); |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| @@ -518,8 +518,16 @@ public class ThreadJobService { | @@ -518,8 +518,16 @@ public class ThreadJobService { | ||
| 518 | // 配置处理 | 518 | // 配置处理 |
| 519 | nowScheduling = handlerScheduler(configMap, schedulingList, nowScheduling); | 519 | nowScheduling = handlerScheduler(configMap, schedulingList, nowScheduling); |
| 520 | // ------|特殊处理|------ | 520 | // ------|特殊处理|------ |
| 521 | - DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1); | ||
| 522 | - scheduling.setZdsjT(scheduling.getFcsjT()); | 521 | + try { |
| 522 | + DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1); | ||
| 523 | + scheduling.setZdsjT(scheduling.getFcsjT()); | ||
| 524 | + } catch (Exception e) { | ||
| 525 | + log.error("特殊处理失败:{}",e.getMessage()); | ||
| 526 | + } | ||
| 527 | + // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错 | ||
| 528 | + if (nowScheduling.get(0).getLineName().startsWith("青蒸线")) { | ||
| 529 | + nowScheduling = handleQinZhengLine(nowScheduling); | ||
| 530 | + } | ||
| 523 | // ------|结束处理|------ | 531 | // ------|结束处理|------ |
| 524 | bcList.addAll(nowScheduling); | 532 | bcList.addAll(nowScheduling); |
| 525 | } else { | 533 | } else { |
| @@ -560,10 +568,6 @@ public class ThreadJobService { | @@ -560,10 +568,6 @@ public class ThreadJobService { | ||
| 560 | if (nowScheduling.get(0).getLineName().equals("青浦20路")) { | 568 | if (nowScheduling.get(0).getLineName().equals("青浦20路")) { |
| 561 | updateQinpu2With5(nowScheduling); | 569 | updateQinpu2With5(nowScheduling); |
| 562 | } | 570 | } |
| 563 | - // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错 | ||
| 564 | - if (nowScheduling.get(0).getLineName().startsWith("青蒸线")) { | ||
| 565 | - nowScheduling = handleQinZhengLine(nowScheduling); | ||
| 566 | - } | ||
| 567 | return nowScheduling; | 571 | return nowScheduling; |
| 568 | } | 572 | } |
| 569 | 573 |
Bsth-admin/src/main/resources/mapper/driver/DriverMapper.xml
| @@ -210,6 +210,9 @@ | @@ -210,6 +210,9 @@ | ||
| 210 | </foreach> | 210 | </foreach> |
| 211 | ) d1 | 211 | ) d1 |
| 212 | </select> | 212 | </select> |
| 213 | + <select id="selectDriverListAll" resultType="com.ruoyi.driver.domain.Driver"> | ||
| 214 | + select job_code, line_name, personnel_name, posts, fleet_name from driver | ||
| 215 | + </select> | ||
| 213 | 216 | ||
| 214 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> | 217 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> |
| 215 | insert into driver | 218 | insert into driver |
Bsth-admin/src/main/test/com.ruoyi/Demo.java
0 → 100644
| 1 | +package com.ruoyi; | ||
| 2 | + | ||
| 3 | +import java.util.ArrayList; | ||
| 4 | +import java.util.Arrays; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +public class Demo { | ||
| 8 | + public static void main(String[] args) { | ||
| 9 | + List<String> list = new ArrayList<>(Arrays.asList("123","2314")); | ||
| 10 | + list.stream().filter(item->item.equals("123")).forEach(System.out::println); | ||
| 11 | + } | ||
| 12 | +} | ||
| 13 | + |
Bsth-admin/src/main/test/com.ruoyi/TestBsthApplication.java
0 → 100644
| 1 | +package com.ruoyi; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.ruoyi.BsthApplication; | ||
| 5 | +import com.ruoyi.common.cache.NowSchedulingCache; | ||
| 6 | +import com.ruoyi.domain.DriverScheduling; | ||
| 7 | +import com.ruoyi.driver.service.IDriverService; | ||
| 8 | +import com.ruoyi.in.domain.SignIn; | ||
| 9 | +import com.ruoyi.in.service.ISignInService; | ||
| 10 | +import com.ruoyi.pojo.request.DriverRequestVo; | ||
| 11 | +import com.ruoyi.pojo.request.ReportViewRequestVo; | ||
| 12 | +import com.ruoyi.pojo.response.ReportViewResponseVo; | ||
| 13 | +import com.ruoyi.service.ReportService; | ||
| 14 | +import com.ruoyi.utils.ConstDateUtil; | ||
| 15 | +import org.junit.Test; | ||
| 16 | +import org.junit.runner.RunWith; | ||
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 18 | +import org.springframework.boot.test.context.SpringBootTest; | ||
| 19 | +import org.springframework.test.context.junit4.SpringRunner; | ||
| 20 | + | ||
| 21 | +import java.math.BigDecimal; | ||
| 22 | + | ||
| 23 | +@RunWith(SpringRunner.class) | ||
| 24 | +@SpringBootTest(classes = BsthApplication.class) | ||
| 25 | +public class TestBsthApplication { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 模拟mvc测试对象 | ||
| 29 | + */ | ||
| 30 | + @Autowired | ||
| 31 | + private ISignInService signInService; | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + private ReportService reportService; | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + private IDriverService driverService; | ||
| 38 | + | ||
| 39 | + @Test | ||
| 40 | + public void testAddSignIn() { | ||
| 41 | + // 模拟前端签到 | ||
| 42 | + String [] params = new String[] { | ||
| 43 | + "2024-02-19 04:30:06,1,1,0", | ||
| 44 | + "2024-02-19 05:03:06,1,1,0", | ||
| 45 | + "2024-02-19 11:30:30,2,0,0", | ||
| 46 | + "2024-02-19 12:16:15,2,0,0", | ||
| 47 | + "2024-02-19 15:13:03,1,1,0", | ||
| 48 | + "2024-02-19 16:13:03,1,1,0", | ||
| 49 | + "2024-02-19 21:36:03,1,1,0",}; | ||
| 50 | + try { | ||
| 51 | + for (int i = 0; i < params.length; i++) { | ||
| 52 | + String[] strings = params[i].split(","); | ||
| 53 | + SignIn signIn = new SignIn(); | ||
| 54 | + signIn.setJobCode("722017"); | ||
| 55 | + signIn.setCreateTime(ConstDateUtil.parseDate(strings[0])); | ||
| 56 | + signIn.setType(Integer.parseInt(strings[1])); | ||
| 57 | + signIn.setDeviceId("003"); | ||
| 58 | + signIn.setAlcoholFlag(Integer.parseInt(strings[2])); | ||
| 59 | + signIn.setAlcoholIntake(new BigDecimal(strings[3])); | ||
| 60 | + signInService.addSignIn(signIn); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + ReportViewRequestVo vo = new ReportViewRequestVo(); | ||
| 64 | + vo.setDate("2024-02-19"); | ||
| 65 | + vo.setJobCode("722017"); | ||
| 66 | + System.out.println(); | ||
| 67 | + for (ReportViewResponseVo responseVo : reportService.getReportScrollViewTable(vo, null)) { | ||
| 68 | + System.out.println(responseVo); | ||
| 69 | + } | ||
| 70 | + } catch (Exception e) { | ||
| 71 | + System.out.println(e.getMessage()); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + // 模拟获取人员信息 | ||
| 76 | + @Test | ||
| 77 | + public void getDriversTest() { | ||
| 78 | + // 722608 | ||
| 79 | + DriverRequestVo vo = new DriverRequestVo(); | ||
| 80 | + vo.setJobCode("722608"); | ||
| 81 | + vo.setUpdateTime(ConstDateUtil.parseDate("2024-02-17 04:56:56")); | ||
| 82 | + System.out.println(driverService.getDrivers(vo)); | ||
| 83 | + | ||
| 84 | + vo.setUpdateTime(ConstDateUtil.parseDate("2024-02-17 04:57:01")); | ||
| 85 | + System.out.println(driverService.getDrivers(vo)); | ||
| 86 | + | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | +} | ||
| 0 | \ No newline at end of file | 90 | \ No newline at end of file |