Commit 41f21df0b91624de3ccf2609751154a81fc2c2bd
1 parent
a31933a6
酒测未通过审核
Showing
16 changed files
with
249 additions
and
70 deletions
Bsth-admin/src/main/java/com/ruoyi/common/cache/NowSchedulingCache.java
| ... | ... | @@ -3,19 +3,19 @@ package com.ruoyi.common.cache; |
| 3 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | 4 | import cn.hutool.core.map.MapUtil; |
| 5 | 5 | import com.ruoyi.common.utils.StringUtils; |
| 6 | +import com.ruoyi.domain.DriverScheduling; | |
| 6 | 7 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 7 | 8 | import com.ruoyi.errorScheduling.domain.ErrorJobcode; |
| 8 | 9 | import com.ruoyi.errorScheduling.service.IErrorJobcodeService; |
| 9 | 10 | import com.ruoyi.in.domain.SignIn; |
| 10 | -import com.ruoyi.domain.DriverScheduling; | |
| 11 | 11 | import com.ruoyi.service.ThreadJobService; |
| 12 | 12 | import com.ruoyi.utils.ConstDateUtil; |
| 13 | -import lombok.extern.slf4j.Slf4j; | |
| 13 | +import com.ruoyi.utils.DateUtil; | |
| 14 | 14 | import org.apache.commons.collections4.CollectionUtils; |
| 15 | +import org.apache.commons.lang3.time.DateUtils; | |
| 15 | 16 | import org.slf4j.Logger; |
| 16 | 17 | import org.slf4j.LoggerFactory; |
| 17 | 18 | import org.springframework.stereotype.Component; |
| 18 | -import org.springframework.stereotype.Service; | |
| 19 | 19 | |
| 20 | 20 | import java.util.*; |
| 21 | 21 | import java.util.concurrent.ConcurrentHashMap; |
| ... | ... | @@ -44,8 +44,10 @@ public class NowSchedulingCache { |
| 44 | 44 | // 查询今天和昨天 |
| 45 | 45 | for (int i = 0; i > -2; i--) { |
| 46 | 46 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 47 | - String date = ConstDateUtil.formatDate("yyyy-MM-dd", ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)); | |
| 48 | - List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); | |
| 47 | + Date comDate = ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i); | |
| 48 | + String date = ConstDateUtil.formatDate("yyyy-MM-dd", comDate); | |
| 49 | + String endDate = DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(comDate,1)); | |
| 50 | + List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, endDate,null, null, null); | |
| 49 | 51 | handlerResultMap(resultMap, schedulingList); |
| 50 | 52 | // 获取错误排班 |
| 51 | 53 | List<ErrorJobcode> errorScheduling = ThreadJobService.getErrorScheduling(resultMap); |
| ... | ... | @@ -152,9 +154,15 @@ public class NowSchedulingCache { |
| 152 | 154 | * @param signIn |
| 153 | 155 | */ |
| 154 | 156 | public void updateCacheByJobCode(String remark, String key, Integer index, SignIn signIn) { |
| 157 | + if(Objects.isNull(cacheNowDayScheduling.get(key)) || Objects.isNull(cacheNowDayScheduling.get(key).get(signIn.getJobCode()))){ | |
| 158 | + return; | |
| 159 | + } | |
| 155 | 160 | if (key.equals(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(0))) |
| 156 | 161 | || key.equals(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)))) { |
| 157 | 162 | DriverScheduling scheduling = cacheNowDayScheduling.get(key).get(signIn.getJobCode()).get(index); |
| 163 | + if(Objects.isNull(scheduling)){ | |
| 164 | + return; | |
| 165 | + } | |
| 158 | 166 | scheduling.setSignInId(signIn.getId()); |
| 159 | 167 | scheduling.setRemark(remark); |
| 160 | 168 | scheduling.setExType(signIn.getExType()); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/TestController.java
| ... | ... | @@ -39,8 +39,8 @@ public class TestController { |
| 39 | 39 | // calendar.set(Calendar.SECOND,30); |
| 40 | 40 | // Date date = calendar.getTime(); |
| 41 | 41 | Date date = new Date(); |
| 42 | - for (int i = 0; i < 30; i++) { | |
| 43 | - driverJob.getSchedulingInfo(DateUtils.addDays(date,i).getTime()); | |
| 42 | + for (int i = 0; i < 2; i++) { | |
| 43 | + driverJob.runScheduling(DateUtils.addDays(date,i).getTime()); | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return ResponseResult.success(); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssEquipmentController.java
| ... | ... | @@ -74,7 +74,7 @@ public class DssEquipmentController extends BaseController { |
| 74 | 74 | private LingangEquimentSelfCheckService lingangEquimentSelfCheckServicelingangEquimentSelfCheckService; |
| 75 | 75 | |
| 76 | 76 | |
| 77 | - private static final String[] GET_CONFIG_DICT_KEY = {"drinking", "drunkenness", "videoParam", "addressParam"}; | |
| 77 | + private static final String[] GET_CONFIG_DICT_KEY = {"drinking", "drunkenness", "videoParam", "addressParam", "resource_base_url"}; | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | @ApiOperation("设备获取访问令牌") |
| ... | ... | @@ -136,10 +136,17 @@ public class DssEquipmentController extends BaseController { |
| 136 | 136 | List<SysDictData> list = sysDictDataService.queryDictDateList(sysDictData, keys); |
| 137 | 137 | Equipment equipment = equipmentService.getOneByDeviceId(device); |
| 138 | 138 | |
| 139 | - EquipmentConfigVo configVo = combitionEquipmentConfigVo(list,equipment); | |
| 139 | + EquipmentConfigVo configVo = combitionEquipmentConfigVo(list, equipment); | |
| 140 | 140 | return ResponseResult.success(configVo); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | + @GetMapping(value = "/device/getConfig/v1.1") | |
| 144 | + @ApiOperation("设备获取远程参数配置") | |
| 145 | + @Parameter(name = "device", description = "设备号", required = true) | |
| 146 | + public ResponseResult<EquipmentConfigVo> getConfigV1_1(@RequestParam(value = "device") String device) { | |
| 147 | + return getConfig(device); | |
| 148 | + } | |
| 149 | + | |
| 143 | 150 | |
| 144 | 151 | @PostMapping("/device/selfcheck") |
| 145 | 152 | @ApiOperation("设备获取远程参数配置") |
| ... | ... | @@ -212,6 +219,8 @@ public class DssEquipmentController extends BaseController { |
| 212 | 219 | } else if (StringUtils.equals(sysDictData.getDiscKey(), "integer")) { |
| 213 | 220 | equimentAddressParamVo.setInteger(Convert.toInt(sysDictData.getDictValue())); |
| 214 | 221 | } |
| 222 | + } else if (Objects.equals(sysDictData.getDictType(), "resource_base_url") && Objects.nonNull(sysDictData.getDictValue())) { | |
| 223 | + configVo.setResourceBashURL(sysDictData.getDictValueStr()); | |
| 215 | 224 | } |
| 216 | 225 | } |
| 217 | 226 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssFaceController.java
| ... | ... | @@ -68,7 +68,9 @@ public class DssFaceController extends BaseController { |
| 68 | 68 | return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage()); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - List<NewDriver> drivers = newDriverService.list(); | |
| 71 | + NewDriver driver = new NewDriver(); | |
| 72 | + driver.setPosts("驾驶员"); | |
| 73 | + List<NewDriver> drivers = newDriverService.list(driver); | |
| 72 | 74 | List<ReqDataVo> vos = convertReqDataVo(drivers); |
| 73 | 75 | return ResponseResult.success(vos); |
| 74 | 76 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/equipment/vo/EquipmentConfigVo.java
| ... | ... | @@ -27,16 +27,16 @@ public class EquipmentConfigVo implements java.io.Serializable { |
| 27 | 27 | @ApiModelProperty(value = "是否开启") |
| 28 | 28 | private Integer promiseSwitch; |
| 29 | 29 | |
| 30 | - @ApiModelProperty(value = "是否开启健康检测 0:不开启 1:开启",example = "1") | |
| 30 | + @ApiModelProperty(value = "是否开启健康检测 0:不开启 1:开启", example = "1") | |
| 31 | 31 | private Integer healthCheck; |
| 32 | 32 | |
| 33 | - @ApiModelProperty(value = "是否开启情绪检测 0:不开启 1:开启",example = "1") | |
| 33 | + @ApiModelProperty(value = "是否开启情绪检测 0:不开启 1:开启", example = "1") | |
| 34 | 34 | private Integer moodCheck; |
| 35 | 35 | |
| 36 | - @ApiModelProperty(value = "是否开启安全考试 0:不开启 1:开启",example = "1") | |
| 36 | + @ApiModelProperty(value = "是否开启安全考试 0:不开启 1:开启", example = "1") | |
| 37 | 37 | private Integer safetyExam; |
| 38 | 38 | |
| 39 | - @ApiModelProperty(value = "开启体温检测 0:不开启 1:开启",example = "1") | |
| 39 | + @ApiModelProperty(value = "开启体温检测 0:不开启 1:开启", example = "1") | |
| 40 | 40 | private Integer temperatureSwitch; |
| 41 | 41 | |
| 42 | 42 | |
| ... | ... | @@ -48,6 +48,8 @@ public class EquipmentConfigVo implements java.io.Serializable { |
| 48 | 48 | private EquimentVideoParamVo videoParam; |
| 49 | 49 | @ApiModelProperty(value = "升级设置") |
| 50 | 50 | private EquimentAddressParamVo addressParam; |
| 51 | + @ApiModelProperty(value = "资源访问URL") | |
| 52 | + private String resourceBashURL; | |
| 51 | 53 | |
| 52 | 54 | @Override |
| 53 | 55 | public String toString() { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/LinggangScheduling.java
| ... | ... | @@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 7 | import com.ruoyi.common.annotation.Excel; |
| 8 | 8 | import lombok.AllArgsConstructor; |
| 9 | 9 | import lombok.Data; |
| 10 | -import lombok.EqualsAndHashCode; | |
| 11 | 10 | import lombok.NoArgsConstructor; |
| 12 | -import lombok.experimental.Accessors; | |
| 13 | 11 | import lombok.extern.slf4j.Slf4j; |
| 14 | 12 | |
| 15 | 13 | import java.util.Date; |
| ... | ... | @@ -19,8 +17,6 @@ import java.util.Date; |
| 19 | 17 | @Slf4j |
| 20 | 18 | @NoArgsConstructor |
| 21 | 19 | @AllArgsConstructor |
| 22 | -@Accessors(chain = true) | |
| 23 | -@EqualsAndHashCode(callSuper = false) | |
| 24 | 20 | @TableName("scheduling") |
| 25 | 21 | /** 实体*/ |
| 26 | 22 | public class LinggangScheduling { |
| ... | ... | @@ -145,6 +141,7 @@ public class LinggangScheduling { |
| 145 | 141 | |
| 146 | 142 | /***1:实际排班表;100为计划排班表*/ |
| 147 | 143 | @Excel(name = "1:实际排班表;100为计划排班表") |
| 144 | + @TableField(value = "scheduling_type") | |
| 148 | 145 | private java.lang.Integer type; |
| 149 | 146 | |
| 150 | 147 | |
| ... | ... | @@ -163,4 +160,5 @@ public class LinggangScheduling { |
| 163 | 160 | public String toString() { |
| 164 | 161 | return com.alibaba.fastjson2.JSON.toJSONString(this); |
| 165 | 162 | } |
| 163 | + | |
| 166 | 164 | } |
| 167 | 165 | \ No newline at end of file | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/driver/mapper/DriverSchedulingMapper.java
| 1 | 1 | package com.ruoyi.driver.mapper; |
| 2 | 2 | |
| 3 | 3 | import com.ruoyi.domain.DriverScheduling; |
| 4 | -import com.ruoyi.driver.domain.Driver; | |
| 5 | -import com.ruoyi.pojo.response.ExportReportViewResponseVo; | |
| 6 | 4 | import org.apache.ibatis.annotations.Param; |
| 7 | 5 | import org.apache.ibatis.annotations.Select; |
| 8 | 6 | |
| ... | ... | @@ -19,7 +17,7 @@ public interface DriverSchedulingMapper { |
| 19 | 17 | void insertRoster(List<DriverScheduling> list); |
| 20 | 18 | |
| 21 | 19 | |
| 22 | - List<DriverScheduling> queryToDay(@Param("date") String date, @Param("name") String name,@Param("jobCode") String jobCode,@Param("lineName")String lineName ); | |
| 20 | + List<DriverScheduling> queryToDay(@Param("date") String date,@Param("endDate") String endDate, @Param("name") String name,@Param("jobCode") String jobCode,@Param("lineName")String lineName ); | |
| 23 | 21 | |
| 24 | 22 | |
| 25 | 23 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| ... | ... | @@ -37,6 +37,7 @@ import com.ruoyi.service.SchedulingService; |
| 37 | 37 | import com.ruoyi.service.ThreadJobService; |
| 38 | 38 | import com.ruoyi.service.scheduling.LinggangSchedulingService; |
| 39 | 39 | import com.ruoyi.utils.ConstDateUtil; |
| 40 | +import com.ruoyi.utils.DateUtil; | |
| 40 | 41 | import org.apache.commons.collections4.CollectionUtils; |
| 41 | 42 | import org.apache.commons.io.FilenameUtils; |
| 42 | 43 | import org.slf4j.Logger; |
| ... | ... | @@ -352,7 +353,7 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme |
| 352 | 353 | throw new RuntimeException("只能对当前月的数据进行补签!"); |
| 353 | 354 | } |
| 354 | 355 | if (CollectionUtil.isEmpty(dto)) { |
| 355 | - dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd", signIn.getCreateTime()), null, driver.getJobCode(), null); | |
| 356 | + dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd", signIn.getCreateTime()), DateUtil.YYYY_MM_DD_LINK.format(org.apache.commons.lang3.time.DateUtils.addDays(signIn.getCreateTime(),1)), null, driver.getJobCode(), null); | |
| 356 | 357 | } |
| 357 | 358 | handleSignBody(signIn, driver, globalIndex, now, dto); |
| 358 | 359 | signIn.setUpdateBy(SecurityUtils.getUsername()); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/job/DriverJob.java
| ... | ... | @@ -8,6 +8,7 @@ import com.ruoyi.common.cache.NowSchedulingCache; |
| 8 | 8 | import com.ruoyi.common.cache.SchedulingCache; |
| 9 | 9 | import com.ruoyi.common.core.redis.RedisCache; |
| 10 | 10 | import com.ruoyi.common.utils.StringUtils; |
| 11 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | |
| 11 | 12 | import com.ruoyi.driver.domain.Driver; |
| 12 | 13 | import com.ruoyi.driver.service.IDriverService; |
| 13 | 14 | import com.ruoyi.equipment.domain.Equipment; |
| ... | ... | @@ -23,10 +24,12 @@ import com.ruoyi.service.DriverSchedulingExpandSmartService; |
| 23 | 24 | import com.ruoyi.service.RuleAttendanceMainService; |
| 24 | 25 | import com.ruoyi.service.RuleNumSettingService; |
| 25 | 26 | import com.ruoyi.service.ThreadJobService; |
| 27 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | |
| 26 | 28 | import com.ruoyi.utils.ConstDateUtil; |
| 27 | 29 | import com.ruoyi.utils.DateUtil; |
| 28 | 30 | import com.ruoyi.utils.ListUtils; |
| 29 | 31 | import lombok.extern.slf4j.Slf4j; |
| 32 | +import org.apache.commons.collections4.CollectionUtils; | |
| 30 | 33 | import org.apache.commons.lang3.time.DateUtils; |
| 31 | 34 | import org.springframework.beans.BeanUtils; |
| 32 | 35 | import org.springframework.beans.factory.InitializingBean; |
| ... | ... | @@ -35,6 +38,7 @@ import org.springframework.beans.factory.annotation.Value; |
| 35 | 38 | import org.springframework.core.ParameterizedTypeReference; |
| 36 | 39 | import org.springframework.http.*; |
| 37 | 40 | import org.springframework.stereotype.Component; |
| 41 | +import org.springframework.transaction.annotation.Transactional; | |
| 38 | 42 | import org.springframework.web.client.RestTemplate; |
| 39 | 43 | |
| 40 | 44 | import javax.annotation.Resource; |
| ... | ... | @@ -95,6 +99,8 @@ public class DriverJob implements InitializingBean { |
| 95 | 99 | |
| 96 | 100 | @Autowired |
| 97 | 101 | private RuleAttendanceMainService attendanceMainService; |
| 102 | + @Autowired | |
| 103 | + private LinggangSchedulingService schedulingService; | |
| 98 | 104 | |
| 99 | 105 | @Value("${api.url.getDriverInfo}") |
| 100 | 106 | private String getDriverInfoUrl; |
| ... | ... | @@ -233,21 +239,53 @@ public class DriverJob implements InitializingBean { |
| 233 | 239 | * 获取排班任务请求 |
| 234 | 240 | * 24小时执行一次 |
| 235 | 241 | */ |
| 236 | - public void getSchedulingInfo(long timeLong) { | |
| 237 | - // TODO 获取当天的签到表 | |
| 242 | + @Transactional(rollbackFor = Exception.class) | |
| 243 | + public void getSchedulingInfo() { | |
| 244 | + Date date = new Date(); | |
| 245 | + for (int i = 0; i < 2; i++) { | |
| 246 | + runScheduling(DateUtils.addDays(date, i).getTime()); | |
| 247 | + } | |
| 248 | + | |
| 249 | + | |
| 250 | + } | |
| 251 | + | |
| 252 | + @Transactional(rollbackFor = Exception.class) | |
| 253 | + public void runScheduling(long timeLong) { | |
| 238 | 254 | long timestamp = System.currentTimeMillis(); |
| 239 | 255 | Date date = new Date(timeLong); |
| 240 | 256 | String formatDate = DateUtil.YYYY_MM_DD.format(date); |
| 241 | 257 | String timeOut = DateUtil.HH_MM_ss.format(date); |
| 242 | -// String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)); | |
| 258 | + | |
| 243 | 259 | log.info("获取排班任务触发时间:{}", formatDate); |
| 244 | 260 | // 获取排班请求 |
| 245 | 261 | String getSchedulingInfoUrl = null; |
| 246 | 262 | |
| 247 | 263 | log.info("开始获取{}的排班数据", formatDate); |
| 248 | - boolean isSameDay = DateUtils.isSameDay(new Date(),date); | |
| 249 | - String url = isSameDay?GET_SCHEDULING_INFO_URL:getSchedulingInfoPlan; | |
| 250 | - int type = isSameDay?1:100; | |
| 264 | + boolean isSameDay = DateUtils.isSameDay(new Date(), date); | |
| 265 | + String url = isSameDay ? GET_SCHEDULING_INFO_URL : getSchedulingInfoPlan; | |
| 266 | + int type = isSameDay ? 1 : 100; | |
| 267 | + | |
| 268 | + LinggangScheduling scheduling = new LinggangScheduling(); | |
| 269 | + scheduling.setStartScheduleDate(DateUtil.shortDate(date)); | |
| 270 | + scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); | |
| 271 | + scheduling.setType(type); | |
| 272 | + Integer count = schedulingService.countId(scheduling); | |
| 273 | + if (Objects.nonNull(count) && count > 0) { | |
| 274 | + log.info("[{}]排班数据已经存在", date); | |
| 275 | + return; | |
| 276 | + } | |
| 277 | + | |
| 278 | + | |
| 279 | + if (isSameDay) { | |
| 280 | + scheduling.setType(100); | |
| 281 | + List<LinggangScheduling> linggangSchedulings = schedulingService.list(scheduling); | |
| 282 | + Set<Long> IdSets = linggangSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); | |
| 283 | + if (CollectionUtils.isNotEmpty(IdSets)) { | |
| 284 | + schedulingService.removeByIds(IdSets); | |
| 285 | + } | |
| 286 | + } | |
| 287 | + | |
| 288 | + | |
| 251 | 289 | // String url = getSchedulingInfoPlan; |
| 252 | 290 | try { |
| 253 | 291 | getSchedulingInfoUrl = String.format(url, "77", formatDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp)))); |
| ... | ... | @@ -255,9 +293,11 @@ public class DriverJob implements InitializingBean { |
| 255 | 293 | throw new RuntimeException(e); |
| 256 | 294 | } |
| 257 | 295 | // 获取排班信息并存入redis |
| 258 | - saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut,date,type); | |
| 296 | + saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut, date, type); | |
| 259 | 297 | // 删除两天前排班信息 |
| 260 | - deleteScheduling(); | |
| 298 | + if (isSameDay) { | |
| 299 | + deleteScheduling(); | |
| 300 | + } | |
| 261 | 301 | log.info("获取{}的排班数据完毕", formatDate); |
| 262 | 302 | } |
| 263 | 303 | |
| ... | ... | @@ -350,14 +390,18 @@ public class DriverJob implements InitializingBean { |
| 350 | 390 | } |
| 351 | 391 | |
| 352 | 392 | |
| 353 | - public Map<String, List<ResponseSchedulingDto>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey, String timeOut,Date date,int type) { | |
| 354 | - log.info("开始拉取排班:{};[{}]", dateKey,getSchedulingInfoUrl); | |
| 393 | + public Map<String, List<ResponseSchedulingDto>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey, String timeOut, Date date, int type) { | |
| 394 | + log.info("开始拉取排班:{};[{}]", dateKey, getSchedulingInfoUrl); | |
| 355 | 395 | List<ResponseSchedulingDto> originSchedulingList = RESTTEMPLATE.exchange( |
| 356 | 396 | getSchedulingInfoUrl, |
| 357 | 397 | HttpMethod.GET, |
| 358 | 398 | null, |
| 359 | 399 | new ParameterizedTypeReference<List<ResponseSchedulingDto>>() { |
| 360 | 400 | }).getBody(); |
| 401 | + | |
| 402 | + if (CollectionUtils.isEmpty(originSchedulingList)) { | |
| 403 | + return null; | |
| 404 | + } | |
| 361 | 405 | Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200); |
| 362 | 406 | // 以员工号为key存入排班集合 |
| 363 | 407 | originSchedulingList.stream().forEach(item -> { |
| ... | ... | @@ -379,7 +423,7 @@ public class DriverJob implements InitializingBean { |
| 379 | 423 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); |
| 380 | 424 | } |
| 381 | 425 | // 存入签到报表 |
| 382 | - THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap, timeOut,date,type); | |
| 426 | + THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap, timeOut, date, type); | |
| 383 | 427 | // 实时排班直接存入缓存 |
| 384 | 428 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); |
| 385 | 429 | log.info("拉取排班完毕:{}", dateKey); |
| ... | ... | @@ -456,15 +500,15 @@ public class DriverJob implements InitializingBean { |
| 456 | 500 | Map<String, Driver> driverMap = new HashMap<>(); |
| 457 | 501 | for (Driver driver : drivers) { |
| 458 | 502 | if (driverMap.get(driver.getJobCode()) == null) { |
| 459 | - driverMap.put(driver.getJobCode(),driver); | |
| 460 | - }else { | |
| 503 | + driverMap.put(driver.getJobCode(), driver); | |
| 504 | + } else { | |
| 461 | 505 | System.out.println(driver); |
| 462 | 506 | } |
| 463 | 507 | } |
| 464 | 508 | // 过滤出需要更新的driver |
| 465 | 509 | List<Driver> updateDriverList = allDriverList.stream() |
| 466 | 510 | // 过滤暂时没有保存的人员 |
| 467 | - .filter(item->driverMap.get(item.getJobCode()) != null) | |
| 511 | + .filter(item -> driverMap.get(item.getJobCode()) != null) | |
| 468 | 512 | // 过滤全部一致的人员信息 |
| 469 | 513 | .filter(item -> !item.equals(driverMap.get(item.getJobCode()))) |
| 470 | 514 | .map(item -> { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/ReportService.java
| ... | ... | @@ -26,9 +26,10 @@ import com.ruoyi.pojo.vo.PersonSignDataResponseVo; |
| 26 | 26 | import com.ruoyi.system.domain.SysNotice; |
| 27 | 27 | import com.ruoyi.system.service.ISysNoticeService; |
| 28 | 28 | import com.ruoyi.utils.ConstDateUtil; |
| 29 | +import com.ruoyi.utils.DateUtil; | |
| 29 | 30 | import com.ruoyi.utils.ToolUtils; |
| 30 | 31 | import lombok.extern.slf4j.Slf4j; |
| 31 | -import org.quartz.Scheduler; | |
| 32 | +import org.apache.commons.lang3.time.DateUtils; | |
| 32 | 33 | import org.springframework.beans.BeanUtils; |
| 33 | 34 | import org.springframework.beans.factory.annotation.Autowired; |
| 34 | 35 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -39,6 +40,7 @@ import javax.servlet.http.HttpServletResponse; |
| 39 | 40 | import javax.validation.constraints.NotBlank; |
| 40 | 41 | import java.io.OutputStream; |
| 41 | 42 | import java.math.BigDecimal; |
| 43 | +import java.text.ParseException; | |
| 42 | 44 | import java.time.LocalDate; |
| 43 | 45 | import java.time.YearMonth; |
| 44 | 46 | import java.time.format.DateTimeFormatter; |
| ... | ... | @@ -265,7 +267,13 @@ public class ReportService { |
| 265 | 267 | } |
| 266 | 268 | |
| 267 | 269 | private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date) { |
| 268 | - List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, null, null, null); | |
| 270 | + String endDateStr = null; | |
| 271 | + try { | |
| 272 | + endDateStr = DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(DateUtil.YYYY_MM_DD_LINK.parse(date),1)); | |
| 273 | + } catch (ParseException e) { | |
| 274 | + throw new RuntimeException(e); | |
| 275 | + } | |
| 276 | + List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date,endDateStr, null, null, null); | |
| 269 | 277 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 270 | 278 | List<ExportReportViewResponseVo> signVo = new ArrayList<>(800); |
| 271 | 279 | handlerResultMap(date, resultMap, schedulingList); |
| ... | ... | @@ -358,7 +366,13 @@ public class ReportService { |
| 358 | 366 | |
| 359 | 367 | public List<ReportDetailResponseVo> getReportDetail(ReportViewRequestVo vo, HttpServletResponse response) { |
| 360 | 368 | List<ReportDetailResponseVo> responseVos = new ArrayList<>(); |
| 361 | - List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); | |
| 369 | + String endDateStr = null; | |
| 370 | + try { | |
| 371 | + endDateStr = DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(DateUtil.YYYY_MM_DD_LINK.parse(vo.getDate()),1)); | |
| 372 | + } catch (ParseException e) { | |
| 373 | + throw new RuntimeException(e); | |
| 374 | + } | |
| 375 | + List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(),endDateStr, vo.getName(), vo.getJobCode(), vo.getLineName()); | |
| 362 | 376 | for (DriverScheduling scheduling : toDay) { |
| 363 | 377 | ToolUtils.updateReport(scheduling); |
| 364 | 378 | ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo(); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/SchedulingService.java
| ... | ... | @@ -3,28 +3,32 @@ package com.ruoyi.service; |
| 3 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | 4 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 5 | 5 | import com.ruoyi.common.utils.DateUtils; |
| 6 | +import com.ruoyi.domain.DriverScheduling; | |
| 7 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | |
| 6 | 8 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 7 | 9 | import com.ruoyi.in.domain.SignIn; |
| 8 | 10 | import com.ruoyi.in.mapper.SignInMapper; |
| 9 | 11 | import com.ruoyi.in.service.impl.SignInServiceImpl; |
| 10 | 12 | import com.ruoyi.pojo.DriverSignInRecommendation; |
| 11 | 13 | import com.ruoyi.pojo.GlobalIndex; |
| 12 | -import com.ruoyi.domain.DriverScheduling; | |
| 13 | 14 | import com.ruoyi.pojo.request.ReportViewRequestVo; |
| 14 | 15 | import com.ruoyi.pojo.response.ReportViewResponseVo; |
| 16 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | |
| 15 | 17 | import com.ruoyi.utils.ConstDateUtil; |
| 18 | +import com.ruoyi.utils.DateUtil; | |
| 16 | 19 | import com.ruoyi.utils.ToolUtils; |
| 20 | +import org.apache.commons.collections4.CollectionUtils; | |
| 17 | 21 | import org.springframework.beans.BeanUtils; |
| 18 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | 23 | import org.springframework.stereotype.Service; |
| 20 | 24 | |
| 21 | 25 | import javax.annotation.Resource; |
| 22 | 26 | import javax.servlet.http.HttpServletResponse; |
| 23 | -import java.time.LocalDate; | |
| 27 | +import java.text.ParseException; | |
| 24 | 28 | import java.time.LocalDateTime; |
| 25 | -import java.time.YearMonth; | |
| 26 | 29 | import java.time.temporal.ChronoUnit; |
| 27 | 30 | import java.util.*; |
| 31 | +import java.util.stream.Collectors; | |
| 28 | 32 | |
| 29 | 33 | import static com.ruoyi.common.ConstDriverProperties.*; |
| 30 | 34 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; |
| ... | ... | @@ -46,6 +50,8 @@ public class SchedulingService { |
| 46 | 50 | |
| 47 | 51 | @Autowired |
| 48 | 52 | private SignInMapper signInMapper; |
| 53 | + @Autowired | |
| 54 | + private LinggangSchedulingService schedulingService; | |
| 49 | 55 | |
| 50 | 56 | |
| 51 | 57 | /** |
| ... | ... | @@ -60,6 +66,22 @@ public class SchedulingService { |
| 60 | 66 | List<DriverScheduling> dto = null; |
| 61 | 67 | for (int i = 0; i > -2; i--) { |
| 62 | 68 | dto = nowSchedulingCache.getCacheSchedulingMapValueByHKey(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)), jobCode); |
| 69 | + if(CollectionUtils.isEmpty(dto)){ | |
| 70 | + Date date = new Date(now); | |
| 71 | + LinggangScheduling linggangScheduling = new LinggangScheduling(); | |
| 72 | + linggangScheduling.setScheduleDate(DateUtil.shortDate(date)); | |
| 73 | + linggangScheduling.setJobCode(jobCode); | |
| 74 | + | |
| 75 | + List<LinggangScheduling> linggangSchedulings = schedulingService.list(linggangScheduling); | |
| 76 | + if(CollectionUtils.isNotEmpty(linggangSchedulings)){ | |
| 77 | + dto = linggangSchedulings.stream().map(l->{ | |
| 78 | + DriverScheduling driverScheduling = new DriverScheduling(); | |
| 79 | + BeanUtils.copyProperties(l,driverScheduling); | |
| 80 | + return driverScheduling; | |
| 81 | + }).collect(Collectors.toList()); | |
| 82 | + } | |
| 83 | + | |
| 84 | + } | |
| 63 | 85 | if (!CollectionUtil.isEmpty(dto)) { |
| 64 | 86 | dto.sort(Comparator.comparing(DriverScheduling::getZdsjT)); |
| 65 | 87 | if (i == -1) { |
| ... | ... | @@ -235,8 +257,14 @@ public class SchedulingService { |
| 235 | 257 | |
| 236 | 258 | |
| 237 | 259 | private List<ReportViewResponseVo> getDayReportTableResponseVo(ReportViewRequestVo vo) { |
| 260 | + String endDateStr = null; | |
| 261 | + try { | |
| 262 | + endDateStr = DateUtil.YYYY_MM_DD_LINK.format(org.apache.commons.lang3.time.DateUtils.addDays(DateUtil.YYYY_MM_DD_LINK.parse(vo.getDate()),1)); | |
| 263 | + } catch (ParseException e) { | |
| 264 | + throw new RuntimeException(e); | |
| 265 | + } | |
| 238 | 266 | // 签到数据 |
| 239 | - List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); | |
| 267 | + List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(),endDateStr, vo.getName(), vo.getJobCode(), vo.getLineName()); | |
| 240 | 268 | toDay.sort(Comparator.comparing(DriverScheduling::getFcsjT)); |
| 241 | 269 | // 转换日期 + jobCode为key |
| 242 | 270 | Map<String, List<DriverScheduling>> orangeMap = new HashMap<>(1200); |
| ... | ... | @@ -325,7 +353,13 @@ public class SchedulingService { |
| 325 | 353 | } |
| 326 | 354 | |
| 327 | 355 | public List<DriverScheduling> queryToDay(String date) { |
| 328 | - return schedulingMapper.queryToDay(date, null, null, null); | |
| 356 | + String endDateStr = null; | |
| 357 | + try { | |
| 358 | + endDateStr = DateUtil.YYYY_MM_DD_LINK.format(org.apache.commons.lang3.time.DateUtils.addDays(DateUtil.YYYY_MM_DD_LINK.parse(date),1)); | |
| 359 | + } catch (ParseException e) { | |
| 360 | + throw new RuntimeException(e); | |
| 361 | + } | |
| 362 | + return schedulingMapper.queryToDay(date,endDateStr, null, null, null); | |
| 329 | 363 | } |
| 330 | 364 | |
| 331 | 365 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -16,6 +16,7 @@ import com.ruoyi.config.domain.LineConfig; |
| 16 | 16 | import com.ruoyi.config.service.ILineConfigService; |
| 17 | 17 | import com.ruoyi.domain.DriverScheduling; |
| 18 | 18 | import com.ruoyi.domain.RuleAttendanceMain; |
| 19 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | |
| 19 | 20 | import com.ruoyi.domain.sign.in.exception.report.EquipmentExceptionReport; |
| 20 | 21 | import com.ruoyi.driver.domain.Driver; |
| 21 | 22 | import com.ruoyi.driver.mapper.DriverMapper; |
| ... | ... | @@ -32,12 +33,15 @@ import com.ruoyi.job.DriverJob; |
| 32 | 33 | import com.ruoyi.pojo.GlobalIndex; |
| 33 | 34 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 34 | 35 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; |
| 36 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | |
| 35 | 37 | import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportService; |
| 36 | 38 | import com.ruoyi.system.domain.SysNotice; |
| 37 | 39 | import com.ruoyi.system.service.ISysNoticeService; |
| 38 | 40 | import com.ruoyi.utils.ConstDateUtil; |
| 39 | 41 | import com.ruoyi.utils.DateUtil; |
| 40 | 42 | import lombok.extern.slf4j.Slf4j; |
| 43 | +import org.apache.commons.collections4.CollectionUtils; | |
| 44 | +import org.apache.commons.collections4.MapUtils; | |
| 41 | 45 | import org.springframework.beans.BeanUtils; |
| 42 | 46 | import org.springframework.beans.factory.annotation.Autowired; |
| 43 | 47 | import org.springframework.beans.factory.annotation.Value; |
| ... | ... | @@ -103,6 +107,9 @@ public class ThreadJobService { |
| 103 | 107 | @Autowired |
| 104 | 108 | private RuleAttendanceMainService attendanceMainService; |
| 105 | 109 | |
| 110 | + @Autowired | |
| 111 | + private LinggangSchedulingService schedulingService; | |
| 112 | + | |
| 106 | 113 | |
| 107 | 114 | @Autowired |
| 108 | 115 | private PlatformTransactionManager transactionManager; |
| ... | ... | @@ -199,8 +206,8 @@ public class ThreadJobService { |
| 199 | 206 | sendNotice(signIn, driver, dto, globalIndex); |
| 200 | 207 | |
| 201 | 208 | |
| 202 | - EquipmentExceptionReport exceptionReport =new EquipmentExceptionReport(); | |
| 203 | - BeanUtils.copyProperties(exception,exceptionReport); | |
| 209 | + EquipmentExceptionReport exceptionReport = new EquipmentExceptionReport(); | |
| 210 | + BeanUtils.copyProperties(exception, exceptionReport); | |
| 204 | 211 | exceptionReport.setSignId(signIn.getId()); |
| 205 | 212 | equipmentExceptionReportService.save(exceptionReport); |
| 206 | 213 | } |
| ... | ... | @@ -409,10 +416,18 @@ public class ThreadJobService { |
| 409 | 416 | */ |
| 410 | 417 | @Async |
| 411 | 418 | @Transactional(rollbackFor = {Exception.class}) |
| 412 | - public void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, String timeOut,Date date,int type) { | |
| 419 | + public void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, String timeOut, Date date, int type) { | |
| 413 | 420 | //查询当天是否保存过考情表 如果不存在则保存 |
| 414 | - List<DriverScheduling> bcList = schedulingMapper.queryToDay(DateUtil.YYYY_MM_DD_LINK.format(date), null, null, null); | |
| 415 | - Map<String, List<DriverScheduling>> dto = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(new Date())); | |
| 421 | + List<DriverScheduling> bcList = schedulingMapper.queryToDay(DateUtil.YYYY_MM_DD_LINK.format(date),DateUtil.YYYY_MM_DD_LINK.format(org.apache.commons.lang3.time.DateUtils.addDays(date,1)), null, null, null); | |
| 422 | + Map<String, List<DriverScheduling>> dto = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(date)); | |
| 423 | + if(CollectionUtils.isNotEmpty(bcList) && MapUtils.isEmpty(dto)){ | |
| 424 | + String dateStr = DateUtil.YYYY_MM_DD.format(date); | |
| 425 | + Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | |
| 426 | + NowSchedulingCache.handlerResultMap(resultMap, bcList); | |
| 427 | + // 更新缓存 | |
| 428 | + nowSchedulingCache.setCacheScheduling(dateStr, resultMap); | |
| 429 | + } | |
| 430 | + | |
| 416 | 431 | // 当天已有记录则不在保存 或者 调度记录为空则不在保存 |
| 417 | 432 | if ((CollectionUtil.isNotEmpty(dto) && CollectionUtil.isNotEmpty(bcList)) || originSchedulingMap.size() == 0) { |
| 418 | 433 | log.info("调度最新数据:{},当天获取数据:{},时间:[{}]", originSchedulingMap.size(),bcList.size(),date); |
| ... | ... | @@ -420,15 +435,52 @@ public class ThreadJobService { |
| 420 | 435 | } |
| 421 | 436 | // TODO maybe delete |
| 422 | 437 | TempCache.resetMapStatus(); |
| 423 | - bcList = getBcList(originSchedulingMap,type); | |
| 438 | + bcList = getBcList(originSchedulingMap, type); | |
| 424 | 439 | |
| 425 | 440 | // 处理非司售人员的排班明细 |
| 426 | - bcList.addAll(handleOtherPostsScheduling()); | |
| 441 | + bcList.addAll(handleOtherPostsScheduling(type)); | |
| 427 | 442 | // 插入排班 |
| 428 | - schedulingMapper.insertRoster(bcList); | |
| 443 | + List<LinggangScheduling> schedulings = bcList.stream().map(b -> { | |
| 444 | + LinggangScheduling scheduling = new LinggangScheduling(); | |
| 445 | + BeanUtils.copyProperties(b, scheduling); | |
| 446 | + return scheduling; | |
| 447 | + }).collect(Collectors.toList()); | |
| 448 | + if (CollectionUtils.isNotEmpty(schedulings)) { | |
| 449 | + Map<String, List<LinggangScheduling>> distinctMap = new HashMap<>(); | |
| 450 | + schedulings.stream().forEach(s -> { | |
| 451 | + String key = org.apache.commons.lang3.StringUtils.join(s.getJobCode(), "-", s.getBcType(), "-", s.getFcsjT(), "-", s.getScheduleDate()); | |
| 452 | + List<LinggangScheduling> linggangSchedulings = distinctMap.get(key); | |
| 453 | + if (Objects.isNull(linggangSchedulings)) { | |
| 454 | + linggangSchedulings = new ArrayList<>(); | |
| 455 | + distinctMap.put(key, linggangSchedulings); | |
| 456 | + } | |
| 457 | + linggangSchedulings.add(s); | |
| 458 | + }); | |
| 459 | + | |
| 460 | + schedulings.clear(); | |
| 461 | + for (Map.Entry<String, List<LinggangScheduling>> entry : distinctMap.entrySet()) { | |
| 462 | + int size = CollectionUtils.size(entry.getValue()); | |
| 463 | + if (size == 1) { | |
| 464 | + schedulings.add(entry.getValue().get(0)); | |
| 465 | + } else if (size > 1) { | |
| 466 | + List<LinggangScheduling> values = entry.getValue().stream().filter(s->!Objects.equals(s.getZdsjT(),s.getFcsjT())).collect(Collectors.toList()); | |
| 467 | + size = CollectionUtils.size(values); | |
| 468 | + if(size == 0){ | |
| 469 | + schedulings.add(entry.getValue().get(0)); | |
| 470 | + }else if(size == 1){ | |
| 471 | + schedulings.add(values.get(0)); | |
| 472 | + }else{ | |
| 473 | + values = values.stream().sorted(Comparator.comparing(LinggangScheduling::getZdsjT)).collect(Collectors.toList()); | |
| 474 | + schedulings.add(values.get(size-1)); | |
| 475 | + } | |
| 476 | + } | |
| 477 | + } | |
| 478 | + | |
| 479 | + schedulingService.saveBatch(schedulings); | |
| 480 | + } | |
| 429 | 481 | String dateStr1 = DateUtil.YYYY_MM_DD_LINK.format(date); |
| 430 | 482 | // 异常数据过多,不通过自增获取id再次查询获取 |
| 431 | - bcList = schedulingMapper.queryToDay(dateStr1, null, null, null); | |
| 483 | + bcList = schedulingMapper.queryToDay(dateStr1, DateUtil.YYYY_MM_DD_LINK.format(org.apache.commons.lang3.time.DateUtils.addDays(date,1)), null, null, null); | |
| 432 | 484 | // 处理缓存和错误排班 |
| 433 | 485 | String dateStr = DateUtil.YYYY_MM_DD.format(date); |
| 434 | 486 | if (!CollectionUtil.isEmpty(bcList)) { |
| ... | ... | @@ -445,7 +497,12 @@ public class ThreadJobService { |
| 445 | 497 | log.info("当天排班数据获取完毕,共:{}条", bcList.size()); |
| 446 | 498 | } |
| 447 | 499 | |
| 448 | - private List<DriverScheduling> handleOtherPostsScheduling() { | |
| 500 | + private <T> String combitionKey(T s1) { | |
| 501 | + LinggangScheduling s = (LinggangScheduling) s1; | |
| 502 | + return (s.getScheduleDate() + "-" + s.getBcType() + "-" + s.getFcsjT() + "-" + s.getScheduleDate()); | |
| 503 | + } | |
| 504 | + | |
| 505 | + private List<DriverScheduling> handleOtherPostsScheduling(int type) { | |
| 449 | 506 | QueryWrapper<RuleAttendanceMain> qw = new QueryWrapper<>(); |
| 450 | 507 | qw.lambda() |
| 451 | 508 | .eq(RuleAttendanceMain::getWorkFlag, WORK_FLAG) |
| ... | ... | @@ -459,6 +516,7 @@ public class ThreadJobService { |
| 459 | 516 | scheduling.setBcType(BC_TYPE_OUT); |
| 460 | 517 | scheduling.setZdsjT(ruleAttendanceMain.getFirstWorkSignInTime().getTime()); |
| 461 | 518 | scheduling.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); |
| 519 | + scheduling.setType(type); | |
| 462 | 520 | bcList.add(scheduling); |
| 463 | 521 | |
| 464 | 522 | DriverScheduling scheduling1 = getDriverScheduling(ruleAttendanceMain); |
| ... | ... | @@ -466,6 +524,7 @@ public class ThreadJobService { |
| 466 | 524 | scheduling1.setZdsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); |
| 467 | 525 | scheduling1.setFcsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); |
| 468 | 526 | scheduling1.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); |
| 527 | + scheduling1.setType(type); | |
| 469 | 528 | bcList.add(scheduling1); |
| 470 | 529 | // 第二段 |
| 471 | 530 | if (!Objects.isNull(ruleAttendanceMain.getSecondWorkSignInTime())) { |
| ... | ... | @@ -474,6 +533,7 @@ public class ThreadJobService { |
| 474 | 533 | scheduling2.setFcsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); |
| 475 | 534 | scheduling2.setZdsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); |
| 476 | 535 | scheduling2.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); |
| 536 | + scheduling2.setType(type); | |
| 477 | 537 | bcList.add(scheduling2); |
| 478 | 538 | |
| 479 | 539 | DriverScheduling scheduling3 = getDriverScheduling(ruleAttendanceMain); |
| ... | ... | @@ -481,6 +541,7 @@ public class ThreadJobService { |
| 481 | 541 | scheduling3.setFcsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); |
| 482 | 542 | scheduling3.setZdsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); |
| 483 | 543 | scheduling3.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); |
| 544 | + scheduling3.setType(type); | |
| 484 | 545 | bcList.add(scheduling3); |
| 485 | 546 | } |
| 486 | 547 | } |
| ... | ... | @@ -515,7 +576,7 @@ public class ThreadJobService { |
| 515 | 576 | return scheduling; |
| 516 | 577 | } |
| 517 | 578 | |
| 518 | - private List<DriverScheduling> getBcList(Map<String, List<ResponseSchedulingDto>> originSchedulingMap,int type) { | |
| 579 | + private List<DriverScheduling> getBcList(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, int type) { | |
| 519 | 580 | List<DriverScheduling> bcList = new ArrayList<>(1000); |
| 520 | 581 | Map<String, LineConfig> configMap = lineConfigService.selectLineConfigList(null).stream().collect(Collectors.toMap(item -> item.getLineName() + item.getLpName(), item -> item)); |
| 521 | 582 | for (String key : originSchedulingMap.keySet()) { |
| ... | ... | @@ -534,7 +595,7 @@ public class ThreadJobService { |
| 534 | 595 | |
| 535 | 596 | if (CollectionUtil.isNotEmpty(nowScheduling)) { |
| 536 | 597 | // 配置处理 |
| 537 | - nowScheduling = handlerScheduler(configMap, schedulingList, nowScheduling); | |
| 598 | + nowScheduling = handlerScheduler(configMap, schedulingList, nowScheduling, type); | |
| 538 | 599 | // ------|特殊处理|------ |
| 539 | 600 | try { |
| 540 | 601 | DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1); |
| ... | ... | @@ -564,10 +625,10 @@ public class ThreadJobService { |
| 564 | 625 | * @param nowScheduling |
| 565 | 626 | * @return |
| 566 | 627 | */ |
| 567 | - private List<DriverScheduling> handlerScheduler(Map<String, LineConfig> configMap, List<ResponseSchedulingDto> schedulingList, List<DriverScheduling> nowScheduling) { | |
| 628 | + private List<DriverScheduling> handlerScheduler(Map<String, LineConfig> configMap, List<ResponseSchedulingDto> schedulingList, List<DriverScheduling> nowScheduling, int type) { | |
| 568 | 629 | // 处理错误班次 |
| 569 | 630 | if (nowScheduling.size() % 2 == 1 && nowScheduling.size() > 2) { |
| 570 | - nowScheduling = handleErrorBc(schedulingList); | |
| 631 | + nowScheduling = handleErrorBc(schedulingList, type); | |
| 571 | 632 | } |
| 572 | 633 | |
| 573 | 634 | // TODO 遍历配置表数据 |
| ... | ... | @@ -749,12 +810,12 @@ public class ThreadJobService { |
| 749 | 810 | return errorJobcode; |
| 750 | 811 | } |
| 751 | 812 | |
| 752 | - private List<DriverScheduling> handleErrorBc(List<ResponseSchedulingDto> nowScheduling) { | |
| 813 | + private List<DriverScheduling> handleErrorBc(List<ResponseSchedulingDto> nowScheduling, int type) { | |
| 753 | 814 | // 处理两个进场 |
| 754 | - return handlerTowIn(nowScheduling); | |
| 815 | + return handlerTowIn(nowScheduling, type); | |
| 755 | 816 | } |
| 756 | 817 | |
| 757 | - private List<DriverScheduling> handlerTowIn(List<ResponseSchedulingDto> nowScheduling) { | |
| 818 | + private List<DriverScheduling> handlerTowIn(List<ResponseSchedulingDto> nowScheduling, int type) { | |
| 758 | 819 | nowScheduling = nowScheduling.stream().filter(item -> BC_TYPE_IN.equals(item.getBcType()) || BC_TYPE_OUT.equals(item.getBcType())).collect(Collectors.toList()); |
| 759 | 820 | if (nowScheduling.get(nowScheduling.size() - 1).getBcType().equals(BC_TYPE_IN)) { |
| 760 | 821 | // 连续的进场 判断哪个适配 |
| ... | ... | @@ -772,6 +833,7 @@ public class ThreadJobService { |
| 772 | 833 | return nowScheduling.stream().map(item -> { |
| 773 | 834 | DriverScheduling scheduling = new DriverScheduling(); |
| 774 | 835 | BeanUtils.copyProperties(item, scheduling); |
| 836 | + scheduling.setType(type); | |
| 775 | 837 | return scheduling; |
| 776 | 838 | }).collect(Collectors.toList()); |
| 777 | 839 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/RuleNumSettingServiceImpl.java
| ... | ... | @@ -21,7 +21,9 @@ import com.ruoyi.service.RuleAttendanceMainHelpService; |
| 21 | 21 | import com.ruoyi.service.RuleAttendanceMainService; |
| 22 | 22 | import com.ruoyi.service.RuleNumSettingService; |
| 23 | 23 | import com.ruoyi.utils.ConstDateUtil; |
| 24 | +import com.ruoyi.utils.DateUtil; | |
| 24 | 25 | import com.ruoyi.utils.ToolUtils; |
| 26 | +import org.apache.commons.lang3.time.DateUtils; | |
| 25 | 27 | import org.slf4j.Logger; |
| 26 | 28 | import org.slf4j.LoggerFactory; |
| 27 | 29 | import org.springframework.beans.BeanUtils; |
| ... | ... | @@ -321,7 +323,7 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 321 | 323 | public void manualAddBcCache() { |
| 322 | 324 | List<DriverScheduling> bcList = handleOtherPostsScheduling(); |
| 323 | 325 | schedulingMapper.insertRoster(bcList); |
| 324 | - bcList = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null, null, null); | |
| 326 | + bcList = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(new Date(),1)), null, null, null); | |
| 325 | 327 | String date = ConstDateUtil.formatDate(new Date()); |
| 326 | 328 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 327 | 329 | NowSchedulingCache.handlerResultMap(resultMap, bcList); | ... | ... |
Bsth-admin/src/main/resources/application-druid-devTest.yml
| ... | ... | @@ -137,7 +137,7 @@ ruoyi: |
| 137 | 137 | # 实例演示开关 |
| 138 | 138 | demoEnabled: true |
| 139 | 139 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| 140 | - profile: D:/ruoyi/uploadPath | |
| 140 | + profile: /data/test/bath-alcoho-sign/apache-tomcat-8.5.61/webapps/uploadPath | |
| 141 | 141 | # 获取ip地址开关 |
| 142 | 142 | addressEnabled: false |
| 143 | 143 | # 验证码类型 math 数字计算 char 字符验证 | ... | ... |
Bsth-admin/src/main/resources/mapper/driver_scheduling/DriverSchedulingMapper.xml
| ... | ... | @@ -37,12 +37,12 @@ |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | <insert id="insertRoster" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> |
| 40 | - insert into scheduling (schedule_date,line_name,job_code,`name`,posts,lp_name,nbbm,bc_type,fcsj_t,zdsj_t,upDown,qdzCode,qdzName,zdzCode,zdzName) | |
| 40 | + insert into scheduling (schedule_date,line_name,job_code,`name`,posts,lp_name,nbbm,bc_type,fcsj_t,zdsj_t,upDown,qdzCode,qdzName,zdzCode,zdzName,scheduling_type) | |
| 41 | 41 | values |
| 42 | 42 | <foreach collection="list" item="item" separator=","> |
| 43 | 43 | ( |
| 44 | 44 | #{item.scheduleDate}, #{item.lineName}, #{item.jobCode}, #{item.name}, #{item.posts}, #{item.lpName}, #{item.nbbm}, |
| 45 | - #{item.bcType},#{item.fcsjT},#{item.zdsjT},#{item.upDown},#{item.qdzCode},#{item.qdzName},#{item.zdzCode},#{item.zdzName} | |
| 45 | + #{item.bcType},#{item.fcsjT},#{item.zdsjT},#{item.upDown},#{item.qdzCode},#{item.qdzName},#{item.zdzCode},#{item.zdzName},#{item.type} | |
| 46 | 46 | ) |
| 47 | 47 | </foreach> |
| 48 | 48 | on duplicate key update |
| ... | ... | @@ -79,10 +79,10 @@ |
| 79 | 79 | <if test="lineName !=null and lineName != ''"> |
| 80 | 80 | and scheduling.line_name like concat('%', #{lineName}, '%') |
| 81 | 81 | </if> |
| 82 | - <if test="date != null and date != ''"> | |
| 83 | - and schedule_date = #{date} | |
| 82 | + <if test="date != null and date != '' and endDate != null and endDate != ''"> | |
| 83 | + and schedule_date between #{date} and #{endDate} | |
| 84 | 84 | </if> |
| 85 | - and scheduling.type = 1 | |
| 85 | + and (scheduling.scheduling_type = 1 or scheduling.scheduling_type is null) | |
| 86 | 86 | </where> |
| 87 | 87 | |
| 88 | 88 | ... | ... |
Bsth-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java
| ... | ... | @@ -9,6 +9,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; |
| 9 | 9 | |
| 10 | 10 | import javax.validation.constraints.NotBlank; |
| 11 | 11 | import javax.validation.constraints.Size; |
| 12 | +import java.util.Objects; | |
| 12 | 13 | |
| 13 | 14 | /** |
| 14 | 15 | * 字典数据表 sys_dict_data |
| ... | ... | @@ -99,12 +100,16 @@ public class SysDictData extends BaseEntity { |
| 99 | 100 | this.dictLabel = dictLabel; |
| 100 | 101 | } |
| 101 | 102 | |
| 102 | - @NotBlank(message = "字典键值不能为空") | |
| 103 | - @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") | |
| 104 | 103 | public Object getDictValue() { |
| 105 | 104 | return dictValue; |
| 106 | 105 | } |
| 107 | 106 | |
| 107 | + @NotBlank(message = "字典键值不能为空") | |
| 108 | + @Size(min = 0, max = 300, message = "字典键值长度不能超过100个字符") | |
| 109 | + public String getDictValueStr() { | |
| 110 | + return Objects.isNull(dictValue)? null:dictValue.toString(); | |
| 111 | + } | |
| 112 | + | |
| 108 | 113 | public void setDictValue(Object dictValue) { |
| 109 | 114 | this.dictValue = dictValue; |
| 110 | 115 | } | ... | ... |