|
|
@@ -12,6 +12,7 @@ import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.DateRange;
|
|
|
import com.xunmei.common.core.domain.worktime.domain.SysWorkTime;
|
|
|
import com.xunmei.common.core.enums.CycleCommonEnum;
|
|
|
+import com.xunmei.common.core.enums.OrgTypeEnum;
|
|
|
import com.xunmei.common.core.utils.DateHelper;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
import com.xunmei.common.core.utils.IDHelper;
|
|
|
@@ -34,6 +35,7 @@ import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.lang.reflect.Array;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -130,6 +132,7 @@ public class SafetyCheckJobBusiness extends TaskCreatingServiceImplBase<CoreSafe
|
|
|
return workTimeService.getWorkTime(map, SecurityConstants.INNER);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 有周期计划生成任务
|
|
|
*
|
|
|
@@ -247,9 +250,9 @@ public class SafetyCheckJobBusiness extends TaskCreatingServiceImplBase<CoreSafe
|
|
|
checkOrgs.add(org);
|
|
|
}
|
|
|
|
|
|
- List<Integer> orgTypes = checkOrgTypes.stream().filter(t -> ObjectUtil.notEqual(t,execOrgType)).collect(Collectors.toList());
|
|
|
- if(CollectionUtil.isNotEmpty(orgTypes)){
|
|
|
- List<SysOrg> checkOrgsTmp = orgService.findByOrgTypesAndParent(new FindOrgTypes(orgTypes, org.getPath()), SecurityConstants.INNER);
|
|
|
+ List<Integer> orgTypes = checkOrgTypes.stream().filter(t -> ObjectUtil.notEqual(t, execOrgType)).collect(Collectors.toList());
|
|
|
+ if (CollectionUtil.isNotEmpty(orgTypes)) {
|
|
|
+ List<SysOrg> checkOrgsTmp = orgService.findByOrgTypesAndParent(new FindOrgTypes(orgTypes, org.getPath()), SecurityConstants.INNER);
|
|
|
checkOrgs.addAll(checkOrgsTmp);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -348,9 +351,9 @@ public class SafetyCheckJobBusiness extends TaskCreatingServiceImplBase<CoreSafe
|
|
|
checkOrgs.add(org);
|
|
|
}
|
|
|
|
|
|
- List<Integer> orgTypes = checkOrgTypes.stream().filter(t -> ObjectUtil.notEqual(t,execOrgType)).collect(Collectors.toList());
|
|
|
- if(CollectionUtil.isNotEmpty(orgTypes)){
|
|
|
- List<SysOrg> checkOrgsTmp = orgService.findByOrgTypesAndParent(new FindOrgTypes(orgTypes, org.getPath()), SecurityConstants.INNER);
|
|
|
+ List<Integer> orgTypes = checkOrgTypes.stream().filter(t -> ObjectUtil.notEqual(t, execOrgType)).collect(Collectors.toList());
|
|
|
+ if (CollectionUtil.isNotEmpty(orgTypes)) {
|
|
|
+ List<SysOrg> checkOrgsTmp = orgService.findByOrgTypesAndParent(new FindOrgTypes(orgTypes, org.getPath()), SecurityConstants.INNER);
|
|
|
checkOrgs.addAll(checkOrgsTmp);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -409,14 +412,25 @@ public class SafetyCheckJobBusiness extends TaskCreatingServiceImplBase<CoreSafe
|
|
|
code = CycleCommonEnum.getEnum(Math.toIntExact(plan.getPlanCycle()) + 2);
|
|
|
dateRange = DateUtils.getStartAndEnd(new Date(), code);
|
|
|
}
|
|
|
- //获取当前受检机构当前周期营业中的作息
|
|
|
- List<SysWorkTime> workTimes = getWorkTime(dateRange.getStartTime(), dateRange.getEndTime(), org.getId());
|
|
|
//配合履职次数为short类型
|
|
|
short coun = Short.parseShort(plan.getCount().toString());
|
|
|
+ //获取当前受检机构当前周期营业中的作息
|
|
|
+ Map<Short, StartEndTime> rangeMap = null;
|
|
|
+ if (needUsedWorkTime(org)) {
|
|
|
+ List<SysWorkTime> workTimes = getWorkTime(dateRange.getStartTime(), dateRange.getEndTime(), org.getId());
|
|
|
+ if (CollectionUtil.isEmpty(workTimes)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ rangeMap = splitTaskTime(coun, CycleCommonEnum.getEnum(cycleCode),
|
|
|
+ dateRange.getStartTime(), dateRange.getEndTime(), workTimes);
|
|
|
+ } else {
|
|
|
+ rangeMap = splitTaskTime(coun, CycleCommonEnum.getEnum(cycleCode),
|
|
|
+ dateRange.getStartTime(), dateRange.getEndTime(), null);
|
|
|
+ }
|
|
|
+
|
|
|
//划分时间
|
|
|
- Map<Short, StartEndTime> rangeMap = splitTaskTime(coun, CycleCommonEnum.getEnum(cycleCode),
|
|
|
- dateRange.getStartTime(), dateRange.getEndTime(), workTimes);
|
|
|
- short cou=1;
|
|
|
+
|
|
|
+ short cou = 1;
|
|
|
for (short i = 1; i <= coun; i++) {
|
|
|
//如果不存在当前次数的时间划分结果
|
|
|
if (!rangeMap.containsKey(i)) {
|