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,6 +153,7 @@ public class AttendanceController extends BaseController { | ||
| 153 | 153 | ||
| 154 | @ApiOperation("生成指定月份的排班") | 154 | @ApiOperation("生成指定月份的排班") |
| 155 | @PostMapping("/create/attendance/{month}") | 155 | @PostMapping("/create/attendance/{month}") |
| 156 | + @Log(title = "生成当月", businessType = BusinessType.INSERT) | ||
| 156 | public Result<?> createAttendance(@PathVariable("month") String month){ | 157 | public Result<?> createAttendance(@PathVariable("month") String month){ |
| 157 | attendanceService.createAttendance(month); | 158 | attendanceService.createAttendance(month); |
| 158 | return Result.OK(); | 159 | return Result.OK(); |
| @@ -160,6 +161,7 @@ public class AttendanceController extends BaseController { | @@ -160,6 +161,7 @@ public class AttendanceController extends BaseController { | ||
| 160 | 161 | ||
| 161 | @ApiOperation("生成指定月份的指定人员的排班") | 162 | @ApiOperation("生成指定月份的指定人员的排班") |
| 162 | @PostMapping("/again/create/attendance") | 163 | @PostMapping("/again/create/attendance") |
| 164 | + @Log(title = "重新生成", businessType = BusinessType.INSERT) | ||
| 163 | public Result<?> againCreateAttendance(@RequestBody @Validated AgainCreateRequestVo vo){ | 165 | public Result<?> againCreateAttendance(@RequestBody @Validated AgainCreateRequestVo vo){ |
| 164 | attendanceService.againCreateAttendance(vo); | 166 | attendanceService.againCreateAttendance(vo); |
| 165 | return Result.OK(); | 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,6 +30,8 @@ public interface RuleAttendanceMainHelpMapper extends BaseMapper<RuleAttendanceM | ||
| 30 | void insertHelpList(@Param("list") List<RuleAttendanceMainHelp> helpList); | 30 | void insertHelpList(@Param("list") List<RuleAttendanceMainHelp> helpList); |
| 31 | 31 | ||
| 32 | List<RuleAttendanceMainHelp> queryNowMonthPeopleByJobCodes(@Param("list") List<AttendanceDto> peopleList, @Param("month") String month); | 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,4 +26,5 @@ public interface RuleAttendanceMainHelpService extends IService<RuleAttendanceMa | ||
| 26 | 26 | ||
| 27 | List<RuleAttendanceMainHelp> queryNowMonthPeopleByJobCodes(List<AttendanceDto> peopleList, String month); | 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,6 +68,9 @@ public class AttendanceServiceImpl implements AttendanceService { | ||
| 68 | private RuleAttendanceMainService attendanceMainService; | 68 | private RuleAttendanceMainService attendanceMainService; |
| 69 | 69 | ||
| 70 | @Autowired | 70 | @Autowired |
| 71 | + private RuleAttendanceMainHelpService attendanceMainHelpService; | ||
| 72 | + | ||
| 73 | + @Autowired | ||
| 71 | private IRuleSchedulingService schedulingService; | 74 | private IRuleSchedulingService schedulingService; |
| 72 | 75 | ||
| 73 | @Autowired | 76 | @Autowired |
| @@ -319,6 +322,8 @@ public class AttendanceServiceImpl implements AttendanceService { | @@ -319,6 +322,8 @@ public class AttendanceServiceImpl implements AttendanceService { | ||
| 319 | String month = vo.getMonth(); | 322 | String month = vo.getMonth(); |
| 320 | String nowMonth = strDate.substring(0, strDate.lastIndexOf("-")); | 323 | String nowMonth = strDate.substring(0, strDate.lastIndexOf("-")); |
| 321 | int compare = month.compareTo(nowMonth); | 324 | int compare = month.compareTo(nowMonth); |
| 325 | + // 删除生成日志 | ||
| 326 | + attendanceMainHelpService.deleteNowMathCreateLog(nowMonth,vo.getJobCode()); | ||
| 322 | if (compare > 0) { | 327 | if (compare > 0) { |
| 323 | LocalDate endDay; | 328 | LocalDate endDay; |
| 324 | endDay = getEndDay(vo.getMonth()); | 329 | endDay = getEndDay(vo.getMonth()); |
Bsth-admin/src/main/java/com/ruoyi/service/impl/RuleAttendanceMainHelpServiceImpl.java
| 1 | package com.ruoyi.service.impl; | 1 | package com.ruoyi.service.impl; |
| 2 | + | ||
| 2 | import cn.hutool.core.collection.CollectionUtil; | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 4 | import com.ruoyi.domain.RuleAttendanceMainHelp; | 5 | import com.ruoyi.domain.RuleAttendanceMainHelp; |
| @@ -12,13 +13,13 @@ import java.util.Collection; | @@ -12,13 +13,13 @@ import java.util.Collection; | ||
| 12 | import java.util.List; | 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 | @Service | 20 | @Service |
| 20 | public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanceMainHelpMapper, RuleAttendanceMainHelp> | 21 | public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanceMainHelpMapper, RuleAttendanceMainHelp> |
| 21 | - implements RuleAttendanceMainHelpService { | 22 | + implements RuleAttendanceMainHelpService { |
| 22 | 23 | ||
| 23 | @Override | 24 | @Override |
| 24 | public List<RuleAttendanceMainHelp> queryNowMonthPeople(PeopleRequestVo vo) { | 25 | public List<RuleAttendanceMainHelp> queryNowMonthPeople(PeopleRequestVo vo) { |
| @@ -27,7 +28,7 @@ public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanc | @@ -27,7 +28,7 @@ public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanc | ||
| 27 | 28 | ||
| 28 | @Override | 29 | @Override |
| 29 | public void insertHelpList(List<RuleAttendanceMainHelp> helpList) { | 30 | public void insertHelpList(List<RuleAttendanceMainHelp> helpList) { |
| 30 | - if (CollectionUtil.isEmpty(helpList)){ | 31 | + if (CollectionUtil.isEmpty(helpList)) { |
| 31 | return; | 32 | return; |
| 32 | } | 33 | } |
| 33 | baseMapper.insertHelpList(helpList); | 34 | baseMapper.insertHelpList(helpList); |
| @@ -35,7 +36,12 @@ public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanc | @@ -35,7 +36,12 @@ public class RuleAttendanceMainHelpServiceImpl extends ServiceImpl<RuleAttendanc | ||
| 35 | 36 | ||
| 36 | @Override | 37 | @Override |
| 37 | public List<RuleAttendanceMainHelp> queryNowMonthPeopleByJobCodes(List<AttendanceDto> peopleList, String month) { | 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,6 +34,14 @@ | ||
| 34 | on duplicate key update | 34 | on duplicate key update |
| 35 | job_code = values(job_code) | 35 | job_code = values(job_code) |
| 36 | </insert> | 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 | <select id="queryNowMonthPeople" resultMap="BaseResultMap" resultType="com.ruoyi.domain.RuleAttendanceMainHelp"> | 45 | <select id="queryNowMonthPeople" resultMap="BaseResultMap" resultType="com.ruoyi.domain.RuleAttendanceMainHelp"> |
| 38 | SELECT * from rule_attendance_main_help WHERE DATE_FORMAT( date_flag, '%Y-%m' ) = #{date} | 46 | SELECT * from rule_attendance_main_help WHERE DATE_FORMAT( date_flag, '%Y-%m' ) = #{date} |
| 39 | <if test="jobCode != null and jobCode != ''"> | 47 | <if test="jobCode != null and jobCode != ''"> |