Browse Source

调整履职任务

luojun 2 years ago
parent
commit
f5df0838d0
20 changed files with 175 additions and 127 deletions
  1. 1 1
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteWorkTimeService.java
  2. 11 11
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/TaskController.java
  3. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlan.java
  4. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlanToCheckOrg.java
  5. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlanToExecOrg.java
  6. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlanToRole.java
  7. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanMapper.java
  8. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToCheckOrgMapper.java
  9. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToExecOrgMapper.java
  10. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToRoleMapper.java
  11. 20 14
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java
  12. 17 9
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/SysResumptionServiceImpl.java
  13. 64 54
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/task/ResumptionTaskBusiness.java
  14. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppPlanMapper.xml
  15. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppResumptionDataMapper.xml
  16. 6 6
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRulePointMapper.xml
  17. 4 4
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/ResumptionMapper.xml
  18. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/SysResumptionMapper.xml
  19. 1 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysWorkTimeController.java
  20. 40 16
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysWorkTimeServiceImpl.java

+ 1 - 1
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteWorkTimeService.java

@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
-@FeignClient(contextId = "remoteWorkTimeService", value = ServiceNameConstants.CORE_SERVICE, fallbackFactory = RemoteWorkTimesFallbackFactory.class)
+@FeignClient(contextId = "remoteWorkTimeService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteWorkTimesFallbackFactory.class)
 public interface RemoteWorkTimeService {
     @GetMapping("/work/time/findOrgIdsByYmd")
     R<List<Long>> findOrgIdsByYmd(@RequestParam("toYmd") String toYmd, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

+ 11 - 11
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/TaskController.java

@@ -52,7 +52,7 @@ public class TaskController {
         DateTime datetime = new DateTime();
         datetime.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
 //        SCHEDULEDTASKSLOG.info("================开始执行每周履职任务生成任务================");
-        taskBusiness.syncWeek(datetime,1);
+        taskBusiness.syncWeek(datetime,3);
 //        SCHEDULEDTASKSLOG.info("================每周履职任务生成任务执行结束================");
         return AjaxResult.success();
     }
@@ -67,23 +67,23 @@ public class TaskController {
 //        SCHEDULEDTASKSLOG.info("================开始执行每月,每季,每半年,每年履职任务生成任务================");
         if(month==1&&day==1){
             //1.1日获取执行周期为每月,每季,每半年,每年的履职计划Plan_cycle=2,3,4,5
-            taskBusiness.syncMonth(datetime,2);
-            taskBusiness.syncQuarter(datetime,3);
-            taskBusiness.syncHalfYear(datetime,4);
-            taskBusiness.syncYear(datetime,5);
+            taskBusiness.syncMonth(datetime,4);
+            taskBusiness.syncQuarter(datetime,5);
+            taskBusiness.syncHalfYear(datetime,6);
+            taskBusiness.syncYear(datetime,7);
         }else if((month==4&&day==1)||(month==10&&day==1)){
             //4.1||10.1日获取执行周期为每月,每季的履职计划Plan_cycle=2,3
-            taskBusiness.syncMonth(datetime,2);
-            taskBusiness.syncQuarter(datetime,3);
+            taskBusiness.syncMonth(datetime,4);
+            taskBusiness.syncQuarter(datetime,5);
         }else if(month==7&&day==1){
             //7.1日获取执行周期为每月,每季,每半年的履职计划Plan_cycle=2,3,4
-            taskBusiness.syncMonth(datetime,2);
-            taskBusiness.syncQuarter(datetime,3);
-            taskBusiness.syncHalfYear(datetime,4);
+            taskBusiness.syncMonth(datetime,4);
+            taskBusiness.syncQuarter(datetime,5);
+            taskBusiness.syncHalfYear(datetime,6);
 
         }else {
             //其他获取每月履职计划Plan_cycle=2
-            taskBusiness.syncMonth(datetime,2);
+            taskBusiness.syncMonth(datetime,4);
         }
 //        SCHEDULEDTASKSLOG.info("================每月,每季,每半年,每年履职任务生成任务执行结束================");
         return AjaxResult.success();

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlan.java

@@ -16,7 +16,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 /**
- * 履职,安全检查计划表(t_app_plan)实体类
+ * 履职,安全检查计划表(core_resumption_plan)实体类
  *
  * @author 高雄
  * @since 2022-04-27 16:38:43

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlanToCheckOrg.java

@@ -9,7 +9,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 
 /**
- * 检查机构关联表(t_app_plan_to_check_org)实体类
+ * 检查机构关联表(core_resumption_plan_to_check_org)实体类
  *
  * @author 高雄
  * @since 2022-05-05 17:02:19

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlanToExecOrg.java

@@ -9,7 +9,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 
 /**
- * 执行机构关系表(t_app_plan_to_exec_org)实体类
+ * 执行机构关系表(core_resumption_plan_to_exec_org)实体类
  *
  * @author 高雄
  * @since 2022-05-05 17:02:24

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlanToRole.java

@@ -9,7 +9,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 
 /**
- * 执行角色关联表(t_app_plan_to_role)实体类
+ * 执行角色关联表(core_resumption_plan_to_role)实体类
  *
  * @author 高雄
  * @since 2022-05-05 17:02:30

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanMapper.java

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Repository;
 import java.util.List;
 
 /**
- * 履职,安全检查计划表(t_app_plan)数据Mapper
+ * 履职,安全检查计划表(core_resumption_plan)数据Mapper
  *
  * @author 高雄
  * @since 2022-04-27 16:38:43

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToCheckOrgMapper.java

@@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
 
 /**
- * 检查机构关联表(t_app_plan_to_check_org)数据Mapper
+ * 检查机构关联表(core_resumption_plan_to_check_org)数据Mapper
  *
  * @author 高雄
  * @since 2022-05-05 17:02:19

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToExecOrgMapper.java

@@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
 
 /**
- * 执行机构关系表(t_app_plan_to_exec_org)数据Mapper
+ * 执行机构关系表(core_resumption_plan_to_exec_org)数据Mapper
  *
  * @author 高雄
  * @since 2022-05-05 17:02:24

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToRoleMapper.java

@@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
 
 /**
- * 执行角色关联表(t_app_plan_to_role)数据Mapper
+ * 执行角色关联表(core_resumption_plan_to_role)数据Mapper
  *
  * @author 高雄
  * @since 2022-05-05 17:02:30

+ 20 - 14
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java

@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author : 高雄
@@ -166,20 +167,25 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                 appPlanToItemMapper.insert(item);
             }
 
-            Long orgId = app.getOrgId();
-            if (orgId != null) {
-                AppPlanToCheckOrg checkOrg = new AppPlanToCheckOrg();
-                AppPlanToExecOrg execOrg = new AppPlanToExecOrg();
-
-                checkOrg.setOrgId(orgId);
-                checkOrg.setPlanId(id);
-
-                execOrg.setOrgId(orgId);
-                execOrg.setPlanId(id);
-
-                appPlanToCheckOrgMapper.insert(checkOrg);
-                appPlanToExecOrgMapper.insert(execOrg);
-            }
+//            Integer orgId = app.getExecOrgType();
+//            if (orgId != null) {
+//                AppPlanToCheckOrg checkOrg = new AppPlanToCheckOrg();
+//                AppPlanToExecOrg execOrg = new AppPlanToExecOrg();
+//                List<SysOrg> sysOrgs = orgService.selectByOrgType(orgId, SecurityConstants.INNER);
+//                List<Long> orgids = sysOrgs.stream().map(SysOrg::getId).collect(Collectors.toList());
+//                for (Long i :
+//                        orgids) {
+//                    checkOrg.setOrgId(i);
+//                    checkOrg.setPlanId(id);
+//                    execOrg.setOrgId(i);
+//                    execOrg.setPlanId(id);
+//                    appPlanToCheckOrgMapper.insert(checkOrg);
+//                    appPlanToExecOrgMapper.insert(execOrg);
+//                }
+//
+//
+//
+//            }
         } else {
             //修改
             QueryWrapper<AppPlan> qw = new QueryWrapper<>();

+ 17 - 9
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/SysResumptionServiceImpl.java

@@ -163,6 +163,14 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
             //resumption.changeWork(isWork);
             resumption.setStatus((long) ResumptionStatus.WAIT.ordinal());
             resumption.setYmd(ymd);
+            resumption.setYmdDate(ymd.getDate());
+            resumption.setYmdDay(Long.valueOf(ymd.getDay()));
+            resumption.setYmdMonth(Long.valueOf(ymd.getMonth()));
+            resumption.setYmdWeek(Long.valueOf(ymd.getWeek()));
+            resumption.setYmdYear(Long.valueOf(ymd.getYear()));
+            resumption.setYmdHour(Long.valueOf(ymd.getHour()));
+            resumption.setYmdQuarter(Long.valueOf(ymd.getQuarter()));
+            resumption.setYmdHalfyear(Long.valueOf(ymd.getHalfyear()));
             resumption.setPlanId(appPlan.getId());
             resumption.setOrgId(orgId);
             resumption.setId(id);
@@ -174,17 +182,17 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
             resumptions.add(resumption);
         }
         //resumptions = this.save(resumptions);
-        for (SysResumption s :
-                resumptions) {
-            sysResumptionMapper.insert(s);
-        }
-
+//        for (SysResumption s :
+//                resumptions) {
+//            sysResumptionMapper.insert(s);
+//        }
+        this.saveBatch(resumptions);
         //resumption = this.save(resumption);
         //插入履职数据
-        for (SysResumption resumption : resumptions) {
-            //生成代办
-            daiban(resumption, resumption.getRoleId(), appPlan, orgId, type.ordinal());
-        }
+//        for (SysResumption resumption : resumptions) {
+//            //生成代办
+//            daiban(resumption, resumption.getRoleId(), appPlan, orgId, type.ordinal());
+//        }
 
     }
     public void daiban(SysResumption resumption, Long roleId, AppPlan appPlan, Long orgId, int type) {

+ 64 - 54
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/task/ResumptionTaskBusiness.java

@@ -201,8 +201,8 @@ public class ResumptionTaskBusiness {
      */
     @Async
     public void syncDay(final DateTime dateTime, int plancycle) {//plancycle==0
-        R<SysConfig> officeBuilding_open_allhours = systemParameService.findFirstByCode("officeBuilding_open_allhours", SecurityConstants.INNER);
-        SysConfig officeAllHourParam = officeBuilding_open_allhours.getData();
+//        R<SysConfig> officeBuilding_open_allhours = systemParameService.findFirstByCode("officeBuilding_open_allhours", SecurityConstants.INNER);
+//        SysConfig officeAllHourParam = officeBuilding_open_allhours.getData();
         //获取履职计划
         List<AppPlan> AppPlanList = appPlanService.list((new QueryWrapper<AppPlan>()).lambda()
                 .eq(AppPlan::getPlanStatus, 1)
@@ -216,6 +216,7 @@ public class ResumptionTaskBusiness {
 //                RESUMPTIONLOG.error("error:该计划ID:{}没有检查项", appPlan.getId());
                 continue;
             }
+
             List<Long> orgIds = getPlanOrgIds(appPlan);
             if (orgIds == null || orgIds.size() <= 0) {//没有检查项不生成履职任务
 //                RESUMPTIONLOG.error("error:该计划ID:{}没有执行机构", appPlan.getId());
@@ -238,28 +239,34 @@ public class ResumptionTaskBusiness {
             /*NFCBindJobDto jobDto = new NFCBindJobDto();
             jobDto.setAreaIds(new ArrayList(areaList));
             List<NFCBindPageVo> nfcList =  nfcBindService.all(jobDto,NFCBindPageVo::to);*/
-            boolean officeAllHour = officeAllHourParam != null && "1".equals(officeAllHourParam.getValue());
+//            boolean officeAllHour = officeAllHourParam != null && "1".equals(officeAllHourParam.getValue());
             List<Long> orgIdList;
 
-            if (ObjectUtil.equal(appPlan.getExecType(), 1)) {
-                if (officeAllHour) {
-                    List<SysOrg> orgs = orgService.listByIds(orgIds, SecurityConstants.INNER).getData();
-                    orgIdList = orgs.stream().filter(o -> ObjectUtil.equal(o.getType(), OrgType.BGDL)).map(o -> o.getId()).collect(Collectors.toList());
-                    List<Long> tempOrgIds = orgs.stream().filter(o -> ObjectUtil.notEqual(o.getType(), OrgType.BGDL)).map(o -> o.getId()).collect(Collectors.toList());
-                    List<Long> orgIdsNew = this.workTimeService.findOrgIdsByYmd(dateTime.toString().substring(0, 10),SecurityConstants.INNER).getData();
-                    orgIdList.addAll(tempOrgIds.stream().filter(r -> orgIdsNew.contains(r)).collect(Collectors.toList()));
-                } else {
-                    List<Long> orgIdsNew = this.workTimeService.findOrgIdsByYmd(dateTime.toString().substring(0, 10),SecurityConstants.INNER).getData();
-                    orgIdList = orgIds.stream().filter(r -> orgIdsNew.contains(r)).collect(Collectors.toList());
-                }
-            } else {
-                if (officeAllHour && ObjectUtil.equal(appPlan.getExecOrgType(), OrgType.BGDL.ordinal())) {
-                    orgIdList = orgIds;
-                } else {
-                    List<Long> orgIdsNew = this.workTimeService.findOrgIdsByYmd(dateTime.toString().substring(0, 10),SecurityConstants.INNER).getData();
-                    orgIdList = orgIds.stream().filter(r -> orgIdsNew.contains(r)).collect(Collectors.toList());
-                }
-            }
+
+            orgIdList = orgIds;
+
+            //不需要类型判断直接用上面的机构ids
+
+
+//            if (ObjectUtil.equal(appPlan.getExecType(), 1)) {
+//                if (officeAllHour) {
+//                    List<SysOrg> orgs = orgService.listByIds(orgIds, SecurityConstants.INNER).getData();
+//                    orgIdList = orgs.stream().filter(o -> ObjectUtil.equal(o.getType(), OrgType.BGDL)).map(o -> o.getId()).collect(Collectors.toList());
+//                    List<Long> tempOrgIds = orgs.stream().filter(o -> ObjectUtil.notEqual(o.getType(), OrgType.BGDL)).map(o -> o.getId()).collect(Collectors.toList());
+//                    List<Long> orgIdsNew = this.workTimeService.findOrgIdsByYmd(dateTime.toString().substring(0, 10),SecurityConstants.INNER).getData();
+//                    orgIdList.addAll(tempOrgIds.stream().filter(r -> orgIdsNew.contains(r)).collect(Collectors.toList()));
+//                } else {
+//                    List<Long> orgIdsNew = this.workTimeService.findOrgIdsByYmd(dateTime.toString().substring(0, 10),SecurityConstants.INNER).getData();
+//                    orgIdList = orgIds.stream().filter(r -> orgIdsNew.contains(r)).collect(Collectors.toList());
+//                }
+//            } else {
+//                if (officeAllHour && ObjectUtil.equal(appPlan.getExecOrgType(), OrgType.BGDL.ordinal())) {
+//                    orgIdList = orgIds;
+//                } else {
+//                    List<Long> orgIdsNew = this.workTimeService.findOrgIdsByYmd(dateTime.toString().substring(0, 10),SecurityConstants.INNER).getData();
+//                    orgIdList = orgIds.stream().filter(r -> orgIdsNew.contains(r)).collect(Collectors.toList());
+//                }
+//            }
 
 
             for (Long orgId : orgIdList) {
@@ -268,16 +275,16 @@ public class ResumptionTaskBusiness {
                 jobDto.setOrgId(orgId);
                 List<NFCBindPageVo> nfcList =  nfcBindService.all(jobDto,NFCBindPageVo::to);*/
                 SysWorkTime workTime;
-                if (officeAllHour) {
-                    workTime  = new SysWorkTime();
-                    workTime.setOpenTime("00:00");
-                    workTime.setCloseTime("23:59");
-                } else {
+//                if (officeAllHour) {
+//                    workTime  = new SysWorkTime();
+//                    workTime.setOpenTime("00:00");
+//                    workTime.setCloseTime("23:59");
+//                } else {
                     Ymd ymd=toYmd(dateTime,"DAY");
                     ymd.setOrgId(orgId);
                     ymd.setEnable(true);
                     workTime = this.workTimeService.findWorkTimeByYmd(ymd).getData();
-                }
+//                }
 
                 DateTime planstartTime = null;
                 DateTime planendTime = null;
@@ -286,7 +293,7 @@ public class ResumptionTaskBusiness {
 
                     String opentime = workTime.getOpenTime();//营业时间
                     String closetime = workTime.getCloseTime();//营业终了
-                    if (appPlan.getPlanExec() == 0) {//全天 上班时间-下班时间 00:00:00-23:59:59
+                    if (appPlan.getPlanExec() == 1) {//全天 上班时间-下班时间 00:00:00-23:59:59
                         DateTime time1 = new DateTime(dateTime);
                         time1.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
                         DateTime time2 = new DateTime(dateTime);
@@ -295,21 +302,21 @@ public class ResumptionTaskBusiness {
                         planendTime = DateUtil.endOfDay(time2).setField(DateField.MILLISECOND, 0);//.offset(DateField.MILLISECOND, -999);
                         //planstartTime = time1.setField(DateField.HOUR_OF_DAY,Integer.parseInt(worktime.split(":")[0])).setField(DateField.MINUTE,Integer.parseInt(worktime.split(":")[1])).setField(DateField.SECOND,0);
                         //planendTime = time2.setField(DateField.HOUR_OF_DAY,Integer.parseInt(workofftime.split(":")[0])).setField(DateField.MINUTE,Integer.parseInt(workofftime.split(":")[1])).setField(DateField.SECOND,0);
-                    } else if (appPlan.getPlanExec() == 1) {//营业前 上班时间-营业时间
+                    } else if (appPlan.getPlanExec() == 2) {//营业前 上班时间-营业时间
                         DateTime time1 = new DateTime(dateTime);
                         time1.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
                         DateTime time2 = new DateTime(dateTime);
                         time2.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
                         planstartTime = time1.setField(DateField.HOUR_OF_DAY, 0).setField(DateField.MINUTE, 0).setField(DateField.SECOND, 0).setField(DateField.MILLISECOND, 0);
                         planendTime = time2.setField(DateField.HOUR_OF_DAY, Integer.parseInt(opentime.split(":")[0])).setField(DateField.MINUTE, Integer.parseInt(opentime.split(":")[1])).setField(DateField.SECOND, 0).setField(DateField.MILLISECOND, 0);
-                    } else if (appPlan.getPlanExec() == 2) {//营业期间 营业时间-营业终了
+                    } else if (appPlan.getPlanExec() == 3) {//营业期间 营业时间-营业终了
                         DateTime time1 = new DateTime(dateTime);
                         time1.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
                         DateTime time2 = new DateTime(dateTime);
                         time2.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
                         planstartTime = time1.setField(DateField.HOUR_OF_DAY, Integer.parseInt(opentime.split(":")[0])).setField(DateField.MINUTE, Integer.parseInt(opentime.split(":")[1])).setField(DateField.SECOND, 0).setField(DateField.MILLISECOND, 0);
                         planendTime = time2.setField(DateField.HOUR_OF_DAY, Integer.parseInt(closetime.split(":")[0])).setField(DateField.MINUTE, Integer.parseInt(closetime.split(":")[1])).setField(DateField.SECOND, 0).setField(DateField.MILLISECOND, 0);
-                    } else if (appPlan.getPlanExec() == 3) {//营业终 营业终了-23.59.59
+                    } else if (appPlan.getPlanExec() == 4) {//营业终 营业终了-23.59.59
                         DateTime time1 = new DateTime(dateTime);
                         time1.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
                         DateTime time2 = new DateTime(dateTime);
@@ -342,9 +349,10 @@ public class ResumptionTaskBusiness {
     @Async
     public void syncWeek(DateTime dateTime, int plancycle) {//plancycle==1
         List<AppPlan> AppPlanList = appPlanService.list((new QueryWrapper<AppPlan>()).lambda()
-                .eq(AppPlan::getPlanStatus, 0)
-                .eq(AppPlan::getPlanCycle, plancycle).eq(AppPlan::getPlanType, 0)
-                .notIn(AppPlan::getPlanExec, canteenPlanExec));
+                .eq(AppPlan::getPlanStatus, 1)
+                .eq(AppPlan::getPlanCycle, plancycle));
+//                        .eq(AppPlan::getPlanType, 0)
+//                .notIn(AppPlan::getPlanExec, canteenPlanExec));
         KeyValue<Integer, Integer> yearWeek = new KeyValue<>(DateUtil.year(dateTime), DateUtil.weekOfYear(dateTime));
         DateTime time1 = new DateTime(dateTime);
         time1.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
@@ -389,7 +397,7 @@ public class ResumptionTaskBusiness {
                 jobDto.setOrgId(orgId);
                 List<NFCBindPageVo> nfcList =  nfcBindService.all(jobDto,NFCBindPageVo::to);*/
                 // 判断这周是否有作息
-                final boolean isExist = workTimeService.existByYmd( Ymd.builder().year(yearWeek.getKey()).week(yearWeek.getValue()).orgId(orgId).isEnable(true).build()).getData();
+                boolean isExist = workTimeService.existByYmd( Ymd.builder().year(yearWeek.getKey()).week(yearWeek.getValue()).orgId(orgId).isEnable(true).build()).getData();
 //                final boolean isExist = false;
                 // 应该用周的第一天, 不然页面查是查询不到的
                 //dateTime即为本周第一天
@@ -413,10 +421,10 @@ public class ResumptionTaskBusiness {
     @Async
     public void syncMonth(DateTime dateTime, int plancycle) {//plancycle==2
         List<AppPlan> AppPlanList = appPlanService.list((new QueryWrapper<AppPlan>()).lambda()
-                .eq(AppPlan::getPlanStatus, 0)
-                .eq(AppPlan::getPlanCycle, plancycle)
-                .eq(AppPlan::getPlanType, 0)
-                .notIn(AppPlan::getPlanExec, canteenPlanExec));
+                .eq(AppPlan::getPlanStatus, 1)
+                .eq(AppPlan::getPlanCycle, plancycle));
+//                .eq(AppPlan::getPlanType, 0)
+//                .notIn(AppPlan::getPlanExec, canteenPlanExec));
         KeyValue<Integer, Integer> yearMonth = new KeyValue<>(DateUtil.year(dateTime), DateUtil.month(dateTime) + 1);
 
         DateTime time1 = new DateTime(dateTime);
@@ -485,10 +493,10 @@ public class ResumptionTaskBusiness {
     @Async
     public void syncQuarter(DateTime dateTime, int plancycle) {//plancycle==3
         List<AppPlan> AppPlanList = appPlanService.list((new QueryWrapper<AppPlan>()).lambda()
-                .eq(AppPlan::getPlanStatus, 0)
-                .eq(AppPlan::getPlanCycle, plancycle)
-                .eq(AppPlan::getPlanType, 0)
-                .notIn(AppPlan::getPlanExec, canteenPlanExec));
+                .eq(AppPlan::getPlanStatus, 1)
+                .eq(AppPlan::getPlanCycle, plancycle));
+//                .eq(AppPlan::getPlanType, 0)
+//                .notIn(AppPlan::getPlanExec, canteenPlanExec));
         KeyValue<Integer, Integer> yearQuarter = new KeyValue<>(DateUtil.year(dateTime), DateUtil.quarter(dateTime));
         DateTime time1 = new DateTime(dateTime);
         time1.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
@@ -554,10 +562,10 @@ public class ResumptionTaskBusiness {
     @Async
     public void syncHalfYear(DateTime dateTime, int plancycle) {//plancycle==4
         List<AppPlan> AppPlanList = appPlanService.list((new QueryWrapper<AppPlan>()).lambda()
-                .eq(AppPlan::getPlanStatus, 0)
-                .eq(AppPlan::getPlanCycle, plancycle)
-                .eq(AppPlan::getPlanType, 0)
-                .notIn(AppPlan::getPlanExec, canteenPlanExec));
+                .eq(AppPlan::getPlanStatus, 1)
+                .eq(AppPlan::getPlanCycle, plancycle));
+//                .eq(AppPlan::getPlanType, 0)
+//                .notIn(AppPlan::getPlanExec, canteenPlanExec));
         DateHelper dateHelper = new DateHelper(dateTime);
         KeyValue<Integer, Integer> yearHalfYear = new KeyValue<>(DateUtil.year(dateTime), dateHelper.getHalfyear());
 
@@ -618,10 +626,10 @@ public class ResumptionTaskBusiness {
     @Async
     public void syncYear(DateTime dateTime, int plancycle) {//plancycle==5
         List<AppPlan> AppPlanList = appPlanService.list((new QueryWrapper<AppPlan>()).lambda()
-                .eq(AppPlan::getPlanStatus, 0)
-                .eq(AppPlan::getPlanCycle, plancycle)
-                .eq(AppPlan::getPlanType, 0)
-                .notIn(AppPlan::getPlanExec, canteenPlanExec));
+                .eq(AppPlan::getPlanStatus, 1)
+                .eq(AppPlan::getPlanCycle, plancycle));
+//                .eq(AppPlan::getPlanType, 0)
+//                .notIn(AppPlan::getPlanExec, canteenPlanExec));
         DateTime time1 = new DateTime(dateTime);
         time1.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
         DateTime time2 = new DateTime(DateHelper.getLastDayOfYear(DateUtil.year(dateTime)));
@@ -729,10 +737,12 @@ public class ResumptionTaskBusiness {
      */
     private List<Long> getPlanOrgIds(AppPlan appPlan) {
         List<Long> orgIds = null;
-        if (appPlan.getExecType() == 0) {//0机构类型需要安类型去机构里查询所以的机构
+        if (appPlan.getExecType()!=null&&appPlan.getExecType() == 0) {//0机构类型需要安类型去机构里查询所以的机构
             orgIds = orgService.findListByOrgType(appPlan.getExecOrgType(),SecurityConstants.INNER).getData();
         } else {
-            orgIds = appPlanService.findExecOrgByPlan(appPlan.getId());
+            List<SysOrg> sysOrgs = orgService.selectByOrgType(appPlan.getExecOrgType(), SecurityConstants.INNER);
+             orgIds = sysOrgs.stream().map(SysOrg::getId).collect(Collectors.toList());
+//            orgIds = appPlanService.findExecOrgByPlan(appPlan.getId());
         }
 
         return orgIds;

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppPlanMapper.xml

@@ -149,7 +149,7 @@
     <select id="findExecOrgByPlan" parameterType="Long" resultType="Long">
         select org_id
         from core_resumption_plan_to_exec_org a
-        INNER JOIN t_org o on a.org_id=o.id and o.deleted=0 and o.is_lock=0 and o.temporarily_closed=0
+        INNER JOIN sys_org o on a.org_id=o.id and o.deleted=0 and o.is_lock=0
         where a.plan_id = #{plan_id}
     </select>
     <select id="findRoleByPlan" parameterType="Long" resultType="Long">

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppResumptionDataMapper.xml

@@ -62,7 +62,7 @@
         FROM
             t_app_resumption_data a
             INNER JOIN t_app_resumption r ON a.resumption_id = r.id
-            INNER JOIN t_app_plan p ON p.id = a.plan_id
+            INNER JOIN core_resumption_plan p ON p.id = a.plan_id
             LEFT JOIN t_app_rule_point d ON a.item_id = d.id
     WHERE
         r.ymd_date = #{date}

+ 6 - 6
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRulePointMapper.xml

@@ -32,7 +32,7 @@
 <!--        inner join sys_area a on p.area_id = a.id-->
 <!--        inner join sys_dict_detail d on d.code = p.safe_type and d.dict_code = 'check_type'-->
 <!--        inner join core_resumption_plan_to_item ti on ti.item_id=p.id-->
-<!--        inner join t_app_plan ap on ti.plan_id =ap.id-->
+<!--        inner join core_resumption_plan ap on ti.plan_id =ap.id-->
 <!--        where p.deleted = 0-->
 <!--        <if test="pointIds != null and pointIds.size > 0">-->
 <!--            and p.id in-->
@@ -50,8 +50,8 @@
     <select id="findPointByPlan" parameterType="Long" resultType="com.xunmei.core.resumption.vo.AppRulePointTaskVo">
         SELECT a.*, b.point_scan
         from core_resumption_rule_point a
-                 LEFT JOIN core_resumption_plan_to_item b ON a.id = b.item_id
-                 LEFT JOIN t_app_plan c ON b.plan_id = c.id
+                 LEFT JOIN core_resumption_plan_to_item b ON a.item_id = b.item_id
+                 LEFT JOIN core_resumption_plan c ON b.plan_id = c.id
         WHERE c.id = #{planid}
     </select>
     <select id="selectPointListByIdList" resultType="com.xunmei.core.resumption.dto.appRulePoint.AppRulePointInfoDto"
@@ -97,7 +97,7 @@
 <!--        SELECT a.*, b.point_scan-->
 <!--        from core_resumption_rule_point a-->
 <!--                 LEFT JOIN core_resumption_plan_to_item b ON a.id = b.item_id-->
-<!--                 LEFT JOIN t_app_plan c ON b.plan_id = c.id-->
+<!--                 LEFT JOIN core_resumption_plan c ON b.plan_id = c.id-->
 <!--        WHERE c.id = #{planid}-->
 <!--    </select>-->
 
@@ -105,7 +105,7 @@
         SELECT a.area_id as areaid, d.name as areaname
         from core_resumption_rule_point a
                  LEFT JOIN core_resumption_plan_to_item b ON a.id = b.item_id
-                 LEFT JOIN t_app_plan c ON b.plan_id = c.id
+                 LEFT JOIN core_resumption_plan c ON b.plan_id = c.id
                  LEFT JOIN t_area d ON a.area_id = d.id
         WHERE c.id = #{planid}
     </select>
@@ -200,7 +200,7 @@
         b.plan_id as planId,e.item_name as itemname,b.point_scan as pointScan,b.required,a.business_type as businessType
         from core_resumption_rule_point a
                  LEFT JOIN core_resumption_plan_to_item b ON a.id = b.item_id
-                 LEFT JOIN t_app_plan c ON b.plan_id = c.id
+                 LEFT JOIN core_resumption_plan c ON b.plan_id = c.id
                  LEFT JOIN t_app_rule_item e ON a.item_id = e.id
                  left join t_area f on a.area_id = f.id
         WHERE c.id = #{planId} and a.deleted=0

+ 4 - 4
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/ResumptionMapper.xml

@@ -31,7 +31,7 @@
             a.type AS type
         FROM
             core_resumption a
-                LEFT JOIN t_app_plan b ON a.plan_id = b.id
+                LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
         WHERE
             a.ymd_year =#{year}
           AND a.ymd_quarter =#{quarter}
@@ -58,7 +58,7 @@
             STATUS
         FROM
             t_app_resumption a
-                LEFT JOIN t_app_plan b ON a.plan_id = b.id
+                LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
         WHERE
             a.ymd_year =#{year}
           AND a.ymd_quarter =#{quarter}
@@ -84,7 +84,7 @@
             STATUS
         FROM
             t_app_resumption a
-                LEFT JOIN t_app_plan b ON a.plan_id = b.id
+                LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
         WHERE
             a.ymd_year =#{year}
           AND a.ymd_quarter =#{quarter}
@@ -117,7 +117,7 @@
             a.type
         FROM
             t_app_resumption a
-                LEFT JOIN t_app_plan b ON a.plan_id = b.id
+                LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
         WHERE
             a.id =#{taskId}
           AND a.ymd_year =#{year}

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/SysResumptionMapper.xml

@@ -121,7 +121,7 @@
     </select>
     <select id="findResumptionList" resultType="com.xunmei.core.resumption.vo.WorkChangeResumptionVo">
         select a.id,b.id as planId,b.plan_exec as planExec,a.status,a.org_id as orgId
-        from core_resumption a left join t_app_plan b on a.plan_id =b.id
+        from core_resumption a left join core_resumption_plan b on a.plan_id =b.id
         where a.ymd_year = #{year} and a.ymd_quarter=#{quarter} and a.ymd_date=#{date} and `type`=#{type} and b.plan_exec not in (4,5,6) and a.org_id in
         <foreach collection="orgIds" item="item" open="(" separator="," close=")">
             #{item}

+ 1 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysWorkTimeController.java

@@ -131,7 +131,7 @@ public class SysWorkTimeController extends BaseController {
     }
 
     @PostMapping("/findWorkTimeByYmd")
-    R<SysWorkTime> findWorkTimeByYmd(Ymd ymd) {
+    R<SysWorkTime> findWorkTimeByYmd(@RequestBody Ymd ymd) {
         return R.ok(sysWorkTimeService.findWorkTimeByYmd(ymd.getOrgId(), ymd, ymd.isEnable()));
 
     }

+ 40 - 16
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysWorkTimeServiceImpl.java

@@ -1,37 +1,38 @@
 package com.xunmei.system.service.impl;
 
-import java.util.*;
-import java.util.stream.Collectors;
-
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
 import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.core.utils.Ymd;
+import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.common.security.utils.SecurityUtils;
+import com.xunmei.system.api.domain.SysWorkTime;
 import com.xunmei.system.domain.SysWorkTimeSet;
 import com.xunmei.system.dto.SysWorkTimeDto;
+import com.xunmei.system.mapper.SysWorkTimeMapper;
 import com.xunmei.system.mapper.SysWorkTimeSetMapper;
+import com.xunmei.system.service.ISysOrgService;
+import com.xunmei.system.service.ISysWorkTimeService;
 import com.xunmei.system.util.WorkChangeEvent;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
-import com.xunmei.system.service.ISysOrgService;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xunmei.common.core.web.page.TableDataInfo;
-import com.xunmei.system.mapper.SysWorkTimeMapper;
-import com.xunmei.system.api.domain.SysWorkTime;
-import com.xunmei.system.service.ISysWorkTimeService;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
 /**
  * 【请填写功能名称】Service业务层处理
  *
@@ -179,7 +180,30 @@ public class SysWorkTimeServiceImpl extends ServiceImpl<SysWorkTimeMapper, SysWo
 
     @Override
     public SysWorkTime findWorkTimeByYmd(Long orgId, Ymd ymd, boolean isEnable) {
-        List<SysWorkTime> workTimes = this.baseMapper.selectList(new QueryWrapper<SysWorkTime>().eq("orgId", orgId).eq("ymd", ymd).eq("isEnable", isEnable));
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String dateString = ymd.getYear() + "-" + ymd.getMonth() + "-" + ymd.getDay();
+        Date date = null;
+        try {
+            date = sdf.parse(dateString);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        QueryWrapper<SysWorkTime> queryWrapper = new QueryWrapper();
+        if (orgId != null) {
+            queryWrapper.eq("org_id", orgId);
+        }
+//        if (ymd.getYear() != null) {
+//            queryWrapper.eq("ymd_year", ymd.getYear());
+//        }
+//        if (ymd.getMonth() != null) {
+//            queryWrapper.eq("ymd_month", ymd.getMonth());
+//        }
+//        if (ymd.getDay() != null) {
+//            queryWrapper.eq("ymd_day", ymd.getDay());
+//        }
+        queryWrapper.eq("ymd_date", date);
+        queryWrapper.eq("is_enable", isEnable);
+        List<SysWorkTime> workTimes = this.baseMapper.selectList(queryWrapper);
         if (workTimes != null && workTimes.size() > 0) {
             return workTimes.get(0);
         } else {
@@ -247,7 +271,7 @@ public class SysWorkTimeServiceImpl extends ServiceImpl<SysWorkTimeMapper, SysWo
         //通过月份获取当月第一天和最后一天
         Date fistDate = DateUtil.beginOfMonth(month);
         Date lastDate = DateUtil.endOfMonth(month);
-        List<SysWorkTime> workTimeOnAppVos = sysWorkTimeMapper.findByOrgAndDate(sysWorkTime.getOrgId(),fistDate,lastDate);
+        List<SysWorkTime> workTimeOnAppVos = sysWorkTimeMapper.findByOrgAndDate(sysWorkTime.getOrgId(), fistDate, lastDate);
         final List<DateTime> dateTimeList = DateUtil.rangeToList(fistDate, lastDate, DateField.DAY_OF_MONTH);
         //遍历dateTimeList
         List<SysWorkTime> workTimeOnAppVoList = new ArrayList<>();
@@ -270,7 +294,7 @@ public class SysWorkTimeServiceImpl extends ServiceImpl<SysWorkTimeMapper, SysWo
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     public List<SysWorkTime> batchnew(Long orgId, List<SysWorkTime> workTimeDtoList) {
         Date now = DateUtil.beginOfDay(new Date());
         Date updateTime = new Date();
@@ -279,7 +303,7 @@ public class SysWorkTimeServiceImpl extends ServiceImpl<SysWorkTimeMapper, SysWo
             if (s.getIsEnable() == null || s.getYmdDate().before(now)) {
 //                WORKTIMEBUSINESSLOG.info("作息时间[ {} ]小于现在时间, 不允许改变", workDate);
 //                return null;
-            }else {
+            } else {
                 s.setId(null);
                 s.setOrgId(orgId);
                 s.setIsManual(1L);