Commit 253d183295c1653ba452bf371a38f12499e4be2f
1 parent
29221cef
fix: 补充重新生成日志,修复重新生成时界面生成生成人员当月多条记录情况
Showing
6 changed files
with
31 additions
and
7 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/AttendanceController.java
| ... | ... | @@ -153,6 +153,7 @@ public class AttendanceController extends BaseController { |
| 153 | 153 | |
| 154 | 154 | @ApiOperation("生成指定月份的排班") |
| 155 | 155 | @PostMapping("/create/attendance/{month}") |
| 156 | + @Log(title = "生成当月", businessType = BusinessType.INSERT) | |
| 156 | 157 | public Result<?> createAttendance(@PathVariable("month") String month){ |
| 157 | 158 | attendanceService.createAttendance(month); |
| 158 | 159 | return Result.OK(); |
| ... | ... | @@ -160,6 +161,7 @@ public class AttendanceController extends BaseController { |
| 160 | 161 | |
| 161 | 162 | @ApiOperation("生成指定月份的指定人员的排班") |
| 162 | 163 | @PostMapping("/again/create/attendance") |
| 164 | + @Log(title = "重新生成", businessType = BusinessType.INSERT) | |
| 163 | 165 | public Result<?> againCreateAttendance(@RequestBody @Validated AgainCreateRequestVo vo){ |
| 164 | 166 | attendanceService.againCreateAttendance(vo); |
| 165 | 167 | return Result.OK(); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/mapper/RuleAttendanceMainHelpMapper.java
| ... | ... | @@ -30,6 +30,8 @@ public interface RuleAttendanceMainHelpMapper extends BaseMapper<RuleAttendanceM |
| 30 | 30 | void insertHelpList(@Param("list") List<RuleAttendanceMainHelp> helpList); |
| 31 | 31 | |
| 32 | 32 | List<RuleAttendanceMainHelp> queryNowMonthPeopleByJobCodes(@Param("list") List<AttendanceDto> peopleList, @Param("month") String month); |
| 33 | + | |
| 34 | + void deleteNowMathCreateLog(@Param("nowMonth") String nowMonth,@Param("list") List<String> jobCode); | |
| 33 | 35 | } |
| 34 | 36 | |
| 35 | 37 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/RuleAttendanceMainHelpService.java
| ... | ... | @@ -26,4 +26,5 @@ public interface RuleAttendanceMainHelpService extends IService<RuleAttendanceMa |
| 26 | 26 | |
| 27 | 27 | List<RuleAttendanceMainHelp> queryNowMonthPeopleByJobCodes(List<AttendanceDto> peopleList, String month); |
| 28 | 28 | |
| 29 | + void deleteNowMathCreateLog(String nowMonth, List<String> jobCode); | |
| 29 | 30 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/AttendanceServiceImpl.java
| ... | ... | @@ -68,6 +68,9 @@ public class AttendanceServiceImpl implements AttendanceService { |
| 68 | 68 | private RuleAttendanceMainService attendanceMainService; |
| 69 | 69 | |
| 70 | 70 | @Autowired |
| 71 | + private RuleAttendanceMainHelpService attendanceMainHelpService; | |
| 72 | + | |
| 73 | + @Autowired | |
| 71 | 74 | private IRuleSchedulingService schedulingService; |
| 72 | 75 | |
| 73 | 76 | @Autowired |
| ... | ... | @@ -319,6 +322,8 @@ public class AttendanceServiceImpl implements AttendanceService { |
| 319 | 322 | String month = vo.getMonth(); |
| 320 | 323 | String nowMonth = strDate.substring(0, strDate.lastIndexOf("-")); |
| 321 | 324 | int compare = month.compareTo(nowMonth); |
| 325 | + // 删除生成日志 | |
| 326 | + attendanceMainHelpService.deleteNowMathCreateLog(nowMonth,vo.getJobCode()); | |
| 322 | 327 | if (compare > 0) { |
| 323 | 328 | LocalDate endDay; |
| 324 | 329 | endDay = getEndDay(vo.getMonth()); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/RuleAttendanceMainHelpServiceImpl.java
| 1 | 1 | package com.ruoyi.service.impl; |
| 2 | + | |
| 2 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 3 | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 4 | 5 | import com.ruoyi.domain.RuleAttendanceMainHelp; |
| ... | ... | @@ -12,13 +13,13 @@ import java.util.Collection; |
| 12 | 13 | import java.util.List; |
| 13 | 14 | |
| 14 | 15 | /** |
| 15 | -* @author 20412 | |
| 16 | -* @description 针对表【rule_attendance_main_help(考勤表)】的数据库操作Service实现 | |
| 17 | -* @createDate 2023-09-05 15:39:18 | |
| 18 | -*/ | |
| 16 | + * @author 20412 | |
| 17 | + * @description 针对表【rule_attendance_main_help(考勤表)】的数据库操作Service实现 | |
| 18 | + * @createDate 2023-09-05 15:39:18 | |
| 19 | + */ | |
| 19 | 20 | @Service |
| 20 | 21 | public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanceMainHelpMapper, RuleAttendanceMainHelp> |
| 21 | - implements RuleAttendanceMainHelpService { | |
| 22 | + implements RuleAttendanceMainHelpService { | |
| 22 | 23 | |
| 23 | 24 | @Override |
| 24 | 25 | public List<RuleAttendanceMainHelp> queryNowMonthPeople(PeopleRequestVo vo) { |
| ... | ... | @@ -27,7 +28,7 @@ public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanc |
| 27 | 28 | |
| 28 | 29 | @Override |
| 29 | 30 | public void insertHelpList(List<RuleAttendanceMainHelp> helpList) { |
| 30 | - if (CollectionUtil.isEmpty(helpList)){ | |
| 31 | + if (CollectionUtil.isEmpty(helpList)) { | |
| 31 | 32 | return; |
| 32 | 33 | } |
| 33 | 34 | baseMapper.insertHelpList(helpList); |
| ... | ... | @@ -35,7 +36,12 @@ public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanc |
| 35 | 36 | |
| 36 | 37 | @Override |
| 37 | 38 | public List<RuleAttendanceMainHelp> queryNowMonthPeopleByJobCodes(List<AttendanceDto> peopleList, String month) { |
| 38 | - return baseMapper.queryNowMonthPeopleByJobCodes(peopleList,month); | |
| 39 | + return baseMapper.queryNowMonthPeopleByJobCodes(peopleList, month); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public void deleteNowMathCreateLog(String nowMonth, List<String> jobCode) { | |
| 44 | + baseMapper.deleteNowMathCreateLog(nowMonth, jobCode); | |
| 39 | 45 | } |
| 40 | 46 | } |
| 41 | 47 | ... | ... |
Bsth-admin/src/main/resources/mapper/RuleAttendanceMainHelpMapper.xml
| ... | ... | @@ -34,6 +34,14 @@ |
| 34 | 34 | on duplicate key update |
| 35 | 35 | job_code = values(job_code) |
| 36 | 36 | </insert> |
| 37 | + <delete id="deleteNowMathCreateLog"> | |
| 38 | + delete from rule_attendance_main_help | |
| 39 | + where DATE_FORMAT(date_flag, '%Y-%m') = #{nowMonth} | |
| 40 | + and job_code in | |
| 41 | + <foreach collection="list" item="item" open="(" separator="," close=")"> | |
| 42 | + #{item} | |
| 43 | + </foreach> | |
| 44 | + </delete> | |
| 37 | 45 | <select id="queryNowMonthPeople" resultMap="BaseResultMap" resultType="com.ruoyi.domain.RuleAttendanceMainHelp"> |
| 38 | 46 | SELECT * from rule_attendance_main_help WHERE DATE_FORMAT( date_flag, '%Y-%m' ) = #{date} |
| 39 | 47 | <if test="jobCode != null and jobCode != ''"> | ... | ... |