Commit 99702208df35badbb0425b853b1385f3b70781b9
1 parent
bc5995c3
feat: 修改排班管理接口,修改配置文件
Showing
22 changed files
with
317 additions
and
106 deletions
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
| ... | ... | @@ -8,6 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 8 | 8 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| 9 | 9 | import org.springframework.context.ConfigurableApplicationContext; |
| 10 | 10 | import org.springframework.core.env.ConfigurableEnvironment; |
| 11 | +import org.springframework.core.env.Environment; | |
| 11 | 12 | import org.springframework.scheduling.annotation.EnableAsync; |
| 12 | 13 | |
| 13 | 14 | import javax.annotation.PostConstruct; |
| ... | ... | @@ -32,7 +33,7 @@ public class RuoYiApplication { |
| 32 | 33 | public static void main(String[] args) throws UnknownHostException { |
| 33 | 34 | // System.setProperty("spring.devtools.restart.enabled", "false"); |
| 34 | 35 | ConfigurableApplicationContext app = SpringApplication.run(RuoYiApplication.class, args); |
| 35 | - ConfigurableEnvironment env = app.getEnvironment(); | |
| 36 | + Environment env = app.getEnvironment(); | |
| 36 | 37 | log.info("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + |
| 37 | 38 | " .-------. ____ __ \n" + |
| 38 | 39 | " | _ _ \\ \\ \\ / / \n" + | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java
ruoyi-admin/src/main/java/com/ruoyi/controller/AttendanceController.java
| ... | ... | @@ -129,18 +129,12 @@ public class AttendanceController extends BaseController { |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - @ApiOperation("获取排班表人员信息") | |
| 132 | + @ApiOperation("获取一个月的排班table") | |
| 133 | 133 | @GetMapping("/list/people") |
| 134 | - public Result<?> getPeopleList(@ModelAttribute PeopleRequestVo vo){ | |
| 135 | - return Result.OK(attendanceService.getPeopleList(vo)); | |
| 134 | + public TableDataInfo getTableMonth(@ModelAttribute PeopleRequestVo vo){ | |
| 135 | + List<TableMonthResponseVo> vos = attendanceService.getTableMonth(vo); | |
| 136 | + return getDataTable(vos); | |
| 136 | 137 | } |
| 137 | 138 | |
| 138 | 139 | |
| 139 | - @GetMapping("/table/month") | |
| 140 | - @ApiOperation("获取一个月的table") | |
| 141 | - public Result<?> getTableMonth(){ | |
| 142 | - // 修改周期 | |
| 143 | - return null; | |
| 144 | - } | |
| 145 | - | |
| 146 | 140 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/domain/RuleAttendanceMainHelp.java
| ... | ... | @@ -42,6 +42,8 @@ public class RuleAttendanceMainHelp implements Serializable { |
| 42 | 42 | |
| 43 | 43 | private String fleetName; |
| 44 | 44 | |
| 45 | + private String ruleDictName; | |
| 46 | + | |
| 45 | 47 | @TableField(exist = false) |
| 46 | 48 | private static final long serialVersionUID = 1L; |
| 47 | 49 | } |
| 48 | 50 | \ No newline at end of file | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/mapper/RuleAttendanceMainMapper.java
| ... | ... | @@ -3,9 +3,12 @@ package com.ruoyi.mapper; |
| 3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 4 | 4 | import com.ruoyi.domain.RuleAttendanceMain; |
| 5 | 5 | import com.ruoyi.pojo.vo.DeleteAttendanceVo; |
| 6 | +import com.ruoyi.pojo.vo.PeopleRequestVo; | |
| 6 | 7 | import com.ruoyi.pojo.vo.UpdateAttendanceVo; |
| 7 | 8 | import org.apache.ibatis.annotations.Param; |
| 8 | 9 | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 9 | 12 | /** |
| 10 | 13 | * @author 20412 |
| 11 | 14 | * @description 针对表【rule_attendance_main(考勤表)】的数据库操作Mapper |
| ... | ... | @@ -26,6 +29,14 @@ public interface RuleAttendanceMainMapper extends BaseMapper<RuleAttendanceMain> |
| 26 | 29 | * @param vo |
| 27 | 30 | */ |
| 28 | 31 | void deleteByJobCodeTotalRecord(DeleteAttendanceVo vo); |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 获取当月的日期数据 | |
| 35 | + * @param vo | |
| 36 | + * @param jobCodes | |
| 37 | + * @return | |
| 38 | + */ | |
| 39 | + List<RuleAttendanceMain> queryNowMonthDate(@Param("vo") PeopleRequestVo vo, @Param("jobCodes")List<String> jobCodes); | |
| 29 | 40 | } |
| 30 | 41 | |
| 31 | 42 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/vo/PeopleRequestVo.java
| ... | ... | @@ -2,14 +2,17 @@ package com.ruoyi.pojo.vo; |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | +import javax.validation.constraints.NotBlank; | |
| 6 | + | |
| 5 | 7 | /** |
| 6 | 8 | * @author 20412 |
| 7 | 9 | */ |
| 8 | 10 | @Data |
| 9 | 11 | public class PeopleRequestVo { |
| 12 | + @NotBlank | |
| 10 | 13 | private String date; |
| 11 | 14 | private String jobCode; |
| 12 | 15 | private String name; |
| 13 | 16 | private String posts; |
| 14 | - private String fleeName; | |
| 17 | + private String fleetName; | |
| 15 | 18 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/vo/TableMonthRequestVo.java
0 → 100644
ruoyi-admin/src/main/java/com/ruoyi/pojo/vo/TableMonthResponseVo.java
| 1 | 1 | package com.ruoyi.pojo.vo; |
| 2 | 2 | |
| 3 | -import com.ruoyi.domain.RuleAttendanceMain; | |
| 4 | 3 | import lombok.Data; |
| 4 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 5 | 5 | |
| 6 | +import java.util.Date; | |
| 6 | 7 | import java.util.List; |
| 7 | 8 | |
| 8 | 9 | /** |
| ... | ... | @@ -15,9 +16,25 @@ public class TableMonthResponseVo { |
| 15 | 16 | private String name; |
| 16 | 17 | private String fleetName; |
| 17 | 18 | private String posts; |
| 18 | - private List<RuleAttendanceMain> monthList; | |
| 19 | - private Integer nowMonthDaysCount; | |
| 20 | -// | |
| 21 | -// @Data | |
| 22 | -// public | |
| 19 | + private List<WorkItemVo> monthList; | |
| 20 | + private String ruleDictName; | |
| 21 | + | |
| 22 | + @Data | |
| 23 | + public static class WorkItemVo { | |
| 24 | + /** | |
| 25 | + * 日期范围 | |
| 26 | + */ | |
| 27 | + private String rangeTime; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 调度日期 | |
| 31 | + */ | |
| 32 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | |
| 33 | + private Date schedulingDate; | |
| 34 | + | |
| 35 | + private String day; | |
| 36 | + | |
| 37 | + private String week; | |
| 38 | + } | |
| 39 | + | |
| 23 | 40 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/AttendanceService.java
| 1 | 1 | package com.ruoyi.service; |
| 2 | 2 | |
| 3 | 3 | import com.ruoyi.domain.RuleAttendanceMain; |
| 4 | -import com.ruoyi.domain.RuleAttendanceMainHelp; | |
| 5 | 4 | import com.ruoyi.pojo.dto.SchedulingDto; |
| 6 | 5 | import com.ruoyi.pojo.dto.SchedulingSettingDto; |
| 7 | 6 | import com.ruoyi.pojo.vo.*; |
| ... | ... | @@ -56,6 +55,11 @@ public interface AttendanceService { |
| 56 | 55 | void updateAttendance(UpdateAttendanceVo vo); |
| 57 | 56 | |
| 58 | 57 | void deleteAttendance(DeleteAttendanceVo vo); |
| 58 | + /** | |
| 59 | + * 获取当月所有排班日期 | |
| 60 | + * @param vo | |
| 61 | + * @return | |
| 62 | + */ | |
| 63 | + List<TableMonthResponseVo> getTableMonth(PeopleRequestVo vo); | |
| 59 | 64 | |
| 60 | - List<RuleAttendanceMainHelp> getPeopleList(PeopleRequestVo vo); | |
| 61 | 65 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/RuleAttendanceMainHelpService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.ruoyi.service; |
| 3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
| 4 | 4 | import com.ruoyi.domain.RuleAttendanceMainHelp; |
| 5 | 5 | import com.ruoyi.pojo.vo.PeopleRequestVo; |
| 6 | +import com.ruoyi.pojo.vo.TableMonthRequestVo; | |
| 6 | 7 | |
| 7 | 8 | import java.util.List; |
| 8 | 9 | |
| ... | ... | @@ -19,4 +20,5 @@ public interface RuleAttendanceMainHelpService extends IService<RuleAttendanceMa |
| 19 | 20 | * @return |
| 20 | 21 | */ |
| 21 | 22 | List<RuleAttendanceMainHelp> queryNowMonthPeople(PeopleRequestVo vo); |
| 23 | + | |
| 22 | 24 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/RuleAttendanceMainService.java
| ... | ... | @@ -37,4 +37,12 @@ public interface RuleAttendanceMainService extends IService<RuleAttendanceMain> |
| 37 | 37 | * @return |
| 38 | 38 | */ |
| 39 | 39 | List<RuleAttendanceMainHelp> queryPeopleList(PeopleRequestVo vo); |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 获取当月的日期数据 | |
| 43 | + * @param vo | |
| 44 | + * @param jobCodes | |
| 45 | + * @return | |
| 46 | + */ | |
| 47 | + List<RuleAttendanceMain> queryNowMonthDate(PeopleRequestVo vo, List<String> jobCodes); | |
| 40 | 48 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/AttendanceServiceImpl.java
| ... | ... | @@ -25,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 25 | 25 | import org.springframework.stereotype.Service; |
| 26 | 26 | import org.springframework.transaction.annotation.Transactional; |
| 27 | 27 | |
| 28 | +import javax.validation.constraints.NotBlank; | |
| 28 | 29 | import java.time.LocalDate; |
| 30 | +import java.time.ZoneId; | |
| 29 | 31 | import java.util.*; |
| 30 | 32 | import java.util.stream.Collectors; |
| 31 | 33 | import java.util.stream.Stream; |
| ... | ... | @@ -39,6 +41,11 @@ import static com.ruoyi.common.WeekEnum.FREE; |
| 39 | 41 | @Service |
| 40 | 42 | public class AttendanceServiceImpl implements AttendanceService { |
| 41 | 43 | |
| 44 | + /** | |
| 45 | + * 中文星期声明 | |
| 46 | + */ | |
| 47 | + private static String[] weekDays = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; | |
| 48 | + | |
| 42 | 49 | @Autowired |
| 43 | 50 | private DriverMapper driverMapper; |
| 44 | 51 | |
| ... | ... | @@ -58,6 +65,9 @@ public class AttendanceServiceImpl implements AttendanceService { |
| 58 | 65 | private RuleAttendanceMainService attendanceMainService; |
| 59 | 66 | |
| 60 | 67 | @Autowired |
| 68 | + private RuleAttendanceMainHelpService helpService; | |
| 69 | + | |
| 70 | + @Autowired | |
| 61 | 71 | private IRuleNumService ruleNumService; |
| 62 | 72 | |
| 63 | 73 | |
| ... | ... | @@ -152,7 +162,7 @@ public class AttendanceServiceImpl implements AttendanceService { |
| 152 | 162 | List<RuleAttendanceMain> list = attendanceMainService.list(new QueryWrapper<RuleAttendanceMain>() |
| 153 | 163 | .lambda() |
| 154 | 164 | .eq(RuleAttendanceMain::getSchedulingDate, vo.getDate()) |
| 155 | - .eq(StringUtils.isNotEmpty(vo.getJocCode()),RuleAttendanceMain::getJobCode,vo.getJocCode())); | |
| 165 | + .eq(StringUtils.isNotEmpty(vo.getJocCode()), RuleAttendanceMain::getJobCode, vo.getJocCode())); | |
| 156 | 166 | return list; |
| 157 | 167 | } |
| 158 | 168 | |
| ... | ... | @@ -191,8 +201,103 @@ public class AttendanceServiceImpl implements AttendanceService { |
| 191 | 201 | } |
| 192 | 202 | |
| 193 | 203 | @Override |
| 194 | - public List<RuleAttendanceMainHelp> getPeopleList(PeopleRequestVo vo) { | |
| 195 | - return attendanceMainService.queryPeopleList(vo); | |
| 204 | + public List<TableMonthResponseVo> getTableMonth(PeopleRequestVo vo) { | |
| 205 | + PageUtils.startPage(); | |
| 206 | + List<RuleAttendanceMainHelp> helpList = attendanceMainService.queryPeopleList(vo); | |
| 207 | + List<String> jobCodes = helpList.stream().map(RuleAttendanceMainHelp::getJobCode).collect(Collectors.toList()); | |
| 208 | + List<RuleAttendanceMain> mainList = attendanceMainService.queryNowMonthDate(vo, jobCodes); | |
| 209 | + return handleTableMonthResponseVo(vo.getDate(), helpList, mainList); | |
| 210 | + } | |
| 211 | + | |
| 212 | + private List<TableMonthResponseVo> handleTableMonthResponseVo(@NotBlank String date, List<RuleAttendanceMainHelp> helpList, List<RuleAttendanceMain> mainList) { | |
| 213 | + Map<String, List<RuleAttendanceMain>> mainMap = transformMapByRuleAttendanceMain(mainList); | |
| 214 | + List<TableMonthResponseVo> vos = new ArrayList<>(10); | |
| 215 | + for (RuleAttendanceMainHelp help : helpList) { | |
| 216 | + TableMonthResponseVo vo = new TableMonthResponseVo(); | |
| 217 | + BeanUtils.copyProperties(help, vo); | |
| 218 | + vo.setMonthList(handleMonthWorkList(date, mainMap.get(help.getJobCode()))); | |
| 219 | + vos.add(vo); | |
| 220 | + } | |
| 221 | + return vos; | |
| 222 | + } | |
| 223 | + | |
| 224 | + private List<TableMonthResponseVo.WorkItemVo> handleMonthWorkList(@NotBlank String date, List<RuleAttendanceMain> mains) { | |
| 225 | + List<TableMonthResponseVo.WorkItemVo> vos = new ArrayList<>(30); | |
| 226 | + for (RuleAttendanceMain main : mains) { | |
| 227 | + TableMonthResponseVo.WorkItemVo itemVo = new TableMonthResponseVo.WorkItemVo(); | |
| 228 | + itemVo.setSchedulingDate(main.getSchedulingDate()); | |
| 229 | + itemVo.setRangeTime(handleRangeTime(main)); | |
| 230 | + itemVo.setDay(ConstDateUtil.formatDate("MM月dd日", main.getSchedulingDate())); | |
| 231 | + itemVo.setWeek(handleNowWeek(main.getSchedulingDate())); | |
| 232 | + vos.add(itemVo); | |
| 233 | + } | |
| 234 | + // 为未生成的日期进行补充 | |
| 235 | + String[] split = date.split(TOMORROW_NO_STRING); | |
| 236 | + int year = Integer.parseInt(split[0]); | |
| 237 | + int month = Integer.parseInt(split[1]); | |
| 238 | + List<LocalDate> dateList = ConstDateUtil.getAllDatesOfTheMonth(year, month); | |
| 239 | + if (vos.size() != dateList.size()) { | |
| 240 | + int diff = dateList.size() - vos.size(); | |
| 241 | + if (diff > 0) { | |
| 242 | + for (int i = 0; i < diff; i++) { | |
| 243 | + TableMonthResponseVo.WorkItemVo itemVo = new TableMonthResponseVo.WorkItemVo(); | |
| 244 | + LocalDate localDate = dateList.get(i); | |
| 245 | + Date nowDate = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); | |
| 246 | + itemVo.setSchedulingDate(nowDate); | |
| 247 | + itemVo.setDay(ConstDateUtil.formatDate("MM月dd日", nowDate)); | |
| 248 | + itemVo.setWeek(handleNowWeek(nowDate)); | |
| 249 | + vos.add(itemVo); | |
| 250 | + } | |
| 251 | + vos.sort(Comparator.comparing(TableMonthResponseVo.WorkItemVo::getSchedulingDate)); | |
| 252 | + } | |
| 253 | + } | |
| 254 | + return vos; | |
| 255 | + } | |
| 256 | + | |
| 257 | + private String handleNowWeek(Date date) { | |
| 258 | + Calendar cal = Calendar.getInstance(); // 获得一个日历 | |
| 259 | + cal.setTime(date); | |
| 260 | + int w = cal.get(Calendar.DAY_OF_WEEK) - 1; // 指示一个星期中的某天。 | |
| 261 | + if (w < 0) { | |
| 262 | + w = 0; | |
| 263 | + } | |
| 264 | + return weekDays[w]; | |
| 265 | + } | |
| 266 | + | |
| 267 | + private String handleRangeTime(RuleAttendanceMain main) { | |
| 268 | + // 处理休息 | |
| 269 | + if (FREE.getValue().equals(main.getWorkFlag())) { | |
| 270 | + return FREE.getDescription(); | |
| 271 | + } | |
| 272 | + String rangeTime; | |
| 273 | + // 处理不分段 | |
| 274 | + if (Objects.isNull(main.getSecondQuittingSignInTime())) { | |
| 275 | + rangeTime = handleFirstRangeTime(main); | |
| 276 | + } else { | |
| 277 | + rangeTime = handleFirstRangeTime(main) + ";" + handleSecondRangeTime(main); | |
| 278 | + } | |
| 279 | + return rangeTime; | |
| 280 | + } | |
| 281 | + | |
| 282 | + private String handleSecondRangeTime(RuleAttendanceMain main) { | |
| 283 | + return ConstDateUtil.formatDate("MM月dd日HH:mm", main.getSecondWorkSignInTime()) + TOMORROW_NO_STRING + ConstDateUtil.formatDate("MM月dd日HH:mm", main.getSecondQuittingSignInTime()); | |
| 284 | + } | |
| 285 | + | |
| 286 | + private String handleFirstRangeTime(RuleAttendanceMain main) { | |
| 287 | + return ConstDateUtil.formatDate("MM月dd日HH:mm", main.getFirstWorkSignInTime()) + TOMORROW_NO_STRING + ConstDateUtil.formatDate("MM月dd日HH:mm", main.getFirstQuittingSignInTime()); | |
| 288 | + } | |
| 289 | + | |
| 290 | + private Map<String, List<RuleAttendanceMain>> transformMapByRuleAttendanceMain(List<RuleAttendanceMain> mainList) { | |
| 291 | + Map<String, List<RuleAttendanceMain>> map = new HashMap<>(); | |
| 292 | + for (RuleAttendanceMain main : mainList) { | |
| 293 | + List<RuleAttendanceMain> mains = map.get(main.getJobCode()); | |
| 294 | + if (CollectionUtil.isEmpty(mains)) { | |
| 295 | + map.put(main.getJobCode(), new ArrayList<>(Arrays.asList(main))); | |
| 296 | + } else { | |
| 297 | + mains.add(main); | |
| 298 | + } | |
| 299 | + } | |
| 300 | + return map; | |
| 196 | 301 | } |
| 197 | 302 | |
| 198 | 303 | private static void getRumSettingByDto(SchedulingDto dto, RuleNumSetting setting) { | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/RuleAttendanceMainServiceImpl.java
| ... | ... | @@ -16,20 +16,20 @@ import org.springframework.stereotype.Service; |
| 16 | 16 | import java.util.List; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | -* @author 20412 | |
| 20 | -* @description 针对表【rule_attendance_main(考勤表)】的数据库操作Service实现 | |
| 21 | -* @createDate 2023-09-03 12:15:39 | |
| 22 | -*/ | |
| 19 | + * @author 20412 | |
| 20 | + * @description 针对表【rule_attendance_main(考勤表)】的数据库操作Service实现 | |
| 21 | + * @createDate 2023-09-03 12:15:39 | |
| 22 | + */ | |
| 23 | 23 | @Service |
| 24 | 24 | public class RuleAttendanceMainServiceImpl extends ServiceImpl<RuleAttendanceMainMapper, RuleAttendanceMain> |
| 25 | - implements RuleAttendanceMainService { | |
| 25 | + implements RuleAttendanceMainService { | |
| 26 | 26 | |
| 27 | 27 | @Autowired |
| 28 | 28 | private RuleAttendanceMainHelpService helpService; |
| 29 | 29 | |
| 30 | 30 | @Override |
| 31 | 31 | public void updateByJobCodeTotalQuantity(UpdateAttendanceVo vo, RuleAttendanceMain main) { |
| 32 | - baseMapper.updateByIdTotalQuantity(vo,main); | |
| 32 | + baseMapper.updateByIdTotalQuantity(vo, main); | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | @Override |
| ... | ... | @@ -41,6 +41,11 @@ public class RuleAttendanceMainServiceImpl extends ServiceImpl<RuleAttendanceMai |
| 41 | 41 | public List<RuleAttendanceMainHelp> queryPeopleList(PeopleRequestVo vo) { |
| 42 | 42 | return helpService.queryNowMonthPeople(vo); |
| 43 | 43 | } |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public List<RuleAttendanceMain> queryNowMonthDate(PeopleRequestVo vo, List<String> jobCodes) { | |
| 47 | + return baseMapper.queryNowMonthDate(vo, jobCodes); | |
| 48 | + } | |
| 44 | 49 | } |
| 45 | 50 | |
| 46 | 51 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/service/impl/RuleNumSettingServiceImpl.java
| ... | ... | @@ -90,7 +90,6 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 90 | 90 | List<RuleNumDto> ruleNumDtoList = ruleNumSettingService.selectRuleNumBySettingId(settingList); |
| 91 | 91 | // 处理规则 |
| 92 | 92 | List<RuleAttendanceMain> attendanceMains = handleAttendanceMain(peopleList, ruleList, ruleNumDtoList); |
| 93 | - backCreatePeopleListLog(peopleList); | |
| 94 | 93 | attendanceMainService.saveBatch(attendanceMains); |
| 95 | 94 | log.info("排班明细生成完毕"); |
| 96 | 95 | } catch (Exception e) { |
| ... | ... | @@ -99,13 +98,14 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 99 | 98 | } |
| 100 | 99 | } |
| 101 | 100 | |
| 102 | - private void backCreatePeopleListLog(List<AttendanceDto> peopleList) { | |
| 101 | + private void backCreatePeopleListLog(List<AttendanceDto> peopleList, Map<Integer, RuleNumDto> ruleNumDtoList) { | |
| 103 | 102 | List<RuleAttendanceMainHelp> helpList = new ArrayList<>(peopleList.size()); |
| 104 | 103 | Date date = new Date(); |
| 105 | 104 | for (AttendanceDto dto : peopleList) { |
| 106 | 105 | RuleAttendanceMainHelp help = new RuleAttendanceMainHelp(); |
| 107 | 106 | BeanUtils.copyProperties(dto, help); |
| 108 | 107 | help.setDateFlag(date); |
| 108 | + help.setRuleDictName(ruleNumDtoList.get(dto.getSettingId()).getRuleDictName()); | |
| 109 | 109 | helpList.add(help); |
| 110 | 110 | } |
| 111 | 111 | helpService.saveBatch(helpList); |
| ... | ... | @@ -139,6 +139,7 @@ public class RuleNumSettingServiceImpl extends ServiceImpl<RuleNumSettingMapper, |
| 139 | 139 | } |
| 140 | 140 | ruleAttendanceMainList.addAll(mainList); |
| 141 | 141 | } |
| 142 | + backCreatePeopleListLog(peopleList, ruleNumMap); | |
| 142 | 143 | return ruleAttendanceMainList; |
| 143 | 144 | } |
| 144 | 145 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/utils/ConstDateUtil.java
| ... | ... | @@ -18,6 +18,10 @@ public class ConstDateUtil { |
| 18 | 18 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); |
| 19 | 19 | return simpleDateFormat.format(date); |
| 20 | 20 | } |
| 21 | + public static String formatDate(String pattern,LocalDate date){ | |
| 22 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); | |
| 23 | + return simpleDateFormat.format(date); | |
| 24 | + } | |
| 21 | 25 | public static String formatDate(long time){ |
| 22 | 26 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); |
| 23 | 27 | return simpleDateFormat.format(new Date(time)); |
| ... | ... | @@ -77,5 +81,20 @@ public class ConstDateUtil { |
| 77 | 81 | return dateList; |
| 78 | 82 | } |
| 79 | 83 | |
| 84 | + /** | |
| 85 | + * 获取指定月份所有日期 | |
| 86 | + */ | |
| 87 | + public static List<LocalDate> getAllDatesOfTheMonth(int year,int month){ | |
| 88 | + YearMonth yearMonth = YearMonth.of(year, month); | |
| 89 | + int daysInMonth = yearMonth.lengthOfMonth(); | |
| 90 | + List<LocalDate> dateList = new ArrayList<>(30); | |
| 91 | + for (int day = 1; day <= daysInMonth; day++) { | |
| 92 | + LocalDate date = LocalDate.of(year, month, day); | |
| 93 | + dateList.add(date); | |
| 94 | + } | |
| 95 | + | |
| 96 | + return dateList; | |
| 97 | + } | |
| 98 | + | |
| 80 | 99 | |
| 81 | 100 | } | ... | ... |
ruoyi-admin/src/main/resources/application-druid-dev.yml
| ... | ... | @@ -93,25 +93,25 @@ spring: |
| 93 | 93 | # 热部署开关 |
| 94 | 94 | enabled: true |
| 95 | 95 | # redis 配置 |
| 96 | - redis: | |
| 97 | - # 地址 | |
| 96 | + redis: | |
| 97 | + # 地址 | |
| 98 | 98 | # host: 121.41.83.61 |
| 99 | - host: 127.0.0.1 | |
| 100 | - database: 0 | |
| 99 | + host: 127.0.0.1 | |
| 100 | + database: 0 | |
| 101 | 101 | # password: "guzijian" |
| 102 | - port: 6379 | |
| 103 | - # 连接超时时间 | |
| 104 | - timeout: 10s | |
| 105 | - lettuce: | |
| 106 | - pool: | |
| 107 | - # 连接池中的最小空闲连接 | |
| 108 | - min-idle: 0 | |
| 109 | - # 连接池中的最大空闲连接 | |
| 110 | - max-idle: 8 | |
| 111 | - # 连接池的最大数据库连接数 | |
| 112 | - max-active: 8 | |
| 113 | - # #连接池最大阻塞等待时间(使用负值表示没有限制) | |
| 114 | - max-wait: -1ms | |
| 102 | + port: 6379 | |
| 103 | + # 连接超时时间 | |
| 104 | + timeout: 10s | |
| 105 | + lettuce: | |
| 106 | + pool: | |
| 107 | + # 连接池中的最小空闲连接 | |
| 108 | + min-idle: 0 | |
| 109 | + # 连接池中的最大空闲连接 | |
| 110 | + max-idle: 8 | |
| 111 | + # 连接池的最大数据库连接数 | |
| 112 | + max-active: 8 | |
| 113 | + # #连接池最大阻塞等待时间(使用负值表示没有限制) | |
| 114 | + max-wait: -1ms | |
| 115 | 115 | # token配置 |
| 116 | 116 | token: |
| 117 | 117 | # 令牌自定义标识 | ... | ... |
ruoyi-admin/src/main/resources/application-druid-prd.yml
| ... | ... | @@ -94,25 +94,25 @@ spring: |
| 94 | 94 | # 热部署开关 |
| 95 | 95 | enabled: false |
| 96 | 96 | # redis 配置 |
| 97 | - redis: | |
| 98 | - # 地址 | |
| 97 | + redis: | |
| 98 | + # 地址 | |
| 99 | 99 | # host: 121.41.83.61 |
| 100 | - host: 127.0.0.1 | |
| 101 | - database: 0 | |
| 102 | - password: "@qpgj#redis" | |
| 103 | - port: 6379 | |
| 104 | - # 连接超时时间 | |
| 105 | - timeout: 10s | |
| 106 | - lettuce: | |
| 107 | - pool: | |
| 108 | - # 连接池中的最小空闲连接 | |
| 109 | - min-idle: 0 | |
| 110 | - # 连接池中的最大空闲连接 | |
| 111 | - max-idle: 8 | |
| 112 | - # 连接池的最大数据库连接数 | |
| 113 | - max-active: 8 | |
| 114 | - # #连接池最大阻塞等待时间(使用负值表示没有限制) | |
| 115 | - max-wait: -1ms | |
| 100 | + host: 127.0.0.1 | |
| 101 | + database: 0 | |
| 102 | +# password: qpgjredis | |
| 103 | + port: 6379 | |
| 104 | + # 连接超时时间 | |
| 105 | + timeout: 10s | |
| 106 | + lettuce: | |
| 107 | + pool: | |
| 108 | + # 连接池中的最小空闲连接 | |
| 109 | + min-idle: 0 | |
| 110 | + # 连接池中的最大空闲连接 | |
| 111 | + max-idle: 8 | |
| 112 | + # 连接池的最大数据库连接数 | |
| 113 | + max-active: 8 | |
| 114 | + # #连接池最大阻塞等待时间(使用负值表示没有限制) | |
| 115 | + max-wait: -1ms | |
| 116 | 116 | # token配置 |
| 117 | 117 | token: |
| 118 | 118 | # 令牌自定义标识 | ... | ... |
ruoyi-admin/src/main/resources/application-druid-uat.yml
| ... | ... | @@ -94,25 +94,25 @@ spring: |
| 94 | 94 | # 热部署开关 |
| 95 | 95 | enabled: true |
| 96 | 96 | # redis 配置 |
| 97 | - redis: | |
| 98 | - # 地址 | |
| 97 | + redis: | |
| 98 | + # 地址 | |
| 99 | 99 | # host: 1.14.107.94 |
| 100 | - host: 121.41.83.61 | |
| 101 | - database: 0 | |
| 102 | - password: "guzijian" | |
| 103 | - port: 6379 | |
| 104 | - # 连接超时时间 | |
| 105 | - timeout: 10s | |
| 106 | - lettuce: | |
| 107 | - pool: | |
| 108 | - # 连接池中的最小空闲连接 | |
| 109 | - min-idle: 0 | |
| 110 | - # 连接池中的最大空闲连接 | |
| 111 | - max-idle: 8 | |
| 112 | - # 连接池的最大数据库连接数 | |
| 113 | - max-active: 8 | |
| 114 | - # #连接池最大阻塞等待时间(使用负值表示没有限制) | |
| 115 | - max-wait: -1ms | |
| 100 | + host: 121.41.83.61 | |
| 101 | + database: 0 | |
| 102 | + password: "guzijian" | |
| 103 | + port: 6379 | |
| 104 | + # 连接超时时间 | |
| 105 | + timeout: 10s | |
| 106 | + lettuce: | |
| 107 | + pool: | |
| 108 | + # 连接池中的最小空闲连接 | |
| 109 | + min-idle: 0 | |
| 110 | + # 连接池中的最大空闲连接 | |
| 111 | + max-idle: 8 | |
| 112 | + # 连接池的最大数据库连接数 | |
| 113 | + max-active: 8 | |
| 114 | + # #连接池最大阻塞等待时间(使用负值表示没有限制) | |
| 115 | + max-wait: -1ms | |
| 116 | 116 | # token配置 |
| 117 | 117 | token: |
| 118 | 118 | # 令牌自定义标识 | ... | ... |
ruoyi-admin/src/main/resources/application.yml
| ... | ... | @@ -71,24 +71,24 @@ spring: |
| 71 | 71 | # 热部署开关 |
| 72 | 72 | enabled: true |
| 73 | 73 | # redis 配置 |
| 74 | -# redis: | |
| 75 | -# # 地址 | |
| 76 | -# host: 127.0.0.1 | |
| 77 | -# database: 0 | |
| 78 | -## password: "guzijian" | |
| 79 | -# port: 6379 | |
| 80 | -# # 连接超时时间 | |
| 81 | -# timeout: 10s | |
| 82 | -# lettuce: | |
| 83 | -# pool: | |
| 84 | -# # 连接池中的最小空闲连接 | |
| 85 | -# min-idle: 0 | |
| 86 | -# # 连接池中的最大空闲连接 | |
| 87 | -# max-idle: 8 | |
| 88 | -# # 连接池的最大数据库连接数 | |
| 89 | -# max-active: 8 | |
| 90 | -# # #连接池最大阻塞等待时间(使用负值表示没有限制) | |
| 91 | -# max-wait: -1ms | |
| 74 | + redis: | |
| 75 | + # 地址 | |
| 76 | + host: 127.0.0.1 | |
| 77 | + database: 0 | |
| 78 | +# password: "guzijian" | |
| 79 | + port: 6379 | |
| 80 | + # 连接超时时间 | |
| 81 | + timeout: 10s | |
| 82 | + lettuce: | |
| 83 | + pool: | |
| 84 | + # 连接池中的最小空闲连接 | |
| 85 | + min-idle: 0 | |
| 86 | + # 连接池中的最大空闲连接 | |
| 87 | + max-idle: 8 | |
| 88 | + # 连接池的最大数据库连接数 | |
| 89 | + max-active: 8 | |
| 90 | + # #连接池最大阻塞等待时间(使用负值表示没有限制) | |
| 91 | + max-wait: -1ms | |
| 92 | 92 | |
| 93 | 93 | # token配置 |
| 94 | 94 | token: | ... | ... |
ruoyi-admin/src/main/resources/mapper/RuleAttendanceMainHelpMapper.xml
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | <result property="posts" column="posts" jdbcType="VARCHAR"/> |
| 12 | 12 | <result property="dateFlag" column="dateFlag" jdbcType="DATE"/> |
| 13 | 13 | <result property="fleetName" column="fleet_name" jdbcType="VARCHAR"/> |
| 14 | + <result property="ruleDictName" column="rule_dict_name" jdbcType="VARCHAR"/> | |
| 14 | 15 | </resultMap> |
| 15 | 16 | |
| 16 | 17 | <sql id="Base_Column_List"> |
| ... | ... | @@ -18,7 +19,7 @@ |
| 18 | 19 | posts,date_flag,fleet_name |
| 19 | 20 | </sql> |
| 20 | 21 | <select id="queryNowMonthPeople" resultMap="BaseResultMap" resultType="com.ruoyi.domain.RuleAttendanceMainHelp"> |
| 21 | - SELECT * from rule_attendance_main_help WHERE DATE_FORMAT( date_flag, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' ) | |
| 22 | + SELECT * from rule_attendance_main_help WHERE DATE_FORMAT( date_flag, '%Y-%m' ) = #{date} | |
| 22 | 23 | <if test="jobCode != null and jobCode != ''"> |
| 23 | 24 | and job_code = #{jobCode} |
| 24 | 25 | </if> | ... | ... |
ruoyi-admin/src/main/resources/mapper/RuleAttendanceMainMapper.xml
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | </resultMap> |
| 27 | 27 | |
| 28 | 28 | <sql id="Base_Column_List"> |
| 29 | - id,name,job_code, | |
| 29 | + id,`name`,job_code, | |
| 30 | 30 | working_hour_plan,working_hour_type,first_work_sign_in_time, |
| 31 | 31 | first_sign_in_working_range,first_quitting_sign_in_time,first_sign_in_quitting_range, |
| 32 | 32 | sign_in_time_out_range,second_work_sign_in_time,second_sign_in_working_range, |
| ... | ... | @@ -62,4 +62,29 @@ |
| 62 | 62 | and scheduling_date >= #{startDate} |
| 63 | 63 | and scheduling_date <= #{endDate} |
| 64 | 64 | </delete> |
| 65 | + <select id="queryNowMonthDate" resultType="com.ruoyi.domain.RuleAttendanceMain"> | |
| 66 | + select job_code,name,posts,first_work_sign_in_time,first_quitting_sign_in_time,second_work_sign_in_time,second_quitting_sign_in_time,scheduling_date,work_flag | |
| 67 | + from rule_attendance_main | |
| 68 | + <where> | |
| 69 | + DATE_FORMAT(scheduling_date,'%Y-%m') = #{vo.date} | |
| 70 | + <if test="vo.jobCode != null and vo.jobCode != ''"> | |
| 71 | + and job_code = #{vo.jobCode} | |
| 72 | + </if> | |
| 73 | + <if test="vo.name != null and vo.name != ''"> | |
| 74 | + and `name` = #{vo.name} | |
| 75 | + </if> | |
| 76 | + <if test="vo.fleetName != null and vo.fleetName != ''"> | |
| 77 | + and fleet_name = #{vo.fleetName} | |
| 78 | + </if> | |
| 79 | + <if test="vo.posts != null and vo.posts != ''"> | |
| 80 | + and posts = #{vo.posts} | |
| 81 | + </if> | |
| 82 | + <if test="jobCodes!=null and jobCodes.size() > 0"> | |
| 83 | + and job_code IN | |
| 84 | + <foreach collection="jobCodes" item="item" open="(" close=")" separator="," index="index"> | |
| 85 | + #{item} | |
| 86 | + </foreach> | |
| 87 | + </if> | |
| 88 | + </where> | |
| 89 | + </select> | |
| 65 | 90 | </mapper> | ... | ... |
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
| ... | ... | @@ -197,7 +197,7 @@ |
| 197 | 197 | posts, |
| 198 | 198 | fleet_name |
| 199 | 199 | FROM driver |
| 200 | - WHERE driver.posts != "驾驶员" and driver.posts != "售票员" | |
| 200 | +-- WHERE driver.posts != "驾驶员" and driver.posts != "售票员" | |
| 201 | 201 | </select> |
| 202 | 202 | |
| 203 | 203 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> | ... | ... |