|
|
@@ -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;
|