|
|
@@ -111,7 +111,8 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
//添加in条件
|
|
|
query.in("org_id", ids);
|
|
|
}
|
|
|
- query.orderByDesc("effective_date");
|
|
|
+ query.orderByDesc
|
|
|
+ ("effective_date");
|
|
|
//时间范围查询
|
|
|
if (sysWorkTimeSet.getParams().get("beginTime") != null && sysWorkTimeSet.getParams().get("endTime") != null) {
|
|
|
query.between("effective_date", sysWorkTimeSet.getParams().get("beginTime"), sysWorkTimeSet.getParams().get("endTime"));
|
|
|
@@ -125,41 +126,42 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
list.forEach(l -> {
|
|
|
ids.add(l.getId());
|
|
|
});
|
|
|
- List<SysWorkTimeSetDayofweek> dayOfWeeks = sysWorkTimeSetDayofweekMapper.findByWorkTimeSetIdIn(ids);
|
|
|
- list.forEach(l -> {
|
|
|
- List<SysWorkTimeSetDayofweek> dayOfWeekList = dayOfWeeks.stream().filter(d -> d.getWorkTimeSetId().equals(l.getId())).collect(Collectors.toList());
|
|
|
- String workDay = "";
|
|
|
- workDay = getWorkDay(dayOfWeekList);
|
|
|
- l.setWorkDay(workDay);
|
|
|
- //当月和下月的作息不能删除
|
|
|
- //获取当前时间的月份
|
|
|
- Calendar cal = Calendar.getInstance();
|
|
|
- cal.setTime(new Date());
|
|
|
- int month = cal.get(Calendar.MONTH) + 1;
|
|
|
- //获取l.getEffectiveDate()的月份
|
|
|
- Calendar cal1 = Calendar.getInstance();
|
|
|
- cal1.setTime(l.getEffectiveDate());
|
|
|
- int month1 = cal1.get(Calendar.MONTH) + 1;
|
|
|
- //l.getEffectiveDate()在当前时间之前的作息不能删除,当月和下月的作息不能删除
|
|
|
- //下月后的模版可删除可编辑
|
|
|
- if (month1 - month >= 2) {
|
|
|
- l.setTimeCheck(0);
|
|
|
- } else {
|
|
|
- //本月之前的不能删除也不能编辑
|
|
|
- if (month1 - month < 0) {
|
|
|
- l.setTimeCheck(1);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ List<SysWorkTimeSetDayofweek> dayOfWeeks = sysWorkTimeSetDayofweekMapper.findByWorkTimeSetIdIn(ids);
|
|
|
+ list.forEach(l -> {
|
|
|
+ List<SysWorkTimeSetDayofweek> dayOfWeekList = dayOfWeeks.stream().filter(d -> d.getWorkTimeSetId().equals(l.getId())).collect(Collectors.toList());
|
|
|
+ String workDay = "";
|
|
|
+ workDay = getWorkDay(dayOfWeekList);
|
|
|
+ l.setWorkDay(workDay);
|
|
|
+ //当月和下月的作息不能删除
|
|
|
+ //获取当前时间的月份
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(new Date());
|
|
|
+ int month = cal.get(Calendar.MONTH) + 1;
|
|
|
+ //获取l.getEffectiveDate()的月份
|
|
|
+ Calendar cal1 = Calendar.getInstance();
|
|
|
+ cal1.setTime(l.getEffectiveDate());
|
|
|
+ int month1 = cal1.get(Calendar.MONTH) + 1;
|
|
|
+ //l.getEffectiveDate()在当前时间之前的作息不能删除,当月和下月的作息不能删除
|
|
|
+ //下月后的模版可删除可编辑
|
|
|
+ if (month1 - month >= 2) {
|
|
|
+ l.setTimeCheck(0);
|
|
|
} else {
|
|
|
- //当月和下月的数据1不能删除2生效的不能编辑3未生效的可以编辑
|
|
|
- if (l.getEffectiveDate().before(new Date())) {
|
|
|
- //2生效的不能编辑不能删除
|
|
|
- l.setTimeCheck(2);
|
|
|
+ //本月之前的不能删除也不能编辑
|
|
|
+ if (month1 - month < 0) {
|
|
|
+ l.setTimeCheck(1);
|
|
|
} else {
|
|
|
- //3未生效的可编辑不能删除
|
|
|
- l.setTimeCheck(3);
|
|
|
- }
|
|
|
+ //当月和下月的数据1不能删除2生效的不能编辑3未生效的可以编辑
|
|
|
+ if (l.getEffectiveDate().before(new Date())) {
|
|
|
+ //2生效的不能编辑不能删除
|
|
|
+ l.setTimeCheck(2);
|
|
|
+ } else {
|
|
|
+ //3未生效的可编辑不能删除
|
|
|
+ l.setTimeCheck(3);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
// if(l.getEffectiveDate().before(new Date()) || month == month1 || month+1 == month1) {
|
|
|
// l.setTimeCheck(1);
|
|
|
@@ -167,9 +169,8 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
// l.setTimeCheck(0);
|
|
|
// }
|
|
|
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
+ });
|
|
|
+ }
|
|
|
return AjaxResult.success(page);
|
|
|
}
|
|
|
|
|
|
@@ -221,7 +222,27 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
@Override
|
|
|
public SysWorkTimeSet selectSysWorkTimeSetById(Long id) {
|
|
|
SysWorkTimeSet sysWorkTimeSet = sysWorkTimeSetMapper.selectById(id);
|
|
|
- sysWorkTimeSet.setDayOfWeeks(sysWorkTimeSetDayofweekMapper.selectList(new QueryWrapper<SysWorkTimeSetDayofweek>().eq("work_time_set_id", id)));
|
|
|
+ if(sysWorkTimeSet!=null) {
|
|
|
+ sysWorkTimeSet.setDayOfWeeks(sysWorkTimeSetDayofweekMapper.selectList(new QueryWrapper<SysWorkTimeSetDayofweek>().eq("work_time_set_id", id)));
|
|
|
+ for (SysWorkTimeSetDayofweek day :
|
|
|
+ sysWorkTimeSet.getDayOfWeeks()) {
|
|
|
+ if (day.getDayOfWeek() == 1) {
|
|
|
+ day.setDayOfWeekText("星期天");
|
|
|
+ } else if (day.getDayOfWeek() == 2) {
|
|
|
+ day.setDayOfWeekText("星期一");
|
|
|
+ }else if (day.getDayOfWeek() == 3) {
|
|
|
+ day.setDayOfWeekText("星期二");
|
|
|
+ }else if (day.getDayOfWeek() == 4) {
|
|
|
+ day.setDayOfWeekText("星期三");
|
|
|
+ }else if (day.getDayOfWeek() == 5) {
|
|
|
+ day.setDayOfWeekText("星期四");
|
|
|
+ }else if (day.getDayOfWeek() == 6) {
|
|
|
+ day.setDayOfWeekText("星期五");
|
|
|
+ }else if (day.getDayOfWeek() == 7) {
|
|
|
+ day.setDayOfWeekText("星期六");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return sysWorkTimeSet;
|
|
|
}
|
|
|
|
|
|
@@ -279,8 +300,8 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
}
|
|
|
|
|
|
// workTimeSetDayOfWeekRepository.deleteByWorkTimeSetIds(oldWorkTimeSetIds);
|
|
|
- for (SysWorkTimeSetDayofweek s:
|
|
|
- dayOfWeeks) {
|
|
|
+ for (SysWorkTimeSetDayofweek s :
|
|
|
+ dayOfWeeks) {
|
|
|
sysWorkTimeSetDayofweekMapper.insert(s);
|
|
|
}
|
|
|
// if (CollectionUtils.isNotEmpty(dayOfWeeks)) {
|
|
|
@@ -378,6 +399,7 @@ public class SysWorkTimeSetServiceImpl extends ServiceImpl<SysWorkTimeSetMapper,
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
+
|
|
|
/**
|
|
|
* 查询作息设置列表
|
|
|
*
|