Commit 03e5fac47db29129441e988118070a46a6b6d01f
1 parent
2b433ba0
feat: 修复过滤为空集合时的bug
Showing
2 changed files
with
29 additions
and
30 deletions
ruoyi-admin/src/main/java/com/ruoyi/scheduling/controller/RuleSchedulingController.java
| @@ -3,6 +3,7 @@ package com.ruoyi.scheduling.controller; | @@ -3,6 +3,7 @@ package com.ruoyi.scheduling.controller; | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import javax.servlet.http.HttpServletResponse; | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | 5 | ||
| 6 | +import com.github.pagehelper.PageInfo; | ||
| 6 | import com.ruoyi.pojo.vo.RuleSchedulingResponseVo; | 7 | import com.ruoyi.pojo.vo.RuleSchedulingResponseVo; |
| 7 | import org.springframework.security.access.prepost.PreAuthorize; | 8 | import org.springframework.security.access.prepost.PreAuthorize; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -25,14 +26,13 @@ import com.ruoyi.common.core.page.TableDataInfo; | @@ -25,14 +26,13 @@ import com.ruoyi.common.core.page.TableDataInfo; | ||
| 25 | 26 | ||
| 26 | /** | 27 | /** |
| 27 | * 排版规则Controller | 28 | * 排版规则Controller |
| 28 | - * | 29 | + * |
| 29 | * @author guzijian | 30 | * @author guzijian |
| 30 | * @date 2023-08-04 | 31 | * @date 2023-08-04 |
| 31 | */ | 32 | */ |
| 32 | @RestController | 33 | @RestController |
| 33 | @RequestMapping("/scheduling/scheduling") | 34 | @RequestMapping("/scheduling/scheduling") |
| 34 | -public class RuleSchedulingController extends BaseController | ||
| 35 | -{ | 35 | +public class RuleSchedulingController extends BaseController { |
| 36 | @Autowired | 36 | @Autowired |
| 37 | private IRuleSchedulingService ruleSchedulingService; | 37 | private IRuleSchedulingService ruleSchedulingService; |
| 38 | 38 | ||
| @@ -41,12 +41,11 @@ public class RuleSchedulingController extends BaseController | @@ -41,12 +41,11 @@ public class RuleSchedulingController extends BaseController | ||
| 41 | */ | 41 | */ |
| 42 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')") | 42 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')") |
| 43 | @GetMapping("/list") | 43 | @GetMapping("/list") |
| 44 | - public TableDataInfo list(RuleScheduling ruleScheduling) | ||
| 45 | - { | 44 | + public TableDataInfo list(RuleScheduling ruleScheduling) { |
| 46 | startPage(); | 45 | startPage(); |
| 47 | List<RuleScheduling> list = ruleSchedulingService.selectRuleSchedulingList(ruleScheduling); | 46 | List<RuleScheduling> list = ruleSchedulingService.selectRuleSchedulingList(ruleScheduling); |
| 48 | List<RuleSchedulingResponseVo> vos = ruleSchedulingService.handleResponseRuleSchedulingList(list); | 47 | List<RuleSchedulingResponseVo> vos = ruleSchedulingService.handleResponseRuleSchedulingList(list); |
| 49 | - return getDataTable(vos); | 48 | + return getDataTable(vos, new PageInfo(list).getTotal()); |
| 50 | } | 49 | } |
| 51 | 50 | ||
| 52 | /** | 51 | /** |
| @@ -54,8 +53,7 @@ public class RuleSchedulingController extends BaseController | @@ -54,8 +53,7 @@ public class RuleSchedulingController extends BaseController | ||
| 54 | */ | 53 | */ |
| 55 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')") | 54 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')") |
| 56 | @GetMapping("/list/all") | 55 | @GetMapping("/list/all") |
| 57 | - public AjaxResult listAll(RuleScheduling ruleScheduling) | ||
| 58 | - { | 56 | + public AjaxResult listAll(RuleScheduling ruleScheduling) { |
| 59 | return AjaxResult.success(ruleSchedulingService.selectRuleSchedulingListVo(ruleScheduling)); | 57 | return AjaxResult.success(ruleSchedulingService.selectRuleSchedulingListVo(ruleScheduling)); |
| 60 | } | 58 | } |
| 61 | 59 | ||
| @@ -64,8 +62,7 @@ public class RuleSchedulingController extends BaseController | @@ -64,8 +62,7 @@ public class RuleSchedulingController extends BaseController | ||
| 64 | */ | 62 | */ |
| 65 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')") | 63 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')") |
| 66 | @GetMapping("/list/scheduling/{settingId}") | 64 | @GetMapping("/list/scheduling/{settingId}") |
| 67 | - public AjaxResult getRuleSchedulingListVoBySettingId(@PathVariable("settingId") Integer settingId) | ||
| 68 | - { | 65 | + public AjaxResult getRuleSchedulingListVoBySettingId(@PathVariable("settingId") Integer settingId) { |
| 69 | return AjaxResult.success(ruleSchedulingService.selectRuleSchedulingListVoBySettingId(settingId)); | 66 | return AjaxResult.success(ruleSchedulingService.selectRuleSchedulingListVoBySettingId(settingId)); |
| 70 | } | 67 | } |
| 71 | 68 | ||
| @@ -76,8 +73,7 @@ public class RuleSchedulingController extends BaseController | @@ -76,8 +73,7 @@ public class RuleSchedulingController extends BaseController | ||
| 76 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:export')") | 73 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:export')") |
| 77 | @Log(title = "排版规则", businessType = BusinessType.EXPORT) | 74 | @Log(title = "排版规则", businessType = BusinessType.EXPORT) |
| 78 | @PostMapping("/export") | 75 | @PostMapping("/export") |
| 79 | - public void export(HttpServletResponse response, RuleScheduling ruleScheduling) | ||
| 80 | - { | 76 | + public void export(HttpServletResponse response, RuleScheduling ruleScheduling) { |
| 81 | List<RuleScheduling> list = ruleSchedulingService.selectRuleSchedulingList(ruleScheduling); | 77 | List<RuleScheduling> list = ruleSchedulingService.selectRuleSchedulingList(ruleScheduling); |
| 82 | ExcelUtil<RuleScheduling> util = new ExcelUtil<RuleScheduling>(RuleScheduling.class); | 78 | ExcelUtil<RuleScheduling> util = new ExcelUtil<RuleScheduling>(RuleScheduling.class); |
| 83 | util.exportExcel(response, list, "排版规则数据"); | 79 | util.exportExcel(response, list, "排版规则数据"); |
| @@ -88,8 +84,7 @@ public class RuleSchedulingController extends BaseController | @@ -88,8 +84,7 @@ public class RuleSchedulingController extends BaseController | ||
| 88 | */ | 84 | */ |
| 89 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:query')") | 85 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:query')") |
| 90 | @GetMapping(value = "/{id}") | 86 | @GetMapping(value = "/{id}") |
| 91 | - public AjaxResult getInfo(@PathVariable("id") Long id) | ||
| 92 | - { | 87 | + public AjaxResult getInfo(@PathVariable("id") Long id) { |
| 93 | return success(ruleSchedulingService.selectRuleSchedulingById(id)); | 88 | return success(ruleSchedulingService.selectRuleSchedulingById(id)); |
| 94 | } | 89 | } |
| 95 | 90 | ||
| @@ -99,8 +94,7 @@ public class RuleSchedulingController extends BaseController | @@ -99,8 +94,7 @@ public class RuleSchedulingController extends BaseController | ||
| 99 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:add')") | 94 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:add')") |
| 100 | @Log(title = "排版规则", businessType = BusinessType.INSERT) | 95 | @Log(title = "排版规则", businessType = BusinessType.INSERT) |
| 101 | @PostMapping | 96 | @PostMapping |
| 102 | - public AjaxResult add(@RequestBody RuleScheduling ruleScheduling) | ||
| 103 | - { | 97 | + public AjaxResult add(@RequestBody RuleScheduling ruleScheduling) { |
| 104 | return toAjax(ruleSchedulingService.insertRuleScheduling(ruleScheduling)); | 98 | return toAjax(ruleSchedulingService.insertRuleScheduling(ruleScheduling)); |
| 105 | } | 99 | } |
| 106 | 100 | ||
| @@ -110,8 +104,7 @@ public class RuleSchedulingController extends BaseController | @@ -110,8 +104,7 @@ public class RuleSchedulingController extends BaseController | ||
| 110 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:edit')") | 104 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:edit')") |
| 111 | @Log(title = "排版规则", businessType = BusinessType.UPDATE) | 105 | @Log(title = "排版规则", businessType = BusinessType.UPDATE) |
| 112 | @PutMapping | 106 | @PutMapping |
| 113 | - public AjaxResult edit(@RequestBody RuleScheduling ruleScheduling) | ||
| 114 | - { | 107 | + public AjaxResult edit(@RequestBody RuleScheduling ruleScheduling) { |
| 115 | return toAjax(ruleSchedulingService.updateRuleScheduling(ruleScheduling)); | 108 | return toAjax(ruleSchedulingService.updateRuleScheduling(ruleScheduling)); |
| 116 | } | 109 | } |
| 117 | 110 | ||
| @@ -120,9 +113,8 @@ public class RuleSchedulingController extends BaseController | @@ -120,9 +113,8 @@ public class RuleSchedulingController extends BaseController | ||
| 120 | */ | 113 | */ |
| 121 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:remove')") | 114 | @PreAuthorize("@ss.hasPermi('scheduling:scheduling:remove')") |
| 122 | @Log(title = "排版规则", businessType = BusinessType.DELETE) | 115 | @Log(title = "排版规则", businessType = BusinessType.DELETE) |
| 123 | - @DeleteMapping("/{ids}") | ||
| 124 | - public AjaxResult remove(@PathVariable Long[] ids) | ||
| 125 | - { | 116 | + @DeleteMapping("/{ids}") |
| 117 | + public AjaxResult remove(@PathVariable Long[] ids) { | ||
| 126 | return toAjax(ruleSchedulingService.deleteRuleSchedulingByIds(ids)); | 118 | return toAjax(ruleSchedulingService.deleteRuleSchedulingByIds(ids)); |
| 127 | } | 119 | } |
| 128 | } | 120 | } |
ruoyi-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| @@ -474,6 +474,7 @@ public class ThreadJobService { | @@ -474,6 +474,7 @@ public class ThreadJobService { | ||
| 474 | private List<DriverScheduling> getBcList(Map<String, List<ResponseSchedulingDto>> originSchedulingMap) { | 474 | private List<DriverScheduling> getBcList(Map<String, List<ResponseSchedulingDto>> originSchedulingMap) { |
| 475 | List<DriverScheduling> bcList = new ArrayList<>(1000); | 475 | List<DriverScheduling> bcList = new ArrayList<>(1000); |
| 476 | for (String key : originSchedulingMap.keySet()) { | 476 | for (String key : originSchedulingMap.keySet()) { |
| 477 | + | ||
| 477 | List<ResponseSchedulingDto> schedulingList = originSchedulingMap.get(key); | 478 | List<ResponseSchedulingDto> schedulingList = originSchedulingMap.get(key); |
| 478 | List<DriverScheduling> nowScheduling = schedulingList.stream() | 479 | List<DriverScheduling> nowScheduling = schedulingList.stream() |
| 479 | .filter(item -> BC_TYPE_IN.equals(item.getBcType()) || BC_TYPE_OUT.equals(item.getBcType())) | 480 | .filter(item -> BC_TYPE_IN.equals(item.getBcType()) || BC_TYPE_OUT.equals(item.getBcType())) |
| @@ -484,16 +485,22 @@ public class ThreadJobService { | @@ -484,16 +485,22 @@ public class ThreadJobService { | ||
| 484 | }) | 485 | }) |
| 485 | .sorted(Comparator.comparing(DriverScheduling::getFcsjT)) | 486 | .sorted(Comparator.comparing(DriverScheduling::getFcsjT)) |
| 486 | .collect(Collectors.toList()); | 487 | .collect(Collectors.toList()); |
| 487 | - if (nowScheduling.size() % 2 == 1 && nowScheduling.size() > 2) { | ||
| 488 | - // 处理错误班次 | ||
| 489 | - nowScheduling = handleErrorBc(schedulingList); | ||
| 490 | - } | ||
| 491 | - // 处理松青线 | ||
| 492 | - // 松1路牌 签到时间 07:20 |松2路牌 签到时间 07:40 |松3路牌 签到时间 08:35 |松4路牌 签到时间 10:30 | ||
| 493 | - if (nowScheduling.get(0).getLineName().equals("松青线") && checkLpName(nowScheduling.get(0))) { | ||
| 494 | - updateScheduling(nowScheduling); | 488 | + |
| 489 | + if (CollectionUtil.isNotEmpty(nowScheduling)) { | ||
| 490 | + if (nowScheduling.size() % 2 == 1 && nowScheduling.size() > 2) { | ||
| 491 | + // 处理错误班次 | ||
| 492 | + nowScheduling = handleErrorBc(schedulingList); | ||
| 493 | + } | ||
| 494 | + // 处理松青线 | ||
| 495 | + // 松1路牌 签到时间 07:20 |松2路牌 签到时间 07:40 |松3路牌 签到时间 08:35 |松4路牌 签到时间 10:30 | ||
| 496 | + if (nowScheduling.get(0).getLineName().equals("松青线") && checkLpName(nowScheduling.get(0))) { | ||
| 497 | + updateScheduling(nowScheduling); | ||
| 498 | + } | ||
| 499 | + bcList.addAll(nowScheduling); | ||
| 500 | + } else { | ||
| 501 | + // 处理无进出场 | ||
| 502 | + log.info("无进出场驾驶员工号:{}", schedulingList.get(0).getJobCode()); | ||
| 495 | } | 503 | } |
| 496 | - bcList.addAll(nowScheduling); | ||
| 497 | } | 504 | } |
| 498 | return bcList; | 505 | return bcList; |
| 499 | } | 506 | } |