فهرست منبع

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper into master

seyason 2 سال پیش
والد
کامیت
d984296b72

+ 15 - 22
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeAutoExcludeController.java

@@ -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) {

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeAutoExcludeServiceImpl.java

@@ -20,7 +20,7 @@ public class TimeAutoExcludeServiceImpl extends ServiceImpl<TimeAutoExcludeMappe
     @Override
     public Boolean timeCheck(String start1, String start2, String end1, String end2) {
         Boolean check = false;
-        if (end1.compareTo(start2) >= 0 && start1.compareTo(end2) <= 0){
+        if (end1.compareTo(start2) > 0 && start1.compareTo(end2) < 0){
             check = true;
         }
         return check;