@@ -1,9 +1,11 @@ | |||
package com.ningdatech.pmapi.dashboard.handle; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.pmapi.common.constant.RegionConst; | |||
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | |||
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; | |||
import com.ningdatech.pmapi.dashboard.model.entity.CockpitStats; | |||
import com.ningdatech.pmapi.dashboard.model.vo.CockpitStatsVO; | |||
import com.ningdatech.pmapi.dashboard.service.ICockpitStatsService; | |||
@@ -34,7 +36,7 @@ public class CockpitStatsHandler { | |||
private final ICockpitStatsService cockpitStatsService; | |||
public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats) { | |||
public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats,Integer year) { | |||
CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class); | |||
if(Objects.isNull(cockpitStats)){ | |||
@@ -47,7 +49,7 @@ public class CockpitStatsHandler { | |||
//顶部数据 | |||
res.setTopData(convertTopData(cockpitStats)); | |||
//地图数据 | |||
res.setMapProjectData(convertMapProjectsData(cockpitStats)); | |||
res.setMapProjectData(convertMapProjectsData(cockpitStats,year)); | |||
//项目项目数据 | |||
res.setStatusProjectsData(convertStatusProjectsData(cockpitStats)); | |||
//项目效益 优秀项目 | |||
@@ -105,16 +107,26 @@ public class CockpitStatsHandler { | |||
return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.StatusProjectsData.class); | |||
} | |||
private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(CockpitStats cockpitStats) { | |||
private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(CockpitStats cockpitStats,Integer year) { | |||
List<CockpitStatsVO.MapProjectsData> mapProjectsDatas = Lists.newArrayList(); | |||
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); | |||
regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); | |||
List<CockpitStats> cockpitStatsAll = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) | |||
.eq(Objects.nonNull(year), CockpitStats::getYear, year) | |||
.eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR)); | |||
Map<String, Integer> totalMap = cockpitStatsAll.stream().filter(c -> Objects.nonNull(c.getRegionCode()) && Objects.nonNull(c.getProjectsTotal())) | |||
.collect(Collectors.toMap(c -> c.getRegionCode(), c -> c.getProjectsTotal())); | |||
for(RegionDTO region : regions){ | |||
CockpitStatsVO.MapProjectsData mapProjectsData = new CockpitStatsVO.MapProjectsData(); | |||
mapProjectsData.setRegionCode(region.getRegionCode()); | |||
mapProjectsData.setRegionName(region.getRegionName()); | |||
//TODO: 项目数据 | |||
mapProjectsData.setProjectsNum(0); | |||
if(totalMap.containsKey(mapProjectsData.getRegionCode())){ | |||
mapProjectsData.setProjectsNum(totalMap.get(mapProjectsData.getRegionCode())); | |||
}else{ | |||
mapProjectsData.setProjectsNum(0); | |||
} | |||
mapProjectsDatas.add(mapProjectsData); | |||
} | |||
return mapProjectsDatas; | |||
@@ -47,6 +47,6 @@ public class CockpitStatsManage { | |||
return new CockpitStatsVO(); | |||
} | |||
return convertCockpitStats.convertCockpitStats(cockpitStats); | |||
return convertCockpitStats.convertCockpitStats(cockpitStats,year); | |||
} | |||
} |
@@ -4,6 +4,7 @@ import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | |||
import com.ningdatech.pmapi.projectdeclared.manage.ConstructionPlanManage; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.ContructionSuggestionsDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.req.ConstrctionPlanListReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
@@ -52,4 +53,12 @@ public class ConstructionPlanController { | |||
public void exportList(ConstrctionPlanListReq planReq, HttpServletResponse response) { | |||
ExcelDownUtil.downXls(response, planReq, constructionPlanManage::exportList); | |||
} | |||
@ApiOperation(value = "建设方案专家建议", notes = "建设方案专家建议") | |||
@WebLog("建设方案专家建议") | |||
@PostMapping("/construction-suggestions") | |||
public String constructionSuggestions(@Validated @RequestBody ContructionSuggestionsDTO dto) { | |||
constructionPlanManage.constructionSuggestions(dto); | |||
return "专家建设方案建议保存成功"; | |||
} | |||
} |
@@ -1,9 +1,11 @@ | |||
package com.ningdatech.pmapi.projectdeclared.manage; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.excel.EasyExcel; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
@@ -18,6 +20,7 @@ import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | |||
import com.ningdatech.pmapi.common.util.ExcelExportStyle; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.ConstructionPlanExportDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.ContructionSuggestionsDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.req.ConstrctionPlanListReq; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
@@ -47,6 +50,8 @@ import com.wflow.workflow.service.ProcessModelService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.flowable.engine.HistoryService; | |||
import org.flowable.engine.history.HistoricActivityInstance; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
@@ -82,6 +87,7 @@ public class ConstructionPlanManage { | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final NoticeManage noticeManage; | |||
private final RegionCacheHelper regionCacheHelper; | |||
private final HistoryService historyService; | |||
/** | |||
* 建设方案 | |||
@@ -326,4 +332,40 @@ public class ConstructionPlanManage { | |||
throw new RuntimeException(e); | |||
} | |||
} | |||
/** | |||
* 专家建设方案建议 暂存 等流程成功后 保存到项目 | |||
* @param dto | |||
*/ | |||
public void constructionSuggestions(ContructionSuggestionsDTO dto) { | |||
String nodeId = dto.getNodeId(); | |||
List<HistoricActivityInstance> hai = historyService.createHistoricActivityInstanceQuery() | |||
.activityId(nodeId) | |||
.orderByHistoricActivityInstanceStartTime() | |||
.asc().list(); | |||
if(CollUtil.isEmpty(hai)){ | |||
throw new BizException("该节点的流程不存在!"); | |||
} | |||
//实例ID | |||
String processInstanceId = hai.get(0).getProcessInstanceId(); | |||
Project project = projectService.getProjectByCode(dto.getProjectCode()); | |||
if(Objects.isNull(project)){ | |||
throw new BizException("该项目不存在!"); | |||
} | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.eq(ProjectInst::getInstCode, processInstanceId) | |||
.eq(ProjectInst::getProjectId,project.getId()) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(projectInst)){ | |||
throw new BizException("该流程的项目关联信息不存在!"); | |||
} | |||
if(InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(projectInst.getInstType())){ | |||
throw new BizException("此流程不是建设方案流程 保存失败!"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.ningdatech.pmapi.projectdeclared.model.dto; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.math.BigDecimal; | |||
/** | |||
* @Classname ContructionSuggestionsDTO | |||
* @Description | |||
* @Date 2023/5/30 15:35 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "专家建设建议", description = "") | |||
public class ContructionSuggestionsDTO { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("nodeId") | |||
@NotNull(message = "nodeId不能为空") | |||
private String nodeId; | |||
@ApiModelProperty("项目编号") | |||
@NotNull(message = "项目编号不能为空") | |||
private String projectCode; | |||
@ApiModelProperty("建议项目总投资") | |||
@NotNull(message = "建议项目总投资不能为空") | |||
private BigDecimal proposeTotalInvest; | |||
@ApiModelProperty("建议年度预算") | |||
@NotNull(message = "建议年度预算不能为空") | |||
private BigDecimal proposeAnnualBudget; | |||
@ApiModelProperty("建议评审意见附件") | |||
@NotBlank(message = "建议评审意见附件不能为空") | |||
private String proposeAttachFiles; | |||
} |
@@ -543,4 +543,13 @@ public class Project implements Serializable { | |||
@ApiModelProperty("实际成效指标") | |||
private String actualPerformanceIndicators; | |||
@ApiModelProperty("建议项目总投资") | |||
private BigDecimal proposeTotalInvest; | |||
@ApiModelProperty("建议年度预算") | |||
private BigDecimal proposeAnnualBudget; | |||
@ApiModelProperty("建议评审意见附件") | |||
private String proposeAttachFiles; | |||
} |
@@ -525,4 +525,13 @@ public class ProjectDetailVO { | |||
@ApiModelProperty("终验信息 IRS档案") | |||
private List<ProtraitProjectOutputVO> finalIrsApps; | |||
@ApiModelProperty("建议项目总投资") | |||
private BigDecimal proposeTotalInvest; | |||
@ApiModelProperty("建议年度预算") | |||
private BigDecimal proposeAnnualBudget; | |||
@ApiModelProperty("建议评审意见附件") | |||
private String proposeAttachFiles; | |||
} |
@@ -68,6 +68,7 @@ import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.contants.HisProInsEndActId; | |||
import com.wflow.contants.ProcessConstant; | |||
import com.wflow.exception.BusinessException; | |||
import com.wflow.workflow.bean.dto.ReqAuditOpinionSaveDTO; | |||
import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; | |||
@@ -570,12 +571,20 @@ public class TodoCenterManage { | |||
res.setProjectId(projectId); | |||
res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId, progressInstanceDetail, request.getTaskId())); | |||
res.setIsHighLine(isHighLine); | |||
res.setConstructionSuggestions(checkConstructionSuggestionsByNodeId(nodeId)); | |||
passHandle.checkCanPassOrSeal(request.getInstanceId(), request.getTaskId(), employeeCode, res); | |||
//是不是被 驳回|退回 | |||
res.setIsChange(todoService.isChangeRecord(projectId)); | |||
return res; | |||
} | |||
private Boolean checkConstructionSuggestionsByNodeId(String nodeId) { | |||
if(StringUtils.isNotBlank(nodeId)){ | |||
return nodeId.endsWith(StrPool.DASH + ProcessConstant.Field.CONSTRUCTION); | |||
} | |||
return Boolean.FALSE; | |||
} | |||
/** | |||
* 筛选 当前登录人 是不是 上级条线单位的审批 | |||
* | |||
@@ -63,4 +63,6 @@ public class ProcessProgressDetailVo { | |||
* 当前项目 是不是被 驳回|退回过 | |||
*/ | |||
private Boolean isChange = Boolean.FALSE; | |||
private Boolean constructionSuggestions = Boolean.FALSE; | |||
} |