|
@@ -53,20 +53,18 @@ public class TimeAutoExcludeController {
|
|
|
if (item.getType().equals(1)){
|
|
|
List<TimeAutoExclude> timeItem = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", user.getCompanyId()));
|
|
|
for (TimeAutoExclude timeAutoExclude : timeItem) {
|
|
|
- if (timeAutoExclude.getDId() == null){
|
|
|
- Boolean b = timeAutoExcludeService.timeCheck(start1, timeAutoExclude.getStartTime(), end1, timeAutoExclude.getEndTime());
|
|
|
- if (item.getId() == null){
|
|
|
- //如果是新增
|
|
|
- if (b) {
|
|
|
- msg.setError("与已设置时间段存在重叠情况,请重新设置!");
|
|
|
- return msg;
|
|
|
- }
|
|
|
- }else {
|
|
|
- //如果是修改
|
|
|
- if (b && !timeAutoExclude.getId().equals(item.getId())) {
|
|
|
- msg.setError("与已设置时间段存在重叠情况,请重新设置!");
|
|
|
- return msg;
|
|
|
- }
|
|
|
+ Boolean b = timeAutoExcludeService.timeCheck(start1, timeAutoExclude.getStartTime(), end1, timeAutoExclude.getEndTime());
|
|
|
+ if (item.getId() == null){
|
|
|
+ //如果是新增
|
|
|
+ if (b) {
|
|
|
+ msg.setError("与已设置时间段存在重叠情况,请重新设置!");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果是修改
|
|
|
+ if (b && !timeAutoExclude.getId().equals(item.getId())) {
|
|
|
+ msg.setError("与已设置时间段存在重叠情况,请重新设置!");
|
|
|
+ return msg;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -74,6 +72,7 @@ public class TimeAutoExcludeController {
|
|
|
timeAutoExcludeService.saveOrUpdate(item);
|
|
|
return msg;
|
|
|
}
|
|
|
+ List<TimeAutoExclude> companyTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", user.getCompanyId()).isNull("d_id"));
|
|
|
//修改
|
|
|
if (item.getId() != null){
|
|
|
TimeAutoExclude timeAutoExclude = timeAutoExcludeMapper.selectById(item.getId());
|
|
@@ -88,6 +87,7 @@ public class TimeAutoExcludeController {
|
|
|
}
|
|
|
}
|
|
|
List<TimeAutoExclude> dList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("d_id", item.getDId()).ne("id",item.getId()));
|
|
|
+ dList.addAll(companyTimeList);
|
|
|
for (TimeAutoExclude autoExclude : dList) {
|
|
|
Boolean b = timeAutoExcludeService.timeCheck(start1, autoExclude.getStartTime(), end1, autoExclude.getEndTime());
|
|
|
if (b) {
|
|
@@ -95,20 +95,13 @@ public class TimeAutoExcludeController {
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
|
-// List<TimeAutoExclude> dList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("d_id", item.getDId()).ne("id",item.getId()));
|
|
|
-// for (TimeAutoExclude autoExclude : dList) {
|
|
|
-// Boolean b = timeAutoExcludeService.timeCheck(start1, autoExclude.getStartTime(), end1, autoExclude.getEndTime());
|
|
|
-// if (b && !timeAutoExclude.getId().equals(item.getId())) {
|
|
|
-// msg.setError("与已设置时间段存在重叠情况,请重新设置!");
|
|
|
-// return msg;
|
|
|
-// }
|
|
|
-// }
|
|
|
timeAutoExcludeService.updateById(item);
|
|
|
return msg;
|
|
|
}
|
|
|
//新增
|
|
|
//如果某部门曾设置过重叠的时间段,不予添加
|
|
|
List<TimeAutoExclude> times = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().in("d_id", item.getDepartmentId()));
|
|
|
+ times.addAll(companyTimeList);
|
|
|
for (TimeAutoExclude t : times) {
|
|
|
Boolean b = timeAutoExcludeService.timeCheck(start1, t.getStartTime(), end1, t.getEndTime());
|
|
|
if (b) {
|