Commit f84a8a36c6b25cbedc54735711bb3a75036df8e5

Authored by guzijian
1 parent 1e978a3f

fix: 修复重新生成导致日志丢失问题

Bsth-admin/src/main/java/com/ruoyi/job/DriverJob.java
@@ -282,7 +282,7 @@ public class DriverJob implements InitializingBean { @@ -282,7 +282,7 @@ public class DriverJob implements InitializingBean {
282 } 282 }
283 283
284 /** 284 /**
285 - * 生成排班 每天早上在获取调度排前生成 285 + * 生成排班 每天早上在获取调度排前生成
286 */ 286 */
287 public void createAttendance() { 287 public void createAttendance() {
288 RULE_NUM_SETTING_SERVICE.createAttendance(); 288 RULE_NUM_SETTING_SERVICE.createAttendance();
Bsth-admin/src/main/java/com/ruoyi/num/service/impl/RuleNumServiceImpl.java
@@ -106,7 +106,7 @@ public class RuleNumServiceImpl implements IRuleNumService @@ -106,7 +106,7 @@ public class RuleNumServiceImpl implements IRuleNumService
106 if (CollectionUtil.isEmpty(list)){ 106 if (CollectionUtil.isEmpty(list)){
107 return ruleNumMapper.deleteRuleNumByIds(ids); 107 return ruleNumMapper.deleteRuleNumByIds(ids);
108 } 108 }
109 - throw new RuntimeException("班次正在被使用,请在排班设置中解绑该班次!"); 109 + throw new RuntimeException("班次正在被使用,请在排班设置中解绑该班次!");
110 } 110 }
111 111
112 /** 112 /**
Bsth-admin/src/main/java/com/ruoyi/scheduling/controller/RuleSchedulingController.java
@@ -25,7 +25,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil; @@ -25,7 +25,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
25 import com.ruoyi.common.core.page.TableDataInfo; 25 import com.ruoyi.common.core.page.TableDataInfo;
26 26
27 /** 27 /**
28 - * 排规则Controller 28 + * 排规则Controller
29 * 29 *
30 * @author guzijian 30 * @author guzijian
31 * @date 2023-08-04 31 * @date 2023-08-04
@@ -37,7 +37,7 @@ public class RuleSchedulingController extends BaseController { @@ -37,7 +37,7 @@ public class RuleSchedulingController extends BaseController {
37 private IRuleSchedulingService ruleSchedulingService; 37 private IRuleSchedulingService ruleSchedulingService;
38 38
39 /** 39 /**
40 - * 查询排规则列表 40 + * 查询排规则列表
41 */ 41 */
42 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')") 42 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')")
43 @GetMapping("/list") 43 @GetMapping("/list")
@@ -49,7 +49,7 @@ public class RuleSchedulingController extends BaseController { @@ -49,7 +49,7 @@ public class RuleSchedulingController extends BaseController {
49 } 49 }
50 50
51 /** 51 /**
52 - * 查询排规则列表 52 + * 查询排规则列表
53 */ 53 */
54 @GetMapping("/list/all") 54 @GetMapping("/list/all")
55 public AjaxResult listAll(RuleScheduling ruleScheduling) { 55 public AjaxResult listAll(RuleScheduling ruleScheduling) {
@@ -57,7 +57,7 @@ public class RuleSchedulingController extends BaseController { @@ -57,7 +57,7 @@ public class RuleSchedulingController extends BaseController {
57 } 57 }
58 58
59 /** 59 /**
60 - * 查询排规则列表 60 + * 查询排规则列表
61 */ 61 */
62 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')") 62 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:list')")
63 @GetMapping("/list/scheduling/{settingId}") 63 @GetMapping("/list/scheduling/{settingId}")
@@ -67,19 +67,19 @@ public class RuleSchedulingController extends BaseController { @@ -67,19 +67,19 @@ public class RuleSchedulingController extends BaseController {
67 67
68 68
69 /** 69 /**
70 - * 导出排规则列表 70 + * 导出排规则列表
71 */ 71 */
72 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:export')") 72 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:export')")
73 - @Log(title = "排规则", businessType = BusinessType.EXPORT) 73 + @Log(title = "排规则", businessType = BusinessType.EXPORT)
74 @PostMapping("/export") 74 @PostMapping("/export")
75 public void export(HttpServletResponse response, RuleScheduling ruleScheduling) { 75 public void export(HttpServletResponse response, RuleScheduling ruleScheduling) {
76 List<RuleScheduling> list = ruleSchedulingService.selectRuleSchedulingList(ruleScheduling); 76 List<RuleScheduling> list = ruleSchedulingService.selectRuleSchedulingList(ruleScheduling);
77 ExcelUtil<RuleScheduling> util = new ExcelUtil<RuleScheduling>(RuleScheduling.class); 77 ExcelUtil<RuleScheduling> util = new ExcelUtil<RuleScheduling>(RuleScheduling.class);
78 - util.exportExcel(response, list, "排规则数据"); 78 + util.exportExcel(response, list, "排规则数据");
79 } 79 }
80 80
81 /** 81 /**
82 - * 获取排规则详细信息 82 + * 获取排规则详细信息
83 */ 83 */
84 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:query')") 84 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:query')")
85 @GetMapping(value = "/{id}") 85 @GetMapping(value = "/{id}")
@@ -88,30 +88,30 @@ public class RuleSchedulingController extends BaseController { @@ -88,30 +88,30 @@ public class RuleSchedulingController extends BaseController {
88 } 88 }
89 89
90 /** 90 /**
91 - * 新增排规则 91 + * 新增排规则
92 */ 92 */
93 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:add')") 93 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:add')")
94 - @Log(title = "排规则", businessType = BusinessType.INSERT) 94 + @Log(title = "排规则", businessType = BusinessType.INSERT)
95 @PostMapping 95 @PostMapping
96 public AjaxResult add(@RequestBody RuleScheduling ruleScheduling) { 96 public AjaxResult add(@RequestBody RuleScheduling ruleScheduling) {
97 return toAjax(ruleSchedulingService.insertRuleScheduling(ruleScheduling)); 97 return toAjax(ruleSchedulingService.insertRuleScheduling(ruleScheduling));
98 } 98 }
99 99
100 /** 100 /**
101 - * 修改排规则 101 + * 修改排规则
102 */ 102 */
103 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:edit')") 103 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:edit')")
104 - @Log(title = "排规则", businessType = BusinessType.UPDATE) 104 + @Log(title = "排规则", businessType = BusinessType.UPDATE)
105 @PutMapping 105 @PutMapping
106 public AjaxResult edit(@RequestBody RuleScheduling ruleScheduling) { 106 public AjaxResult edit(@RequestBody RuleScheduling ruleScheduling) {
107 return toAjax(ruleSchedulingService.updateRuleScheduling(ruleScheduling)); 107 return toAjax(ruleSchedulingService.updateRuleScheduling(ruleScheduling));
108 } 108 }
109 109
110 /** 110 /**
111 - * 删除排规则 111 + * 删除排规则
112 */ 112 */
113 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:remove')") 113 @PreAuthorize("@ss.hasPermi('scheduling:scheduling:remove')")
114 - @Log(title = "排规则", businessType = BusinessType.DELETE) 114 + @Log(title = "排规则", businessType = BusinessType.DELETE)
115 @DeleteMapping("/{ids}") 115 @DeleteMapping("/{ids}")
116 public AjaxResult remove(@PathVariable Long[] ids) { 116 public AjaxResult remove(@PathVariable Long[] ids) {
117 return toAjax(ruleSchedulingService.deleteRuleSchedulingByIds(ids)); 117 return toAjax(ruleSchedulingService.deleteRuleSchedulingByIds(ids));
Bsth-admin/src/main/java/com/ruoyi/scheduling/domain/RuleScheduling.java
@@ -10,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; @@ -10,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
10 import org.springframework.format.annotation.DateTimeFormat; 10 import org.springframework.format.annotation.DateTimeFormat;
11 11
12 /** 12 /**
13 - * 排规则对象 rule_scheduling 13 + * 排规则对象 rule_scheduling
14 * 14 *
15 * @author guzijian 15 * @author guzijian
16 * @date 2023-08-07 16 * @date 2023-08-07
Bsth-admin/src/main/java/com/ruoyi/scheduling/mapper/RuleSchedulingMapper.java
@@ -8,54 +8,54 @@ import com.ruoyi.scheduling.domain.RuleScheduling; @@ -8,54 +8,54 @@ import com.ruoyi.scheduling.domain.RuleScheduling;
8 import org.apache.ibatis.annotations.Param; 8 import org.apache.ibatis.annotations.Param;
9 9
10 /** 10 /**
11 - * 排规则Mapper接口 11 + * 排规则Mapper接口
12 * 12 *
13 * @author guzijian 13 * @author guzijian
14 * @date 2023-08-04 14 * @date 2023-08-04
15 */ 15 */
16 public interface RuleSchedulingMapper { 16 public interface RuleSchedulingMapper {
17 /** 17 /**
18 - * 查询排规则 18 + * 查询排规则
19 * 19 *
20 - * @param id 排版规则主键  
21 - * @return 排版规则 20 + * @param id 排班规则主键
  21 + * @return 排班规则
22 */ 22 */
23 public RuleScheduling selectRuleSchedulingById(Long id); 23 public RuleScheduling selectRuleSchedulingById(Long id);
24 24
25 /** 25 /**
26 - * 查询排规则列表 26 + * 查询排规则列表
27 * 27 *
28 - * @param ruleScheduling 排版规则  
29 - * @return 排版规则集合 28 + * @param ruleScheduling 排班规则
  29 + * @return 排班规则集合
30 */ 30 */
31 public List<RuleScheduling> selectRuleSchedulingList(RuleScheduling ruleScheduling); 31 public List<RuleScheduling> selectRuleSchedulingList(RuleScheduling ruleScheduling);
32 32
33 /** 33 /**
34 - * 新增排规则 34 + * 新增排规则
35 * 35 *
36 - * @param ruleScheduling 排规则 36 + * @param ruleScheduling 排规则
37 * @return 结果 37 * @return 结果
38 */ 38 */
39 public int insertRuleScheduling(RuleScheduling ruleScheduling); 39 public int insertRuleScheduling(RuleScheduling ruleScheduling);
40 40
41 /** 41 /**
42 - * 修改排规则 42 + * 修改排规则
43 * 43 *
44 - * @param ruleScheduling 排规则 44 + * @param ruleScheduling 排规则
45 * @return 结果 45 * @return 结果
46 */ 46 */
47 public int updateRuleScheduling(RuleScheduling ruleScheduling); 47 public int updateRuleScheduling(RuleScheduling ruleScheduling);
48 48
49 /** 49 /**
50 - * 删除排规则 50 + * 删除排规则
51 * 51 *
52 - * @param id 排规则主键 52 + * @param id 排规则主键
53 * @return 结果 53 * @return 结果
54 */ 54 */
55 public int deleteRuleSchedulingById(Long id); 55 public int deleteRuleSchedulingById(Long id);
56 56
57 /** 57 /**
58 - * 批量删除排规则 58 + * 批量删除排规则
59 * 59 *
60 * @param ids 需要删除的数据主键集合 60 * @param ids 需要删除的数据主键集合
61 * @return 结果 61 * @return 结果
Bsth-admin/src/main/java/com/ruoyi/scheduling/service/IRuleSchedulingService.java
@@ -9,56 +9,56 @@ import com.ruoyi.pojo.vo.RuleSchedulingVo; @@ -9,56 +9,56 @@ import com.ruoyi.pojo.vo.RuleSchedulingVo;
9 import com.ruoyi.scheduling.domain.RuleScheduling; 9 import com.ruoyi.scheduling.domain.RuleScheduling;
10 10
11 /** 11 /**
12 - * 排规则Service接口 12 + * 排规则Service接口
13 * 13 *
14 * @author guzijian 14 * @author guzijian
15 * @date 2023-08-04 15 * @date 2023-08-04
16 */ 16 */
17 public interface IRuleSchedulingService { 17 public interface IRuleSchedulingService {
18 /** 18 /**
19 - * 查询排规则 19 + * 查询排规则
20 * 20 *
21 - * @param id 排版规则主键  
22 - * @return 排版规则 21 + * @param id 排班规则主键
  22 + * @return 排班规则
23 */ 23 */
24 public RuleScheduling selectRuleSchedulingById(Long id); 24 public RuleScheduling selectRuleSchedulingById(Long id);
25 25
26 /** 26 /**
27 - * 查询排规则列表 27 + * 查询排规则列表
28 * 28 *
29 - * @param ruleScheduling 排版规则  
30 - * @return 排版规则集合 29 + * @param ruleScheduling 排班规则
  30 + * @return 排班规则集合
31 */ 31 */
32 public List<RuleScheduling> selectRuleSchedulingList(RuleScheduling ruleScheduling); 32 public List<RuleScheduling> selectRuleSchedulingList(RuleScheduling ruleScheduling);
33 33
34 /** 34 /**
35 - * 新增排规则 35 + * 新增排规则
36 * 36 *
37 - * @param ruleScheduling 排规则 37 + * @param ruleScheduling 排规则
38 * @return 结果 38 * @return 结果
39 */ 39 */
40 public int insertRuleScheduling(RuleScheduling ruleScheduling); 40 public int insertRuleScheduling(RuleScheduling ruleScheduling);
41 41
42 /** 42 /**
43 - * 修改排规则 43 + * 修改排规则
44 * 44 *
45 - * @param ruleScheduling 排规则 45 + * @param ruleScheduling 排规则
46 * @return 结果 46 * @return 结果
47 */ 47 */
48 public int updateRuleScheduling(RuleScheduling ruleScheduling); 48 public int updateRuleScheduling(RuleScheduling ruleScheduling);
49 49
50 /** 50 /**
51 - * 批量删除排规则 51 + * 批量删除排规则
52 * 52 *
53 - * @param ids 需要删除的排规则主键集合 53 + * @param ids 需要删除的排规则主键集合
54 * @return 结果 54 * @return 结果
55 */ 55 */
56 public int deleteRuleSchedulingByIds(Long[] ids); 56 public int deleteRuleSchedulingByIds(Long[] ids);
57 57
58 /** 58 /**
59 - * 删除排规则信息 59 + * 删除排规则信息
60 * 60 *
61 - * @param id 排规则主键 61 + * @param id 排规则主键
62 * @return 结果 62 * @return 结果
63 */ 63 */
64 public int deleteRuleSchedulingById(Long id); 64 public int deleteRuleSchedulingById(Long id);
Bsth-admin/src/main/java/com/ruoyi/scheduling/service/impl/RuleSchedulingServiceImpl.java
@@ -30,7 +30,7 @@ import static com.ruoyi.common.RuleSchedulingProperties.*; @@ -30,7 +30,7 @@ import static com.ruoyi.common.RuleSchedulingProperties.*;
30 import static com.ruoyi.common.WeekEnum.FREE; 30 import static com.ruoyi.common.WeekEnum.FREE;
31 31
32 /** 32 /**
33 - * 排规则Service业务层处理 33 + * 排规则Service业务层处理
34 * 34 *
35 * @author guzijian 35 * @author guzijian
36 * @date 2023-08-04 36 * @date 2023-08-04
@@ -47,10 +47,10 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService { @@ -47,10 +47,10 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService {
47 private RuleNumSettingService ruleNumSettingService; 47 private RuleNumSettingService ruleNumSettingService;
48 48
49 /** 49 /**
50 - * 查询排规则 50 + * 查询排规则
51 * 51 *
52 - * @param id 排版规则主键  
53 - * @return 排版规则 52 + * @param id 排班规则主键
  53 + * @return 排班规则
54 */ 54 */
55 @Override 55 @Override
56 public RuleScheduling selectRuleSchedulingById(Long id) { 56 public RuleScheduling selectRuleSchedulingById(Long id) {
@@ -58,10 +58,10 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService { @@ -58,10 +58,10 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService {
58 } 58 }
59 59
60 /** 60 /**
61 - * 查询排规则列表 61 + * 查询排规则列表
62 * 62 *
63 - * @param ruleScheduling 排版规则  
64 - * @return 排版规则 63 + * @param ruleScheduling 排班规则
  64 + * @return 排班规则
65 */ 65 */
66 @Override 66 @Override
67 public List<RuleScheduling> selectRuleSchedulingList(RuleScheduling ruleScheduling) { 67 public List<RuleScheduling> selectRuleSchedulingList(RuleScheduling ruleScheduling) {
@@ -69,9 +69,9 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService { @@ -69,9 +69,9 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService {
69 } 69 }
70 70
71 /** 71 /**
72 - * 新增排规则 72 + * 新增排规则
73 * 73 *
74 - * @param ruleScheduling 排规则 74 + * @param ruleScheduling 排规则
75 * @return 结果 75 * @return 结果
76 */ 76 */
77 @Override 77 @Override
@@ -98,9 +98,9 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService { @@ -98,9 +98,9 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService {
98 } 98 }
99 99
100 /** 100 /**
101 - * 修改排规则 101 + * 修改排规则
102 * 102 *
103 - * @param ruleScheduling 排规则 103 + * @param ruleScheduling 排规则
104 * @return 结果 104 * @return 结果
105 */ 105 */
106 @Override 106 @Override
@@ -112,9 +112,9 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService { @@ -112,9 +112,9 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService {
112 } 112 }
113 113
114 /** 114 /**
115 - * 批量删除排规则 115 + * 批量删除排规则
116 * 116 *
117 - * @param ids 需要删除的排规则主键 117 + * @param ids 需要删除的排规则主键
118 * @return 结果 118 * @return 结果
119 */ 119 */
120 @Override 120 @Override
@@ -130,15 +130,15 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService { @@ -130,15 +130,15 @@ public class RuleSchedulingServiceImpl implements IRuleSchedulingService {
130 List<Integer> settingIds = list.stream().map(RuleSettingScheduling::getSettingId).distinct().collect(Collectors.toList()); 130 List<Integer> settingIds = list.stream().map(RuleSettingScheduling::getSettingId).distinct().collect(Collectors.toList());
131 List<RuleNumSetting> settingList = ruleNumSettingService.listByIds(settingIds); 131 List<RuleNumSetting> settingList = ruleNumSettingService.listByIds(settingIds);
132 for (RuleNumSetting setting : settingList) { 132 for (RuleNumSetting setting : settingList) {
133 - prompt = prompt + setting.getRuleDictName()+ ","; 133 + prompt = prompt + setting.getRuleDictName()+ "";
134 } 134 }
135 - throw new RuntimeException("该排班规则已班次名称为" + prompt.replaceFirst(",$", "。") + "等班次绑定,请在排班设置中解绑后删除!"); 135 + throw new RuntimeException("排班规则已班次名称为:" + prompt.replaceFirst("、$", "") + "等班次绑定,请在排班设置中解绑后删除!");
136 } 136 }
137 137
138 /** 138 /**
139 - * 删除排规则信息 139 + * 删除排规则信息
140 * 140 *
141 - * @param id 排规则主键 141 + * @param id 排规则主键
142 * @return 结果 142 * @return 结果
143 */ 143 */
144 @Override 144 @Override
Bsth-admin/src/main/java/com/ruoyi/service/impl/AttendanceServiceImpl.java
@@ -304,7 +304,7 @@ public class AttendanceServiceImpl implements AttendanceService { @@ -304,7 +304,7 @@ public class AttendanceServiceImpl implements AttendanceService {
304 @Override 304 @Override
305 @Transactional(rollbackFor = Exception.class) 305 @Transactional(rollbackFor = Exception.class)
306 public void againCreateAttendance(AgainCreateRequestVo vo) { 306 public void againCreateAttendance(AgainCreateRequestVo vo) {
307 - // 删除排班 307 + // 删除排班和生成日志
308 deleteScheduleByRule(vo); 308 deleteScheduleByRule(vo);
309 //生成排班 309 //生成排班
310 createAttendanceByStartDate(vo); 310 createAttendanceByStartDate(vo);
@@ -324,7 +324,7 @@ public class AttendanceServiceImpl implements AttendanceService { @@ -324,7 +324,7 @@ public class AttendanceServiceImpl implements AttendanceService {
324 String nowMonth = strDate.substring(0, strDate.lastIndexOf("-")); 324 String nowMonth = strDate.substring(0, strDate.lastIndexOf("-"));
325 int compare = month.compareTo(nowMonth); 325 int compare = month.compareTo(nowMonth);
326 // 删除生成日志 326 // 删除生成日志
327 - attendanceMainHelpService.deleteNowMathCreateLog(nowMonth, vo.getJobCode()); 327 + attendanceMainHelpService.deleteNowMathCreateLog(vo.getMonth(), vo.getJobCode());
328 if (compare > 0) { 328 if (compare > 0) {
329 LocalDate endDay; 329 LocalDate endDay;
330 endDay = getEndDay(vo.getMonth()); 330 endDay = getEndDay(vo.getMonth());