Commit fc89a99bfa4f2896a061233bf4a7aaefa4a00f9d
1 parent
2f206ef0
酒测未通过审核
Showing
8 changed files
with
92 additions
and
15 deletions
Bsth-admin/src/main/java/com/ruoyi/common/TipEnum.java
| @@ -23,7 +23,7 @@ public enum TipEnum { | @@ -23,7 +23,7 @@ public enum TipEnum { | ||
| 23 | TIP_201(201, "Created"), | 23 | TIP_201(201, "Created"), |
| 24 | 24 | ||
| 25 | TIP_401(401, "Unauthorized"), | 25 | TIP_401(401, "Unauthorized"), |
| 26 | - TIP_403(401, "Forbidden"), | 26 | + TIP_403(403, "Forbidden"), |
| 27 | TIP_404(404, "Not Found"), | 27 | TIP_404(404, "Not Found"), |
| 28 | 28 | ||
| 29 | TIP_500(500, "ERROR"), | 29 | TIP_500(500, "ERROR"), |
Bsth-admin/src/main/java/com/ruoyi/controller/RefreshController.java
| 1 | package com.ruoyi.controller; | 1 | package com.ruoyi.controller; |
| 2 | 2 | ||
| 3 | import com.ruoyi.common.core.domain.ResponseResult; | 3 | import com.ruoyi.common.core.domain.ResponseResult; |
| 4 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | ||
| 4 | import com.ruoyi.job.DriverJob; | 5 | import com.ruoyi.job.DriverJob; |
| 5 | import com.ruoyi.service.driver.NewDriverService; | 6 | import com.ruoyi.service.driver.NewDriverService; |
| 6 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; | 7 | import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; |
| 8 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | ||
| 9 | +import com.ruoyi.utils.DateUtil; | ||
| 7 | import io.swagger.annotations.ApiOperation; | 10 | import io.swagger.annotations.ApiOperation; |
| 8 | import org.apache.commons.lang3.time.DateUtils; | 11 | import org.apache.commons.lang3.time.DateUtils; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -12,7 +15,11 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -12,7 +15,11 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 15 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | import org.springframework.web.bind.annotation.RestController; | 16 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 17 | ||
| 18 | +import java.text.ParseException; | ||
| 15 | import java.util.Date; | 19 | import java.util.Date; |
| 20 | +import java.util.List; | ||
| 21 | +import java.util.Set; | ||
| 22 | +import java.util.stream.Collectors; | ||
| 16 | 23 | ||
| 17 | /** | 24 | /** |
| 18 | * @author liujun | 25 | * @author liujun |
| @@ -27,6 +34,8 @@ public class RefreshController { | @@ -27,6 +34,8 @@ public class RefreshController { | ||
| 27 | private LinggangKeyWorkLocationService keyWorkLocationService; | 34 | private LinggangKeyWorkLocationService keyWorkLocationService; |
| 28 | @Autowired | 35 | @Autowired |
| 29 | private NewDriverService newDriverService; | 36 | private NewDriverService newDriverService; |
| 37 | + @Autowired | ||
| 38 | + private LinggangSchedulingService linggangSchedulingService; | ||
| 30 | 39 | ||
| 31 | @GetMapping(value = "/scheduling") | 40 | @GetMapping(value = "/scheduling") |
| 32 | @ApiOperation("scheduling") | 41 | @ApiOperation("scheduling") |
| @@ -41,8 +50,17 @@ public class RefreshController { | @@ -41,8 +50,17 @@ public class RefreshController { | ||
| 41 | 50 | ||
| 42 | @GetMapping(value = "/key/info/local") | 51 | @GetMapping(value = "/key/info/local") |
| 43 | @ApiOperation("/key/info/local") | 52 | @ApiOperation("/key/info/local") |
| 44 | - public ResponseResult<Boolean> testKeyInfoLocal(@RequestParam("dateStr") String dateStr) { | ||
| 45 | - keyWorkLocationService.insertJob(dateStr); | 53 | + public ResponseResult<Boolean> testKeyInfoLocal(@RequestParam("dateStr") String dateStr) throws ParseException { |
| 54 | + Date date = DateUtil.YYYY_MM_DD_LINK.parse(dateStr); | ||
| 55 | + | ||
| 56 | + LinggangScheduling scheduling = new LinggangScheduling(); | ||
| 57 | + scheduling.setStartScheduleDate(DateUtil.shortDate(date)); | ||
| 58 | + scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); | ||
| 59 | + scheduling.setType(100); | ||
| 60 | + | ||
| 61 | + List<LinggangScheduling> linggangSchedulings = linggangSchedulingService.list(scheduling); | ||
| 62 | + Set<Long> idSets = linggangSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); | ||
| 63 | + keyWorkLocationService.insertJob(dateStr, idSets); | ||
| 46 | return ResponseResult.success(); | 64 | return ResponseResult.success(); |
| 47 | } | 65 | } |
| 48 | 66 |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/driver/dto/GetBeforeWorkListDTO.java
| @@ -22,6 +22,8 @@ public class GetBeforeWorkListDTO implements java.io.Serializable { | @@ -22,6 +22,8 @@ public class GetBeforeWorkListDTO implements java.io.Serializable { | ||
| 22 | 22 | ||
| 23 | private static final long serialVersionUID = -19813580197166104L; | 23 | private static final long serialVersionUID = -19813580197166104L; |
| 24 | 24 | ||
| 25 | + private String device; | ||
| 26 | + | ||
| 25 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 27 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 26 | @ApiModelProperty(value = "酒测时间") | 28 | @ApiModelProperty(value = "酒测时间") |
| 27 | private Date checkTime; | 29 | private Date checkTime; |
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.common.utils.spring.SpringUtils; | ||
| 11 | import com.ruoyi.domain.scheduling.LinggangScheduling; | 12 | import com.ruoyi.domain.scheduling.LinggangScheduling; |
| 12 | import com.ruoyi.driver.domain.Driver; | 13 | import com.ruoyi.driver.domain.Driver; |
| 13 | import com.ruoyi.driver.service.IDriverService; | 14 | import com.ruoyi.driver.service.IDriverService; |
| @@ -15,6 +16,7 @@ import com.ruoyi.equipment.domain.Equipment; | @@ -15,6 +16,7 @@ import com.ruoyi.equipment.domain.Equipment; | ||
| 15 | import com.ruoyi.equipment.mapper.EquipmentMapper; | 16 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 16 | import com.ruoyi.expand.domain.DriverSchedulingExpand; | 17 | import com.ruoyi.expand.domain.DriverSchedulingExpand; |
| 17 | import com.ruoyi.expand.mapper.DriverSchedulingExpandMapper; | 18 | import com.ruoyi.expand.mapper.DriverSchedulingExpandMapper; |
| 19 | +import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; | ||
| 18 | import com.ruoyi.pojo.request.PersonnelRequestVo; | 20 | import com.ruoyi.pojo.request.PersonnelRequestVo; |
| 19 | import com.ruoyi.pojo.request.TokenRequestVo; | 21 | import com.ruoyi.pojo.request.TokenRequestVo; |
| 20 | import com.ruoyi.pojo.response.ResponseSchedulingDto; | 22 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| @@ -242,6 +244,7 @@ public class DriverJob implements InitializingBean { | @@ -242,6 +244,7 @@ public class DriverJob implements InitializingBean { | ||
| 242 | @Transactional(rollbackFor = Exception.class) | 244 | @Transactional(rollbackFor = Exception.class) |
| 243 | public void getSchedulingInfo() { | 245 | public void getSchedulingInfo() { |
| 244 | Date date = new Date(); | 246 | Date date = new Date(); |
| 247 | + JwtAuthenticationTokenFilter.putMDC("job",JwtAuthenticationTokenFilter.getRequestIdOfMDCValue()); | ||
| 245 | for (int i = 0; i < 2; i++) { | 248 | for (int i = 0; i < 2; i++) { |
| 246 | runScheduling(DateUtils.addDays(date, i).getTime()); | 249 | runScheduling(DateUtils.addDays(date, i).getTime()); |
| 247 | } | 250 | } |
| @@ -269,31 +272,35 @@ public class DriverJob implements InitializingBean { | @@ -269,31 +272,35 @@ public class DriverJob implements InitializingBean { | ||
| 269 | scheduling.setStartScheduleDate(DateUtil.shortDate(date)); | 272 | scheduling.setStartScheduleDate(DateUtil.shortDate(date)); |
| 270 | scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); | 273 | scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); |
| 271 | scheduling.setType(type); | 274 | scheduling.setType(type); |
| 275 | + if(Objects.isNull(schedulingService)){ | ||
| 276 | + schedulingService = SpringUtils.getBean(LinggangSchedulingService.class); | ||
| 277 | + } | ||
| 272 | Integer count = schedulingService.countId(scheduling); | 278 | Integer count = schedulingService.countId(scheduling); |
| 273 | if (Objects.nonNull(count) && count > 0) { | 279 | if (Objects.nonNull(count) && count > 0) { |
| 274 | log.info("[{}]排班数据已经存在", date); | 280 | log.info("[{}]排班数据已经存在", date); |
| 275 | return; | 281 | return; |
| 276 | } | 282 | } |
| 277 | 283 | ||
| 278 | - | 284 | + Set<Long> idSets = null; |
| 279 | if (isSameDay) { | 285 | if (isSameDay) { |
| 280 | scheduling.setType(100); | 286 | scheduling.setType(100); |
| 281 | List<LinggangScheduling> linggangSchedulings = schedulingService.list(scheduling); | 287 | 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); | 288 | + idSets = linggangSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); |
| 289 | + if (CollectionUtils.isNotEmpty(idSets)) { | ||
| 290 | + schedulingService.removeByIds(idSets); | ||
| 285 | } | 291 | } |
| 286 | } | 292 | } |
| 287 | 293 | ||
| 288 | 294 | ||
| 289 | // String url = getSchedulingInfoPlan; | 295 | // String url = getSchedulingInfoPlan; |
| 290 | try { | 296 | try { |
| 297 | + log.info("url:[{}];formatDate:[{}];timestamp:[{}]",url,formatDate,timestamp); | ||
| 291 | getSchedulingInfoUrl = String.format(url, "77", formatDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp)))); | 298 | getSchedulingInfoUrl = String.format(url, "77", formatDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp)))); |
| 292 | } catch (Exception e) { | 299 | } catch (Exception e) { |
| 293 | throw new RuntimeException(e); | 300 | throw new RuntimeException(e); |
| 294 | } | 301 | } |
| 295 | // 获取排班信息并存入redis | 302 | // 获取排班信息并存入redis |
| 296 | - saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut, date, type); | 303 | + saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut, date, type,idSets); |
| 297 | // 删除两天前排班信息 | 304 | // 删除两天前排班信息 |
| 298 | if (isSameDay) { | 305 | if (isSameDay) { |
| 299 | deleteScheduling(); | 306 | deleteScheduling(); |
| @@ -390,7 +397,7 @@ public class DriverJob implements InitializingBean { | @@ -390,7 +397,7 @@ public class DriverJob implements InitializingBean { | ||
| 390 | } | 397 | } |
| 391 | 398 | ||
| 392 | 399 | ||
| 393 | - public Map<String, List<ResponseSchedulingDto>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey, String timeOut, Date date, int type) { | 400 | + public Map<String, List<ResponseSchedulingDto>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey, String timeOut, Date date, int type,Set<Long> idSets) { |
| 394 | log.info("开始拉取排班:{};[{}]", dateKey, getSchedulingInfoUrl); | 401 | log.info("开始拉取排班:{};[{}]", dateKey, getSchedulingInfoUrl); |
| 395 | List<ResponseSchedulingDto> originSchedulingList = RESTTEMPLATE.exchange( | 402 | List<ResponseSchedulingDto> originSchedulingList = RESTTEMPLATE.exchange( |
| 396 | getSchedulingInfoUrl, | 403 | getSchedulingInfoUrl, |
| @@ -436,7 +443,7 @@ public class DriverJob implements InitializingBean { | @@ -436,7 +443,7 @@ public class DriverJob implements InitializingBean { | ||
| 436 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); | 443 | schedulingList.sort(Comparator.comparing(ResponseSchedulingDto::getFcsjT)); |
| 437 | } | 444 | } |
| 438 | // 存入签到报表 | 445 | // 存入签到报表 |
| 439 | - THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap, timeOut, date, type); | 446 | + THREAD_JOB_SERVICE.asyncComputedScheduling(driverSchedulingMap, timeOut, date, type,idSets); |
| 440 | // 实时排班直接存入缓存 | 447 | // 实时排班直接存入缓存 |
| 441 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); | 448 | SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap); |
| 442 | log.info("拉取排班完毕:{}", dateKey); | 449 | log.info("拉取排班完毕:{}", dateKey); |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| @@ -416,7 +416,7 @@ public class ThreadJobService { | @@ -416,7 +416,7 @@ public class ThreadJobService { | ||
| 416 | */ | 416 | */ |
| 417 | @Async | 417 | @Async |
| 418 | @Transactional(rollbackFor = {Exception.class}) | 418 | @Transactional(rollbackFor = {Exception.class}) |
| 419 | - 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,Set<Long> IdSets) { |
| 420 | //查询当天是否保存过考情表 如果不存在则保存 | 420 | //查询当天是否保存过考情表 如果不存在则保存 |
| 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); | 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)); | 422 | Map<String, List<DriverScheduling>> dto = nowSchedulingCache.getCacheScheduling(ConstDateUtil.formatDate(date)); |
| @@ -519,7 +519,7 @@ public class ThreadJobService { | @@ -519,7 +519,7 @@ public class ThreadJobService { | ||
| 519 | // 插入错误排班 | 519 | // 插入错误排班 |
| 520 | errorJobcodeService.insertBatchErrorJobcode(errorScheduling); | 520 | errorJobcodeService.insertBatchErrorJobcode(errorScheduling); |
| 521 | } | 521 | } |
| 522 | - keyWorkLocationService.insertJob(dateStr1); | 522 | + keyWorkLocationService.insertJob(dateStr1,IdSets); |
| 523 | log.info("当天排班数据获取完毕,共:{}条", bcList.size()); | 523 | log.info("当天排班数据获取完毕,共:{}条", bcList.size()); |
| 524 | } | 524 | } |
| 525 | 525 |
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
| @@ -125,6 +125,22 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -125,6 +125,22 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | @Override | 127 | @Override |
| 128 | + public List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Collection<Long> schedulingIds) { | ||
| 129 | + LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = null; | ||
| 130 | + if(Objects.isNull(entity)){ | ||
| 131 | + wrapper = new LambdaQueryWrapper<>(); | ||
| 132 | + }else { | ||
| 133 | + wrapper = new LambdaQueryWrapper<>(entity); | ||
| 134 | + } | ||
| 135 | + switchTime(entity, wrapper); | ||
| 136 | + | ||
| 137 | + if(CollectionUtils.isNotEmpty(schedulingIds)){ | ||
| 138 | + wrapper.in(LinggangKeyWorkLocation::getSchedulingId,schedulingIds); | ||
| 139 | + } | ||
| 140 | + return list(wrapper); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + @Override | ||
| 128 | public List<LinggangKeyWorkLocation> listRecent(Collection<Integer> keyIds, Date date) { | 144 | public List<LinggangKeyWorkLocation> listRecent(Collection<Integer> keyIds, Date date) { |
| 129 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(); | 145 | LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(); |
| 130 | if (CollectionUtils.isNotEmpty(keyIds)) { | 146 | if (CollectionUtils.isNotEmpty(keyIds)) { |
| @@ -235,11 +251,22 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | @@ -235,11 +251,22 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl<LinggangKeyW | ||
| 235 | 251 | ||
| 236 | @Override | 252 | @Override |
| 237 | @Transactional(rollbackFor = Exception.class) | 253 | @Transactional(rollbackFor = Exception.class) |
| 238 | - public boolean insertJob(String timeStr) { | 254 | + public boolean insertJob(String timeStr,Set<Long> schedulingIds) { |
| 239 | try { | 255 | try { |
| 256 | + if(CollectionUtils.isNotEmpty(schedulingIds)){ | ||
| 257 | + List<LinggangKeyWorkLocation> workLocations = listRecent(null,schedulingIds); | ||
| 258 | + if(CollectionUtils.isNotEmpty(workLocations)){ | ||
| 259 | + Set<Long> ids = workLocations.stream().map(LinggangKeyWorkLocation::getId).collect(Collectors.toSet()); | ||
| 260 | + if(CollectionUtils.isNotEmpty(ids)){ | ||
| 261 | + removeByIds(ids); | ||
| 262 | + } | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + | ||
| 240 | Date date = DateUtil.YYYY_MM_DD_LINK.parse(timeStr); | 266 | Date date = DateUtil.YYYY_MM_DD_LINK.parse(timeStr); |
| 241 | LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation(); | 267 | LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation(); |
| 242 | - workLocation.setScheduleDate(date); | 268 | + workLocation.setStartScheduleDate(date); |
| 269 | + workLocation.setEndScheduleDate(DateUtils.addDays(date,1)); | ||
| 243 | Integer count = countId(workLocation); | 270 | Integer count = countId(workLocation); |
| 244 | if (Objects.nonNull(count) && count > 0) { | 271 | if (Objects.nonNull(count) && count > 0) { |
| 245 | log.error("当天的数据已经存在:[{}];[{}]", timeStr, count); | 272 | log.error("当天的数据已经存在:[{}];[{}]", timeStr, count); |
Bsth-admin/src/main/java/com/ruoyi/service/key/location/LinggangKeyWorkLocationService.java
| @@ -9,6 +9,7 @@ import com.ruoyi.domain.key.location.LinggangKeyWorkLocation; | @@ -9,6 +9,7 @@ import com.ruoyi.domain.key.location.LinggangKeyWorkLocation; | ||
| 9 | import java.util.Collection; | 9 | import java.util.Collection; |
| 10 | import java.util.Date; | 10 | import java.util.Date; |
| 11 | import java.util.List; | 11 | import java.util.List; |
| 12 | +import java.util.Set; | ||
| 12 | 13 | ||
| 13 | 14 | ||
| 14 | /** | 15 | /** |
| @@ -27,6 +28,8 @@ public interface LinggangKeyWorkLocationService extends IService<LinggangKeyWork | @@ -27,6 +28,8 @@ public interface LinggangKeyWorkLocationService extends IService<LinggangKeyWork | ||
| 27 | 28 | ||
| 28 | List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Date date); | 29 | List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Date date); |
| 29 | 30 | ||
| 31 | + List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Collection<Long> schedulingIds); | ||
| 32 | + | ||
| 30 | List<LinggangKeyWorkLocation> listRecent(Collection<Integer> keyIds, Date date); | 33 | List<LinggangKeyWorkLocation> listRecent(Collection<Integer> keyIds, Date date); |
| 31 | 34 | ||
| 32 | List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity,Collection<Integer> keyIds, Date date); | 35 | List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity,Collection<Integer> keyIds, Date date); |
| @@ -57,7 +60,7 @@ public interface LinggangKeyWorkLocationService extends IService<LinggangKeyWork | @@ -57,7 +60,7 @@ public interface LinggangKeyWorkLocationService extends IService<LinggangKeyWork | ||
| 57 | /***插入数据*/ | 60 | /***插入数据*/ |
| 58 | boolean insert(LinggangKeyWorkLocation entity); | 61 | boolean insert(LinggangKeyWorkLocation entity); |
| 59 | 62 | ||
| 60 | - boolean insertJob(String timeStr); | 63 | + boolean insertJob(String timeStr, Set<Long> IdSets); |
| 61 | 64 | ||
| 62 | /** | 65 | /** |
| 63 | * 根据主键修改数据 | 66 | * 根据主键修改数据 |
Bsth-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java
| @@ -11,6 +11,8 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio | @@ -11,6 +11,8 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio | ||
| 11 | import org.springframework.security.core.context.SecurityContextHolder; | 11 | import org.springframework.security.core.context.SecurityContextHolder; |
| 12 | import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; | 12 | import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; |
| 13 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
| 14 | +import org.springframework.web.context.request.RequestContextHolder; | ||
| 15 | +import org.springframework.web.context.request.ServletRequestAttributes; | ||
| 14 | import org.springframework.web.filter.OncePerRequestFilter; | 16 | import org.springframework.web.filter.OncePerRequestFilter; |
| 15 | 17 | ||
| 16 | import javax.servlet.FilterChain; | 18 | import javax.servlet.FilterChain; |
| @@ -50,6 +52,24 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { | @@ -50,6 +52,24 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { | ||
| 50 | chain.doFilter(request, response); | 52 | chain.doFilter(request, response); |
| 51 | } | 53 | } |
| 52 | 54 | ||
| 55 | + public static String validateDevice(String device) { | ||
| 56 | +// LoginUser loginUser = SecurityUtils.getLoginUser(); | ||
| 57 | +// if(Objects.isNull(loginUser)){ | ||
| 58 | +// return "没有登陆信息"; | ||
| 59 | +// } | ||
| 60 | +// | ||
| 61 | +// if(org.apache.commons.lang3.StringUtils.equals(device,Convert.toStr(loginUser.getDeptId()))){ | ||
| 62 | + return null; | ||
| 63 | +// } | ||
| 64 | +// | ||
| 65 | +// return "登陆的设备和token不匹配"; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public static HttpServletRequest getRequest() { | ||
| 69 | + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); | ||
| 70 | + return Objects.isNull(servletRequestAttributes) ? (HttpServletRequest) servletRequestAttributes.getRequest() : null; | ||
| 71 | + } | ||
| 72 | + | ||
| 53 | public static void putMDC(String userId, String requestId) { | 73 | public static void putMDC(String userId, String requestId) { |
| 54 | if (org.apache.commons.lang3.StringUtils.isEmpty(userId)) { | 74 | if (org.apache.commons.lang3.StringUtils.isEmpty(userId)) { |
| 55 | userId = getRandomValue(); | 75 | userId = getRandomValue(); |