Commit d4acd1aa200b3f65dba344035fd4538e6c2ee244
1 parent
8add210f
feat: 补签优化,之前限定时间是两天内现在限定补签为当月内
Showing
3 changed files
with
25 additions
and
4 deletions
Bsth-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| ... | ... | @@ -267,7 +267,12 @@ public class SignInServiceImpl implements ISignInService { |
| 267 | 267 | if (Objects.isNull(driver)) return AjaxResult.warn("这个工号的员工不存在!"); |
| 268 | 268 | GlobalIndex globalIndex = new GlobalIndex(); |
| 269 | 269 | long now = signIn.getCreateTime().getTime(); |
| 270 | - List<DriverScheduling> dto = schedulingService.queryScheduling(signIn.getJobCode(), now); | |
| 270 | +// List<DriverScheduling> dto = schedulingService.queryScheduling(signIn.getJobCode(), now); | |
| 271 | + // 只能补签当月 | |
| 272 | + if (checkSupplementarySignatureTime(signIn.getCreateTime())) { | |
| 273 | + throw new RuntimeException("只能对当前月的数据进行补签!"); | |
| 274 | + } | |
| 275 | + List<DriverScheduling> dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd",signIn.getCreateTime()),null,driver.getJobCode(),null); | |
| 271 | 276 | handleSignBody(signIn, driver, globalIndex, now, dto); |
| 272 | 277 | signIn.setUpdateBy(SecurityUtils.getUsername()); |
| 273 | 278 | signIn.setRemark("补签"); |
| ... | ... | @@ -285,6 +290,15 @@ public class SignInServiceImpl implements ISignInService { |
| 285 | 290 | return AjaxResult.success("补签成功"); |
| 286 | 291 | } |
| 287 | 292 | |
| 293 | + private boolean checkSupplementarySignatureTime(Date createTime) { | |
| 294 | + String date = ConstDateUtil.formatDate("yyyy-MM", createTime); | |
| 295 | + String now = ConstDateUtil.formatDate("yyyy-MM", new Date()); | |
| 296 | + if (date.equals(now)){ | |
| 297 | + return false; | |
| 298 | + } | |
| 299 | + return true; | |
| 300 | + } | |
| 301 | + | |
| 288 | 302 | @Override |
| 289 | 303 | public List<SignInResponseVo> selectSignInByIds(List<Long> collect) { |
| 290 | 304 | if (CollectionUtil.isEmpty(collect)) { | ... | ... |
Bsth-admin/src/main/test/com.ruoyi/Demo.java
| 1 | 1 | package com.ruoyi; |
| 2 | 2 | |
| 3 | +import com.ruoyi.driver.domain.Driver; | |
| 4 | + | |
| 3 | 5 | import java.util.ArrayList; |
| 4 | 6 | import java.util.Arrays; |
| 5 | 7 | import java.util.List; |
| 8 | +import java.util.Map; | |
| 9 | +import java.util.stream.Collectors; | |
| 6 | 10 | |
| 7 | 11 | public class Demo { |
| 8 | 12 | public static void main(String[] args) { |
| 9 | - List<String> list = new ArrayList<>(Arrays.asList("123","2314")); | |
| 10 | - list.stream().filter(item->item.equals("123")).forEach(System.out::println); | |
| 13 | +// List<String> list = new ArrayList<>(Arrays.asList("123","2314")); | |
| 14 | +// list.stream().filter(item->item.equals("123")).forEach(System.out::println); | |
| 15 | + List<Driver> list = new ArrayList<>(); | |
| 16 | + Map<String, Driver> collect = list.stream().collect(Collectors.toMap(Driver::getJobCode, driver -> driver)); | |
| 17 | + System.out.println(collect); | |
| 11 | 18 | } |
| 12 | 19 | } |
| 13 | 20 | ... | ... |