From fdb8cb8bb5dea273f440c8a52b7b4d9c73966f37 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: Mon, 18 Aug 2025 14:51:40 +0800
Subject: [PATCH] 查询统计优化
---
expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java b/expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java
index e5f0a8b..3c2b179 100644
--- a/expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java
+++ b/expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java
@@ -8,6 +8,7 @@
import com.gkhy.common.utils.DateUtils;
import com.gkhy.common.utils.SecurityUtils;
import com.gkhy.common.utils.StringUtils;
+import com.gkhy.common.utils.uuid.RandomStringGenerator;
import com.gkhy.system.domain.*;
import com.gkhy.system.domain.vo.request.*;
import com.gkhy.system.domain.vo.response.*;
@@ -65,7 +66,7 @@
*/
@Override
public List<ProjectManagement> selectProjectManagementList(ProjectManagement projectManagement) {
- if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
+ if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && SecurityUtils.getUserId() != 130L){
projectManagement.setDeptId(SecurityUtils.getDeptId());
}
return projectManagementMapper.selectProjectManagementList(projectManagement);
@@ -93,6 +94,7 @@
// projectManagementMapper.updateProjectManagement(projectManagementSave);
updateById(projectManagementSave);
}else {
+ projectManagementSave.setProjectCode(RandomStringGenerator.generateRandomString(10));
projectManagementSave.setStep(1L);
projectManagementSave.setCreateBy(SecurityUtils.getUsername());
projectManagementSave.setCreateTime(DateUtils.getNowDate());
@@ -138,13 +140,9 @@
// throw new ServiceException("固定专家不能为空!");
// }
- if ((projectManagement1.getStep() == 1 || projectManagement1.getStep() == 2) && (projectManagement.getStep() == 2 ) ){
+ if ((projectManagement1.getStep() == 1 || projectManagement1.getStep() == 2) && (projectManagement.getStep() == 2 ) ){
projectManagementSave.setStep(2L);
projectManagementSave.setState(1L);
- }else if (projectManagement1.getStep() == 2 && projectManagement.getStep() == 3){
- projectManagementSave.setStep(2L);
- projectManagementSave.setState(2L);
- projectManagementSave.setProjectCheckTime(new Date());
List<ProjectExpertSaveReqDto> collect = saveData.stream()
.filter(dto -> "1".equals(dto.getTeamLeader().toString()))
.collect(Collectors.toList());
@@ -157,6 +155,11 @@
}
projectManagementSave.setExpertName(collect.get(0).getExpertName());
projectManagementSave.setExpertId(collect.get(0).getExpertId());
+ }else if (projectManagement1.getStep() == 2 && projectManagement.getStep() == 3){
+ projectManagementSave.setStep(2L);
+ projectManagementSave.setState(2L);
+ projectManagementSave.setProjectCheckTime(new Date());
+
}
List<ProjectExpertSaveReqDto> saveList = saveData.stream()
@@ -239,8 +242,11 @@
public int deleteProjectManagementByIds(Long[] ids) {
// 校验
for (Long id : ids) {
- checkDataPer(id);
+ checkDelData(id);
}
+// if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) ){
+// throw new ServiceException("无权操作!");
+// }
return projectManagementMapper.deleteProjectManagementByIds(ids);
}
@@ -281,12 +287,16 @@
if (req.getState() == 3){
projectManagementUp.setStep(3L);
}else if (req.getState() == 1){
- projectManagementUp.setStep(2L);
+ projectManagementUp.setExpertName("");
+ projectManagementUp.setExpertId(0l);
+ projectManagementUp.setExpertNum(0L);
+ projectManagementUp.setStep(1L);
}
int i = projectManagementMapper.updateProjectManagement(projectManagementUp);
//驳回删
if (req.getState() == 1){
projectFileMapper.deleteProjectFileByIdAndType(req.getId(), "1");
+ projectExpertMapper.deleteProjectExpertByProjectId(req.getId());
}
if (i > 0 && StringUtils.isNotEmpty(projectFile) && req.getState() == 3){
//删除之前的该类型
@@ -317,7 +327,7 @@
projectManagementUp.setId(req.getId());
projectManagementUp.setState(4L);
projectManagementUp.setStep(4L);
- projectManagementUp.setDesc(req.getDesc());
+// projectManagementUp.setDesc(req.getDesc());
projectManagementUp.setProjectEndTime(req.getProjectEndTime());
projectManagementUp.setUpdateBy(SecurityUtils.getUsername());
int i = projectManagementMapper.updateProjectManagement(projectManagementUp);
@@ -460,7 +470,8 @@
Collectors.counting()
));
projectNumResp.setTotal(dataNum.size());
- projectNumResp.setApproval(statusCounts.get(3) == null ? 0 : statusCounts.get(3).intValue());
+ int i = statusCounts.get(2) == null ? 0 : statusCounts.get(2).intValue();
+ projectNumResp.setApproval(statusCounts.get(3) == null ? 0+i: statusCounts.get(3).intValue()+i);
projectNumResp.setExpert(statusCounts.get(1) == null ? 0 : statusCounts.get(1).intValue());
projectNumResp.setStaging(statusCounts.get(0) == null ? 0:statusCounts.get(0).intValue());
projectNumResp.setEnd(statusCounts.get(4) == null ? 0:statusCounts.get(4).intValue());
@@ -485,11 +496,17 @@
projectDetailResp.setDeptId(projectManagement.getDeptId());
projectDetailResp.setDeptName(projectDetailResp.getDeptName());
projectDetailResp.setProjectName(projectManagement.getProjectName());
+ projectDetailResp.setProjectDateStart(projectManagement.getProjectDateStart());
+ projectDetailResp.setProjectDateEnd(projectManagement.getProjectDateEnd());
+ if (StringUtils.isNotEmpty(projectManagement.getJobCategory())){
+ projectDetailResp.setJobCategory(projectManagement.getJobCategory());
+ }
SysExpertInfo sysExpertInfo = sysExpertInfoMapper.selectById(projectDetailResp.getExpertId());
if (sysExpertInfo != null){
projectDetailResp.setTitle(sysExpertInfo.getTitle());
projectDetailResp.setJob(sysExpertInfo.getJob());
}
+
}
return projectDetailResp;
}
@@ -509,6 +526,11 @@
return projectExpertMapper.projectExpertExportList(projectId);
+ }
+
+ @Override
+ public List<ProjectDataResp> selectProjectData(ProjectManagement projectManagement) {
+ return projectManagementMapper.selectProjectData(projectManagement);
}
private List<ProjectExpertDetail> dealData(List<ProjectExpertScoreSaveReq.Score> data,Long projectExpertId){
@@ -545,11 +567,24 @@
Long deptId = projectManagement.getDeptId();
// 本部门审批?
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()){
- throw new ServiceException("非本部门数据,无权操作!");
+ throw new ServiceException("非本处室数据,无权操作!");
}
if (projectManagement.getState() == 4){
throw new ServiceException("已结项,无权操作!");
}
return projectManagement;
}
+
+
+ private void checkDelData(Long id){
+ ProjectManagement projectManagement = checkData(id);
+ Long deptId = projectManagement.getDeptId();
+ // 本部门审批?
+ if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()){
+ throw new ServiceException("非本处室数据,无权操作!");
+ }
+ }
+
+
+
}
\ No newline at end of file
--
Gitblit v1.9.2