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,19 +3,19 @@ package com.ruoyi.common.cache; | ||
| 3 | import cn.hutool.core.collection.CollectionUtil; | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | import cn.hutool.core.map.MapUtil; | 4 | import cn.hutool.core.map.MapUtil; |
| 5 | import com.ruoyi.common.utils.StringUtils; | 5 | import com.ruoyi.common.utils.StringUtils; |
| 6 | +import com.ruoyi.domain.DriverScheduling; | ||
| 6 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; | 7 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 7 | import com.ruoyi.errorScheduling.domain.ErrorJobcode; | 8 | import com.ruoyi.errorScheduling.domain.ErrorJobcode; |
| 8 | import com.ruoyi.errorScheduling.service.IErrorJobcodeService; | 9 | import com.ruoyi.errorScheduling.service.IErrorJobcodeService; |
| 9 | import com.ruoyi.in.domain.SignIn; | 10 | import com.ruoyi.in.domain.SignIn; |
| 10 | -import com.ruoyi.domain.DriverScheduling; | ||
| 11 | import com.ruoyi.service.ThreadJobService; | 11 | import com.ruoyi.service.ThreadJobService; |
| 12 | import com.ruoyi.utils.ConstDateUtil; | 12 | import com.ruoyi.utils.ConstDateUtil; |
| 13 | -import lombok.extern.slf4j.Slf4j; | 13 | +import com.ruoyi.utils.DateUtil; |
| 14 | import org.apache.commons.collections4.CollectionUtils; | 14 | import org.apache.commons.collections4.CollectionUtils; |
| 15 | +import org.apache.commons.lang3.time.DateUtils; | ||
| 15 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 16 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| 17 | import org.springframework.stereotype.Component; | 18 | import org.springframework.stereotype.Component; |
| 18 | -import org.springframework.stereotype.Service; | ||
| 19 | 19 | ||
| 20 | import java.util.*; | 20 | import java.util.*; |
| 21 | import java.util.concurrent.ConcurrentHashMap; | 21 | import java.util.concurrent.ConcurrentHashMap; |
| @@ -44,8 +44,10 @@ public class NowSchedulingCache { | @@ -44,8 +44,10 @@ public class NowSchedulingCache { | ||
| 44 | // 查询今天和昨天 | 44 | // 查询今天和昨天 |
| 45 | for (int i = 0; i > -2; i--) { | 45 | for (int i = 0; i > -2; i--) { |
| 46 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | 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 | handlerResultMap(resultMap, schedulingList); | 51 | handlerResultMap(resultMap, schedulingList); |
| 50 | // 获取错误排班 | 52 | // 获取错误排班 |
| 51 | List<ErrorJobcode> errorScheduling = ThreadJobService.getErrorScheduling(resultMap); | 53 | List<ErrorJobcode> errorScheduling = ThreadJobService.getErrorScheduling(resultMap); |
| @@ -152,9 +154,15 @@ public class NowSchedulingCache { | @@ -152,9 +154,15 @@ public class NowSchedulingCache { | ||
| 152 | * @param signIn | 154 | * @param signIn |
| 153 | */ | 155 | */ |
| 154 | public void updateCacheByJobCode(String remark, String key, Integer index, SignIn signIn) { | 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 | if (key.equals(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(0))) | 160 | if (key.equals(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(0))) |
| 156 | || key.equals(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)))) { | 161 | || key.equals(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)))) { |
| 157 | DriverScheduling scheduling = cacheNowDayScheduling.get(key).get(signIn.getJobCode()).get(index); | 162 | DriverScheduling scheduling = cacheNowDayScheduling.get(key).get(signIn.getJobCode()).get(index); |
| 163 | + if(Objects.isNull(scheduling)){ | ||
| 164 | + return; | ||
| 165 | + } | ||
| 158 | scheduling.setSignInId(signIn.getId()); | 166 | scheduling.setSignInId(signIn.getId()); |
| 159 | scheduling.setRemark(remark); | 167 | scheduling.setRemark(remark); |
| 160 | scheduling.setExType(signIn.getExType()); | 168 | scheduling.setExType(signIn.getExType()); |
Bsth-admin/src/main/java/com/ruoyi/controller/TestController.java
| @@ -39,8 +39,8 @@ public class TestController { | @@ -39,8 +39,8 @@ public class TestController { | ||
| 39 | // calendar.set(Calendar.SECOND,30); | 39 | // calendar.set(Calendar.SECOND,30); |
| 40 | // Date date = calendar.getTime(); | 40 | // Date date = calendar.getTime(); |
| 41 | Date date = new Date(); | 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 | return ResponseResult.success(); | 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,7 +74,7 @@ public class DssEquipmentController extends BaseController { | ||
| 74 | private LingangEquimentSelfCheckService lingangEquimentSelfCheckServicelingangEquimentSelfCheckService; | 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 | @ApiOperation("设备获取访问令牌") | 80 | @ApiOperation("设备获取访问令牌") |
| @@ -136,10 +136,17 @@ public class DssEquipmentController extends BaseController { | @@ -136,10 +136,17 @@ public class DssEquipmentController extends BaseController { | ||
| 136 | List<SysDictData> list = sysDictDataService.queryDictDateList(sysDictData, keys); | 136 | List<SysDictData> list = sysDictDataService.queryDictDateList(sysDictData, keys); |
| 137 | Equipment equipment = equipmentService.getOneByDeviceId(device); | 137 | Equipment equipment = equipmentService.getOneByDeviceId(device); |
| 138 | 138 | ||
| 139 | - EquipmentConfigVo configVo = combitionEquipmentConfigVo(list,equipment); | 139 | + EquipmentConfigVo configVo = combitionEquipmentConfigVo(list, equipment); |
| 140 | return ResponseResult.success(configVo); | 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 | @PostMapping("/device/selfcheck") | 151 | @PostMapping("/device/selfcheck") |
| 145 | @ApiOperation("设备获取远程参数配置") | 152 | @ApiOperation("设备获取远程参数配置") |
| @@ -212,6 +219,8 @@ public class DssEquipmentController extends BaseController { | @@ -212,6 +219,8 @@ public class DssEquipmentController extends BaseController { | ||
| 212 | } else if (StringUtils.equals(sysDictData.getDiscKey(), "integer")) { | 219 | } else if (StringUtils.equals(sysDictData.getDiscKey(), "integer")) { |
| 213 | equimentAddressParamVo.setInteger(Convert.toInt(sysDictData.getDictValue())); | 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,7 +68,9 @@ public class DssFaceController extends BaseController { | ||
| 68 | return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage()); | 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 | List<ReqDataVo> vos = convertReqDataVo(drivers); | 74 | List<ReqDataVo> vos = convertReqDataVo(drivers); |
| 73 | return ResponseResult.success(vos); | 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,16 +27,16 @@ public class EquipmentConfigVo implements java.io.Serializable { | ||
| 27 | @ApiModelProperty(value = "是否开启") | 27 | @ApiModelProperty(value = "是否开启") |
| 28 | private Integer promiseSwitch; | 28 | private Integer promiseSwitch; |
| 29 | 29 | ||
| 30 | - @ApiModelProperty(value = "是否开启健康检测 0:不开启 1:开启",example = "1") | 30 | + @ApiModelProperty(value = "是否开启健康检测 0:不开启 1:开启", example = "1") |
| 31 | private Integer healthCheck; | 31 | private Integer healthCheck; |
| 32 | 32 | ||
| 33 | - @ApiModelProperty(value = "是否开启情绪检测 0:不开启 1:开启",example = "1") | 33 | + @ApiModelProperty(value = "是否开启情绪检测 0:不开启 1:开启", example = "1") |
| 34 | private Integer moodCheck; | 34 | private Integer moodCheck; |
| 35 | 35 | ||
| 36 | - @ApiModelProperty(value = "是否开启安全考试 0:不开启 1:开启",example = "1") | 36 | + @ApiModelProperty(value = "是否开启安全考试 0:不开启 1:开启", example = "1") |
| 37 | private Integer safetyExam; | 37 | private Integer safetyExam; |
| 38 | 38 | ||
| 39 | - @ApiModelProperty(value = "开启体温检测 0:不开启 1:开启",example = "1") | 39 | + @ApiModelProperty(value = "开启体温检测 0:不开启 1:开启", example = "1") |
| 40 | private Integer temperatureSwitch; | 40 | private Integer temperatureSwitch; |
| 41 | 41 | ||
| 42 | 42 | ||
| @@ -48,6 +48,8 @@ public class EquipmentConfigVo implements java.io.Serializable { | @@ -48,6 +48,8 @@ public class EquipmentConfigVo implements java.io.Serializable { | ||
| 48 | private EquimentVideoParamVo videoParam; | 48 | private EquimentVideoParamVo videoParam; |
| 49 | @ApiModelProperty(value = "升级设置") | 49 | @ApiModelProperty(value = "升级设置") |
| 50 | private EquimentAddressParamVo addressParam; | 50 | private EquimentAddressParamVo addressParam; |
| 51 | + @ApiModelProperty(value = "资源访问URL") | ||
| 52 | + private String resourceBashURL; | ||
| 51 | 53 | ||
| 52 | @Override | 54 | @Override |
| 53 | public String toString() { | 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,9 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; | ||
| 7 | import com.ruoyi.common.annotation.Excel; | 7 | import com.ruoyi.common.annotation.Excel; |
| 8 | import lombok.AllArgsConstructor; | 8 | import lombok.AllArgsConstructor; |
| 9 | import lombok.Data; | 9 | import lombok.Data; |
| 10 | -import lombok.EqualsAndHashCode; | ||
| 11 | import lombok.NoArgsConstructor; | 10 | import lombok.NoArgsConstructor; |
| 12 | -import lombok.experimental.Accessors; | ||
| 13 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
| 14 | 12 | ||
| 15 | import java.util.Date; | 13 | import java.util.Date; |
| @@ -19,8 +17,6 @@ import java.util.Date; | @@ -19,8 +17,6 @@ import java.util.Date; | ||
| 19 | @Slf4j | 17 | @Slf4j |
| 20 | @NoArgsConstructor | 18 | @NoArgsConstructor |
| 21 | @AllArgsConstructor | 19 | @AllArgsConstructor |
| 22 | -@Accessors(chain = true) | ||
| 23 | -@EqualsAndHashCode(callSuper = false) | ||
| 24 | @TableName("scheduling") | 20 | @TableName("scheduling") |
| 25 | /** 实体*/ | 21 | /** 实体*/ |
| 26 | public class LinggangScheduling { | 22 | public class LinggangScheduling { |
| @@ -145,6 +141,7 @@ public class LinggangScheduling { | @@ -145,6 +141,7 @@ public class LinggangScheduling { | ||
| 145 | 141 | ||
| 146 | /***1:实际排班表;100为计划排班表*/ | 142 | /***1:实际排班表;100为计划排班表*/ |
| 147 | @Excel(name = "1:实际排班表;100为计划排班表") | 143 | @Excel(name = "1:实际排班表;100为计划排班表") |
| 144 | + @TableField(value = "scheduling_type") | ||
| 148 | private java.lang.Integer type; | 145 | private java.lang.Integer type; |
| 149 | 146 | ||
| 150 | 147 | ||
| @@ -163,4 +160,5 @@ public class LinggangScheduling { | @@ -163,4 +160,5 @@ public class LinggangScheduling { | ||
| 163 | public String toString() { | 160 | public String toString() { |
| 164 | return com.alibaba.fastjson2.JSON.toJSONString(this); | 161 | return com.alibaba.fastjson2.JSON.toJSONString(this); |
| 165 | } | 162 | } |
| 163 | + | ||
| 166 | } | 164 | } |
| 167 | \ No newline at end of file | 165 | \ No newline at end of file |
Bsth-admin/src/main/java/com/ruoyi/driver/mapper/DriverSchedulingMapper.java
| 1 | package com.ruoyi.driver.mapper; | 1 | package com.ruoyi.driver.mapper; |
| 2 | 2 | ||
| 3 | import com.ruoyi.domain.DriverScheduling; | 3 | import com.ruoyi.domain.DriverScheduling; |
| 4 | -import com.ruoyi.driver.domain.Driver; | ||
| 5 | -import com.ruoyi.pojo.response.ExportReportViewResponseVo; | ||
| 6 | import org.apache.ibatis.annotations.Param; | 4 | import org.apache.ibatis.annotations.Param; |
| 7 | import org.apache.ibatis.annotations.Select; | 5 | import org.apache.ibatis.annotations.Select; |
| 8 | 6 | ||
| @@ -19,7 +17,7 @@ public interface DriverSchedulingMapper { | @@ -19,7 +17,7 @@ public interface DriverSchedulingMapper { | ||
| 19 | void insertRoster(List<DriverScheduling> list); | 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,6 +37,7 @@ import com.ruoyi.service.SchedulingService; | ||
| 37 | import com.ruoyi.service.ThreadJobService; | 37 | import com.ruoyi.service.ThreadJobService; |
| 38 | import com.ruoyi.service.scheduling.LinggangSchedulingService; | 38 | import com.ruoyi.service.scheduling.LinggangSchedulingService; |
| 39 | import com.ruoyi.utils.ConstDateUtil; | 39 | import com.ruoyi.utils.ConstDateUtil; |
| 40 | +import com.ruoyi.utils.DateUtil; | ||
| 40 | import org.apache.commons.collections4.CollectionUtils; | 41 | import org.apache.commons.collections4.CollectionUtils; |
| 41 | import org.apache.commons.io.FilenameUtils; | 42 | import org.apache.commons.io.FilenameUtils; |
| 42 | import org.slf4j.Logger; | 43 | import org.slf4j.Logger; |
| @@ -352,7 +353,7 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme | @@ -352,7 +353,7 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme | ||
| 352 | throw new RuntimeException("只能对当前月的数据进行补签!"); | 353 | throw new RuntimeException("只能对当前月的数据进行补签!"); |
| 353 | } | 354 | } |
| 354 | if (CollectionUtil.isEmpty(dto)) { | 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 | handleSignBody(signIn, driver, globalIndex, now, dto); | 358 | handleSignBody(signIn, driver, globalIndex, now, dto); |
| 358 | signIn.setUpdateBy(SecurityUtils.getUsername()); | 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,6 +8,7 @@ import com.ruoyi.common.cache.NowSchedulingCache; | ||
| 8 | import com.ruoyi.common.cache.SchedulingCache; | 8 | import com.ruoyi.common.cache.SchedulingCache; |
| 9 | import com.ruoyi.common.core.redis.RedisCache; | 9 | import com.ruoyi.common.core.redis.RedisCache; |
| 10 | import com.ruoyi.common.utils.StringUtils; | 10 | import com.ruoyi.common.utils.StringUtils; |
| 11 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | ||
| 11 | import com.ruoyi.driver.domain.Driver; | 12 | import com.ruoyi.driver.domain.Driver; |
| 12 | import com.ruoyi.driver.service.IDriverService; | 13 | import com.ruoyi.driver.service.IDriverService; |
| 13 | import com.ruoyi.equipment.domain.Equipment; | 14 | import com.ruoyi.equipment.domain.Equipment; |
| @@ -23,10 +24,12 @@ import com.ruoyi.service.DriverSchedulingExpandSmartService; | @@ -23,10 +24,12 @@ import com.ruoyi.service.DriverSchedulingExpandSmartService; | ||
| 23 | import com.ruoyi.service.RuleAttendanceMainService; | 24 | import com.ruoyi.service.RuleAttendanceMainService; |
| 24 | import com.ruoyi.service.RuleNumSettingService; | 25 | import com.ruoyi.service.RuleNumSettingService; |
| 25 | import com.ruoyi.service.ThreadJobService; | 26 | import com.ruoyi.service.ThreadJobService; |
| 27 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | ||
| 26 | import com.ruoyi.utils.ConstDateUtil; | 28 | import com.ruoyi.utils.ConstDateUtil; |
| 27 | import com.ruoyi.utils.DateUtil; | 29 | import com.ruoyi.utils.DateUtil; |
| 28 | import com.ruoyi.utils.ListUtils; | 30 | import com.ruoyi.utils.ListUtils; |
| 29 | import lombok.extern.slf4j.Slf4j; | 31 | import lombok.extern.slf4j.Slf4j; |
| 32 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 30 | import org.apache.commons.lang3.time.DateUtils; | 33 | import org.apache.commons.lang3.time.DateUtils; |
| 31 | import org.springframework.beans.BeanUtils; | 34 | import org.springframework.beans.BeanUtils; |
| 32 | import org.springframework.beans.factory.InitializingBean; | 35 | import org.springframework.beans.factory.InitializingBean; |
| @@ -35,6 +38,7 @@ import org.springframework.beans.factory.annotation.Value; | @@ -35,6 +38,7 @@ import org.springframework.beans.factory.annotation.Value; | ||
| 35 | import org.springframework.core.ParameterizedTypeReference; | 38 | import org.springframework.core.ParameterizedTypeReference; |
| 36 | import org.springframework.http.*; | 39 | import org.springframework.http.*; |
| 37 | import org.springframework.stereotype.Component; | 40 | import org.springframework.stereotype.Component; |
| 41 | +import org.springframework.transaction.annotation.Transactional; | ||
| 38 | import org.springframework.web.client.RestTemplate; | 42 | import org.springframework.web.client.RestTemplate; |
| 39 | 43 | ||
| 40 | import javax.annotation.Resource; | 44 | import javax.annotation.Resource; |
| @@ -95,6 +99,8 @@ public class DriverJob implements InitializingBean { | @@ -95,6 +99,8 @@ public class DriverJob implements InitializingBean { | ||
| 95 | 99 | ||
| 96 | @Autowired | 100 | @Autowired |
| 97 | private RuleAttendanceMainService attendanceMainService; | 101 | private RuleAttendanceMainService attendanceMainService; |
| 102 | + @Autowired | ||
| 103 | + private LinggangSchedulingService schedulingService; | ||
| 98 | 104 | ||
| 99 | @Value("${api.url.getDriverInfo}") | 105 | @Value("${api.url.getDriverInfo}") |
| 100 | private String getDriverInfoUrl; | 106 | private String getDriverInfoUrl; |
| @@ -233,21 +239,53 @@ public class DriverJob implements InitializingBean { | @@ -233,21 +239,53 @@ public class DriverJob implements InitializingBean { | ||
| 233 | * 获取排班任务请求 | 239 | * 获取排班任务请求 |
| 234 | * 24小时执行一次 | 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 | long timestamp = System.currentTimeMillis(); | 254 | long timestamp = System.currentTimeMillis(); |
| 239 | Date date = new Date(timeLong); | 255 | Date date = new Date(timeLong); |
| 240 | String formatDate = DateUtil.YYYY_MM_DD.format(date); | 256 | String formatDate = DateUtil.YYYY_MM_DD.format(date); |
| 241 | String timeOut = DateUtil.HH_MM_ss.format(date); | 257 | String timeOut = DateUtil.HH_MM_ss.format(date); |
| 242 | -// String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)); | 258 | + |
| 243 | log.info("获取排班任务触发时间:{}", formatDate); | 259 | log.info("获取排班任务触发时间:{}", formatDate); |
| 244 | // 获取排班请求 | 260 | // 获取排班请求 |
| 245 | String getSchedulingInfoUrl = null; | 261 | String getSchedulingInfoUrl = null; |
| 246 | 262 | ||
| 247 | log.info("开始获取{}的排班数据", formatDate); | 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 | // String url = getSchedulingInfoPlan; | 289 | // String url = getSchedulingInfoPlan; |
| 252 | try { | 290 | try { |
| 253 | getSchedulingInfoUrl = String.format(url, "77", formatDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp)))); | 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,9 +293,11 @@ public class DriverJob implements InitializingBean { | ||
| 255 | throw new RuntimeException(e); | 293 | throw new RuntimeException(e); |
| 256 | } | 294 | } |
| 257 | // 获取排班信息并存入redis | 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 | log.info("获取{}的排班数据完毕", formatDate); | 301 | log.info("获取{}的排班数据完毕", formatDate); |
| 262 | } | 302 | } |
| 263 | 303 | ||
| @@ -350,14 +390,18 @@ public class DriverJob implements InitializingBean { | @@ -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 | List<ResponseSchedulingDto> originSchedulingList = RESTTEMPLATE.exchange( | 395 | List<ResponseSchedulingDto> originSchedulingList = RESTTEMPLATE.exchange( |
| 356 | getSchedulingInfoUrl, | 396 | getSchedulingInfoUrl, |
| 357 | HttpMethod.GET, | 397 | HttpMethod.GET, |
| 358 | null, | 398 | null, |
| 359 | new ParameterizedTypeReference<List<ResponseSchedulingDto>>() { | 399 | new ParameterizedTypeReference<List<ResponseSchedulingDto>>() { |
| 360 | }).getBody(); | 400 | }).getBody(); |
| 401 | + | ||
| 402 | + if (CollectionUtils.isEmpty(originSchedulingList)) { | ||
| 403 | + return null; | ||
| 404 | + } | ||
| 361 | Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200); | 405 | Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200); |
| 362 | // 以员工号为key存入排班集合 | 406 | // 以员工号为key存入排班集合 |
| 363 | originSchedulingList.stream().forEach(item -> { | 407 | originSchedulingList.stream().forEach(item -> { |
| @@ -379,7 +423,7 @@ public class DriverJob implements InitializingBean { | @@ -379,7 +423,7 @@ public class DriverJob implements InitializingBean { | ||
| 379 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); | 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 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); | 428 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); |
| 385 | log.info("拉取排班完毕:{}", dateKey); | 429 | log.info("拉取排班完毕:{}", dateKey); |
| @@ -456,15 +500,15 @@ public class DriverJob implements InitializingBean { | @@ -456,15 +500,15 @@ public class DriverJob implements InitializingBean { | ||
| 456 | Map<String, Driver> driverMap = new HashMap<>(); | 500 | Map<String, Driver> driverMap = new HashMap<>(); |
| 457 | for (Driver driver : drivers) { | 501 | for (Driver driver : drivers) { |
| 458 | if (driverMap.get(driver.getJobCode()) == null) { | 502 | if (driverMap.get(driver.getJobCode()) == null) { |
| 459 | - driverMap.put(driver.getJobCode(),driver); | ||
| 460 | - }else { | 503 | + driverMap.put(driver.getJobCode(), driver); |
| 504 | + } else { | ||
| 461 | System.out.println(driver); | 505 | System.out.println(driver); |
| 462 | } | 506 | } |
| 463 | } | 507 | } |
| 464 | // 过滤出需要更新的driver | 508 | // 过滤出需要更新的driver |
| 465 | List<Driver> updateDriverList = allDriverList.stream() | 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 | .filter(item -> !item.equals(driverMap.get(item.getJobCode()))) | 513 | .filter(item -> !item.equals(driverMap.get(item.getJobCode()))) |
| 470 | .map(item -> { | 514 | .map(item -> { |
Bsth-admin/src/main/java/com/ruoyi/service/ReportService.java
| @@ -26,9 +26,10 @@ import com.ruoyi.pojo.vo.PersonSignDataResponseVo; | @@ -26,9 +26,10 @@ import com.ruoyi.pojo.vo.PersonSignDataResponseVo; | ||
| 26 | import com.ruoyi.system.domain.SysNotice; | 26 | import com.ruoyi.system.domain.SysNotice; |
| 27 | import com.ruoyi.system.service.ISysNoticeService; | 27 | import com.ruoyi.system.service.ISysNoticeService; |
| 28 | import com.ruoyi.utils.ConstDateUtil; | 28 | import com.ruoyi.utils.ConstDateUtil; |
| 29 | +import com.ruoyi.utils.DateUtil; | ||
| 29 | import com.ruoyi.utils.ToolUtils; | 30 | import com.ruoyi.utils.ToolUtils; |
| 30 | import lombok.extern.slf4j.Slf4j; | 31 | import lombok.extern.slf4j.Slf4j; |
| 31 | -import org.quartz.Scheduler; | 32 | +import org.apache.commons.lang3.time.DateUtils; |
| 32 | import org.springframework.beans.BeanUtils; | 33 | import org.springframework.beans.BeanUtils; |
| 33 | import org.springframework.beans.factory.annotation.Autowired; | 34 | import org.springframework.beans.factory.annotation.Autowired; |
| 34 | import org.springframework.stereotype.Service; | 35 | import org.springframework.stereotype.Service; |
| @@ -39,6 +40,7 @@ import javax.servlet.http.HttpServletResponse; | @@ -39,6 +40,7 @@ import javax.servlet.http.HttpServletResponse; | ||
| 39 | import javax.validation.constraints.NotBlank; | 40 | import javax.validation.constraints.NotBlank; |
| 40 | import java.io.OutputStream; | 41 | import java.io.OutputStream; |
| 41 | import java.math.BigDecimal; | 42 | import java.math.BigDecimal; |
| 43 | +import java.text.ParseException; | ||
| 42 | import java.time.LocalDate; | 44 | import java.time.LocalDate; |
| 43 | import java.time.YearMonth; | 45 | import java.time.YearMonth; |
| 44 | import java.time.format.DateTimeFormatter; | 46 | import java.time.format.DateTimeFormatter; |
| @@ -265,7 +267,13 @@ public class ReportService { | @@ -265,7 +267,13 @@ public class ReportService { | ||
| 265 | } | 267 | } |
| 266 | 268 | ||
| 267 | private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date) { | 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 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | 277 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 270 | List<ExportReportViewResponseVo> signVo = new ArrayList<>(800); | 278 | List<ExportReportViewResponseVo> signVo = new ArrayList<>(800); |
| 271 | handlerResultMap(date, resultMap, schedulingList); | 279 | handlerResultMap(date, resultMap, schedulingList); |
| @@ -358,7 +366,13 @@ public class ReportService { | @@ -358,7 +366,13 @@ public class ReportService { | ||
| 358 | 366 | ||
| 359 | public List<ReportDetailResponseVo> getReportDetail(ReportViewRequestVo vo, HttpServletResponse response) { | 367 | public List<ReportDetailResponseVo> getReportDetail(ReportViewRequestVo vo, HttpServletResponse response) { |
| 360 | List<ReportDetailResponseVo> responseVos = new ArrayList<>(); | 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 | for (DriverScheduling scheduling : toDay) { | 376 | for (DriverScheduling scheduling : toDay) { |
| 363 | ToolUtils.updateReport(scheduling); | 377 | ToolUtils.updateReport(scheduling); |
| 364 | ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo(); | 378 | ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo(); |
Bsth-admin/src/main/java/com/ruoyi/service/SchedulingService.java
| @@ -3,28 +3,32 @@ package com.ruoyi.service; | @@ -3,28 +3,32 @@ package com.ruoyi.service; | ||
| 3 | import cn.hutool.core.collection.CollectionUtil; | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | import com.ruoyi.common.cache.NowSchedulingCache; | 4 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 5 | import com.ruoyi.common.utils.DateUtils; | 5 | import com.ruoyi.common.utils.DateUtils; |
| 6 | +import com.ruoyi.domain.DriverScheduling; | ||
| 7 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | ||
| 6 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; | 8 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 7 | import com.ruoyi.in.domain.SignIn; | 9 | import com.ruoyi.in.domain.SignIn; |
| 8 | import com.ruoyi.in.mapper.SignInMapper; | 10 | import com.ruoyi.in.mapper.SignInMapper; |
| 9 | import com.ruoyi.in.service.impl.SignInServiceImpl; | 11 | import com.ruoyi.in.service.impl.SignInServiceImpl; |
| 10 | import com.ruoyi.pojo.DriverSignInRecommendation; | 12 | import com.ruoyi.pojo.DriverSignInRecommendation; |
| 11 | import com.ruoyi.pojo.GlobalIndex; | 13 | import com.ruoyi.pojo.GlobalIndex; |
| 12 | -import com.ruoyi.domain.DriverScheduling; | ||
| 13 | import com.ruoyi.pojo.request.ReportViewRequestVo; | 14 | import com.ruoyi.pojo.request.ReportViewRequestVo; |
| 14 | import com.ruoyi.pojo.response.ReportViewResponseVo; | 15 | import com.ruoyi.pojo.response.ReportViewResponseVo; |
| 16 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | ||
| 15 | import com.ruoyi.utils.ConstDateUtil; | 17 | import com.ruoyi.utils.ConstDateUtil; |
| 18 | +import com.ruoyi.utils.DateUtil; | ||
| 16 | import com.ruoyi.utils.ToolUtils; | 19 | import com.ruoyi.utils.ToolUtils; |
| 20 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 17 | import org.springframework.beans.BeanUtils; | 21 | import org.springframework.beans.BeanUtils; |
| 18 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 20 | 24 | ||
| 21 | import javax.annotation.Resource; | 25 | import javax.annotation.Resource; |
| 22 | import javax.servlet.http.HttpServletResponse; | 26 | import javax.servlet.http.HttpServletResponse; |
| 23 | -import java.time.LocalDate; | 27 | +import java.text.ParseException; |
| 24 | import java.time.LocalDateTime; | 28 | import java.time.LocalDateTime; |
| 25 | -import java.time.YearMonth; | ||
| 26 | import java.time.temporal.ChronoUnit; | 29 | import java.time.temporal.ChronoUnit; |
| 27 | import java.util.*; | 30 | import java.util.*; |
| 31 | +import java.util.stream.Collectors; | ||
| 28 | 32 | ||
| 29 | import static com.ruoyi.common.ConstDriverProperties.*; | 33 | import static com.ruoyi.common.ConstDriverProperties.*; |
| 30 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; | 34 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; |
| @@ -46,6 +50,8 @@ public class SchedulingService { | @@ -46,6 +50,8 @@ public class SchedulingService { | ||
| 46 | 50 | ||
| 47 | @Autowired | 51 | @Autowired |
| 48 | private SignInMapper signInMapper; | 52 | private SignInMapper signInMapper; |
| 53 | + @Autowired | ||
| 54 | + private LinggangSchedulingService schedulingService; | ||
| 49 | 55 | ||
| 50 | 56 | ||
| 51 | /** | 57 | /** |
| @@ -60,6 +66,22 @@ public class SchedulingService { | @@ -60,6 +66,22 @@ public class SchedulingService { | ||
| 60 | List<DriverScheduling> dto = null; | 66 | List<DriverScheduling> dto = null; |
| 61 | for (int i = 0; i > -2; i--) { | 67 | for (int i = 0; i > -2; i--) { |
| 62 | dto = nowSchedulingCache.getCacheSchedulingMapValueByHKey(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)), jobCode); | 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 | if (!CollectionUtil.isEmpty(dto)) { | 85 | if (!CollectionUtil.isEmpty(dto)) { |
| 64 | dto.sort(Comparator.comparing(DriverScheduling::getZdsjT)); | 86 | dto.sort(Comparator.comparing(DriverScheduling::getZdsjT)); |
| 65 | if (i == -1) { | 87 | if (i == -1) { |
| @@ -235,8 +257,14 @@ public class SchedulingService { | @@ -235,8 +257,14 @@ public class SchedulingService { | ||
| 235 | 257 | ||
| 236 | 258 | ||
| 237 | private List<ReportViewResponseVo> getDayReportTableResponseVo(ReportViewRequestVo vo) { | 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 | toDay.sort(Comparator.comparing(DriverScheduling::getFcsjT)); | 268 | toDay.sort(Comparator.comparing(DriverScheduling::getFcsjT)); |
| 241 | // 转换日期 + jobCode为key | 269 | // 转换日期 + jobCode为key |
| 242 | Map<String, List<DriverScheduling>> orangeMap = new HashMap<>(1200); | 270 | Map<String, List<DriverScheduling>> orangeMap = new HashMap<>(1200); |
| @@ -325,7 +353,13 @@ public class SchedulingService { | @@ -325,7 +353,13 @@ public class SchedulingService { | ||
| 325 | } | 353 | } |
| 326 | 354 | ||
| 327 | public List<DriverScheduling> queryToDay(String date) { | 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,6 +16,7 @@ import com.ruoyi.config.domain.LineConfig; | ||
| 16 | import com.ruoyi.config.service.ILineConfigService; | 16 | import com.ruoyi.config.service.ILineConfigService; |
| 17 | import com.ruoyi.domain.DriverScheduling; | 17 | import com.ruoyi.domain.DriverScheduling; |
| 18 | import com.ruoyi.domain.RuleAttendanceMain; | 18 | import com.ruoyi.domain.RuleAttendanceMain; |
| 19 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | ||
| 19 | import com.ruoyi.domain.sign.in.exception.report.EquipmentExceptionReport; | 20 | import com.ruoyi.domain.sign.in.exception.report.EquipmentExceptionReport; |
| 20 | import com.ruoyi.driver.domain.Driver; | 21 | import com.ruoyi.driver.domain.Driver; |
| 21 | import com.ruoyi.driver.mapper.DriverMapper; | 22 | import com.ruoyi.driver.mapper.DriverMapper; |
| @@ -32,12 +33,15 @@ import com.ruoyi.job.DriverJob; | @@ -32,12 +33,15 @@ import com.ruoyi.job.DriverJob; | ||
| 32 | import com.ruoyi.pojo.GlobalIndex; | 33 | import com.ruoyi.pojo.GlobalIndex; |
| 33 | import com.ruoyi.pojo.response.ResponseSchedulingDto; | 34 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 34 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; | 35 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; |
| 36 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | ||
| 35 | import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportService; | 37 | import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportService; |
| 36 | import com.ruoyi.system.domain.SysNotice; | 38 | import com.ruoyi.system.domain.SysNotice; |
| 37 | import com.ruoyi.system.service.ISysNoticeService; | 39 | import com.ruoyi.system.service.ISysNoticeService; |
| 38 | import com.ruoyi.utils.ConstDateUtil; | 40 | import com.ruoyi.utils.ConstDateUtil; |
| 39 | import com.ruoyi.utils.DateUtil; | 41 | import com.ruoyi.utils.DateUtil; |
| 40 | import lombok.extern.slf4j.Slf4j; | 42 | import lombok.extern.slf4j.Slf4j; |
| 43 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 44 | +import org.apache.commons.collections4.MapUtils; | ||
| 41 | import org.springframework.beans.BeanUtils; | 45 | import org.springframework.beans.BeanUtils; |
| 42 | import org.springframework.beans.factory.annotation.Autowired; | 46 | import org.springframework.beans.factory.annotation.Autowired; |
| 43 | import org.springframework.beans.factory.annotation.Value; | 47 | import org.springframework.beans.factory.annotation.Value; |
| @@ -103,6 +107,9 @@ public class ThreadJobService { | @@ -103,6 +107,9 @@ public class ThreadJobService { | ||
| 103 | @Autowired | 107 | @Autowired |
| 104 | private RuleAttendanceMainService attendanceMainService; | 108 | private RuleAttendanceMainService attendanceMainService; |
| 105 | 109 | ||
| 110 | + @Autowired | ||
| 111 | + private LinggangSchedulingService schedulingService; | ||
| 112 | + | ||
| 106 | 113 | ||
| 107 | @Autowired | 114 | @Autowired |
| 108 | private PlatformTransactionManager transactionManager; | 115 | private PlatformTransactionManager transactionManager; |
| @@ -199,8 +206,8 @@ public class ThreadJobService { | @@ -199,8 +206,8 @@ public class ThreadJobService { | ||
| 199 | sendNotice(signIn, driver, dto, globalIndex); | 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 | exceptionReport.setSignId(signIn.getId()); | 211 | exceptionReport.setSignId(signIn.getId()); |
| 205 | equipmentExceptionReportService.save(exceptionReport); | 212 | equipmentExceptionReportService.save(exceptionReport); |
| 206 | } | 213 | } |
| @@ -409,10 +416,18 @@ public class ThreadJobService { | @@ -409,10 +416,18 @@ public class ThreadJobService { | ||
| 409 | */ | 416 | */ |
| 410 | @Async | 417 | @Async |
| 411 | @Transactional(rollbackFor = {Exception.class}) | 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 | if ((CollectionUtil.isNotEmpty(dto) && CollectionUtil.isNotEmpty(bcList)) || originSchedulingMap.size() == 0) { | 432 | if ((CollectionUtil.isNotEmpty(dto) && CollectionUtil.isNotEmpty(bcList)) || originSchedulingMap.size() == 0) { |
| 418 | log.info("调度最新数据:{},当天获取数据:{},时间:[{}]", originSchedulingMap.size(),bcList.size(),date); | 433 | log.info("调度最新数据:{},当天获取数据:{},时间:[{}]", originSchedulingMap.size(),bcList.size(),date); |
| @@ -420,15 +435,52 @@ public class ThreadJobService { | @@ -420,15 +435,52 @@ public class ThreadJobService { | ||
| 420 | } | 435 | } |
| 421 | // TODO maybe delete | 436 | // TODO maybe delete |
| 422 | TempCache.resetMapStatus(); | 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 | String dateStr1 = DateUtil.YYYY_MM_DD_LINK.format(date); | 481 | String dateStr1 = DateUtil.YYYY_MM_DD_LINK.format(date); |
| 430 | // 异常数据过多,不通过自增获取id再次查询获取 | 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 | String dateStr = DateUtil.YYYY_MM_DD.format(date); | 485 | String dateStr = DateUtil.YYYY_MM_DD.format(date); |
| 434 | if (!CollectionUtil.isEmpty(bcList)) { | 486 | if (!CollectionUtil.isEmpty(bcList)) { |
| @@ -445,7 +497,12 @@ public class ThreadJobService { | @@ -445,7 +497,12 @@ public class ThreadJobService { | ||
| 445 | log.info("当天排班数据获取完毕,共:{}条", bcList.size()); | 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 | QueryWrapper<RuleAttendanceMain> qw = new QueryWrapper<>(); | 506 | QueryWrapper<RuleAttendanceMain> qw = new QueryWrapper<>(); |
| 450 | qw.lambda() | 507 | qw.lambda() |
| 451 | .eq(RuleAttendanceMain::getWorkFlag, WORK_FLAG) | 508 | .eq(RuleAttendanceMain::getWorkFlag, WORK_FLAG) |
| @@ -459,6 +516,7 @@ public class ThreadJobService { | @@ -459,6 +516,7 @@ public class ThreadJobService { | ||
| 459 | scheduling.setBcType(BC_TYPE_OUT); | 516 | scheduling.setBcType(BC_TYPE_OUT); |
| 460 | scheduling.setZdsjT(ruleAttendanceMain.getFirstWorkSignInTime().getTime()); | 517 | scheduling.setZdsjT(ruleAttendanceMain.getFirstWorkSignInTime().getTime()); |
| 461 | scheduling.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | 518 | scheduling.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); |
| 519 | + scheduling.setType(type); | ||
| 462 | bcList.add(scheduling); | 520 | bcList.add(scheduling); |
| 463 | 521 | ||
| 464 | DriverScheduling scheduling1 = getDriverScheduling(ruleAttendanceMain); | 522 | DriverScheduling scheduling1 = getDriverScheduling(ruleAttendanceMain); |
| @@ -466,6 +524,7 @@ public class ThreadJobService { | @@ -466,6 +524,7 @@ public class ThreadJobService { | ||
| 466 | scheduling1.setZdsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); | 524 | scheduling1.setZdsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); |
| 467 | scheduling1.setFcsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); | 525 | scheduling1.setFcsjT(ruleAttendanceMain.getFirstQuittingSignInTime().getTime()); |
| 468 | scheduling1.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | 526 | scheduling1.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); |
| 527 | + scheduling1.setType(type); | ||
| 469 | bcList.add(scheduling1); | 528 | bcList.add(scheduling1); |
| 470 | // 第二段 | 529 | // 第二段 |
| 471 | if (!Objects.isNull(ruleAttendanceMain.getSecondWorkSignInTime())) { | 530 | if (!Objects.isNull(ruleAttendanceMain.getSecondWorkSignInTime())) { |
| @@ -474,6 +533,7 @@ public class ThreadJobService { | @@ -474,6 +533,7 @@ public class ThreadJobService { | ||
| 474 | scheduling2.setFcsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); | 533 | scheduling2.setFcsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); |
| 475 | scheduling2.setZdsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); | 534 | scheduling2.setZdsjT(ruleAttendanceMain.getSecondWorkSignInTime().getTime()); |
| 476 | scheduling2.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | 535 | scheduling2.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); |
| 536 | + scheduling2.setType(type); | ||
| 477 | bcList.add(scheduling2); | 537 | bcList.add(scheduling2); |
| 478 | 538 | ||
| 479 | DriverScheduling scheduling3 = getDriverScheduling(ruleAttendanceMain); | 539 | DriverScheduling scheduling3 = getDriverScheduling(ruleAttendanceMain); |
| @@ -481,6 +541,7 @@ public class ThreadJobService { | @@ -481,6 +541,7 @@ public class ThreadJobService { | ||
| 481 | scheduling3.setFcsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); | 541 | scheduling3.setFcsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); |
| 482 | scheduling3.setZdsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); | 542 | scheduling3.setZdsjT(ruleAttendanceMain.getSecondQuittingSignInTime().getTime()); |
| 483 | scheduling3.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); | 543 | scheduling3.setScheduleDate(ruleAttendanceMain.getSchedulingDate()); |
| 544 | + scheduling3.setType(type); | ||
| 484 | bcList.add(scheduling3); | 545 | bcList.add(scheduling3); |
| 485 | } | 546 | } |
| 486 | } | 547 | } |
| @@ -515,7 +576,7 @@ public class ThreadJobService { | @@ -515,7 +576,7 @@ public class ThreadJobService { | ||
| 515 | return scheduling; | 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 | List<DriverScheduling> bcList = new ArrayList<>(1000); | 580 | List<DriverScheduling> bcList = new ArrayList<>(1000); |
| 520 | Map<String, LineConfig> configMap = lineConfigService.selectLineConfigList(null).stream().collect(Collectors.toMap(item -> item.getLineName() + item.getLpName(), item -> item)); | 581 | Map<String, LineConfig> configMap = lineConfigService.selectLineConfigList(null).stream().collect(Collectors.toMap(item -> item.getLineName() + item.getLpName(), item -> item)); |
| 521 | for (String key : originSchedulingMap.keySet()) { | 582 | for (String key : originSchedulingMap.keySet()) { |
| @@ -534,7 +595,7 @@ public class ThreadJobService { | @@ -534,7 +595,7 @@ public class ThreadJobService { | ||
| 534 | 595 | ||
| 535 | if (CollectionUtil.isNotEmpty(nowScheduling)) { | 596 | if (CollectionUtil.isNotEmpty(nowScheduling)) { |
| 536 | // 配置处理 | 597 | // 配置处理 |
| 537 | - nowScheduling = handlerScheduler(configMap, schedulingList, nowScheduling); | 598 | + nowScheduling = handlerScheduler(configMap, schedulingList, nowScheduling, type); |
| 538 | // ------|特殊处理|------ | 599 | // ------|特殊处理|------ |
| 539 | try { | 600 | try { |
| 540 | DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1); | 601 | DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1); |
| @@ -564,10 +625,10 @@ public class ThreadJobService { | @@ -564,10 +625,10 @@ public class ThreadJobService { | ||
| 564 | * @param nowScheduling | 625 | * @param nowScheduling |
| 565 | * @return | 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 | if (nowScheduling.size() % 2 == 1 && nowScheduling.size() > 2) { | 630 | if (nowScheduling.size() % 2 == 1 && nowScheduling.size() > 2) { |
| 570 | - nowScheduling = handleErrorBc(schedulingList); | 631 | + nowScheduling = handleErrorBc(schedulingList, type); |
| 571 | } | 632 | } |
| 572 | 633 | ||
| 573 | // TODO 遍历配置表数据 | 634 | // TODO 遍历配置表数据 |
| @@ -749,12 +810,12 @@ public class ThreadJobService { | @@ -749,12 +810,12 @@ public class ThreadJobService { | ||
| 749 | return errorJobcode; | 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 | nowScheduling = nowScheduling.stream().filter(item -> BC_TYPE_IN.equals(item.getBcType()) || BC_TYPE_OUT.equals(item.getBcType())).collect(Collectors.toList()); | 819 | nowScheduling = nowScheduling.stream().filter(item -> BC_TYPE_IN.equals(item.getBcType()) || BC_TYPE_OUT.equals(item.getBcType())).collect(Collectors.toList()); |
| 759 | if (nowScheduling.get(nowScheduling.size() - 1).getBcType().equals(BC_TYPE_IN)) { | 820 | if (nowScheduling.get(nowScheduling.size() - 1).getBcType().equals(BC_TYPE_IN)) { |
| 760 | // 连续的进场 判断哪个适配 | 821 | // 连续的进场 判断哪个适配 |
| @@ -772,6 +833,7 @@ public class ThreadJobService { | @@ -772,6 +833,7 @@ public class ThreadJobService { | ||
| 772 | return nowScheduling.stream().map(item -> { | 833 | return nowScheduling.stream().map(item -> { |
| 773 | DriverScheduling scheduling = new DriverScheduling(); | 834 | DriverScheduling scheduling = new DriverScheduling(); |
| 774 | BeanUtils.copyProperties(item, scheduling); | 835 | BeanUtils.copyProperties(item, scheduling); |
| 836 | + scheduling.setType(type); | ||
| 775 | return scheduling; | 837 | return scheduling; |
| 776 | }).collect(Collectors.toList()); | 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,7 +21,9 @@ import com.ruoyi.service.RuleAttendanceMainHelpService; | ||
| 21 | import com.ruoyi.service.RuleAttendanceMainService; | 21 | import com.ruoyi.service.RuleAttendanceMainService; |
| 22 | import com.ruoyi.service.RuleNumSettingService; | 22 | import com.ruoyi.service.RuleNumSettingService; |
| 23 | import com.ruoyi.utils.ConstDateUtil; | 23 | import com.ruoyi.utils.ConstDateUtil; |
| 24 | +import com.ruoyi.utils.DateUtil; | ||
| 24 | import com.ruoyi.utils.ToolUtils; | 25 | import com.ruoyi.utils.ToolUtils; |
| 26 | +import org.apache.commons.lang3.time.DateUtils; | ||
| 25 | import org.slf4j.Logger; | 27 | import org.slf4j.Logger; |
| 26 | import org.slf4j.LoggerFactory; | 28 | import org.slf4j.LoggerFactory; |
| 27 | import org.springframework.beans.BeanUtils; | 29 | import org.springframework.beans.BeanUtils; |
| @@ -321,7 +323,7 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, | @@ -321,7 +323,7 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, | ||
| 321 | public void manualAddBcCache() { | 323 | public void manualAddBcCache() { |
| 322 | List<DriverScheduling> bcList = handleOtherPostsScheduling(); | 324 | List<DriverScheduling> bcList = handleOtherPostsScheduling(); |
| 323 | schedulingMapper.insertRoster(bcList); | 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 | String date = ConstDateUtil.formatDate(new Date()); | 327 | String date = ConstDateUtil.formatDate(new Date()); |
| 326 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | 328 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 327 | NowSchedulingCache.handlerResultMap(resultMap, bcList); | 329 | NowSchedulingCache.handlerResultMap(resultMap, bcList); |
Bsth-admin/src/main/resources/application-druid-devTest.yml
| @@ -137,7 +137,7 @@ ruoyi: | @@ -137,7 +137,7 @@ ruoyi: | ||
| 137 | # 实例演示开关 | 137 | # 实例演示开关 |
| 138 | demoEnabled: true | 138 | demoEnabled: true |
| 139 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) | 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 | # 获取ip地址开关 | 141 | # 获取ip地址开关 |
| 142 | addressEnabled: false | 142 | addressEnabled: false |
| 143 | # 验证码类型 math 数字计算 char 字符验证 | 143 | # 验证码类型 math 数字计算 char 字符验证 |
Bsth-admin/src/main/resources/mapper/driver_scheduling/DriverSchedulingMapper.xml
| @@ -37,12 +37,12 @@ | @@ -37,12 +37,12 @@ | ||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | <insert id="insertRoster" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> | 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 | values | 41 | values |
| 42 | <foreach collection="list" item="item" separator=","> | 42 | <foreach collection="list" item="item" separator=","> |
| 43 | ( | 43 | ( |
| 44 | #{item.scheduleDate}, #{item.lineName}, #{item.jobCode}, #{item.name}, #{item.posts}, #{item.lpName}, #{item.nbbm}, | 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 | </foreach> | 47 | </foreach> |
| 48 | on duplicate key update | 48 | on duplicate key update |
| @@ -79,10 +79,10 @@ | @@ -79,10 +79,10 @@ | ||
| 79 | <if test="lineName !=null and lineName != ''"> | 79 | <if test="lineName !=null and lineName != ''"> |
| 80 | and scheduling.line_name like concat('%', #{lineName}, '%') | 80 | and scheduling.line_name like concat('%', #{lineName}, '%') |
| 81 | </if> | 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 | </if> | 84 | </if> |
| 85 | - and scheduling.type = 1 | 85 | + and (scheduling.scheduling_type = 1 or scheduling.scheduling_type is null) |
| 86 | </where> | 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,6 +9,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; | ||
| 9 | 9 | ||
| 10 | import javax.validation.constraints.NotBlank; | 10 | import javax.validation.constraints.NotBlank; |
| 11 | import javax.validation.constraints.Size; | 11 | import javax.validation.constraints.Size; |
| 12 | +import java.util.Objects; | ||
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| 14 | * 字典数据表 sys_dict_data | 15 | * 字典数据表 sys_dict_data |
| @@ -99,12 +100,16 @@ public class SysDictData extends BaseEntity { | @@ -99,12 +100,16 @@ public class SysDictData extends BaseEntity { | ||
| 99 | this.dictLabel = dictLabel; | 100 | this.dictLabel = dictLabel; |
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | - @NotBlank(message = "字典键值不能为空") | ||
| 103 | - @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") | ||
| 104 | public Object getDictValue() { | 103 | public Object getDictValue() { |
| 105 | return dictValue; | 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 | public void setDictValue(Object dictValue) { | 113 | public void setDictValue(Object dictValue) { |
| 109 | this.dictValue = dictValue; | 114 | this.dictValue = dictValue; |
| 110 | } | 115 | } |