Commit 3efc5173679d5e66c9d18807dacbe0640311b4c2
1 parent
7c508a1f
feat: 恢复缓存
Showing
4 changed files
with
2 additions
and
123 deletions
Bsth-admin/src/main/java/com/ruoyi/common/cache/NowSchedulingCache.java
| @@ -29,7 +29,7 @@ public class NowSchedulingCache { | @@ -29,7 +29,7 @@ public class NowSchedulingCache { | ||
| 29 | this.schedulingMapper = driverSchedulingMapper; | 29 | this.schedulingMapper = driverSchedulingMapper; |
| 30 | this.errorJobcodeService = errorJobcodeService; | 30 | this.errorJobcodeService = errorJobcodeService; |
| 31 | log.info("项目启动加载中获取排班表并存入缓存-----"); | 31 | log.info("项目启动加载中获取排班表并存入缓存-----"); |
| 32 | -// cacheNowDaySchedulingInit(); | 32 | + cacheNowDaySchedulingInit(); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
Bsth-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java
| @@ -36,7 +36,7 @@ public class SchedulingCache { | @@ -36,7 +36,7 @@ public class SchedulingCache { | ||
| 36 | 36 | ||
| 37 | public SchedulingCache(SchedulerProperty property) { | 37 | public SchedulingCache(SchedulerProperty property) { |
| 38 | log.info("项目启动加载中获取实时班次并存入缓存-----"); | 38 | log.info("项目启动加载中获取实时班次并存入缓存-----"); |
| 39 | -// schedulingInit(property); | 39 | + schedulingInit(property); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | 42 |
Bsth-admin/src/main/test/com.ruoyi/Demo.java deleted
100644 → 0
| 1 | -package com.ruoyi; | ||
| 2 | - | ||
| 3 | -import com.ruoyi.driver.domain.Driver; | ||
| 4 | - | ||
| 5 | -import java.util.ArrayList; | ||
| 6 | -import java.util.Arrays; | ||
| 7 | -import java.util.List; | ||
| 8 | -import java.util.Map; | ||
| 9 | -import java.util.stream.Collectors; | ||
| 10 | - | ||
| 11 | -public class Demo { | ||
| 12 | - public static void main(String[] args) { | ||
| 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); | ||
| 18 | - } | ||
| 19 | -} | ||
| 20 | - |
Bsth-admin/src/main/test/com.ruoyi/TestBsthApplication.java deleted
100644 → 0
| 1 | -package com.ruoyi; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -import com.ruoyi.BsthApplication; | ||
| 5 | -import com.ruoyi.common.cache.NowSchedulingCache; | ||
| 6 | -import com.ruoyi.common.utils.bean.BeanUtils; | ||
| 7 | -import com.ruoyi.domain.DriverScheduling; | ||
| 8 | -import com.ruoyi.driver.service.IDriverService; | ||
| 9 | -import com.ruoyi.in.domain.SignIn; | ||
| 10 | -import com.ruoyi.in.service.ISignInService; | ||
| 11 | -import com.ruoyi.pojo.request.DriverRequestVo; | ||
| 12 | -import com.ruoyi.pojo.request.ReportViewRequestVo; | ||
| 13 | -import com.ruoyi.pojo.response.ReportViewResponseVo; | ||
| 14 | -import com.ruoyi.service.ReportService; | ||
| 15 | -import com.ruoyi.utils.ConstDateUtil; | ||
| 16 | -import org.junit.Test; | ||
| 17 | -import org.junit.runner.RunWith; | ||
| 18 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 19 | -import org.springframework.boot.test.context.SpringBootTest; | ||
| 20 | -import org.springframework.test.context.junit4.SpringRunner; | ||
| 21 | - | ||
| 22 | -import java.math.BigDecimal; | ||
| 23 | - | ||
| 24 | -@RunWith(SpringRunner.class) | ||
| 25 | -@SpringBootTest(classes = BsthApplication.class) | ||
| 26 | -public class TestBsthApplication { | ||
| 27 | - | ||
| 28 | - /** | ||
| 29 | - * 模拟mvc测试对象 | ||
| 30 | - */ | ||
| 31 | - @Autowired | ||
| 32 | - private ISignInService signInService; | ||
| 33 | - | ||
| 34 | - @Autowired | ||
| 35 | - private ReportService reportService; | ||
| 36 | - | ||
| 37 | - @Autowired | ||
| 38 | - private IDriverService driverService; | ||
| 39 | - | ||
| 40 | - @Test | ||
| 41 | - public void testAddSignIn() { | ||
| 42 | -// 724778 722104 722576 | ||
| 43 | - // 模拟前端签到 | ||
| 44 | - String [] params = new String[] { | ||
| 45 | - "2024-03-20 3:45:44,1,1,0", | ||
| 46 | - "2024-03-20 07:45:44,1,1,0", | ||
| 47 | -// "2024-03-20 11:27:57,2,1,0", | ||
| 48 | -// "2024-03-20 11:39:30,2,0,0", | ||
| 49 | - "2024-03-20 12:21:02,2,0,0", | ||
| 50 | -// "2024-03-20 21:45:35,2,1,0", | ||
| 51 | - "2024-03-20 17:45:35,2,1,0", | ||
| 52 | - }; | ||
| 53 | - try { | ||
| 54 | - for (int i = 0; i < params.length; i++) { | ||
| 55 | - String[] strings = params[i].split(","); | ||
| 56 | - SignIn signIn1 = new SignIn(); | ||
| 57 | - SignIn signIn2 = new SignIn(); | ||
| 58 | - SignIn signIn3 = new SignIn(); | ||
| 59 | - signIn1.setJobCode("722902"); | ||
| 60 | - signIn1.setCreateTime(ConstDateUtil.parseDate(strings[0])); | ||
| 61 | - signIn1.setType(Integer.parseInt(strings[1])); | ||
| 62 | - signIn1.setDeviceId("003"); | ||
| 63 | - signIn1.setAlcoholFlag(Integer.parseInt(strings[2])); | ||
| 64 | - signIn1.setAlcoholIntake(new BigDecimal(strings[3])); | ||
| 65 | - signInService.addSignIn(signIn1); | ||
| 66 | -// | ||
| 67 | -// BeanUtils.copyProperties(signIn1,signIn2); | ||
| 68 | -// signIn2.setJobCode("722104"); | ||
| 69 | -// signInService.addSignIn(signIn2); | ||
| 70 | -// BeanUtils.copyProperties(signIn1,signIn3); | ||
| 71 | -// signIn3.setJobCode("722576"); | ||
| 72 | -// signInService.addSignIn(signIn3); | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - ReportViewRequestVo vo = new ReportViewRequestVo(); | ||
| 76 | - vo.setDate("2024-3-19"); | ||
| 77 | - vo.setJobCode("722519"); | ||
| 78 | - System.out.println(); | ||
| 79 | - for (ReportViewResponseVo responseVo : reportService.getReportScrollViewTable(vo, null)) { | ||
| 80 | - System.out.println(responseVo); | ||
| 81 | - } | ||
| 82 | - } catch (Exception e) { | ||
| 83 | - System.out.println(e.getMessage()); | ||
| 84 | - } | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - // 模拟获取人员信息 | ||
| 88 | - @Test | ||
| 89 | - public void getDriversTest() { | ||
| 90 | - // 722608 | ||
| 91 | - DriverRequestVo vo = new DriverRequestVo(); | ||
| 92 | - vo.setJobCode("722608"); | ||
| 93 | - vo.setUpdateTime(ConstDateUtil.parseDate("2024-02-17 04:56:56")); | ||
| 94 | - System.out.println(driverService.getDrivers(vo)); | ||
| 95 | - | ||
| 96 | - vo.setUpdateTime(ConstDateUtil.parseDate("2024-02-17 04:57:01")); | ||
| 97 | - System.out.println(driverService.getDrivers(vo)); | ||
| 98 | - | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | -} | ||
| 102 | \ No newline at end of file | 0 | \ No newline at end of file |