|
@ -1,5 +1,6 @@ |
|
|
package com.easy.admin.modules.huzhou.service.impl; |
|
|
package com.easy.admin.modules.huzhou.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
@ -8,20 +9,20 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.easy.admin.auth.model.SysUser; |
|
|
import com.easy.admin.auth.model.SysUser; |
|
|
import com.easy.admin.auth.service.SysUserService; |
|
|
import com.easy.admin.auth.service.SysUserService; |
|
|
|
|
|
import com.easy.admin.common.constant.CommonConstant; |
|
|
import com.easy.admin.common.core.common.select.Select; |
|
|
import com.easy.admin.common.core.common.select.Select; |
|
|
import com.easy.admin.common.core.exception.EasyException; |
|
|
import com.easy.admin.common.core.exception.EasyException; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouPlaninfoHistoryMapper; |
|
|
|
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouPlaninfoMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouPlaninfoMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouPlaninfofileMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouPlaninfofileMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouProcessinfoMapper; |
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouProcessinfoMapper; |
|
|
|
|
|
import com.easy.admin.modules.huzhou.dao.HuzhouSubProjectinfoMapper; |
|
|
import com.easy.admin.modules.huzhou.entity.*; |
|
|
import com.easy.admin.modules.huzhou.entity.*; |
|
|
import com.easy.admin.modules.huzhou.service.*; |
|
|
import com.easy.admin.modules.huzhou.service.*; |
|
|
import com.easy.admin.modules.huzhou.vo.HuzhouProjectinfoOV; |
|
|
import com.easy.admin.modules.huzhou.vo.HuzhouProjectinfoOV; |
|
|
import com.easy.admin.sys.model.SysDict; |
|
|
import com.easy.admin.sys.model.SysDict; |
|
|
import com.easy.admin.sys.service.SysDictService; |
|
|
import com.easy.admin.sys.service.SysDictService; |
|
|
import com.easy.admin.util.ShiroUtil; |
|
|
import com.easy.admin.util.ShiroUtil; |
|
|
import com.google.common.collect.Lists; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import groovyjarjarantlr4.v4.parse.v4ParserException; |
|
|
|
|
|
import org.activiti.engine.HistoryService; |
|
|
import org.activiti.engine.HistoryService; |
|
|
import org.activiti.engine.RuntimeService; |
|
|
import org.activiti.engine.RuntimeService; |
|
|
import org.activiti.engine.TaskService; |
|
|
import org.activiti.engine.TaskService; |
|
@ -38,7 +39,6 @@ import com.easy.admin.modules.huzhou.vo.HuzhouPlaninfoOV; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.util.FileCopyUtils; |
|
|
import org.springframework.util.FileCopyUtils; |
|
@ -51,9 +51,9 @@ import java.io.IOException; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigInteger; |
|
|
import java.math.BigInteger; |
|
|
|
|
|
import java.math.RoundingMode; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
import java.time.Period; |
|
|
|
|
|
import java.time.ZoneId; |
|
|
import java.time.ZoneId; |
|
|
import java.time.temporal.ChronoUnit; |
|
|
import java.time.temporal.ChronoUnit; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
@ -68,6 +68,7 @@ import java.util.stream.Collectors; |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
@Transactional |
|
|
@Transactional |
|
|
|
|
|
@Slf4j |
|
|
public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper,HuzhouPlaninfo> implements IHuzhouPlaninfoService { |
|
|
public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper,HuzhouPlaninfo> implements IHuzhouPlaninfoService { |
|
|
@Value(value = "${jeecg.path.upload}") |
|
|
@Value(value = "${jeecg.path.upload}") |
|
|
private String uploadpath; |
|
|
private String uploadpath; |
|
@ -96,8 +97,12 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper, |
|
|
@Autowired |
|
|
@Autowired |
|
|
private SysDictService sysDictService; |
|
|
private SysDictService sysDictService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
private HuzhouPlaninfoMapper planInfoMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IHuzhouUserprojectService userProjectService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private HuzhouSubProjectinfoMapper subProjectInfoMapper; |
|
|
|
|
|
|
|
|
private HuzhouPlaninfoMapper planinfoMapper; |
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public HashMap<String,Object> getPlanInfoListFromFile(MultipartFile multipartFile,String projectid) throws Exception { |
|
|
public HashMap<String,Object> getPlanInfoListFromFile(MultipartFile multipartFile,String projectid) throws Exception { |
|
|
HashMap<String, Object> resHashMap = new HashMap<>(); |
|
|
HashMap<String, Object> resHashMap = new HashMap<>(); |
|
@ -276,57 +281,141 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public ArrayList<HuzhouPlaninfoOV> getPlanInfoMainTimelineList(String projectid) { |
|
|
public ArrayList<HuzhouPlaninfoOV> getPlanInfoMainTimelineList(String projectId) { |
|
|
//查询父计划
|
|
|
//查询父计划
|
|
|
LambdaQueryWrapper<HuzhouPlaninfo> planinfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<HuzhouPlaninfo> planinfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
planinfoLambdaQueryWrapper.eq(HuzhouPlaninfo::getProjectId,projectid); |
|
|
planinfoLambdaQueryWrapper.eq(HuzhouPlaninfo::getProjectId, projectId); |
|
|
planinfoLambdaQueryWrapper.eq(HuzhouPlaninfo::getSuperior, "0"); |
|
|
planinfoLambdaQueryWrapper.eq(HuzhouPlaninfo::getSuperior, "0"); |
|
|
planinfoLambdaQueryWrapper.orderByAsc(HuzhouPlaninfo::getTaskLevel); |
|
|
planinfoLambdaQueryWrapper.orderByAsc(HuzhouPlaninfo::getTaskLevel); |
|
|
List<HuzhouPlaninfo> huzhouPlaninfoList = this.list(planinfoLambdaQueryWrapper); |
|
|
// 查询 huzhou_planinfo 项目计划表 查询本级任务进度的信息
|
|
|
ArrayList<HuzhouPlaninfoOV> mapArrayList = new ArrayList<>(); |
|
|
List<HuzhouPlaninfo> superPlanInfoList = this.list(planinfoLambdaQueryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
// 1.判断该项目是否存在子项目
|
|
|
|
|
|
List<String> subProjectIds = getSubProjectIds(projectId); |
|
|
|
|
|
if (CollectionUtil.isNotEmpty(subProjectIds)) { |
|
|
|
|
|
log.info("存在子项目需重新计算主项目进度"); |
|
|
|
|
|
// 2.获取所有子项目对应的任务级别 (不考虑任务本级)
|
|
|
|
|
|
List<String> taskLevelList = planInfoMapper.selectDistinctLowerTaskLevels(projectId); |
|
|
|
|
|
log.info("下级任务级别集合为:{}", taskLevelList); |
|
|
|
|
|
|
|
|
|
|
|
// 3.获取子项目的计划进度 (huzhou_planinfo)
|
|
|
|
|
|
LambdaQueryWrapper<HuzhouPlaninfo> subPlanInfoWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
subPlanInfoWrapper.in(HuzhouPlaninfo::getProjectId, subProjectIds); |
|
|
|
|
|
List<HuzhouPlaninfo> subPlanInfoList = this.list(subPlanInfoWrapper); |
|
|
|
|
|
|
|
|
|
|
|
// 4.获取主任务各阶段计划表
|
|
|
|
|
|
LambdaQueryWrapper<HuzhouPlaninfo> mainInfoWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
mainInfoWrapper.eq(HuzhouPlaninfo::getProjectId, projectId); |
|
|
|
|
|
mainInfoWrapper.orderByAsc(HuzhouPlaninfo::getTaskLevel); |
|
|
|
|
|
List<HuzhouPlaninfo> mainPlanInfoList = planInfoMapper.selectList(mainInfoWrapper); |
|
|
|
|
|
|
|
|
|
|
|
// 5.遍历子项目的各子级别,所有子完成则主完成
|
|
|
|
|
|
dealMainTaskLevelIsFinish(projectId, taskLevelList, subPlanInfoList, mainPlanInfoList); |
|
|
|
|
|
} |
|
|
|
|
|
ArrayList<HuzhouPlaninfoOV> resultList = new ArrayList<>(); |
|
|
long totalCount = 0; //计划总数量
|
|
|
long totalCount = 0; //计划总数量
|
|
|
long totalFinishCount = 0;//已完成的数量
|
|
|
long totalFinishCount = 0;//已完成的数量
|
|
|
for (HuzhouPlaninfo info:huzhouPlaninfoList) { |
|
|
|
|
|
|
|
|
for (HuzhouPlaninfo info:superPlanInfoList) { |
|
|
HuzhouPlaninfoOV huzhouPlaninfoOV = new HuzhouPlaninfoOV(); |
|
|
HuzhouPlaninfoOV huzhouPlaninfoOV = new HuzhouPlaninfoOV(); |
|
|
BeanUtils.copyProperties(info,huzhouPlaninfoOV); |
|
|
BeanUtils.copyProperties(info,huzhouPlaninfoOV); |
|
|
//当前计划如果在流程中,判断是否可编辑
|
|
|
|
|
|
HuzhouPlaninfoOV setchilddata = setchild(huzhouPlaninfoOV); |
|
|
HuzhouPlaninfoOV setChildData = setchild(huzhouPlaninfoOV); |
|
|
if("1".equals(setchilddata.getIsfinish())){ |
|
|
|
|
|
String isEdit = getPlanFileApprovalInfoByPlaninfoId(setchilddata.getId()).get("isEdit"); |
|
|
//当前计划如果在流程中,判断是否可编辑 isfinish字段值含义:0未开始 1审批中 2已完成
|
|
|
setchilddata.setIsEdit(isEdit); |
|
|
if(CommonConstant.PRO_PLAN_APPLY.equals(setChildData.getIsfinish())){ |
|
|
|
|
|
String isEdit = getPlanFileApprovalInfoByPlaninfoId(setChildData.getId()).get("isEdit"); |
|
|
|
|
|
setChildData.setIsEdit(isEdit); |
|
|
} |
|
|
} |
|
|
String taskLevel = info.getTaskLevel(); |
|
|
String taskLevel = info.getTaskLevel(); |
|
|
//查询任务整体进度情况
|
|
|
//查询主任务整体进度情况
|
|
|
LambdaQueryWrapper<HuzhouPlaninfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<HuzhouPlaninfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
queryWrapper.likeRight(HuzhouPlaninfo::getTaskLevel,taskLevel+"."); |
|
|
queryWrapper.likeRight(HuzhouPlaninfo::getTaskLevel,taskLevel+"."); |
|
|
queryWrapper.eq(HuzhouPlaninfo::getProjectId,projectid); |
|
|
queryWrapper.eq(HuzhouPlaninfo::getProjectId,projectId); |
|
|
//所有:所有下级还要加他自己
|
|
|
//所有:所有下级还要加他自己 (下级阶段数+本级阶段数 1.% +1 )
|
|
|
long count = this.count(queryWrapper)+1; |
|
|
long lowerCount = this.count(queryWrapper)+1; |
|
|
|
|
|
|
|
|
//查询完成的数量
|
|
|
//查询完成的数量
|
|
|
queryWrapper.eq(HuzhouPlaninfo::getIsfinish,"2"); |
|
|
queryWrapper.eq(HuzhouPlaninfo::getIsfinish, CommonConstant.PRO_PLAN_FINISHED); |
|
|
long finishCount = this.count(queryWrapper); |
|
|
long lowerFinishiCount = this.count(queryWrapper); |
|
|
if("2".equals(info.getIsfinish())){ |
|
|
if( CommonConstant.PRO_PLAN_FINISHED.equals(info.getIsfinish())){ |
|
|
//如果自己也完成了 则加1
|
|
|
//如果自己也完成了 则加1
|
|
|
finishCount++; |
|
|
lowerFinishiCount++; |
|
|
} |
|
|
} |
|
|
totalCount+=count; |
|
|
log.info("本阶段的完成数为:{}-----本阶段的总数为:{}",lowerFinishiCount,lowerCount); |
|
|
totalFinishCount+=finishCount; |
|
|
totalCount+=lowerCount; |
|
|
BigDecimal a = new BigDecimal(count); |
|
|
totalFinishCount+=lowerFinishiCount; |
|
|
BigDecimal b = new BigDecimal(finishCount); |
|
|
log.info("整体累计完成数为:{}----整体累计总数为:{}",totalFinishCount,totalCount); |
|
|
String percent = b.divide(a, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).toString(); |
|
|
// 计算子阶段的百分比
|
|
|
|
|
|
BigDecimal a = new BigDecimal(lowerCount); |
|
|
|
|
|
BigDecimal b = new BigDecimal(lowerFinishiCount); |
|
|
|
|
|
|
|
|
|
|
|
String percent = b.divide(a, 2, RoundingMode.HALF_UP) |
|
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
|
.toString(); |
|
|
percent = percent.substring(0,percent.indexOf(".")); |
|
|
percent = percent.substring(0,percent.indexOf(".")); |
|
|
setchilddata.setPercent(percent); |
|
|
// 设置百分比(小)
|
|
|
mapArrayList.add(setchilddata); |
|
|
setChildData.setPercent(percent); |
|
|
|
|
|
resultList.add(setChildData); |
|
|
} |
|
|
} |
|
|
|
|
|
// 设置整体百分比
|
|
|
String totalPercent="0"; |
|
|
String totalPercent="0"; |
|
|
if(totalCount>0){ |
|
|
if(totalCount>0){ |
|
|
totalPercent = new BigDecimal(totalFinishCount).divide(new BigDecimal(totalCount), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).toString(); |
|
|
totalPercent = new BigDecimal(totalFinishCount) |
|
|
|
|
|
.divide(new BigDecimal(totalCount), 2, RoundingMode.HALF_UP) |
|
|
|
|
|
.multiply(BigDecimal.valueOf(100)) |
|
|
|
|
|
.toString(); |
|
|
totalPercent = totalPercent.substring(0,totalPercent.indexOf(".")); |
|
|
totalPercent = totalPercent.substring(0,totalPercent.indexOf(".")); |
|
|
mapArrayList.get(0).setTotalPercent(totalPercent); |
|
|
resultList.get(0).setTotalPercent(totalPercent); |
|
|
|
|
|
} |
|
|
|
|
|
return resultList; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void dealMainTaskLevelIsFinish(String projectId, List<String> taskLevelList, List<HuzhouPlaninfo> subPlanInfoList, List<HuzhouPlaninfo> mainPlanInfoList) { |
|
|
|
|
|
for (String taskLevel : taskLevelList) { |
|
|
|
|
|
// 检查该 taskLevel 下的所有子项目是否都已完成
|
|
|
|
|
|
boolean allSubTasksFinished = subPlanInfoList.stream() |
|
|
|
|
|
.filter(info -> taskLevel.equals(info.getTaskLevel())) // 过滤出当前 taskLevel 的子项目
|
|
|
|
|
|
.allMatch(info -> "2".equals(info.getIsfinish())); // 检查是否所有子项目的该 taskLevel 已完成
|
|
|
|
|
|
|
|
|
|
|
|
if (allSubTasksFinished) { |
|
|
|
|
|
// 更新主项目的对应 taskLevel 的 isFinish 状态为 2(已完成)
|
|
|
|
|
|
mainPlanInfoList.stream() |
|
|
|
|
|
.filter(info -> taskLevel.equals(info.getTaskLevel())) |
|
|
|
|
|
.findFirst() |
|
|
|
|
|
// 处于正在执行中暂不考虑(后续根据要求再加即可)
|
|
|
|
|
|
.ifPresent(mainProject -> { |
|
|
|
|
|
mainProject.setIsfinish(CommonConstant.PRO_PLAN_FINISHED); |
|
|
|
|
|
this.updateById(mainProject); |
|
|
|
|
|
log.info("更新主项目 {} 的 taskLevel {} 为已完成", projectId, taskLevel); |
|
|
|
|
|
// if (!"1".equals(mainProject.getIsfinish())) {
|
|
|
|
|
|
// }
|
|
|
|
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
totalPercent="0"; |
|
|
mainPlanInfoList.stream() |
|
|
|
|
|
.filter(info -> taskLevel.equals(info.getTaskLevel())) |
|
|
|
|
|
.findFirst() |
|
|
|
|
|
.ifPresent(mainProject -> { |
|
|
|
|
|
mainProject.setIsfinish(CommonConstant.PRO_PLAN_UNFINISHED); |
|
|
|
|
|
this.updateById(mainProject); |
|
|
|
|
|
log.info("更新主项目 {} 的 taskLevel {} 为未完成", projectId, taskLevel); |
|
|
|
|
|
// if (!"1".equals(mainProject.getIsfinish())) {
|
|
|
|
|
|
// }
|
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
return mapArrayList; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<String> getSubProjectIds(String projectId) { |
|
|
|
|
|
LambdaQueryWrapper<HuzhouSubProjectinfo> userProjectWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
userProjectWrapper.eq(HuzhouSubProjectinfo::getProjectId, projectId) |
|
|
|
|
|
.select(HuzhouSubProjectinfo::getId); |
|
|
|
|
|
List<HuzhouSubProjectinfo> subProjectInfos = subProjectinfoService.list(userProjectWrapper); |
|
|
|
|
|
List<String> subProjectIds = subProjectInfos |
|
|
|
|
|
.stream().map(HuzhouSubProjectinfo::getId) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
log.info("该主项目id为:{} 子项目数量为:{} 子项目id集合为:{}", projectId,subProjectIds.size(),subProjectIds); |
|
|
|
|
|
return subProjectIds != null ? subProjectIds : new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -560,14 +649,17 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper, |
|
|
Map<String, String> hashMap =new HashMap<>(); |
|
|
Map<String, String> hashMap =new HashMap<>(); |
|
|
LambdaQueryWrapper<HuzhouProcessinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<HuzhouProcessinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
queryWrapper.eq(HuzhouProcessinfo::getProjectid,planinfoid); |
|
|
queryWrapper.eq(HuzhouProcessinfo::getProjectid,planinfoid); |
|
|
|
|
|
//0已作废,1流程中,2已结束
|
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"1"); |
|
|
queryWrapper.eq(HuzhouProcessinfo::getProcessstatus,"1"); |
|
|
|
|
|
// 查询处于流程中的项目查询:huzhou_processinfo表
|
|
|
HuzhouProcessinfo huzhouProcessinfo = processinfoMapper.selectOne(queryWrapper); |
|
|
HuzhouProcessinfo huzhouProcessinfo = processinfoMapper.selectOne(queryWrapper); |
|
|
String processInstanceId = huzhouProcessinfo.getProcessinstanceid(); |
|
|
String processInstanceId = huzhouProcessinfo.getProcessinstanceid(); |
|
|
|
|
|
// 工作流引擎
|
|
|
List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery() |
|
|
List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery() |
|
|
.processInstanceId(processInstanceId) |
|
|
.processInstanceId(processInstanceId) |
|
|
.orderByTaskCreateTime().desc().list(); |
|
|
.orderByTaskCreateTime().desc().list(); |
|
|
String taskId=list.get(0).getId(); |
|
|
String taskId=list.get(0).getId(); |
|
|
|
|
|
log.info("name:{}",list.get(0).getName()); |
|
|
// //根据流程实例查询当前流所在位置
|
|
|
// //根据流程实例查询当前流所在位置
|
|
|
List<Task> taskList = taskService.createTaskQuery() |
|
|
List<Task> taskList = taskService.createTaskQuery() |
|
|
.processInstanceId(processInstanceId) |
|
|
.processInstanceId(processInstanceId) |
|
@ -849,27 +941,30 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper, |
|
|
*/ |
|
|
*/ |
|
|
private HuzhouPlaninfoOV setchild(HuzhouPlaninfoOV planinfoOV){ |
|
|
private HuzhouPlaninfoOV setchild(HuzhouPlaninfoOV planinfoOV){ |
|
|
//在流程这的是否可编辑
|
|
|
//在流程这的是否可编辑
|
|
|
|
|
|
log.info("当前任务id为{},当前任务级别为{},完成情况{}",planinfoOV.getId(),planinfoOV.getTaskLevel(),planinfoOV.getIsfinish()); |
|
|
|
|
|
// 0未开始 1审批中 2已完成
|
|
|
if("1".equals(planinfoOV.getIsfinish())){ |
|
|
if("1".equals(planinfoOV.getIsfinish())){ |
|
|
String isEdit = getPlanFileApprovalInfoByPlaninfoId(planinfoOV.getId()).get("isEdit"); |
|
|
String isEdit = getPlanFileApprovalInfoByPlaninfoId(planinfoOV.getId()).get("isEdit"); |
|
|
|
|
|
// 获取Edit字段信息 0 1
|
|
|
planinfoOV.setIsEdit(isEdit); |
|
|
planinfoOV.setIsEdit(isEdit); |
|
|
} |
|
|
} |
|
|
ArrayList<HuzhouPlaninfoOV> mapArrayList = new ArrayList<>(); |
|
|
ArrayList<HuzhouPlaninfoOV> mapArrayList = new ArrayList<>(); |
|
|
String taskLevel = planinfoOV.getTaskLevel(); |
|
|
String taskLevel = planinfoOV.getTaskLevel(); |
|
|
HuzhouPlaninfo planinfo = new HuzhouPlaninfo(); |
|
|
HuzhouPlaninfo planInfo = new HuzhouPlaninfo(); |
|
|
BeanUtils.copyProperties(planinfoOV,planinfo); |
|
|
BeanUtils.copyProperties(planinfoOV,planInfo); |
|
|
List<HuzhouPlaninfo> childTaskBySuperior = planinfoMapper.getChildTaskBySuperior(planinfo); |
|
|
// 根据上级任务获取子任务
|
|
|
// LambdaQueryWrapper<HuzhouPlaninfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
List<HuzhouPlaninfo> childTaskBySuperior = planInfoMapper.getChildTaskBySuperior(planInfo); |
|
|
// queryWrapper.eq(HuzhouPlaninfo::getSuperior,taskLevel.toString());
|
|
|
log.info("本级任务级别为{},该任务的下级任务数量为{}",taskLevel,childTaskBySuperior.size()); |
|
|
// queryWrapper.eq(HuzhouPlaninfo::getProjectId,planinfoOV.getProjectId());
|
|
|
|
|
|
//// queryWrapper.orderByAsc(HuzhouPlaninfo::getTaskLevel);
|
|
|
|
|
|
// List<HuzhouPlaninfo> huzhouPlaninfoList = this.list(queryWrapper);
|
|
|
|
|
|
if(childTaskBySuperior.size()!=0){ |
|
|
if(childTaskBySuperior.size()!=0){ |
|
|
for(HuzhouPlaninfo childInfo:childTaskBySuperior){ |
|
|
for(HuzhouPlaninfo childInfo:childTaskBySuperior){ |
|
|
HuzhouPlaninfoOV huzhouPlaninfoOV = new HuzhouPlaninfoOV(); |
|
|
HuzhouPlaninfoOV huzhouPlanInfoOV = new HuzhouPlaninfoOV(); |
|
|
BeanUtils.copyProperties(childInfo,huzhouPlaninfoOV); |
|
|
BeanUtils.copyProperties(childInfo,huzhouPlanInfoOV); |
|
|
HuzhouPlaninfoOV setchildmap = setchild(huzhouPlaninfoOV); |
|
|
HuzhouPlaninfoOV setChildMap = setchild(huzhouPlanInfoOV); |
|
|
mapArrayList.add(setchildmap); |
|
|
mapArrayList.add(setChildMap); |
|
|
|
|
|
log.info("当前添加的下级任务名称为:{},{}",setChildMap.getTaskName(),setChildMap.getTaskLevel()); |
|
|
} |
|
|
} |
|
|
|
|
|
// 封装下级任务
|
|
|
planinfoOV.setChildren(mapArrayList); |
|
|
planinfoOV.setChildren(mapArrayList); |
|
|
} |
|
|
} |
|
|
return planinfoOV; |
|
|
return planinfoOV; |
|
@ -998,11 +1093,11 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper, |
|
|
LambdaQueryWrapper<HuzhouPlaninfo> query = new LambdaQueryWrapper<>(new HuzhouPlaninfo()) |
|
|
LambdaQueryWrapper<HuzhouPlaninfo> query = new LambdaQueryWrapper<>(new HuzhouPlaninfo()) |
|
|
.in(HuzhouPlaninfo::getProjectId,projectIds) |
|
|
.in(HuzhouPlaninfo::getProjectId,projectIds) |
|
|
.select(HuzhouPlaninfo::getProjectId,HuzhouPlaninfo::getId); |
|
|
.select(HuzhouPlaninfo::getProjectId,HuzhouPlaninfo::getId); |
|
|
List<HuzhouPlaninfo> planInfoList=planinfoMapper.selectList(query); |
|
|
List<HuzhouPlaninfo> planInfoList= planInfoMapper.selectList(query); |
|
|
List<String> planIds = planInfoList.stream().map(x -> x.getId()).collect(Collectors.toList()); |
|
|
List<String> planIds = planInfoList.stream().map(x -> x.getId()).collect(Collectors.toList()); |
|
|
List<HuzhouPlaninfo> result= new ArrayList<>(); |
|
|
List<HuzhouPlaninfo> result= new ArrayList<>(); |
|
|
if(planIds.size()!=0){ |
|
|
if(planIds.size()!=0){ |
|
|
result = planinfoMapper.selectBatchIds(planIds); |
|
|
result = planInfoMapper.selectBatchIds(planIds); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
@ -1028,13 +1123,13 @@ public class HuzhouPlaninfoServiceImpl extends ServiceImpl<HuzhouPlaninfoMapper, |
|
|
public Integer getPlanList(String projectId) { |
|
|
public Integer getPlanList(String projectId) { |
|
|
LambdaUpdateWrapper<HuzhouPlaninfo> query=new LambdaUpdateWrapper<>(); |
|
|
LambdaUpdateWrapper<HuzhouPlaninfo> query=new LambdaUpdateWrapper<>(); |
|
|
query.eq(HuzhouPlaninfo::getProjectId,projectId); |
|
|
query.eq(HuzhouPlaninfo::getProjectId,projectId); |
|
|
int result = planinfoMapper.selectList(query).isEmpty() ? 0 : planinfoMapper.selectList(query).size(); |
|
|
int result = planInfoMapper.selectList(query).isEmpty() ? 0 : planInfoMapper.selectList(query).size(); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Integer getStartedProjectNum(List<String> projectIds) { |
|
|
public Integer getStartedProjectNum(List<String> projectIds) { |
|
|
Integer result = planinfoMapper.getStartedProjectNum(projectIds); |
|
|
Integer result = planInfoMapper.getStartedProjectNum(projectIds); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|