@@ -191,10 +191,10 @@ public class ProjectLibManage { | |||||
List<ProjectRenewalFundDeclaration> fundDeclarations = renewalMap.get(w.getId()); | List<ProjectRenewalFundDeclaration> fundDeclarations = renewalMap.get(w.getId()); | ||||
if (fundDeclarations != null) { | if (fundDeclarations != null) { | ||||
item.setAnnualAccumulateAmount(computeAmount(totalAnnualPaymentAmount, fundDeclarations)); | item.setAnnualAccumulateAmount(computeAmount(totalAnnualPaymentAmount, fundDeclarations)); | ||||
item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, fundDeclarations)); | |||||
item.setAnnualAccumulateAmountList(convertAccumulate(w, totalAnnualPaymentAmount, fundDeclarations)); | |||||
} else { | } else { | ||||
item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); | item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); | ||||
item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList())); | |||||
item.setAnnualAccumulateAmountList(convertAccumulate(w, totalAnnualPaymentAmount, Collections.emptyList())); | |||||
} | } | ||||
return item; | return item; | ||||
}); | }); | ||||
@@ -256,10 +256,10 @@ public class ProjectLibManage { | |||||
List<ProjectRenewalFundDeclaration> fundDeclarations = renewalMap.get(w.getId()); | List<ProjectRenewalFundDeclaration> fundDeclarations = renewalMap.get(w.getId()); | ||||
if (fundDeclarations != null) { | if (fundDeclarations != null) { | ||||
item.setAnnualAccumulateAmount(computeAmount(totalAnnualPaymentAmount, fundDeclarations)); | item.setAnnualAccumulateAmount(computeAmount(totalAnnualPaymentAmount, fundDeclarations)); | ||||
item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, fundDeclarations)); | |||||
item.setAnnualAccumulateAmountList(convertAccumulate(w, totalAnnualPaymentAmount, fundDeclarations)); | |||||
} else { | } else { | ||||
item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); | item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); | ||||
item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList())); | |||||
item.setAnnualAccumulateAmountList(convertAccumulate(w, totalAnnualPaymentAmount, Collections.emptyList())); | |||||
} | } | ||||
return item; | return item; | ||||
}); | }); | ||||
@@ -295,8 +295,8 @@ public class ProjectLibManage { | |||||
Map<String, List<Task>> map = Maps.newHashMap(); | Map<String, List<Task>> map = Maps.newHashMap(); | ||||
Map<Long, UserFullInfoDTO> userMap = Maps.newHashMap(); | Map<Long, UserFullInfoDTO> userMap = Maps.newHashMap(); | ||||
if (CollUtil.isNotEmpty(tasks)) { | if (CollUtil.isNotEmpty(tasks)) { | ||||
map = tasks.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId)); | |||||
userMap = searchUser(tasks, userInfoHelper); | |||||
map = CollUtils.group(tasks, Task::getProcessInstanceId); | |||||
userMap = searchUser(tasks); | |||||
} | } | ||||
List<ProjectLibListItemVO> records = Lists.newArrayList(); | List<ProjectLibListItemVO> records = Lists.newArrayList(); | ||||
@@ -345,18 +345,19 @@ public class ProjectLibManage { | |||||
return Collections.emptyList(); | return Collections.emptyList(); | ||||
} | } | ||||
private Map<Long, UserFullInfoDTO> searchUser(List<Task> tasks, UserInfoHelper userInfoHelper) { | |||||
private Map<Long, UserFullInfoDTO> searchUser(List<Task> tasks) { | |||||
if (CollUtil.isEmpty(tasks)) { | if (CollUtil.isEmpty(tasks)) { | ||||
return Collections.emptyMap(); | return Collections.emptyMap(); | ||||
} | } | ||||
Set<Long> userIds = tasks.stream().filter(w -> NumberUtil.isNumber(w.getAssignee())) | |||||
Set<Long> userIds = tasks.stream() | |||||
.filter(w -> NumberUtil.isNumber(w.getAssignee())) | |||||
.map(w -> Long.parseLong(w.getAssignee())) | .map(w -> Long.parseLong(w.getAssignee())) | ||||
.collect(Collectors.toSet()); | .collect(Collectors.toSet()); | ||||
if (userIds.isEmpty()) { | if (userIds.isEmpty()) { | ||||
return Collections.emptyMap(); | return Collections.emptyMap(); | ||||
} | } | ||||
List<UserFullInfoDTO> users = userInfoHelper.listUserFullInfoByUserIds(userIds); | List<UserFullInfoDTO> users = userInfoHelper.listUserFullInfoByUserIds(userIds); | ||||
return users.stream().collect(Collectors.toMap(UserFullInfoDTO::getUserId, u -> u)); | |||||
return CollUtils.listToMap(users, UserFullInfoDTO::getUserId); | |||||
} | } | ||||
private Map<String, List<TagVO>> getProjectTags(Collection<String> projectCodes) { | private Map<String, List<TagVO>> getProjectTags(Collection<String> projectCodes) { | ||||
@@ -530,17 +531,25 @@ public class ProjectLibManage { | |||||
.map(ProjectPO::getInstCode) | .map(ProjectPO::getInstCode) | ||||
.filter(StringUtils::isNotBlank) | .filter(StringUtils::isNotBlank) | ||||
.collect(Collectors.toSet()); | .collect(Collectors.toSet()); | ||||
List<Task> tasks = taskService.createTaskQuery() | |||||
.processInstanceIdIn(instCodes) | |||||
.orderByTaskCreateTime() | |||||
.asc() | |||||
.list(); | |||||
Map<String, List<Task>> map = Maps.newHashMap(); | |||||
Map<Long, UserFullInfoDTO> userMap = Maps.newHashMap(); | |||||
List<Task> tasks; | |||||
if (!instCodes.isEmpty()) { | |||||
tasks = taskService.createTaskQuery() | |||||
.processInstanceIdIn(instCodes) | |||||
.orderByTaskCreateTime() | |||||
.asc() | |||||
.list(); | |||||
} else { | |||||
tasks = Collections.emptyList(); | |||||
} | |||||
Map<String, List<Task>> map; | |||||
Map<Long, UserFullInfoDTO> userMap; | |||||
if (CollUtil.isNotEmpty(tasks)) { | if (CollUtil.isNotEmpty(tasks)) { | ||||
map = tasks.stream() | |||||
.collect(Collectors.groupingBy(Task::getProcessInstanceId)); | |||||
userMap = searchUser(tasks, userInfoHelper); | |||||
map = CollUtils.group(tasks, Task::getProcessInstanceId); | |||||
userMap = searchUser(tasks); | |||||
} else { | |||||
map = Collections.emptyMap(); | |||||
userMap = Collections.emptyMap(); | |||||
} | } | ||||
List<ProjectLibListItemVO> records = Lists.newArrayList(); | List<ProjectLibListItemVO> records = Lists.newArrayList(); | ||||
@@ -601,7 +610,7 @@ public class ProjectLibManage { | |||||
return annualAmounts; | return annualAmounts; | ||||
} | } | ||||
public static List<AnnualAmountVO> convertAccmulate(Project project, BigDecimal totalAnnualPlanAmount, List<ProjectRenewalFundDeclaration> prfs) { | |||||
public static List<AnnualAmountVO> convertAccumulate(Project project, BigDecimal totalAnnualPlanAmount, List<ProjectRenewalFundDeclaration> prfs) { | |||||
List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); | List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); | ||||
annualAmounts.add(AnnualAmountVO.builder() | annualAmounts.add(AnnualAmountVO.builder() | ||||
.projectId(project.getId()) | .projectId(project.getId()) | ||||
@@ -187,10 +187,10 @@ public class ProjectRenewalFundManage { | |||||
if (finalRenewalMap.containsKey(item.getId())) { | if (finalRenewalMap.containsKey(item.getId())) { | ||||
List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); | List<ProjectRenewalFundDeclaration> prfs = finalRenewalMap.get(item.getId()); | ||||
item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(totalAnnualPaymentAmount, prfs)); | item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(totalAnnualPaymentAmount, prfs)); | ||||
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, totalAnnualPaymentAmount, prfs)); | |||||
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccumulate(w, totalAnnualPaymentAmount, prfs)); | |||||
} else { | } else { | ||||
item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); | item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); | ||||
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList())); | |||||
item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccumulate(w, totalAnnualPaymentAmount, Collections.emptyList())); | |||||
} | } | ||||
return item; | return item; | ||||
}); | }); | ||||
@@ -1,10 +1,14 @@ | |||||
package com.hz.pm.api.projectlib.service; | package com.hz.pm.api.projectlib.service; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | import com.hz.pm.api.projectlib.model.entity.ProjectInst; | ||||
import java.util.Collection; | |||||
import java.util.List; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 服务类 | * 服务类 | ||||
@@ -21,4 +25,11 @@ public interface IProjectInstService extends IService<ProjectInst> { | |||||
.last(BizConst.LIMIT_1)); | .last(BizConst.LIMIT_1)); | ||||
} | } | ||||
default List<ProjectInst> listByProjectIds(Collection<Long> projectIds) { | |||||
LambdaQueryWrapper<ProjectInst> query = Wrappers.lambdaQuery(ProjectInst.class) | |||||
.in(ProjectInst::getProjectId, projectIds) | |||||
.orderByDesc(ProjectInst::getProjectId); | |||||
return list(query); | |||||
} | |||||
} | } |
@@ -167,13 +167,9 @@ public class TodoCenterManage { | |||||
if (CollUtil.isEmpty(projects)) { | if (CollUtil.isEmpty(projects)) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
} | } | ||||
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); | |||||
// 再查出项目关联的流程实例ID | |||||
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); | |||||
Map<Long, Project> projectsMap = CollUtils.listToMap(projects, Project::getId); | |||||
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) | |||||
.in(ProjectInst::getProjectId, projectIdList) | |||||
.orderByDesc(ProjectInst::getProjectId)); | |||||
List<ProjectInst> projectInstList = projectInstService.listByProjectIds(projectsMap.keySet()); | |||||
Map<String, Project> projectInfoMap = projectInstList.stream() | Map<String, Project> projectInfoMap = projectInstList.stream() | ||||
.filter(p -> StringUtils.isNotBlank(p.getInstCode()) && | .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && | ||||
!TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) | !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) | ||||
@@ -1,6 +1,7 @@ | |||||
package com.hz.pm.api.user.manage; | package com.hz.pm.api.user.manage; | ||||
import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
@@ -100,7 +101,7 @@ public class MhUnitManage { | |||||
List<MhUnitUserTreeDTO> selectedUnits = new ArrayList<>(); | List<MhUnitUserTreeDTO> selectedUnits = new ArrayList<>(); | ||||
if (req.getId() != null) { | if (req.getId() != null) { | ||||
// 查询单位 | // 查询单位 | ||||
LambdaQueryWrapper<MhUnit> unitQuery = Wrappers.lambdaQuery(MhUnit.class) | |||||
Wrapper<MhUnit> unitQuery = Wrappers.lambdaQuery(MhUnit.class) | |||||
.select(MhUnit::getId) | .select(MhUnit::getId) | ||||
.like(StrUtils.isNotBlank(req.getName()), MhUnit::getName, req.getName()) | .like(StrUtils.isNotBlank(req.getName()), MhUnit::getName, req.getName()) | ||||
.eq(MhUnit::getParentId, req.getId()); | .eq(MhUnit::getParentId, req.getId()); | ||||
@@ -34,7 +34,6 @@ import com.hz.pm.api.user.util.LoginUserUtil; | |||||
import com.hz.pm.api.workbench.converter.WorkbenchConverter; | import com.hz.pm.api.workbench.converter.WorkbenchConverter; | ||||
import com.hz.pm.api.workbench.model.vo.WorkbenchVO; | import com.hz.pm.api.workbench.model.vo.WorkbenchVO; | ||||
import com.hz.pm.api.workbench.model.vo.WorkbenchVO.WarningStatistics; | import com.hz.pm.api.workbench.model.vo.WorkbenchVO.WarningStatistics; | ||||
import com.ningdatech.basic.function.VUtils; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.basic.util.StrPool; | import com.ningdatech.basic.util.StrPool; | ||||
@@ -106,7 +105,7 @@ public class WorkbenchManage { | |||||
todoCenterStat.setTodoList(todoList); | todoCenterStat.setTodoList(todoList); | ||||
res.setTodoCerter(todoCenterStat); | res.setTodoCerter(todoCenterStat); | ||||
stopWatch.stop(); | stopWatch.stop(); | ||||
log.info("待办中心数据 耗时,{} s", stopWatch.getTotalTimeSeconds()); | |||||
log.info("待办中心数据 耗时,{} s", stopWatch.getLastTaskTimeMillis()); | |||||
}, ForkJoinPool.commonPool()), | }, ForkJoinPool.commonPool()), | ||||
CompletableFuture.runAsync(() -> { | CompletableFuture.runAsync(() -> { | ||||
StopWatch stopWatch = new StopWatch(); | StopWatch stopWatch = new StopWatch(); | ||||
@@ -115,14 +114,14 @@ public class WorkbenchManage { | |||||
//2.项目统计数据 | //2.项目统计数据 | ||||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year, user), | res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year, user), | ||||
defaultDeclaredProjectManage.declaredProjectOrgStatistics(year - 1, user))); | defaultDeclaredProjectManage.declaredProjectOrgStatistics(year - 1, user))); | ||||
if (userInfoHelper.isSuperOrRegionAdmin(user.getUserId())) { | |||||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||||
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year, user), | res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year, user), | ||||
defaultDeclaredProjectManage.declaredProjectRegionStatistics(year - 1, user))); | defaultDeclaredProjectManage.declaredProjectRegionStatistics(year - 1, user))); | ||||
} else { | } else { | ||||
res.setRegionDeclared(new WorkbenchVO.DeclaredStatistics()); | res.setRegionDeclared(new WorkbenchVO.DeclaredStatistics()); | ||||
} | } | ||||
stopWatch.stop(); | stopWatch.stop(); | ||||
log.info("项目统计数据 耗时,{} s", stopWatch.getTotalTimeSeconds()); | |||||
log.info("项目统计数据 耗时,{} s", stopWatch.getTotalTimeMillis()); | |||||
}, ForkJoinPool.commonPool()), | }, ForkJoinPool.commonPool()), | ||||
CompletableFuture.runAsync(() -> { | CompletableFuture.runAsync(() -> { | ||||
StopWatch stopWatch = new StopWatch(); | StopWatch stopWatch = new StopWatch(); | ||||