|
|
@@ -2,6 +2,7 @@ package com.xunmei.core.drill.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
@@ -25,6 +26,7 @@ import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanDataVo;
|
|
|
import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanDetailVo;
|
|
|
import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanPageVo;
|
|
|
import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanRoleVo;
|
|
|
+import com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlan;
|
|
|
import com.xunmei.common.core.enums.OrgTypeEnum;
|
|
|
import com.xunmei.common.core.enums.drill.DrillDoStatus;
|
|
|
import com.xunmei.common.core.enums.drill.DrillPlanCycleEnum;
|
|
|
@@ -334,11 +336,14 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
|
|
|
.set(CoreDrillPlan::getUpdateTime, new Date())
|
|
|
.set(CoreDrillPlan::getUpdateBy, String.valueOf(SecurityUtils.getLoginUser().getSysUser().getId()))
|
|
|
);
|
|
|
+ final Date today = new Date();
|
|
|
for (Long pId : list) {
|
|
|
CompletableFuture.runAsync(() -> {
|
|
|
//如果不是省联社或者办事处,状态启用,并且是无周期或者立即生效
|
|
|
CoreDrillPlanDataVo detailPlanData = getCoreDrillPlanDataVo(pId);
|
|
|
- coreDrillTaskService.createTaskForNow(detailPlanData, plan.getPlanStartDate(), plan.getPlanEndDate());
|
|
|
+ if (DateUtil.isSameDay(detailPlanData.getEffectiveTime(), today) || detailPlanData.getEffectiveTime().before(today)) {
|
|
|
+ coreDrillTaskService.createTaskForNow(detailPlanData, plan.getPlanStartDate(), plan.getPlanEndDate());
|
|
|
+ }
|
|
|
}, threadPoolTaskExecutor);
|
|
|
}
|
|
|
|
|
|
@@ -397,7 +402,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
|
|
|
delAllByParentPlanId(plan);
|
|
|
List<CoreDrillPlan> planList = null;
|
|
|
if (plan.getIssue() == 1) {
|
|
|
- planList = buildPlanData(plan, null, false);
|
|
|
+ planList = buildPlanData(plan, null, false, 0);
|
|
|
} else {
|
|
|
planList = ListUtil.list(true, plan);
|
|
|
}
|
|
|
@@ -674,7 +679,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
|
|
|
.eq(CoreDrillPlan::getParentId, planId)
|
|
|
.select(CoreDrillPlan::getId).list();
|
|
|
if (planList.isEmpty()) {
|
|
|
- planList = buildPlanData(plan, new ArrayList<>(), true);
|
|
|
+ planList = buildPlanData(plan, new ArrayList<>(), true, status);
|
|
|
} else {
|
|
|
planList.forEach(plan1 -> plan1.setPlanStatus(EduTrainingPlanStatus.USING.getCode()));
|
|
|
List<Long> collect = planList.stream().map(CoreDrillPlan::getId).collect(Collectors.toList());
|
|
|
@@ -683,6 +688,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
|
|
|
//下发后修改为使用中
|
|
|
plan.setPlanStatus(DrillPlanStatus.USING.getCode());
|
|
|
plan.setIssue(1);
|
|
|
+ this.updatePlanTime(plan, status);
|
|
|
this.updateById(plan);
|
|
|
if (ObjectUtil.equal(status, 1)) {
|
|
|
//status=1:立即生效 status=0:下周期生效
|
|
|
@@ -709,6 +715,18 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void updatePlanTime(CoreDrillPlan plan, int status) {
|
|
|
+ plan.setPublishTime(new Date());
|
|
|
+ if (ObjectUtil.equal(status, 1)) {
|
|
|
+ //status=1:立即生效 status=0:下周期生效
|
|
|
+ plan.setBuildTaskNow(1);
|
|
|
+ plan.setEffectiveTime(new Date());
|
|
|
+ } else {
|
|
|
+ plan.setBuildTaskNow(0);
|
|
|
+ plan.setEffectiveTime(DateUtil.offsetDay(plan.getPlanEndDate(), 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private Boolean anotherCheckOrgType(Integer orgType) {
|
|
|
if (ObjectUtil.isEmpty(orgType)) {
|
|
|
throw new RuntimeException("当前用户所在机构类型无法确认!");
|
|
|
@@ -738,11 +756,12 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
|
|
|
update(new LambdaUpdateWrapper<CoreDrillPlan>()
|
|
|
.eq(CoreDrillPlan::getId, planId)
|
|
|
.set(CoreDrillPlan::getIssue, 0)
|
|
|
+ .set(CoreDrillPlan::getWithdrawTime, new Date())
|
|
|
.set(CoreDrillPlan::getPlanStatus, DrillPlanStatus.DRAFT.getCode()));
|
|
|
return 1;
|
|
|
} else {
|
|
|
//计划下有已完成:不删任务,计划状态回到停用。
|
|
|
- coreDrillPlanMapper.updatePlanStatusByIdOrParentId(planId, EduTrainingPlanStatus.DELETED.getCode());
|
|
|
+ coreDrillPlanMapper.updatePlanStatusByIdOrParentId(planId, DrillPlanStatus.DELETED.getCode());
|
|
|
CoreDrillPlan plan = getById(planId);
|
|
|
plan.setIssue(0);
|
|
|
return coreDrillPlanMapper.updateById(plan);
|
|
|
@@ -792,7 +811,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- private List<CoreDrillPlan> buildPlanData(CoreDrillPlan plan, List<CoreDrillPlanToRole> planRoleList, boolean isPublish) {
|
|
|
+ private List<CoreDrillPlan> buildPlanData(CoreDrillPlan plan, List<CoreDrillPlanToRole> planRoleList, boolean isPublish, int status) {
|
|
|
/*if (ObjectUtil.isEmpty(planRoleList)) {
|
|
|
//获取执行角色
|
|
|
LambdaQueryWrapper<CoreDrillPlanToRole> ros = new LambdaQueryWrapper<>();
|
|
|
@@ -840,6 +859,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
|
|
|
drillPlan.setParentId(plan.getId());
|
|
|
drillPlan.setCreateTime(new Date());
|
|
|
drillPlan.setUpdateTime(new Date());
|
|
|
+ this.updatePlanTime(plan, status);
|
|
|
list.add(drillPlan);
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(planExecOrgList)) {
|