@@ -14,7 +14,7 @@ import java.util.Collections; | |||
public class GeneratorCodeKingbaseConfig { | |||
private static final String PATH_LXX = "/Users/liuxinxin/IdeaProjects/project-management/pmapi/src/main/java"; | |||
private static final String PATH_YYD = "/Users/wendy/coding/java/project-management/pmapi/src/main/java"; | |||
private static final String PATH_YYD = "/Users/wendy/code project/java/project-management/pmapi/src/main/java"; | |||
private static final String PATH_LS = ""; | |||
private static final String PATH_ZPF = "D:\\ningda\\project-management\\pmapi\\src\\main\\java"; | |||
private static final String PATH_CMM = "D:\\work\\project-management\\project-management\\pmapi\\src\\main\\java"; | |||
@@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig { | |||
public static void main(String[] args) { | |||
//generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | |||
generate("CMM", "meeting", PATH_YYD, "meeting_expert_judge"); | |||
generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_app_indicator"); | |||
} | |||
} |
@@ -26,7 +26,9 @@ public enum CommonEnum { | |||
LS_QY(331126,"庆元县",2), | |||
LS_JN(331127,"景宁畲族自治县",2), | |||
LS_LQ(331181,"龙泉市",2), | |||
LS_KFQ(331199,"开发区",2); | |||
LS_KFQ(331199,"开发区",2), | |||
ZWDD(0,"浙政钉",3), | |||
MOBILE(1,"短信",3); | |||
private Integer code; | |||
private String desc; | |||
@@ -30,7 +30,9 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | |||
"com.ningdatech.pmapi.ding.controller", | |||
"com.ningdatech.pmapi.filemanage.controller", | |||
"com.ningdatech.pmapi.performance.controller", | |||
"com.ningdatech.pmapi.irs.controller" | |||
"com.ningdatech.pmapi.irs.controller", | |||
"com.ningdatech.pmapi.safety.controller", | |||
"com.ningdatech.pmapi.portrait.controller" | |||
}) | |||
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | |||
@@ -209,9 +209,14 @@ public class ProjectDeclareAction { | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -206,9 +206,14 @@ public class ProjectDeclareJNAction { | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -204,10 +204,15 @@ public class ProjectDeclareJYAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -204,10 +204,15 @@ public class ProjectDeclareKFBAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -204,10 +204,15 @@ public class ProjectDeclareLDAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -204,10 +204,15 @@ public class ProjectDeclareLQAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -204,10 +204,15 @@ public class ProjectDeclareQTAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -204,10 +204,15 @@ public class ProjectDeclareQYAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -204,10 +204,15 @@ public class ProjectDeclareSBJAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -212,10 +212,15 @@ public class ProjectDeclareSCAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -204,10 +204,15 @@ public class ProjectDeclareSYAction { | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -205,9 +205,15 @@ public class ProjectDeclareYHAction { | |||
} | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION") | |||
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") | |||
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.OPERATION.getCode()); | |||
} | |||
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") | |||
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) { | |||
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); | |||
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
} | |||
@@ -214,8 +214,13 @@ public class ProjectDeclareStateMachineJNBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.START_TO_WORK).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
@@ -214,8 +214,14 @@ public class ProjectDeclareStateMachineJYBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.START_TO_WORK).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
@@ -214,8 +214,14 @@ public class ProjectDeclareStateMachineKFQBuilder implements ProjectDeclareState | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.START_TO_WORK).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
@@ -214,6 +214,12 @@ public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
@@ -215,6 +215,12 @@ public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
@@ -214,6 +214,12 @@ public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
@@ -214,6 +214,12 @@ public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
@@ -215,6 +215,12 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
@@ -224,6 +224,12 @@ public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
@@ -214,6 +214,12 @@ public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
@@ -214,6 +214,12 @@ public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateM | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.OPERATION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待开工 实施,从实施到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.OPERATION) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
@@ -1,19 +1,17 @@ | |||
package com.ningdatech.pmapi.irs.controller; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.irs.manage.AppIrsManage; | |||
import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; | |||
import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult; | |||
import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.security.NoSuchAlgorithmException; | |||
import java.util.List; | |||
/** | |||
* @Classname ApplicationController | |||
@@ -45,4 +43,10 @@ public class ApplicationController { | |||
public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { | |||
return appIrsManage.searchApps(apply); | |||
} | |||
@GetMapping("/digitalResourcesIndicators/{appCode}/{pageSize}") | |||
public JSONObject getDigitalResourcesIndicators(@PathVariable String appCode,@PathVariable Integer pageSize) { | |||
return appIrsManage.getDigitalResourceIndicatorsByAppCode(appCode, pageSize); | |||
} | |||
} |
@@ -1,9 +1,6 @@ | |||
package com.ningdatech.pmapi.irs.controller; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.common.util.CryptUtils; | |||
import com.ningdatech.pmapi.common.util.HttpUtil; | |||
import com.ningdatech.pmapi.irs.utils.RefreshTokenUtil; | |||
import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO; | |||
@@ -11,10 +8,11 @@ import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.http.ResponseEntity; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.client.RestTemplate; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import java.io.UnsupportedEncodingException; | |||
import java.security.NoSuchAlgorithmException; | |||
@@ -9,12 +9,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.irs.service.IRefreshTokenService; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.common.util.CryptUtils; | |||
import com.ningdatech.pmapi.common.util.HttpUtil; | |||
import com.ningdatech.pmapi.common.util.RefreshKeyUtil; | |||
import com.ningdatech.pmapi.irs.model.dto.*; | |||
import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; | |||
import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult; | |||
import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; | |||
import com.ningdatech.pmapi.irs.model.res.ApiResponse; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
@@ -34,7 +35,6 @@ import org.springframework.web.client.RestTemplate; | |||
import javax.annotation.Resource; | |||
import java.security.NoSuchAlgorithmException; | |||
import java.time.LocalDateTime; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
@@ -93,8 +93,23 @@ public class AppIrsManage { | |||
@Value("${irs.push-project-detail.appSecret}") | |||
private String pushProjectAppSecret; | |||
//=============数字资源指标获取======================================================================================== | |||
@Value("${irs.digital-resource-indicators.app-key}") | |||
private String driAppKey; | |||
@Value("${irs.digital-resource-indicators.app-secret}") | |||
private String driAppSecret; | |||
@Value("${irs.digital-resource-indicators.interface-name}") | |||
private String driInterfaceName; | |||
@Value("${irs.digital-resource-indicators.url}") | |||
private String driUrl; | |||
/** | |||
* 推送 项目和应用关系 | |||
* | |||
* @param dto | |||
* @return | |||
* @throws NoSuchAlgorithmException | |||
@@ -112,14 +127,14 @@ public class AppIrsManage { | |||
ApiApplyDTO apiApply = new ApiApplyDTO(); | |||
apiApply.setAppId(appCode); | |||
JSONObject jsonObject = this.searchApp(apiApply); | |||
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject),ApiApplySearchResult.class); | |||
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject), ApiApplySearchResult.class); | |||
VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); | |||
long timestamp = System.currentTimeMillis(); | |||
String areaCode = project.getAreaCode(); | |||
String projectName = project.getProjectName(); | |||
String requestSecret = RefreshKeyUtil.getRequestSecret(pushAppKey, pushAppScret); | |||
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode,"bcb4fc0f517fc168ee543fcf4d231f3b"); | |||
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); | |||
String capTime = String.valueOf(timestamp); | |||
String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp); | |||
String url = pushUrl + "?requestTime=" + timestamp + | |||
@@ -134,14 +149,14 @@ public class AppIrsManage { | |||
ApiResponse body = forEntity.getBody(); | |||
if(Objects.isNull(body) || Objects.isNull(body.getCode()) | |||
|| 0 != body.getCode()){ | |||
if (Objects.isNull(body) || Objects.isNull(body.getCode()) | |||
|| 0 != body.getCode()) { | |||
return Boolean.FALSE; | |||
} | |||
//保存关系 | |||
app.setAppCode(appCode); | |||
if(applicationService.updateById(app)){ | |||
if (applicationService.updateById(app)) { | |||
/** | |||
* 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册 | |||
* 如果都已经注册 要调用状态机 进入下一个状态 | |||
@@ -150,8 +165,8 @@ public class AppIrsManage { | |||
.eq(ProjectApplication::getProjectId, project.getId())); | |||
//筛选出 初次新建的app 但是没有appCode的 | |||
apps = apps.stream().filter(a -> { | |||
if(CommonEnum.YES.getCode().equals(a.getIsFirst()) && | |||
StringUtils.isBlank(app.getAppCode())){ | |||
if (CommonEnum.YES.getCode().equals(a.getIsFirst()) && | |||
StringUtils.isBlank(app.getAppCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
@@ -159,7 +174,7 @@ public class AppIrsManage { | |||
.collect(Collectors.toList()); | |||
//如果筛选出来的 为空的话 就调用状态机 | |||
if(CollUtil.isEmpty(apps)){ | |||
if (CollUtil.isEmpty(apps)) { | |||
stateMachineUtils.pass(project); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
projectService.updateById(project); | |||
@@ -171,6 +186,7 @@ public class AppIrsManage { | |||
/** | |||
* 查询app | |||
* | |||
* @param apply | |||
* @return | |||
* @throws NoSuchAlgorithmException | |||
@@ -184,27 +200,27 @@ public class AppIrsManage { | |||
"&appKey=" + searchAppKey + "&" + | |||
"pageSize=10&pageNum=1&appCode=" + appCode + | |||
"&areaCode=&deptCode=&name="; | |||
log.info("url : {}",url); | |||
log.info("url : {}", url); | |||
RestTemplate restTemplate = new RestTemplate(); | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); | |||
log.info("查询应用目录 : {}", JSON.toJSONString(forEntity)); | |||
if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())){ | |||
if (Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())) { | |||
JSONObject body = JSON.parseObject(forEntity.getBody()); | |||
if(Objects.isNull(body)){ | |||
if (Objects.isNull(body)) { | |||
return null; | |||
} | |||
JSONObject datas = body.getJSONObject("datas"); | |||
if(Objects.isNull(datas)){ | |||
if (Objects.isNull(datas)) { | |||
return null; | |||
} | |||
JSONObject data = datas.getJSONObject("data"); | |||
if(Objects.isNull(data)){ | |||
if (Objects.isNull(data)) { | |||
return null; | |||
} | |||
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); | |||
if(CollUtil.isEmpty(apiApplySearchResult)){ | |||
if (CollUtil.isEmpty(apiApplySearchResult)) { | |||
return null; | |||
} | |||
return apiApplySearchResult.getJSONObject(0); | |||
@@ -225,19 +241,19 @@ public class AppIrsManage { | |||
RestTemplate restTemplate = new RestTemplate(); | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); | |||
log.info("查询应用目录 : {}", JSON.toJSONString(forEntity)); | |||
if(Objects.nonNull(forEntity.getBody())){ | |||
if (Objects.nonNull(forEntity.getBody())) { | |||
JSONObject body = JSON.parseObject(forEntity.getBody()); | |||
if(Objects.isNull(body)){ | |||
if (Objects.isNull(body)) { | |||
return null; | |||
} | |||
JSONObject datas = body.getJSONObject("datas"); | |||
if(Objects.isNull(datas)){ | |||
if (Objects.isNull(datas)) { | |||
return null; | |||
} | |||
JSONObject data = datas.getJSONObject("data"); | |||
if(Objects.isNull(data)){ | |||
if (Objects.isNull(data)) { | |||
return null; | |||
} | |||
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); | |||
@@ -252,14 +268,14 @@ public class AppIrsManage { | |||
String appKey = "A331101453557202109017383"; | |||
String method = "POST"; | |||
String interfaceName = "5crv7i4727abLCv0"; | |||
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method); | |||
log.info("secret :{}",secret); | |||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); | |||
log.info("secret :{}", secret); | |||
String sign = MD5.create().digestHex(appKey + secret + timestamp); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if(Objects.nonNull(factory)){ | |||
if (Objects.nonNull(factory)) { | |||
restTemplate = new RestTemplate(factory); | |||
}else{ | |||
} else { | |||
restTemplate = new RestTemplate(); | |||
} | |||
String appId = "A330000100000202105005790"; | |||
@@ -269,7 +285,7 @@ public class AppIrsManage { | |||
"&sign=" + sign + "&appKey=" + appKey + | |||
"&capCode=" + capCode + "&capTime=" + timestamp + | |||
"&appId=" + appId; | |||
log.info("url :{}",url); | |||
log.info("url :{}", url); | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
log.info(forEntity.getBody()); | |||
return forEntity.getBody(); | |||
@@ -277,6 +293,7 @@ public class AppIrsManage { | |||
/** | |||
* 推送项目详情 | |||
* | |||
* @return | |||
*/ | |||
public String pushProjectDetail(ProjectDTO projectDto) { | |||
@@ -285,14 +302,14 @@ public class AppIrsManage { | |||
String appKey = pushProjectAppKey; | |||
String method = HttpMethod.POST.name(); | |||
String interfaceName = pushProjectInterfaceName; | |||
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method); | |||
log.info("secret :{}",secret); | |||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); | |||
log.info("secret :{}", secret); | |||
String sign = MD5.create().digestHex(appKey + secret + timestamp); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if(Objects.nonNull(factory)){ | |||
if (Objects.nonNull(factory)) { | |||
restTemplate = new RestTemplate(factory); | |||
}else{ | |||
} else { | |||
restTemplate = new RestTemplate(); | |||
} | |||
String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海" | |||
@@ -318,13 +335,13 @@ public class AppIrsManage { | |||
String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32"; | |||
String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; | |||
String capCode = null; | |||
try{ | |||
try { | |||
capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); | |||
}catch (Exception e){ | |||
} catch (Exception e) { | |||
log.error(e.getMessage()); | |||
} | |||
String url = pushProjectUrl+ "?" + | |||
String url = pushProjectUrl + "?" + | |||
"requestTime=" + timestamp + "&sign=" + sign + | |||
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + | |||
"&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId + | |||
@@ -337,9 +354,36 @@ public class AppIrsManage { | |||
"&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing + | |||
"&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish + | |||
"&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName; | |||
log.info("url :{}",url); | |||
log.info("url :{}", url); | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
log.info(forEntity.getBody()); | |||
return forEntity.getBody(); | |||
} | |||
public JSONObject getDigitalResourceIndicatorsByAppCode(String appCode, Integer pageSize) { | |||
long timestamp = System.currentTimeMillis(); | |||
String appSecret = driAppSecret; | |||
String appKey = driAppKey; | |||
String method = HttpMethod.POST.name(); | |||
String interfaceName = driInterfaceName; | |||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); | |||
log.info("secret : {}", secret); | |||
String sign = MD5.create().digestHex(appKey + secret + timestamp); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if (Objects.nonNull(factory)) { | |||
restTemplate = new RestTemplate(factory); | |||
} else { | |||
restTemplate = new RestTemplate(); | |||
} | |||
String url = driUrl + "?" + | |||
"requestTime=" + timestamp + "&sign=" + sign + | |||
"&appKey=" + appKey + "&appCode=" + appCode + "&pageIndex=1&pageSize=" + pageSize; | |||
log.info("url :{}", url); | |||
ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class); | |||
log.info(Objects.requireNonNull(forEntity.getBody()).toJSONString()); | |||
return forEntity.getBody(); | |||
} | |||
} |
@@ -2,10 +2,12 @@ package com.ningdatech.pmapi.meeting.controller; | |||
import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq; | |||
import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq.Basic; | |||
import com.ningdatech.pmapi.meeting.manage.MeetingExpertJudgeManage; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
@@ -28,7 +30,7 @@ public class MeetingExpertJudgeController { | |||
@ApiOperation("保存履职评价") | |||
@PostMapping("/submit") | |||
public void saveExpertJudge(@Valid @RequestBody MeetingExpertJudgeReq req) { | |||
public void saveExpertJudge(@Validated(Basic.class) @RequestBody MeetingExpertJudgeReq req) { | |||
expertJudgeManage.saveExpertJudge(req); | |||
} | |||
@@ -30,6 +30,8 @@ public class MeetingExpertJudge implements Serializable { | |||
@ApiModelProperty("会议ID") | |||
private Long meetingId; | |||
private Long expertId; | |||
@ApiModelProperty("会议专家ID") | |||
private Long meetingExpertId; | |||
@@ -0,0 +1,49 @@ | |||
package com.ningdatech.pmapi.meeting.entity.enumeration; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
/** | |||
* <p> | |||
* ExpertJudgeEnum | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 2023/8/3 | |||
**/ | |||
public class ExpertJudgeEnum { | |||
private ExpertJudgeEnum() { | |||
} | |||
@Getter | |||
@AllArgsConstructor | |||
public enum AttendStatus { | |||
ON_TIME(1, "准时"), | |||
BE_LATE(2, "迟到"), | |||
ABSENT(3, "缺席"); | |||
private final Integer code; | |||
private final String value; | |||
public boolean eq(Integer code) { | |||
return this.code.equals(code); | |||
} | |||
} | |||
@Getter | |||
@AllArgsConstructor | |||
public enum Performance { | |||
POSITIVE(1, "积极"), | |||
NEGATIVE(2, "消极"); | |||
private final Integer code; | |||
private final String value; | |||
public boolean eq(Integer code) { | |||
return this.code.equals(code); | |||
} | |||
} | |||
} |
@@ -7,6 +7,9 @@ import lombok.Data; | |||
import javax.validation.constraints.NotNull; | |||
import java.time.LocalDateTime; | |||
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertJudgeEnum; | |||
import org.hibernate.validator.constraints.Range; | |||
/** | |||
* <p> | |||
* MeetingExpertJudgeReq | |||
@@ -20,34 +23,41 @@ public class MeetingExpertJudgeReq { | |||
private Long id; | |||
@NotNull(message = "会议ID不能为空") | |||
@NotNull(message = "会议ID不能为空", groups = Basic.class) | |||
private Long meetingId; | |||
@NotNull(message = "会议专家ID不能为空") | |||
@NotNull(message = "会议专家ID不能为空", groups = Basic.class) | |||
private Long meetingExpertId; | |||
@ApiModelProperty("评分(1~10)") | |||
@NotNull(message = "评分不能为空") | |||
@NotNull(message = "评分不能为空", groups = Basic.class) | |||
@Range(min = 1, max = 10, message = "评分范围为:1~10") | |||
private Integer score; | |||
/** | |||
* @see ExpertJudgeEnum.AttendStatus | |||
*/ | |||
@ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席") | |||
@NotNull(message = "是否参加不能为空") | |||
@NotNull(message = "是否参加不能为空", groups = Basic.class) | |||
private Integer attended; | |||
/** | |||
* @see ExpertJudgeEnum.Performance | |||
*/ | |||
@ApiModelProperty("参与程度:1 积极、2 消极") | |||
@NotNull(message = "参与度不能为空") | |||
@NotNull(message = "参与度不能为空", groups = Attend.class) | |||
private Integer performance; | |||
@ApiModelProperty("是否提出建议:true 是、false 否") | |||
@NotNull(message = "是否提出建议不能为空") | |||
@NotNull(message = "是否提出建议不能为空", groups = Attend.class) | |||
private Boolean advised; | |||
@ApiModelProperty("是否早退:true 早退、false 未早退") | |||
@NotNull(message = "是否早退不能为空") | |||
@NotNull(message = "是否早退不能为空", groups = Attend.class) | |||
private Boolean leaveEarly; | |||
@ApiModelProperty("是否违规:true 是、false 否") | |||
@NotNull(message = "是否违规不能为空") | |||
@NotNull(message = "是否违规不能为空", groups = Attend.class) | |||
private Boolean brokeRule; | |||
@ApiModelProperty("违规内容") | |||
@@ -56,4 +66,12 @@ public class MeetingExpertJudgeReq { | |||
@JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||
private LocalDateTime createOn; | |||
//================================================================================================================== | |||
public interface Attend { | |||
} | |||
public interface Basic { | |||
} | |||
} |
@@ -4,19 +4,25 @@ import cn.hutool.core.bean.BeanUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.ValidUtil; | |||
import com.ningdatech.cache.lock.DistributedLock; | |||
import com.ningdatech.pmapi.meeting.entity.domain.Meeting; | |||
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; | |||
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge; | |||
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; | |||
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertJudgeEnum; | |||
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; | |||
import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq; | |||
import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq.Attend; | |||
import com.ningdatech.pmapi.meeting.service.IMeetingExpertJudgeService; | |||
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; | |||
import com.ningdatech.pmapi.meeting.service.IMeetingService; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* MeetingExpertJudgeManage | |||
@@ -46,6 +52,13 @@ public class MeetingExpertJudgeManage { | |||
throw BizException.wrap("履职评价失败,请重试"); | |||
} | |||
try { | |||
if (!ExpertJudgeEnum.AttendStatus.ABSENT.eq(req.getAttended())) { | |||
Map<String, String> validMap = ValidUtil.valid(req, Attend.class); | |||
if (!validMap.isEmpty()) { | |||
String errMsg = CollUtils.joinByComma(validMap.values()); | |||
throw BizException.wrap(errMsg); | |||
} | |||
} | |||
// 会议状态校验 | |||
Meeting meeting = meetingService.getById(req.getMeetingId()); | |||
if (meeting == null || MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { | |||
@@ -63,6 +76,7 @@ public class MeetingExpertJudgeManage { | |||
throw BizException.wrap("履职评价已提交"); | |||
} | |||
MeetingExpertJudge entity = BeanUtil.copyProperties(req, MeetingExpertJudge.class); | |||
entity.setExpertId(expert.getExpertId()); | |||
expertJudgeService.save(entity); | |||
} finally { | |||
distributedLock.releaseLock(key); | |||
@@ -0,0 +1,64 @@ | |||
package com.ningdatech.pmapi.portrait.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.portrait.manage.TagManage; | |||
import com.ningdatech.pmapi.portrait.model.dto.TagDTO; | |||
import com.ningdatech.pmapi.portrait.model.dto.TagToProjectDTO; | |||
import com.ningdatech.pmapi.portrait.model.req.TagPageReq; | |||
import com.ningdatech.pmapi.portrait.model.vo.TagVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.List; | |||
/** | |||
* @Classname TagController | |||
* @Description | |||
* @Date 2023/8/2 14:11 | |||
* @Author PoffyZhang | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "项目画像-标签") | |||
@RequestMapping("/api/v1/portrait/tag") | |||
public class TagController { | |||
private final TagManage tagManage; | |||
@GetMapping("/list/{areaCode}") | |||
@ApiOperation("按区域查询标签列表") | |||
public PageVo<TagVO> list(@PathVariable String areaCode, TagPageReq req) { | |||
return tagManage.list(areaCode,req); | |||
} | |||
@PostMapping("/save") | |||
@ApiOperation("保存标签") | |||
@WebLog("保存标签") | |||
public String save(@Valid @RequestBody TagDTO dto) { | |||
return tagManage.save(dto); | |||
} | |||
@PostMapping("/delete/{id}") | |||
@ApiOperation("删除标签") | |||
@WebLog("删除标签") | |||
public String save(@PathVariable Long id) { | |||
return tagManage.delete(id); | |||
} | |||
@PostMapping("/save-to-project") | |||
@ApiOperation("设置标签到项目") | |||
@WebLog("设置标签到项目") | |||
public String saveToProject(@Valid @RequestBody List<TagToProjectDTO> dtos) { | |||
return tagManage.saveToProject(dtos); | |||
} | |||
@PostMapping("/remove-tag-to-project") | |||
@ApiOperation("项目删除标签") | |||
@WebLog("项目删除标签") | |||
public String removeTagToProject(@Valid @RequestBody TagToProjectDTO dto) { | |||
return tagManage.removeTagToProject(dto); | |||
} | |||
} |
@@ -0,0 +1,199 @@ | |||
package com.ningdatech.pmapi.portrait.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
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.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.portrait.model.dto.TagDTO; | |||
import com.ningdatech.pmapi.portrait.model.dto.TagToProjectDTO; | |||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||
import com.ningdatech.pmapi.portrait.model.req.TagPageReq; | |||
import com.ningdatech.pmapi.portrait.model.vo.TagVO; | |||
import com.ningdatech.pmapi.portrait.service.IProjectTagService; | |||
import com.ningdatech.pmapi.portrait.service.ITagService; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname TagManage | |||
* @Description | |||
* @Date 2023/8/2 14:10 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@Slf4j | |||
@AllArgsConstructor | |||
public class TagManage { | |||
private final ITagService tagService; | |||
private final IProjectService projectService; | |||
private final IProjectTagService projectTagService; | |||
/** | |||
* 标签分页 | |||
* @param areaCode | |||
* @param req | |||
* @return | |||
*/ | |||
public PageVo<TagVO> list(String areaCode, TagPageReq req) { | |||
LambdaQueryWrapper<Tag> query = Wrappers.lambdaQuery(Tag.class) | |||
.eq(Tag::getAreaCode, areaCode) | |||
.like(StringUtils.isNotBlank(req.getName()),Tag::getName,req.getName()) | |||
.orderByDesc(Tag::getUpdateOn); | |||
checkAuth(query,LoginUserUtil.loginUserDetail()); | |||
Page<Tag> page = tagService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<TagVO> records = CollUtils.convert(page.getRecords(), | |||
t -> BeanUtil.copyProperties(t,TagVO.class)); | |||
return PageVo.of(records, total); | |||
} | |||
/** | |||
* 权限控制 | |||
* @param query | |||
* @param user | |||
*/ | |||
private void checkAuth(LambdaQueryWrapper<Tag> query, UserInfoDetails user) { | |||
//如果是超管 | |||
if(user.getSuperAdmin()){ | |||
log.info(user.getUsername() + " 是超管,可以看所有标签"); | |||
}else if(user.getRegionAdmin()){ | |||
//如果是区域管理员 | |||
log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "标签"); | |||
query.eq(Tag::getAreaCode,user.getRegionCode()); | |||
}else{ | |||
//其它角色全都看不见 | |||
query.eq(Tag::getId,0L); | |||
} | |||
} | |||
/** | |||
* 保存标签 | |||
* @param dto | |||
* @return | |||
*/ | |||
public String save(TagDTO dto) { | |||
deduplicationName(dto); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
Tag entity = BeanUtil.copyProperties(dto,Tag.class); | |||
if(Objects.nonNull(dto.getId())){ | |||
Tag old = tagService.getById(dto.getId()); | |||
VUtils.isTrue(Objects.isNull(old)).throwMessage("此id标签不存在!"); | |||
entity.setId(old.getId()); | |||
}else{ | |||
entity.setId(null); | |||
entity.setCreateOn(LocalDateTime.now()); | |||
entity.setCreateBy(user.getUsername()); | |||
} | |||
entity.setUpdateOn(LocalDateTime.now()); | |||
entity.setUpdateBy(user.getUsername()); | |||
tagService.saveOrUpdate(entity); | |||
return "保存成功"; | |||
} | |||
/** | |||
* 标签名 去重 | |||
* @param dto | |||
*/ | |||
private void deduplicationName(TagDTO dto) { | |||
if(StringUtils.isNotBlank(dto.getName())){ | |||
long count = tagService.count(Wrappers.lambdaQuery(Tag.class) | |||
.eq(Tag::getAreaCode, dto.getAreaCode()) | |||
.eq(Tag::getName, dto.getName()) | |||
.ne(Objects.nonNull(dto.getId()), Tag::getId, dto.getId())); | |||
VUtils.isTrue(count > 0).throwMessage("保存失败!此区域标签名重复!"); | |||
} | |||
} | |||
public String saveToProject(List<TagToProjectDTO> dtos) { | |||
if(CollUtil.isEmpty(dtos)){ | |||
return "参入的标签为空"; | |||
} | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String projectCode = dtos.get(0).getProjectCode(); | |||
Project project = projectService.getProjectByCode(projectCode); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode,projectCode)); | |||
//去重 | |||
dtos = dtos.stream().distinct().collect(Collectors.toList()); | |||
for(TagToProjectDTO dto : dtos){ | |||
Long tagId = dto.getTagId(); | |||
Tag tag = tagService.getById(tagId); | |||
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!"); | |||
VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode())) | |||
.throwMessage("项目和标签不是一个区域的!"); | |||
ProjectTag projectTag = new ProjectTag(); | |||
projectTag.setProjectCode(projectCode); | |||
projectTag.setTagId(tagId); | |||
projectTag.setCreateOn(LocalDateTime.now()); | |||
projectTag.setCreateBy(user.getUsername()); | |||
projectTagService.save(projectTag); | |||
} | |||
return "保存成功"; | |||
} | |||
public String removeTagToProject(TagToProjectDTO dto) { | |||
String projectCode = dto.getProjectCode(); | |||
Project project = projectService.getProjectByCode(projectCode); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||
Long tagId = dto.getTagId(); | |||
Tag tag = tagService.getById(tagId); | |||
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!"); | |||
VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode())) | |||
.throwMessage("项目和标签不是一个区域的!"); | |||
ProjectTag pt = projectTagService.getOne(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode, projectCode) | |||
.eq(ProjectTag::getTagId, tagId)); | |||
VUtils.isTrue(Objects.isNull(pt)) | |||
.throwMessage("该项目没有绑定此标签!"); | |||
projectTagService.removeById(pt.getId()); | |||
return "删除成功"; | |||
} | |||
/** | |||
* 删除标签 | |||
* @param id | |||
* @return | |||
*/ | |||
public String delete(Long id) { | |||
Tag tag = tagService.getById(id); | |||
VUtils.isTrue(Objects.isNull(tag)) | |||
.throwMessage("删除失败 此标签ID不存在!"); | |||
if(tagService.removeById(id)){ | |||
//关联关系 也要删 | |||
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getTagId,id)); | |||
return "删除成功"; | |||
} | |||
return "删除失败"; | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.ningdatech.pmapi.portrait.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
/** | |||
* <p> | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-2 | |||
*/ | |||
public interface ProjectTagMapper extends BaseMapper<ProjectTag> { | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.ningdatech.pmapi.portrait.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||
/** | |||
* <p> | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-2 | |||
*/ | |||
public interface TagMapper extends BaseMapper<Tag> { | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.ningdatech.pmapi.portrait.model.dto; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotNull; | |||
import java.io.Serializable; | |||
/** | |||
* <p> | |||
* 标签 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@ApiModel(value = "Tag对象", description = "标签") | |||
public class TagDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
private Long id; | |||
@ApiModelProperty("标签名") | |||
private String name; | |||
@ApiModelProperty("备注") | |||
private String remark; | |||
@ApiModelProperty("区域CODE") | |||
@NotNull(message = "区域CODE必填") | |||
private String areaCode; | |||
} |
@@ -0,0 +1,31 @@ | |||
package com.ningdatech.pmapi.portrait.model.dto; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotNull; | |||
import java.io.Serializable; | |||
/** | |||
* <p> | |||
* 标签 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@ApiModel(value = "Tag对象", description = "标签") | |||
public class TagToProjectDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
@NotNull(message = "标签ID必填") | |||
private Long tagId; | |||
@ApiModelProperty("当前项目编号") | |||
@NotNull(message = "项目编号必填") | |||
private String projectCode; | |||
} |
@@ -0,0 +1,40 @@ | |||
package com.ningdatech.pmapi.portrait.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* 标签项目关联 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@TableName("nd_project_tag") | |||
@ApiModel(value = "ProjectTag对象", description = "标签项目关联") | |||
public class ProjectTag implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
@TableId(type = IdType.AUTO) | |||
private Long id; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("标签ID") | |||
private Long tagId; | |||
private LocalDateTime createOn; | |||
private String createBy; | |||
} |
@@ -0,0 +1,45 @@ | |||
package com.ningdatech.pmapi.portrait.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* 标签 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@TableName("nd_tag") | |||
@ApiModel(value = "Tag对象", description = "标签") | |||
public class Tag implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
@TableId(type = IdType.AUTO) | |||
private Long id; | |||
@ApiModelProperty("标签名") | |||
private String name; | |||
@ApiModelProperty("备注") | |||
private String remark; | |||
@ApiModelProperty("区域CODE") | |||
private String areaCode; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.ningdatech.pmapi.portrait.model.req; | |||
import com.ningdatech.basic.model.PagePo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.*; | |||
/** | |||
* @Classname TagPageReq | |||
* @Description | |||
* @Date 2023/8/2 14:16 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@Builder | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
@ApiModel("标签列表查询") | |||
@EqualsAndHashCode(callSuper = true) | |||
public class TagPageReq extends PagePo { | |||
@ApiModelProperty("标签名") | |||
private String name; | |||
} |
@@ -0,0 +1,40 @@ | |||
package com.ningdatech.pmapi.portrait.model.vo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* 标签 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@ApiModel(value = "Tag对象", description = "标签") | |||
public class TagVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
private Long id; | |||
@ApiModelProperty("标签名") | |||
private String name; | |||
@ApiModelProperty("备注") | |||
private String remark; | |||
@ApiModelProperty("区域CODE") | |||
private String areaCode; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.ningdatech.pmapi.portrait.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
/** | |||
* @Classname ITagService | |||
* @Description | |||
* @Date 2023/8/2 10:47 | |||
* @Author PoffyZhang | |||
*/ | |||
public interface IProjectTagService extends IService<ProjectTag> { | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.ningdatech.pmapi.portrait.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||
/** | |||
* @Classname ITagService | |||
* @Description | |||
* @Date 2023/8/2 10:47 | |||
* @Author PoffyZhang | |||
*/ | |||
public interface ITagService extends IService<Tag> { | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.ningdatech.pmapi.portrait.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.pmapi.portrait.mapper.ProjectTagMapper; | |||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
import com.ningdatech.pmapi.portrait.service.IProjectTagService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-2 | |||
*/ | |||
@Service | |||
public class ProjectTagServiceImpl extends ServiceImpl<ProjectTagMapper, | |||
ProjectTag> implements IProjectTagService { | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.ningdatech.pmapi.portrait.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.pmapi.portrait.mapper.TagMapper; | |||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||
import com.ningdatech.pmapi.portrait.service.ITagService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-2 | |||
*/ | |||
@Service | |||
public class TagServiceImpl extends ServiceImpl<TagMapper, | |||
Tag> implements ITagService { | |||
} |
@@ -4,7 +4,6 @@ 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.DelayedApplyManage; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.DelayedApplyVO; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
@@ -16,6 +15,7 @@ import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.util.List; | |||
/** | |||
* @Classname DelayedProjectController | |||
@@ -39,6 +39,12 @@ public class DelayedApplyController { | |||
return delayedApplyManage.projectLibList(req); | |||
} | |||
@ApiOperation(value = "查看某个项目的延期列表", notes = "查看某个项目的延期列表") | |||
@GetMapping("/delay-list/{projectId}") | |||
public List<DelayedApplyVO> delayList(@PathVariable Long projectId) { | |||
return delayedApplyManage.delayList(projectId); | |||
} | |||
@ApiOperation(value = "延期的内容详情", notes = "延期的内容详情") | |||
@GetMapping("/detail/{projectId}") | |||
public DelayedApplyVO detailByProjectId(@PathVariable Long projectId) { | |||
@@ -59,4 +59,12 @@ public class FinalAcceptanceController { | |||
String instanceId = finalAcceptanceManage.startProcess(dto); | |||
return "终验申报 【" + instanceId + "】 成功"; | |||
} | |||
@ApiOperation(value = "终验申报重新提交", notes = "终验申报重新提交") | |||
@WebLog("终验申报重新提交") | |||
@PostMapping("/restart-process") | |||
public String restartTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { | |||
String instanceId = finalAcceptanceManage.restartProcess(dto); | |||
return "终验申报 【" + instanceId + "】 成功"; | |||
} | |||
} |
@@ -171,7 +171,7 @@ public class ConstructionPlanManage { | |||
defaultDeclaredProjectManage.buildCondition(params, dto); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, constructProject); | |||
String instanceId = processService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); | |||
String instanceId = processService.startProcessLs(model, params, orgModelMap); | |||
log.info("建设方案项目申报成功 【{}】", instanceId); | |||
// 保存建设项目相关 | |||
@@ -154,7 +154,7 @@ public class DeclaredProjectManage { | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectInfo,project); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); | |||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | |||
String instanceId = processService.startProcessLs(model, params,orgModelMap); | |||
log.info("申报项目成功 【{}】", instanceId); | |||
//如果是重新提交的话 判断下 项目是否存在 | |||
@@ -240,7 +240,7 @@ public class DeclaredProjectManage { | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectDto,project); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); | |||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | |||
String instanceId = processService.startProcessLs(model, params,orgModelMap); | |||
log.info("重新申报项目成功 【{}】", instanceId); | |||
//保存项目相关 | |||
@@ -298,10 +298,28 @@ public class DelayedApplyManage { | |||
.eq(ProjectDelayApply::getProjectId, projectId) | |||
.orderByDesc(ProjectDelayApply::getCreateOn) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(delayApply)){ | |||
return null; | |||
} | |||
return BeanUtil.copyProperties(delayApply,DelayedApplyVO.class); | |||
} | |||
/** | |||
* 查看某个项目的 延期列表 | |||
* @param projectId | |||
* @return | |||
*/ | |||
public List<DelayedApplyVO> delayList(Long projectId) { | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectId); | |||
List<ProjectDelayApply> delays = projectDelayApplyService.list(Wrappers.lambdaQuery(ProjectDelayApply.class) | |||
.in(ProjectDelayApply::getProjectId, allVersionProjectId) | |||
.eq(ProjectDelayApply::getSuccess, Boolean.TRUE)); | |||
if(CollUtil.isEmpty(delays)){ | |||
return Collections.emptyList(); | |||
} | |||
return delays.stream().map(d -> BeanUtil.copyProperties(d,DelayedApplyVO.class)) | |||
.collect(Collectors.toList()); | |||
} | |||
} |
@@ -206,9 +206,6 @@ public class FinalAcceptanceManage { | |||
String regionCode = projectInfo.getAreaCode(); | |||
//放入终验材料 | |||
projectInfo.setFinalAcceptanceMaterials(projectDto.getFinalAcceptanceMaterials()); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) | |||
@@ -233,12 +230,13 @@ public class FinalAcceptanceManage { | |||
declaredProjectManage.buildCondition(params, dto); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); | |||
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("终验方案项目申报成功 【{}】", instanceId); | |||
//保存终验项目 | |||
//生成新版本 并且进入下一状态 | |||
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()); | |||
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, | |||
InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.FALSE); | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | |||
@@ -266,9 +264,6 @@ public class FinalAcceptanceManage { | |||
String regionCode = projectInfo.getAreaCode(); | |||
//放入终验材料 | |||
projectInfo.setFinalAcceptanceMaterials(projectDto.getFinalAcceptanceMaterials()); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) | |||
@@ -293,12 +288,13 @@ public class FinalAcceptanceManage { | |||
declaredProjectManage.buildCondition(params, dto); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); | |||
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("终验方案项目重新申报成功 【{}】", instanceId); | |||
//保存终验项目 | |||
//生成新版本 并且进入下一状态 | |||
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()); | |||
projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, | |||
InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE); | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | |||
@@ -81,6 +81,8 @@ public class OperationManage { | |||
entity.setProjectCode(project.getProjectCode()); | |||
entity.setUpdateOn(LocalDateTime.now()); | |||
entity.setUpdateBy(user.getUsername()); | |||
//强制放入 计划终验时间 | |||
entity.setFinalInspectionDate(project.getPlanAcceptanceTime()); | |||
if(operationService.saveOrUpdate(entity)){ | |||
stateMachineUtils.pass(project); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
@@ -194,7 +194,7 @@ public class PrequalificationDeclaredProjectManage { | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo); | |||
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | |||
String instanceId = processInstanceService.startProcessLs(model, params,orgModelMap); | |||
log.info("提交预审项目成功 【{}】", instanceId); | |||
log.info("restart 【{}】", restart); | |||
@@ -97,14 +97,11 @@ public class ReviewByDeptJointManage { | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode,project); | |||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | |||
String instanceId = processService.startProcessLs(model, params,orgModelMap); | |||
log.info("部门联审申报成功 【{}】", instanceId); | |||
//保存项目信息 | |||
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); | |||
// if(!modifyProject(projectInfo, instanceId)){ | |||
// return Boolean.FALSE; | |||
// } | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | |||
@@ -37,7 +37,6 @@ public class AnnualPlanController { | |||
@GetMapping("/list") | |||
@ApiOperation("年度计划库列表") | |||
@WebLog("年度计划库列表") | |||
public PageVo<AnnualPlanListItemVO> annualPlanLibList(ProjectListReq req) { | |||
return annualPlanLibManage.annulPlanLibList(req); | |||
} | |||
@@ -0,0 +1,58 @@ | |||
package com.ningdatech.pmapi.projectlib.enumeration; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Objects; | |||
/** | |||
* | |||
* 预警填报类型枚举 | |||
* @author CMM | |||
* @since 2023/02/24 16:14 | |||
*/ | |||
@Getter | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
public enum WarningFlowTypeEnum { | |||
/** | |||
* 预警填报类型枚举 | |||
*/ | |||
UNIT_INNER_AUDIT(1, "预审申报",ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()), | |||
PRELIMINARY_PREVIEW(2, "建设方案申报",ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()), | |||
DEPT_UNITED_REVIEW(3,"采购结果备案",ProjectStatusEnum.TO_BE_PURCHASED.getCode()), | |||
CONSTRUCTION_PLAN_REVIEW(4,"初验备案",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()), | |||
PROJECT_FINAL_INSPECTION(5,"验收申报",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
private Integer code; | |||
private String desc; | |||
//对应的 待提交时的项目状态 | |||
private Integer projectStutas; | |||
public static String getDescByCode(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return StringUtils.EMPTY; | |||
} | |||
for (WarningFlowTypeEnum t : WarningFlowTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t.desc; | |||
} | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
public static WarningFlowTypeEnum getByCode(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return null; | |||
} | |||
for (WarningFlowTypeEnum t : WarningFlowTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t; | |||
} | |||
} | |||
return null; | |||
} | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.ningdatech.pmapi.projectlib.enumeration; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Objects; | |||
/** | |||
* | |||
* 预警填报类型枚举 | |||
* @author CMM | |||
* @since 2023/02/24 16:14 | |||
*/ | |||
@Getter | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
public enum WarningOperationTypeEnum { | |||
/** | |||
* 预警实施类型枚举 | |||
*/ | |||
CHUYAN(1, "项目初验",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()), | |||
ZHONGYAN(2, "项目终验",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
private Integer code; | |||
private String desc; | |||
//对应的 待提交时的项目状态 | |||
private Integer projectStutas; | |||
public static String getDescByCode(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return StringUtils.EMPTY; | |||
} | |||
for (WarningOperationTypeEnum t : WarningOperationTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t.desc; | |||
} | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
public static WarningOperationTypeEnum getByCode(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return null; | |||
} | |||
for (WarningOperationTypeEnum t : WarningOperationTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t; | |||
} | |||
} | |||
return null; | |||
} | |||
} |
@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; | |||
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -64,6 +65,7 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last(BizConst.LIMIT_1)); | |||
ProcessProgressVo instanceDetail = null; | |||
@@ -10,6 +10,7 @@ import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; | |||
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -66,6 +67,7 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(projectInst)){ | |||
@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; | |||
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -60,10 +61,13 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||
if (Objects.isNull(project)){ | |||
throw new BizException("当前项目不存在!"); | |||
} | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(projectId); | |||
// 根据项目ID查询项目预审流程的流程状态 | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.eq(ProjectInst::getProjectId, projectId) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last("limit 1")); | |||
ProcessProgressVo instanceDetail = null; | |||
@@ -13,6 +13,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -60,6 +61,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last(BizConst.LIMIT_1)); | |||
@@ -20,6 +20,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; | |||
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
@@ -67,6 +68,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last(BizConst.LIMIT_1)); | |||
ProcessProgressVo instanceDetail = null; | |||
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.projectlib.helper; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
@@ -11,6 +12,9 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; | |||
import cn.hutool.core.collection.CollUtil; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* ProjectHelper | |||
@@ -65,6 +69,16 @@ public class ProjectHelper { | |||
* @param app | |||
* @return | |||
*/ | |||
public static ProjectApplicationVO convertVOWithMap(ProjectApplication app, | |||
Map<Long, List<ProjectCoreBusinessIndicators>> coreBizMap) { | |||
ProjectApplicationVO appVo = new ProjectApplicationVO(); | |||
BeanUtils.copyProperties(app, appVo); | |||
if(coreBizMap.containsKey(app.getId())){ | |||
List<ProjectCoreBusinessIndicators> projectCoreBusinessIndicators = coreBizMap.get(app.getId()); | |||
appVo.setCoreBusinessList(projectCoreBusinessIndicators); | |||
} | |||
return appVo; | |||
} | |||
public static ProjectApplicationVO convertVO(ProjectApplication app) { | |||
ProjectApplicationVO appVo = new ProjectApplicationVO(); | |||
BeanUtils.copyProperties(app, appVo); | |||
@@ -7,11 +7,9 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.poi.excel.ExcelUtil; | |||
import com.alibaba.excel.EasyExcel; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
@@ -21,15 +19,12 @@ import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | |||
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.datascope.model.DataScopeDTO; | |||
import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; | |||
import com.ningdatech.pmapi.expert.constant.ExpertUserInfoSensitiveFieldEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectLibFlagEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
@@ -44,11 +39,11 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; | |||
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 lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -58,20 +53,12 @@ import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import javax.servlet.ServletOutputStream; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.*; | |||
import java.net.URLEncoder; | |||
import java.nio.charset.StandardCharsets; | |||
import java.nio.file.Files; | |||
import java.nio.file.Path; | |||
import java.nio.file.Paths; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
import static com.ningdatech.pmapi.expert.constant.ExpertUserInfoSensitiveFieldEnum.UnitType.list; | |||
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||
/** | |||
@@ -88,11 +75,11 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||
public class AnnualPlanLibManage { | |||
private final IProjectService projectService; | |||
private final IProjectApplicationService applicationService; | |||
private final StateMachineUtils stateMachine; | |||
private final INdProjectStatusChangeService statusChangeService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; | |||
private final RegionCacheHelper regionCacheHelper; | |||
/** | |||
* 年度计划查询状态 | |||
@@ -159,19 +146,35 @@ public class AnnualPlanLibManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public void projectApproved(ProjectApprovedReq req) { | |||
Project project = projectService.getById(req.getProjectId()); | |||
Project oldProject = projectService.getById(req.getProjectId()); | |||
Project project = BeanUtil.copyProperties(oldProject, Project.class); | |||
// 被撤回重新申报的项目,项目ID要置空 | |||
project.setId(null); | |||
project.setCreateOn(LocalDateTime.now()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
stateMachine.pass(project); | |||
//计划出 计划验收时间 | |||
LocalDateTime planAcceptanceTime = getPlanAcceptanceTime(req); | |||
LambdaUpdateWrapper<Project> update = | |||
Wrappers.lambdaUpdate(Project.class).set(Project::getApprovalAmount, req.getApprovedAmount()) | |||
.set(Project::getApprovedFile, req.getApprovedFileId()).set(Project::getBuildCycle, req.getBuildCycle()) | |||
.set(Project::getApprovedConstructionPlanFile, req.getBuildPlanFileId()) | |||
.set(Project::getApprovalDate, req.getApprovedDate()).set(Project::getStatus, project.getStatus()) | |||
.set(Project::getStage, project.getStage()) | |||
.set(Objects.nonNull(planAcceptanceTime),Project::getPlanAcceptanceTime,planAcceptanceTime) | |||
.eq(Project::getId, req.getProjectId()); | |||
projectService.update(update); | |||
project.setApprovalAmount(req.getApprovedAmount()); | |||
project.setApprovedFile(String.valueOf(req.getApprovedFileId())); | |||
project.setBuildCycle(String.valueOf(req.getBuildCycle())); | |||
project.setOriginBuildCycle(req.getBuildCycle()); | |||
project.setApprovedConstructionPlanFile(String.valueOf(req.getBuildPlanFileId())); | |||
project.setApprovalDate(req.getApprovedDate()); | |||
project.setPlanAcceptanceTime(planAcceptanceTime); | |||
project.setOriginPlanAcceptanceTime(planAcceptanceTime); | |||
// 项目编号不变,版本号加1 | |||
project.setProjectCode(oldProject.getProjectCode()); | |||
project.setVersion(oldProject.getVersion() + 1); | |||
project.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); | |||
if(projectService.save(project)){ | |||
applicationService.saveApplication(project,oldProject,Boolean.TRUE); | |||
// 将旧的项目版本置为不是最新 | |||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||
.set(Project::getNewest, Boolean.FALSE) | |||
.ne(Project::getId, project.getId()) | |||
.eq(Project::getProjectCode, project.getProjectCode())); | |||
} | |||
} | |||
public LocalDateTime getPlanAcceptanceTime(ProjectApprovedReq req){ | |||
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
@@ -34,19 +35,15 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; | |||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||
import com.ningdatech.pmapi.portrait.model.vo.TagVO; | |||
import com.ningdatech.pmapi.portrait.service.IProjectTagService; | |||
import com.ningdatech.pmapi.portrait.service.ITagService; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PaymentPlanVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | |||
import com.ningdatech.pmapi.projectdeclared.service.IContractService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.*; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.*; | |||
import com.ningdatech.pmapi.projectdeclared.service.*; | |||
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | |||
import com.ningdatech.pmapi.projectlib.constant.ProjectConstant; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
@@ -63,9 +60,17 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.ningdatech.pmapi.projectlib.service.*; | |||
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo; | |||
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification; | |||
import com.ningdatech.pmapi.safety.model.vo.PersonSafetyInfoVO; | |||
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO; | |||
import com.ningdatech.pmapi.safety.model.vo.SupplierSafetyQualificationVO; | |||
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService; | |||
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService; | |||
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | |||
import com.ningdatech.pmapi.todocenter.service.ITodoService; | |||
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.exception.BusinessException; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -114,6 +119,15 @@ public class ProjectLibManage { | |||
private final ITodoService todoService; | |||
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; | |||
private final IProjectTagService projectTagService; | |||
private final ITagService tagService; | |||
private final IOperationService operationService; | |||
private final ISupplierSafetyQualificationService supplierSafetyQualificationService; | |||
private final IPersonSafetyInfoService personSafetyInfoService; | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
@@ -126,6 +140,9 @@ public class ProjectLibManage { | |||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | |||
item.setId(w.getId()); | |||
item.setProjectName(w.getProjectName()); | |||
item.setProjectCode(w.getProjectCode()); | |||
item.setArea(w.getArea()); | |||
item.setAreaCode(w.getAreaCode()); | |||
item.setCreateOn(w.getCreateOn()); | |||
item.setDeclaredAmount(w.getDeclareAmount()); | |||
item.setStage(w.getStage()); | |||
@@ -153,10 +170,31 @@ public class ProjectLibManage { | |||
return PageVo.empty(); | |||
} | |||
UserFullInfoDTO finalUser = user; | |||
Set<String> projectCodes = page.getRecords().stream() | |||
.map(Project::getProjectCode).collect(Collectors.toSet()); | |||
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
.in(ProjectTag::getProjectCode, projectCodes)); | |||
Map<String,List<ProjectTag>> tagMap = Maps.newHashMap(); | |||
Map<Long,String> tagNameMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(pts)){ | |||
tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); | |||
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); | |||
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class) | |||
.in(Tag::getId, tagIds)); | |||
if(CollUtil.isNotEmpty(tags)){ | |||
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName)); | |||
} | |||
} | |||
Map<String, List<ProjectTag>> finalTagMap = tagMap; | |||
Map<Long,String> finalTagNameMap = tagNameMap; | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | |||
item.setId(w.getId()); | |||
item.setProjectName(w.getProjectName()); | |||
item.setProjectCode(w.getProjectCode()); | |||
item.setArea(w.getArea()); | |||
item.setAreaCode(w.getAreaCode()); | |||
item.setCreateOn(w.getCreateOn()); | |||
item.setDeclaredAmount(w.getDeclareAmount()); | |||
item.setStage(w.getStage()); | |||
@@ -175,17 +213,284 @@ public class ProjectLibManage { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
item.setPrePlanProjectId(w.getPrePlanProjectId()); | |||
setTag(item,finalTagMap,finalTagNameMap); | |||
return item; | |||
}); | |||
return PageVo.of(records, total); | |||
} | |||
private void setTag(ProjectLibListItemVO item, Map<String, List<ProjectTag>> finalTagMap, Map<Long, String> finalTagNameMap) { | |||
if(finalTagMap.containsKey(item.getProjectCode())){ | |||
List<TagVO> tags = Lists.newArrayList(); | |||
List<ProjectTag> projectTags = finalTagMap.get(item.getProjectCode()); | |||
for(ProjectTag pt :projectTags){ | |||
if(finalTagNameMap.containsKey(pt.getTagId())){ | |||
TagVO vo = new TagVO(); | |||
vo.setId(pt.getTagId()); | |||
vo.setName(finalTagNameMap.get(pt.getTagId())); | |||
tags.add(vo); | |||
} | |||
} | |||
item.setTags(tags); | |||
} | |||
} | |||
public List<Project> projectList(ProjectListReq req) { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
return projectService.list(query); | |||
} | |||
/** | |||
* @param projectId 项目详情 | |||
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | |||
* @author ZPF | |||
* @since 2023/02/11 11:15 | |||
*/ | |||
public ProjectDetailVO getProjectDetail(Long projectId) { | |||
// 查询最新的项目申报信息 | |||
Project projectInfo = projectService.getNewProject(projectId); | |||
if (Objects.isNull(projectInfo)) { | |||
return null; | |||
} | |||
ProjectDetailVO vo = new ProjectDetailVO(); | |||
BeanUtils.copyProperties(projectInfo, vo); | |||
vo.buildDynamicForm(projectInfo.getDynamicForm()); | |||
// 查询应用 | |||
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, vo.getProjectCode()) | |||
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) | |||
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); | |||
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); | |||
//核心业务 | |||
if(CollUtil.isNotEmpty(applicationIds)){ | |||
List<ProjectCoreBusinessIndicators> coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) | |||
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); | |||
Map<Long,List<ProjectCoreBusinessIndicators>> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId)); | |||
Optional.ofNullable(applications).ifPresent(apps -> | |||
vo.setProjectApplications(CollUtils.convert(apps, | |||
app -> ProjectHelper.convertVOWithMap(app,coreBizMap)) | |||
)); | |||
} | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); | |||
//查询采购备案 | |||
List<Purchase> purchases = purchaseService.listByProjectId(projectId); | |||
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); | |||
//查询合同备案 | |||
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId) | |||
.last(BizConst.LIMIT_1)); | |||
ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); | |||
vo.setContract(contractVO); | |||
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) | |||
.in(PaymentPlan::getProjectId, allVersionProjectId) | |||
.orderByAsc(PaymentPlan::getPaymentTime)); | |||
if (Objects.nonNull(contractVO)) { | |||
contractVO.setPayments(convertPayments(payments, | |||
contractVO.getTotalAmount())); | |||
} | |||
//查询实施信息 | |||
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) | |||
.in(Operation::getProjectId, allVersionProjectId) | |||
.orderByAsc(Operation::getCreateOn) | |||
.last(BizConst.LIMIT_1)); | |||
vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class)); | |||
SafetyMonitorVO safetyVo = new SafetyMonitorVO(); | |||
//查询风险监测 | |||
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class) | |||
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode())); | |||
if(CollUtil.isNotEmpty(ssq)){ | |||
safetyVo.setSupplierSafetyQualification(ssq.stream() | |||
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class)) | |||
.collect(Collectors.toList())); | |||
} | |||
vo.setSafetyInfo(safetyVo); | |||
List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class) | |||
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode())); | |||
if(CollUtil.isNotEmpty(psi)){ | |||
safetyVo.setPersonSafetyInfo(psi.stream() | |||
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class)) | |||
.collect(Collectors.toList())); | |||
} | |||
//查询初验信息 | |||
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) | |||
.orderByAsc(PreInsAcceptancePerson::getCreateOn)); | |||
vo.setAcceptancePersons(convertPersons(acceptancePersons)); | |||
//查询终验信息 | |||
//查询年度投资金额 要是已验收的项目 | |||
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { | |||
List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); | |||
annualAmounts.add(AnnualAmountVO.builder() | |||
.projectId(projectInfo.getId()) | |||
.projectYear(projectInfo.getProjectYear()) | |||
.annualAmount(projectInfo.getAnnualPlanAmount()) | |||
.build()); | |||
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) | |||
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) | |||
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); | |||
Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> | |||
declarations.forEach(declaration -> { | |||
annualAmounts.add(AnnualAmountVO.builder() | |||
.projectId(projectInfo.getId()) | |||
.projectYear(declaration.getProjectYear()) | |||
.annualAmount(declaration.getAnnualPaymentAmount()) | |||
.build()); | |||
}) | |||
); | |||
vo.setAnnualAccumulateAmountList(annualAmounts); | |||
} | |||
// 处理文件名 | |||
List<Long> fileIdList = new ArrayList<>(); | |||
BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); | |||
BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w))); | |||
if (!fileIdList.isEmpty()) { | |||
List<File> files = fileService.listByIds(fileIdList); | |||
Map<String, String> fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName); | |||
vo.setApprovedFileName(fileMap.get(vo.getApprovedFile())); | |||
vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile())); | |||
} | |||
return vo; | |||
} | |||
/** | |||
* @param projectId 项目详情 不查询最新版本 | |||
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | |||
* @author ZPF | |||
* @since 2023/02/11 11:15 | |||
*/ | |||
public ProjectDetailVO getProjectDetailThisVersion(Long projectId) { | |||
// 查询最新的项目申报信息 | |||
Project projectInfo = projectService.getById(projectId); | |||
if (Objects.isNull(projectInfo)) { | |||
return null; | |||
} | |||
ProjectDetailVO vo = new ProjectDetailVO(); | |||
BeanUtils.copyProperties(projectInfo, vo); | |||
vo.buildDynamicForm(projectInfo.getDynamicForm()); | |||
// 查询应用 | |||
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, vo.getProjectCode()) | |||
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) | |||
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); | |||
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); | |||
//核心业务 | |||
if(CollUtil.isNotEmpty(applicationIds)){ | |||
List<ProjectCoreBusinessIndicators> coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) | |||
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); | |||
Map<Long,List<ProjectCoreBusinessIndicators>> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId)); | |||
Optional.ofNullable(applications).ifPresent(apps -> | |||
vo.setProjectApplications(CollUtils.convert(apps, | |||
app -> ProjectHelper.convertVOWithMap(app,coreBizMap)) | |||
)); | |||
} | |||
//审批信息 | |||
ProcessDetailReq req = new ProcessDetailReq(); | |||
req.setInstanceId(projectInfo.getInstCode()); | |||
req.setProjectId(projectId); | |||
vo.setProcess(todoService.getProcessDetail(req)); | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); | |||
//查询采购备案 | |||
List<Purchase> purchases = purchaseService.listByProjectId(projectId); | |||
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); | |||
//查询合同备案 | |||
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId) | |||
.last(BizConst.LIMIT_1)); | |||
ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); | |||
vo.setContract(contractVO); | |||
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) | |||
.in(PaymentPlan::getProjectId, allVersionProjectId) | |||
.orderByAsc(PaymentPlan::getPaymentTime)); | |||
if (Objects.nonNull(contractVO)) { | |||
contractVO.setPayments(convertPayments(payments, | |||
contractVO.getTotalAmount())); | |||
} | |||
//查询实施信息 | |||
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) | |||
.in(Operation::getProjectId, allVersionProjectId) | |||
.orderByAsc(Operation::getCreateOn) | |||
.last(BizConst.LIMIT_1)); | |||
vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class)); | |||
SafetyMonitorVO safetyVo = new SafetyMonitorVO(); | |||
//查询风险监测 | |||
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class) | |||
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode())); | |||
if(CollUtil.isNotEmpty(ssq)){ | |||
safetyVo.setSupplierSafetyQualification(ssq.stream() | |||
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class)) | |||
.collect(Collectors.toList())); | |||
} | |||
vo.setSafetyInfo(safetyVo); | |||
List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class) | |||
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode())); | |||
if(CollUtil.isNotEmpty(psi)){ | |||
safetyVo.setPersonSafetyInfo(psi.stream() | |||
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class)) | |||
.collect(Collectors.toList())); | |||
} | |||
//查询初验信息 | |||
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) | |||
.orderByAsc(PreInsAcceptancePerson::getCreateOn)); | |||
vo.setAcceptancePersons(convertPersons(acceptancePersons)); | |||
//查询终验信息 | |||
//查询年度投资金额 要是已验收的项目 | |||
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { | |||
List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); | |||
annualAmounts.add(AnnualAmountVO.builder() | |||
.projectId(projectInfo.getId()) | |||
.projectYear(projectInfo.getProjectYear()) | |||
.annualAmount(projectInfo.getAnnualPlanAmount()) | |||
.build()); | |||
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) | |||
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) | |||
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); | |||
Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> | |||
declarations.forEach(declaration -> { | |||
annualAmounts.add(AnnualAmountVO.builder() | |||
.projectId(projectInfo.getId()) | |||
.projectYear(declaration.getProjectYear()) | |||
.annualAmount(declaration.getAnnualPaymentAmount()) | |||
.build()); | |||
}) | |||
); | |||
vo.setAnnualAccumulateAmountList(annualAmounts); | |||
} | |||
// 处理文件名 | |||
List<Long> fileIdList = new ArrayList<>(); | |||
BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); | |||
BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w))); | |||
if (!fileIdList.isEmpty()) { | |||
List<File> files = fileService.listByIds(fileIdList); | |||
Map<String, String> fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName); | |||
vo.setApprovedFileName(fileMap.get(vo.getApprovedFile())); | |||
vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile())); | |||
} | |||
return vo; | |||
} | |||
/** | |||
* 申报新项目时 保存项目信息和其它相关联的信息 | |||
* | |||
* @param projectDto | |||
@@ -195,7 +500,7 @@ public class ProjectLibManage { | |||
*/ | |||
public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, | |||
String employeeCode) { | |||
Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode); | |||
Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode,Boolean.FALSE); | |||
//保存项目和实例的关系 | |||
ProjectInst projectInst = new ProjectInst(); | |||
projectInst.setProjectId(project.getId()); | |||
@@ -247,7 +552,7 @@ public class ProjectLibManage { | |||
* @return | |||
*/ | |||
public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, | |||
String employeeCode) { | |||
String employeeCode,Boolean isContruct) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
Project project = new Project(); | |||
@@ -262,10 +567,12 @@ public class ProjectLibManage { | |||
project.setSponsor(employeeCode); | |||
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); | |||
project.setProjectCode(projectCode); | |||
projectService.save(project); | |||
if(projectService.save(project)){ | |||
saveApplication(projectDto,project,null); | |||
} | |||
} else { | |||
//否则是重新提交的 新生成一个新版本的项目 | |||
project = newProjectWithVersion(projectDto); | |||
project = newProjectWithVersion(projectDto,isContruct); | |||
if (Objects.nonNull(project)) { | |||
project.setInstCode(instanceId); | |||
project.setSponsor(employeeCode); | |||
@@ -309,6 +616,7 @@ public class ProjectLibManage { | |||
project.setVersion(oldProject.getVersion() + 1); | |||
// 标记为建设方案申报 | |||
project.setIsConstruct(Boolean.TRUE); | |||
project.setIsBackReject(Boolean.FALSE); | |||
// 保存初步方案项目ID | |||
if (Boolean.TRUE.equals(oldProject.getIsConstruct())) { | |||
// 重新提交 | |||
@@ -316,16 +624,19 @@ public class ProjectLibManage { | |||
} else { | |||
project.setPrePlanProjectId(oldProject.getId()); | |||
} | |||
projectService.save(project); | |||
if(projectService.save(project)){ | |||
saveApplication(projectDto,project,Boolean.TRUE); | |||
// 将旧的项目版本置为不是最新 | |||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||
.set(Project::getNewest, Boolean.FALSE) | |||
.ne(Project::getId, project.getId()) | |||
.eq(Project::getProjectCode, project.getProjectCode())); | |||
} | |||
// 将旧的项目版本置为不是最新 | |||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||
.set(Project::getNewest, Boolean.FALSE) | |||
.ne(Project::getId, project.getId()) | |||
.eq(Project::getProjectCode, project.getProjectCode())); | |||
} else { | |||
//否则是被驳回,重新提交的 新生成一个新版本的项目 | |||
project = newProjectWithVersion(projectDto); | |||
project = newProjectWithVersion(projectDto,Boolean.TRUE); | |||
if (Objects.nonNull(project)) { | |||
project.setInstCode(instanceId); | |||
project.setSponsor(employeeCode); | |||
@@ -346,10 +657,10 @@ public class ProjectLibManage { | |||
* @param projectDto | |||
* @return | |||
*/ | |||
public Project reSaveProjectNewVersion(ProjectDTO projectDto) { | |||
public Project reSaveProjectNewVersion(ProjectDTO projectDto,Boolean isContruct) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
return newProjectWithVersion(projectDto); | |||
return newProjectWithVersion(projectDto,isContruct); | |||
} catch (Exception e) { | |||
log.error("项目信息入库错误 " + e); | |||
throw new BusinessException("项目信息入库错误 :" + e); | |||
@@ -360,7 +671,7 @@ public class ProjectLibManage { | |||
* 重新提交工作流时 舍弃在原有项目修改 | |||
* 新增一个新的项目 新的版本号 | |||
*/ | |||
public Project newProjectWithVersion(ProjectDTO projecDto) { | |||
public Project newProjectWithVersion(ProjectDTO projecDto,Boolean isContruct) { | |||
Project oldProject = projectService.getById(projecDto.getId()); | |||
Project project = new Project(); | |||
VUtils.isTrue(Objects.isNull(oldProject)) | |||
@@ -373,15 +684,19 @@ public class ProjectLibManage { | |||
project.setId(null); | |||
project.setCreateOn(LocalDateTime.now()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
project.setIsBackReject(Boolean.FALSE); | |||
stateMachineUtils.pass(project); | |||
projectService.save(project); | |||
oldProject.setIsBackReject(Boolean.TRUE); | |||
projectService.updateById(oldProject); | |||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||
.set(Project::getNewest, Boolean.FALSE) | |||
.ne(Project::getId, project.getId()) | |||
.eq(Project::getProjectCode, project.getProjectCode())); | |||
saveApplication(projecDto,project,null); | |||
saveApplication(projecDto,project,isContruct); | |||
return project; | |||
} | |||
@@ -399,6 +714,8 @@ public class ProjectLibManage { | |||
project.setId(null); | |||
project.setCreateOn(LocalDateTime.now()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
//都是在驳回 重新提交时用的 | |||
project.setIsBackReject(Boolean.FALSE); | |||
if (Objects.nonNull(stageCode)) { | |||
project.setStage(stageCode); | |||
} | |||
@@ -406,6 +723,9 @@ public class ProjectLibManage { | |||
project.setStatus(statusCode); | |||
} | |||
oldProject.setIsBackReject(Boolean.TRUE); | |||
projectService.updateById(oldProject); | |||
if (projectService.save(project)) { | |||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||
.set(Project::getNewest, Boolean.FALSE) | |||
@@ -489,7 +809,7 @@ public class ProjectLibManage { | |||
return project; | |||
} | |||
public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) { | |||
public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId,ProjectDTO dto, Integer instType,Boolean isBackReject) { | |||
Project project = new Project(); | |||
VUtils.isTrue(Objects.isNull(oldProject)) | |||
.throwMessage("项目不存在!"); | |||
@@ -501,9 +821,15 @@ public class ProjectLibManage { | |||
project.setCreateOn(LocalDateTime.now()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
// 标识保存的项目信息是否为建设方案申报项目 | |||
project.setIsConstruct(Boolean.TRUE); | |||
project.setIsConstruct(Boolean.FALSE); | |||
project.setIsBackReject(isBackReject); | |||
//终验材料 | |||
project.setFinalAcceptanceMaterials(dto.getFinalAcceptanceMaterials()); | |||
stateMachineUtils.pass(project); | |||
oldProject.setIsBackReject(isBackReject); | |||
projectService.updateById(oldProject); | |||
if (projectService.save(project)) { | |||
//保存项目和实例的关系 | |||
ProjectInst projectInst = new ProjectInst(); | |||
@@ -538,9 +864,12 @@ public class ProjectLibManage { | |||
project.setCreateOn(LocalDateTime.now()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
// 标识保存的项目信息是否为建设方案申报项目 | |||
project.setIsConstruct(Boolean.TRUE); | |||
project.setIsConstruct(Boolean.FALSE); | |||
stateMachineUtils.pass(project); | |||
oldProject.setIsBackReject(Boolean.TRUE); | |||
projectService.updateById(oldProject); | |||
if (projectService.save(project)) { | |||
//保存项目和实例的关系 | |||
ProjectInst projectInst = new ProjectInst(); | |||
@@ -563,188 +892,6 @@ public class ProjectLibManage { | |||
} | |||
/** | |||
* @param projectId 项目详情 | |||
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | |||
* @author ZPF | |||
* @since 2023/02/11 11:15 | |||
*/ | |||
public ProjectDetailVO getProjectDetail(Long projectId) { | |||
// 查询最新的项目申报信息 | |||
Project projectInfo = projectService.getNewProject(projectId); | |||
if (Objects.isNull(projectInfo)) { | |||
return null; | |||
} | |||
ProjectDetailVO vo = new ProjectDetailVO(); | |||
BeanUtils.copyProperties(projectInfo, vo); | |||
vo.buildDynamicForm(projectInfo.getDynamicForm()); | |||
// 查询应用 | |||
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, vo.getProjectCode()) | |||
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) | |||
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); | |||
Optional.ofNullable(applications).ifPresent(apps -> | |||
vo.setProjectApplications(CollUtils.convert(apps, | |||
ProjectHelper::convertVO) | |||
)); | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); | |||
//查询采购备案 | |||
List<Purchase> purchases = purchaseService.listByProjectId(projectId); | |||
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); | |||
//查询合同备案 | |||
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId) | |||
.last(BizConst.LIMIT_1)); | |||
ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); | |||
vo.setContract(contractVO); | |||
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) | |||
.in(PaymentPlan::getProjectId, allVersionProjectId) | |||
.orderByAsc(PaymentPlan::getPaymentTime)); | |||
if (Objects.nonNull(contractVO)) { | |||
contractVO.setPayments(convertPayments(payments, | |||
contractVO.getTotalAmount())); | |||
} | |||
//查询初验信息 | |||
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) | |||
.orderByAsc(PreInsAcceptancePerson::getCreateOn)); | |||
vo.setAcceptancePersons(convertPersons(acceptancePersons)); | |||
//查询终验信息 | |||
//查询年度投资金额 要是已验收的项目 | |||
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { | |||
List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); | |||
annualAmounts.add(AnnualAmountVO.builder() | |||
.projectId(projectInfo.getId()) | |||
.projectYear(projectInfo.getProjectYear()) | |||
.annualAmount(projectInfo.getAnnualPlanAmount()) | |||
.build()); | |||
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) | |||
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) | |||
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); | |||
Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> | |||
declarations.forEach(declaration -> { | |||
annualAmounts.add(AnnualAmountVO.builder() | |||
.projectId(projectInfo.getId()) | |||
.projectYear(declaration.getProjectYear()) | |||
.annualAmount(declaration.getAnnualPaymentAmount()) | |||
.build()); | |||
}) | |||
); | |||
vo.setAnnualAccumulateAmountList(annualAmounts); | |||
} | |||
// 处理文件名 | |||
List<Long> fileIdList = new ArrayList<>(); | |||
BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); | |||
BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w))); | |||
if (!fileIdList.isEmpty()) { | |||
List<File> files = fileService.listByIds(fileIdList); | |||
Map<String, String> fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName); | |||
vo.setApprovedFileName(fileMap.get(vo.getApprovedFile())); | |||
vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile())); | |||
} | |||
return vo; | |||
} | |||
/** | |||
* @param projectId 项目详情 不查询最新版本 | |||
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | |||
* @author ZPF | |||
* @since 2023/02/11 11:15 | |||
*/ | |||
public ProjectDetailVO getProjectDetailThisVersion(Long projectId) { | |||
// 查询最新的项目申报信息 | |||
Project projectInfo = projectService.getById(projectId); | |||
if (Objects.isNull(projectInfo)) { | |||
return null; | |||
} | |||
ProjectDetailVO vo = new ProjectDetailVO(); | |||
BeanUtils.copyProperties(projectInfo, vo); | |||
vo.buildDynamicForm(projectInfo.getDynamicForm()); | |||
// 查询应用 | |||
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, vo.getProjectCode()) | |||
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) | |||
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); | |||
Optional.ofNullable(applications).ifPresent(apps -> | |||
vo.setProjectApplications(CollUtils.convert(apps, | |||
ProjectHelper::convertVO) | |||
)); | |||
//审批信息 | |||
ProcessDetailReq req = new ProcessDetailReq(); | |||
req.setInstanceId(projectInfo.getInstCode()); | |||
req.setProjectId(projectId); | |||
vo.setProcess(todoService.getProcessDetail(req)); | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); | |||
//查询采购备案 | |||
List<Purchase> purchases = purchaseService.listByProjectId(projectId); | |||
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); | |||
//查询合同备案 | |||
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId) | |||
.last(BizConst.LIMIT_1)); | |||
ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); | |||
vo.setContract(contractVO); | |||
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) | |||
.in(PaymentPlan::getProjectId, allVersionProjectId) | |||
.orderByAsc(PaymentPlan::getPaymentTime)); | |||
if (Objects.nonNull(contractVO)) { | |||
contractVO.setPayments(convertPayments(payments, | |||
contractVO.getTotalAmount())); | |||
} | |||
//查询初验信息 | |||
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) | |||
.orderByAsc(PreInsAcceptancePerson::getCreateOn)); | |||
vo.setAcceptancePersons(convertPersons(acceptancePersons)); | |||
//查询终验信息 | |||
//查询年度投资金额 要是已验收的项目 | |||
if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { | |||
List<AnnualAmountVO> annualAmounts = Lists.newArrayList(); | |||
annualAmounts.add(AnnualAmountVO.builder() | |||
.projectId(projectInfo.getId()) | |||
.projectYear(projectInfo.getProjectYear()) | |||
.annualAmount(projectInfo.getAnnualPlanAmount()) | |||
.build()); | |||
List<ProjectRenewalFundDeclaration> renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) | |||
.eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) | |||
.orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); | |||
Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> | |||
declarations.forEach(declaration -> { | |||
annualAmounts.add(AnnualAmountVO.builder() | |||
.projectId(projectInfo.getId()) | |||
.projectYear(declaration.getProjectYear()) | |||
.annualAmount(declaration.getAnnualPaymentAmount()) | |||
.build()); | |||
}) | |||
); | |||
vo.setAnnualAccumulateAmountList(annualAmounts); | |||
} | |||
// 处理文件名 | |||
List<Long> fileIdList = new ArrayList<>(); | |||
BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); | |||
BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w))); | |||
if (!fileIdList.isEmpty()) { | |||
List<File> files = fileService.listByIds(fileIdList); | |||
Map<String, String> fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName); | |||
vo.setApprovedFileName(fileMap.get(vo.getApprovedFile())); | |||
vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile())); | |||
} | |||
return vo; | |||
} | |||
/** | |||
* 获取项目初步方案详情 | |||
* | |||
* @param projectId | |||
@@ -1009,8 +1156,11 @@ public class ProjectLibManage { | |||
return res; | |||
} | |||
//只查 当前版本 和历史被驳回|退回的版本 | |||
List<Project> historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getProjectCode, project.getProjectCode()) | |||
.and(q1->q1.eq(Project::getNewest, Boolean.TRUE) | |||
.or(q2->q2.eq(Project::getIsBackReject,Boolean.TRUE))) | |||
.orderByDesc(Project::getCreateOn)); | |||
if (CollUtil.isEmpty(historyProjects)) { | |||
@@ -1072,25 +1222,37 @@ public class ProjectLibManage { | |||
return res; | |||
} | |||
private void saveApplication(Project project,Project oldProject,Boolean isConstruct) { | |||
public void saveApplication(Project project,Project oldProject,Boolean isConstruct) { | |||
List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode()) | |||
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion())); | |||
if(CollUtil.isNotEmpty(apps)){ | |||
apps = apps.stream().map(app -> { | |||
apps.forEach(app -> { | |||
Long oldAppId = app.getId(); | |||
app.setProjectVersion(project.getVersion()); | |||
app.setProjectId(project.getId()); | |||
app.setId(null); | |||
if(Objects.nonNull(isConstruct)){ | |||
app.setIsConstruct(isConstruct); | |||
} | |||
return app; | |||
}).collect(Collectors.toList()); | |||
projectApplicationService.saveBatch(apps); | |||
projectApplicationService.save(app); | |||
//核心业务 | |||
List<ProjectCoreBusinessIndicators> cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) | |||
.eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId)); | |||
if(CollUtil.isNotEmpty(cores)){ | |||
cores.forEach(c -> { | |||
c.setId(null); | |||
c.setApplicationId(app.getId()); | |||
projectCoreBusinessIndicatorsService.save(c); | |||
}); | |||
} | |||
}); | |||
} | |||
} | |||
private void saveApplication(ProjectDTO projectDto,Project project,Boolean isConstruct) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
//保存项目应用 | |||
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) | |||
? Boolean.TRUE : Boolean.FALSE; | |||
@@ -1102,9 +1264,6 @@ public class ProjectLibManage { | |||
.eq(ProjectApplication::getProjectVersion, version)); | |||
if (CollUtil.isNotEmpty(applications)) { | |||
projectApplicationService.removeBatchByIds(applications); | |||
List<Long> applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); | |||
projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) | |||
.in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); | |||
} | |||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||
@@ -1120,6 +1279,10 @@ public class ProjectLibManage { | |||
projectApplication.setProjectVersion(version); | |||
projectApplication.setIsConstruct(isConstruct); | |||
if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){ | |||
projectApplication.setApplicationName(null); | |||
} | |||
boolean result = projectApplicationService.save(projectApplication); | |||
// 保存应用关联的核心业务 | |||
List<ProjectCoreBusinessDTO> coreBusinessList = application.getCoreBusinessList(); | |||
@@ -1128,7 +1291,10 @@ public class ProjectLibManage { | |||
for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { | |||
ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); | |||
BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); | |||
projectCoreBusinessIndicators.setApplicationId(application.getId()); | |||
projectCoreBusinessIndicators.setId(null); | |||
projectCoreBusinessIndicators.setApplicationId(projectApplication.getId()); | |||
projectCoreBusinessIndicators.setCreateOn(LocalDateTime.now()); | |||
projectCoreBusinessIndicators.setCreateBy(user.getUsername()); | |||
projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); | |||
} | |||
} | |||
@@ -317,4 +317,7 @@ public class ProjectDTO implements Serializable { | |||
@ApiModelProperty("项目类型 01首次建设;02迭代升级;03结转建设;04新运维;05续运维") | |||
private String baseProjType; | |||
@ApiModelProperty("是否退回|驳回的项目版本") | |||
private Boolean isBackReject = Boolean.FALSE; | |||
} |
@@ -325,6 +325,10 @@ public class Project implements Serializable { | |||
@Compare("建设周期(月)") | |||
private String buildCycle; | |||
@ApiModelProperty("原始建设周期(月)") | |||
@Compare("建设周期(月)") | |||
private Integer originBuildCycle; | |||
@ApiModelProperty("建设方案文件") | |||
@Compare("建设方案文件") | |||
private String constructionPlanFile; | |||
@@ -453,10 +457,15 @@ public class Project implements Serializable { | |||
@Compare("合同总金额") | |||
private BigDecimal contractAmount; | |||
@ApiModelProperty("计划验收时间") | |||
@Compare("计划验收时间") | |||
@ApiModelProperty("计划验收时间(有可能是延期后的)") | |||
private LocalDateTime planAcceptanceTime; | |||
@ApiModelProperty("原本计划验收时间") | |||
private LocalDateTime originPlanAcceptanceTime; | |||
@ApiModelProperty("延期月份数") | |||
private Integer applyDelayMonths; | |||
@ApiModelProperty("申请延期佐证材料") | |||
private String applyDelayFile; | |||
@@ -483,4 +492,8 @@ public class Project implements Serializable { | |||
@ApiModelProperty("区县预审本级主管单位盖章审核日期") | |||
private String countrySealAuditDate; | |||
@ApiModelProperty("是否退回|驳回的项目版本") | |||
private Boolean isBackReject; | |||
} |
@@ -187,4 +187,7 @@ public class ProjectApplication implements Serializable { | |||
@ApiModelProperty("是否为建设方案申报") | |||
private Boolean isConstruct; | |||
@ApiModelProperty("应用核心业务") | |||
private Boolean coreBusinessList; | |||
} |
@@ -54,4 +54,7 @@ public class ProjectDelayApply implements Serializable { | |||
@ApiModelProperty("延期申请实例ID") | |||
private String instanceId; | |||
@ApiModelProperty("是否审批成功") | |||
private Boolean success; | |||
} |
@@ -1,11 +1,13 @@ | |||
package com.ningdatech.pmapi.projectlib.model.vo; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
@@ -177,8 +179,10 @@ public class ProjectApplicationVO implements Serializable { | |||
@ApiModelProperty("项目版本") | |||
private Integer projectVersion; | |||
@ApiModelProperty("应用核心业务") | |||
private List<ProjectCoreBusinessIndicators> coreBusinessList; | |||
private Long createBy; | |||
private Long updateBy; | |||
} |
@@ -2,14 +2,17 @@ package com.ningdatech.pmapi.projectlib.model.vo; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.annotation.JSONField; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.pmapi.common.compare.Compare; | |||
import com.ningdatech.pmapi.common.util.BizUtils; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | |||
import com.ningdatech.pmapi.portrait.model.vo.TagVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.OperationVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO; | |||
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | |||
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
@@ -17,7 +20,6 @@ import lombok.Data; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDate; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -374,6 +376,9 @@ public class ProjectDetailVO { | |||
@ApiModelProperty("初审人员") | |||
private List<PreInsAcceptancePersonVO> acceptancePersons; | |||
@ApiModelProperty("实施信息") | |||
private OperationVO operation; | |||
@ApiModelProperty("版本号str") | |||
private String versionStr; | |||
@@ -395,6 +400,27 @@ public class ProjectDetailVO { | |||
@ApiModelProperty("审批详情") | |||
private ProcessProgressDetailVo process; | |||
@ApiModelProperty("标签") | |||
private List<TagVO> tags; | |||
@ApiModelProperty("是否退回|驳回的项目版本") | |||
private Boolean isBackReject; | |||
@ApiModelProperty("原本计划验收时间") | |||
@Compare("原本计划验收时间") | |||
private LocalDateTime originPlanAcceptanceTime; | |||
@ApiModelProperty("延期月份数") | |||
private Integer applyDelayMonths; | |||
@ApiModelProperty("原始建设周期(月)") | |||
@Compare("建设周期(月)") | |||
private Integer originBuildCycle; | |||
@ApiModelProperty("计划验收时间(有可能是延期后的)") | |||
@Compare("计划验收时间") | |||
private LocalDateTime planAcceptanceTime; | |||
public String getVersionStr() { | |||
if (Objects.nonNull(this.newest) && this.newest) { | |||
this.versionStr = "当前版本"; | |||
@@ -418,4 +444,27 @@ public class ProjectDetailVO { | |||
this.dynamicForm = JSON.parseObject(dynamicFormStr, Map.class); | |||
} | |||
} | |||
@ApiModelProperty("项目阶段中文") | |||
private String stageName; | |||
public String getStageName() { | |||
if (Objects.nonNull(this.stage)) { | |||
return ProjectStatusEnum.getDesc(this.stage); | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
@ApiModelProperty("项目状态中文") | |||
private String statusName; | |||
public String getStatusName() { | |||
if (Objects.nonNull(this.status)) { | |||
return ProjectStatusEnum.getDesc(this.status); | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
@ApiModelProperty("安全风险监测信息") | |||
private SafetyMonitorVO safetyInfo; | |||
} |
@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.projectlib.model.vo; | |||
import com.alibaba.fastjson.annotation.JSONField; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.portrait.model.vo.TagVO; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
@@ -16,6 +17,7 @@ import lombok.experimental.Tolerate; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDate; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.Optional; | |||
@@ -39,6 +41,15 @@ public class ProjectLibListItemVO { | |||
@ApiModelProperty("项目ID") | |||
private Long id; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("区域") | |||
private String area; | |||
@ApiModelProperty("区域Code") | |||
private String areaCode; | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
@@ -127,9 +138,6 @@ public class ProjectLibListItemVO { | |||
@ApiModelProperty("能否被预审申报") | |||
private Boolean canPreDeclared = Boolean.FALSE; | |||
@ApiModelProperty("21位项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("是否有上级条线主管部门 0没有 1有") | |||
private Integer isHigherSuperOrg; | |||
@@ -142,6 +150,9 @@ public class ProjectLibListItemVO { | |||
@ApiModelProperty("初步方案项目ID") | |||
private Long prePlanProjectId; | |||
@ApiModelProperty("标签") | |||
private List<TagVO> tags; | |||
//预审申报时候 需不需要上传上级条线意见文件 | |||
private Boolean needUploadSuperLineFile; | |||
public Boolean getNeedUploadSuperLineFile() { | |||
@@ -17,4 +17,6 @@ import java.util.List; | |||
public interface IProjectApplicationService extends IService<ProjectApplication> { | |||
List<ProjectApplication> getApplicationsByProject(Project project); | |||
void saveApplication(Project project,Project oldProject,Boolean isConstruct); | |||
} |
@@ -1,14 +1,20 @@ | |||
package com.ningdatech.pmapi.projectlib.service.impl; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.mapper.ProjectApplicationMapper; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
import java.util.Objects; | |||
/** | |||
* <p> | |||
@@ -19,7 +25,12 @@ import java.util.List; | |||
* @since 2023-02-05 | |||
*/ | |||
@Service | |||
public class ProjectApplicationServiceImpl extends ServiceImpl<ProjectApplicationMapper, ProjectApplication> implements IProjectApplicationService { | |||
@Slf4j | |||
@AllArgsConstructor | |||
public class ProjectApplicationServiceImpl extends ServiceImpl<ProjectApplicationMapper, ProjectApplication> | |||
implements IProjectApplicationService { | |||
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; | |||
@Override | |||
public List<ProjectApplication> getApplicationsByProject(Project project) { | |||
@@ -27,4 +38,34 @@ public class ProjectApplicationServiceImpl extends ServiceImpl<ProjectApplicatio | |||
.eq(ProjectApplication::getProjectCode, project.getProjectCode())); | |||
return apps; | |||
} | |||
@Override | |||
public void saveApplication(Project project,Project oldProject,Boolean isConstruct) { | |||
List<ProjectApplication> apps = list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode()) | |||
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion())); | |||
if(CollUtil.isNotEmpty(apps)){ | |||
apps.forEach(app -> { | |||
Long oldAppId = app.getId(); | |||
app.setProjectVersion(project.getVersion()); | |||
app.setProjectId(project.getId()); | |||
app.setId(null); | |||
if(Objects.nonNull(isConstruct)){ | |||
app.setIsConstruct(isConstruct); | |||
} | |||
save(app); | |||
//核心业务 | |||
List<ProjectCoreBusinessIndicators> cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) | |||
.eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId)); | |||
if(CollUtil.isNotEmpty(cores)){ | |||
cores.forEach(c -> { | |||
c.setId(null); | |||
c.setApplicationId(app.getId()); | |||
projectCoreBusinessIndicatorsService.save(c); | |||
}); | |||
} | |||
}); | |||
} | |||
} | |||
} |
@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.mapper.ProjectMapper; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.stereotype.Service; | |||
@@ -0,0 +1,65 @@ | |||
package com.ningdatech.pmapi.safety.controller; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.safety.manage.SafetyRiskManage; | |||
import com.ningdatech.pmapi.safety.model.dto.PersonSafetyInfoDTO; | |||
import com.ningdatech.pmapi.safety.model.dto.SupplierSafetyQualificationDTO; | |||
import com.ningdatech.pmapi.safety.model.vo.ProjectMonitorVO; | |||
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.List; | |||
/** | |||
* @Classname SafetyRiskController | |||
* @Description | |||
* @Date 2023/8/2 9:15 | |||
* @Author PoffyZhang | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "安全风险监测") | |||
@RequestMapping("/api/v1/safety-risk") | |||
public class SafetyRiskController { | |||
private final SafetyRiskManage safetyRiskManage; | |||
@GetMapping("/person-monitor/list") | |||
@ApiOperation("安全人员监控列表") | |||
public PageVo<ProjectMonitorVO> personMonitorList(ProjectListReq req) { | |||
return safetyRiskManage.personMonitorList(req); | |||
} | |||
@PostMapping("/person-monitor/save") | |||
@ApiOperation("安全人员监控信息保存") | |||
@WebLog("安全人员监控信息保存") | |||
public String personMonitorSave(@Valid @RequestBody List<PersonSafetyInfoDTO> dtos) { | |||
return safetyRiskManage.personMonitorSave(dtos); | |||
} | |||
@PostMapping("/supplier-safety-qualification/save") | |||
@ApiOperation("供应商安全资质保存") | |||
@WebLog("供应商安全资质保存") | |||
public String supplierSafetyQualificationSave(@Valid @RequestBody List<SupplierSafetyQualificationDTO> dtos) { | |||
return safetyRiskManage.supplierSafetyQualificationSave(dtos); | |||
} | |||
@GetMapping("/detail/{projectCode}") | |||
@ApiOperation("安全人员管控详情") | |||
public SafetyMonitorVO personMonitorDetail(@PathVariable String projectCode) { | |||
return safetyRiskManage.personMonitorDetail(projectCode); | |||
} | |||
@GetMapping("/operation-monitor/search/{projectCode}") | |||
@ApiOperation("安全运行监控-查询监测(对接外部平台)") | |||
public JSONObject operationnMonitorList(@PathVariable String projectCode) { | |||
return safetyRiskManage.operationnMonitorSearch(projectCode); | |||
} | |||
} |
@@ -0,0 +1,219 @@ | |||
package com.ningdatech.pmapi.safety.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
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.CollUtils; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.safety.model.dto.PersonSafetyInfoDTO; | |||
import com.ningdatech.pmapi.safety.model.dto.SupplierSafetyQualificationDTO; | |||
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo; | |||
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification; | |||
import com.ningdatech.pmapi.safety.model.vo.PersonSafetyInfoVO; | |||
import com.ningdatech.pmapi.safety.model.vo.ProjectMonitorVO; | |||
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO; | |||
import com.ningdatech.pmapi.safety.model.vo.SupplierSafetyQualificationVO; | |||
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService; | |||
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname SafetyRiskManage | |||
* @Description | |||
* @Date 2023/8/2 9:17 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@Slf4j | |||
@AllArgsConstructor | |||
public class SafetyRiskManage { | |||
private final IProjectService projectService; | |||
private final ISupplierSafetyQualificationService supplierSafetyQualificationService; | |||
private final IPersonSafetyInfoService personSafetyInfoService; | |||
/** | |||
* 列表 | |||
* @param req | |||
* @return | |||
*/ | |||
public PageVo<ProjectMonitorVO> personMonitorList(ProjectListReq req) { | |||
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.ge(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) | |||
.ne(Project::getStatus, ProjectStatusEnum.OPERATION.getCode()) | |||
.eq(StringUtils.isNotBlank(req.getRegionCode()),Project::getAreaCode,req.getRegionCode()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()) | |||
.like(StringUtils.isNotBlank(req.getBuildOrgName()),Project::getBuildOrgName,req.getBuildOrgName()) | |||
.orderByDesc(Project::getUpdateOn); | |||
checkAuth(query,LoginUserUtil.loginUserDetail()); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<ProjectMonitorVO> records = CollUtils.convert(page.getRecords(), | |||
p -> BeanUtil.copyProperties(p,ProjectMonitorVO.class)); | |||
return PageVo.of(records, total); | |||
} | |||
/** | |||
* 权限控制 | |||
* @param query | |||
* @param user | |||
*/ | |||
private void checkAuth(LambdaQueryWrapper<Project> query, UserInfoDetails user) { | |||
//如果是超管 | |||
if(user.getSuperAdmin()){ | |||
log.info(user.getUsername() + " 是超管,可以看所有项目"); | |||
}else if(user.getRegionAdmin()){ | |||
//如果是区域管理员 | |||
log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "项目"); | |||
query.eq(Project::getAreaCode,user.getRegionCode()); | |||
}else if(user.getIsOrgAdmin()){ | |||
//单位管理员 | |||
log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getEmpPosUnitName() + " 项目"); | |||
query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); | |||
}else{ | |||
//其它角色全都看不见 | |||
query.eq(Project::getId,0L); | |||
} | |||
} | |||
public SafetyMonitorVO personMonitorDetail(String projectCode) { | |||
SafetyMonitorVO vo = new SafetyMonitorVO(); | |||
Project project = projectService.getOne(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getProjectCode, projectCode) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(project)){ | |||
return null; | |||
} | |||
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class) | |||
.eq(SupplierSafetyQualification::getProjectCode, projectCode)); | |||
if(CollUtil.isNotEmpty(ssq)){ | |||
vo.setSupplierSafetyQualification(ssq.stream() | |||
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class)) | |||
.collect(Collectors.toList())); | |||
} | |||
List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class) | |||
.eq(PersonSafetyInfo::getProjectCode, projectCode)); | |||
if(CollUtil.isNotEmpty(psi)){ | |||
vo.setPersonSafetyInfo(psi.stream() | |||
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class)) | |||
.collect(Collectors.toList())); | |||
} | |||
return vo; | |||
} | |||
public JSONObject operationnMonitorSearch(String projectCode) { | |||
return null; | |||
} | |||
/** | |||
* 保存 供应商安全资质 | |||
* @param dtos | |||
* @return | |||
*/ | |||
public String supplierSafetyQualificationSave(List<SupplierSafetyQualificationDTO> dtos) { | |||
if(CollUtil.isEmpty(dtos)){ | |||
return "数据为空"; | |||
} | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String projectCode = dtos.get(0).getProjectCode(); | |||
if(StringUtils.isBlank(projectCode)){ | |||
throw new BizException("参数有误!"); | |||
} | |||
supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class) | |||
.eq(SupplierSafetyQualification::getProjectCode, projectCode)); | |||
Integer sucessNum = 0; | |||
for(SupplierSafetyQualificationDTO dto : dtos){ | |||
projectCode = dto.getProjectCode(); | |||
Project project = projectService.getOne(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getProjectCode, projectCode) | |||
.last(BizConst.LIMIT_1)); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("此项目并不存在!"); | |||
SupplierSafetyQualification entity = BeanUtil.copyProperties(dto, SupplierSafetyQualification.class); | |||
entity.setCreateBy(user.getUsername()); | |||
entity.setCreateOn(LocalDateTime.now()); | |||
entity.setProjectId(project.getId()); | |||
entity.setUpdateBy(user.getUsername()); | |||
entity.setUpdateOn(LocalDateTime.now()); | |||
if(supplierSafetyQualificationService.save(entity)){ | |||
sucessNum ++; | |||
} | |||
} | |||
return "保存成功" + sucessNum + "条"; | |||
} | |||
public String personMonitorSave(List<PersonSafetyInfoDTO> dtos) { | |||
if(CollUtil.isEmpty(dtos)){ | |||
return "数据为空"; | |||
} | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String projectCode = dtos.get(0).getProjectCode(); | |||
if(StringUtils.isBlank(projectCode)){ | |||
throw new BizException("参数有误!"); | |||
} | |||
personSafetyInfoService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class) | |||
.eq(PersonSafetyInfo::getProjectCode, projectCode)); | |||
Integer sucessNum = 0; | |||
for(PersonSafetyInfoDTO dto : dtos){ | |||
projectCode = dto.getProjectCode(); | |||
Project project = projectService.getOne(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getProjectCode, projectCode) | |||
.last(BizConst.LIMIT_1)); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("此项目并不存在!"); | |||
PersonSafetyInfo entity = BeanUtil.copyProperties(dto, PersonSafetyInfo.class); | |||
entity.setCreateBy(user.getUsername()); | |||
entity.setCreateOn(LocalDateTime.now()); | |||
entity.setProjectId(project.getId()); | |||
entity.setUpdateBy(user.getUsername()); | |||
entity.setUpdateOn(LocalDateTime.now()); | |||
if(personSafetyInfoService.save(entity)){ | |||
sucessNum ++; | |||
} | |||
} | |||
return "保存成功" + sucessNum + "条"; | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.ningdatech.pmapi.safety.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo; | |||
/** | |||
* <p> | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-2 | |||
*/ | |||
public interface PersonSafetyInfoMapper extends BaseMapper<PersonSafetyInfo> { | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.ningdatech.pmapi.safety.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification; | |||
/** | |||
* <p> | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-2 | |||
*/ | |||
public interface SupplierSafetyQualificationMapper extends BaseMapper<SupplierSafetyQualification> { | |||
} |
@@ -0,0 +1,42 @@ | |||
package com.ningdatech.pmapi.safety.model.dto; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* 安全人员信息 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@ApiModel(value = "PersonSafetyInfo对象", description = "安全人员信息") | |||
public class PersonSafetyInfoDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("项目编号") | |||
@NotBlank(message = "项目编号不能为空") | |||
private String projectCode; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("人员姓名") | |||
private String username; | |||
@ApiModelProperty("调查报告") | |||
private String investigationReport; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.ningdatech.pmapi.safety.model.dto; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
import java.io.Serializable; | |||
/** | |||
* <p> | |||
* 供应商安全资质 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@ApiModel(value = "SupplierSafetyQualification对象", description = "供应商安全资质") | |||
public class SupplierSafetyQualificationDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("项目编号") | |||
@NotBlank(message = "项目编号不能为空") | |||
private String projectCode; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("安全资质") | |||
private String safetyQualification; | |||
@ApiModelProperty("安全协议") | |||
private String safetyProtocol; | |||
} |
@@ -0,0 +1,48 @@ | |||
package com.ningdatech.pmapi.safety.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* 安全人员信息 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@TableName("nd_person_safety_info") | |||
@ApiModel(value = "PersonSafetyInfo对象", description = "安全人员信息") | |||
public class PersonSafetyInfo implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
@TableId(type = IdType.AUTO) | |||
private Long id; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("人员姓名") | |||
private String username; | |||
@ApiModelProperty("调查报告") | |||
private String investigationReport; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
} |
@@ -0,0 +1,45 @@ | |||
package com.ningdatech.pmapi.safety.model.entity; | |||
import com.baomidou.mybatisplus.annotation.*; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* 供应商安全资质 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@TableName("nd_supplier_safety_qualification") | |||
@ApiModel(value = "SupplierSafetyQualification对象", description = "供应商安全资质") | |||
public class SupplierSafetyQualification implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
@TableId(type = IdType.AUTO) | |||
private Long id; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("安全资质") | |||
private String safetyQualification; | |||
@ApiModelProperty("安全协议") | |||
private String safetyProtocol; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
} |
@@ -0,0 +1,43 @@ | |||
package com.ningdatech.pmapi.safety.model.vo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* 安全人员信息 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@ApiModel(value = "PersonSafetyInfo对象", description = "安全人员信息") | |||
public class PersonSafetyInfoVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
private Long id; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("人员姓名") | |||
private String username; | |||
@ApiModelProperty("调查报告") | |||
private String investigationReport; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
} |
@@ -0,0 +1,78 @@ | |||
package com.ningdatech.pmapi.safety.model.vo; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Objects; | |||
import java.util.Optional; | |||
/** | |||
* @Classname ProjectMonitorVO | |||
* @Description | |||
* @Date 2023/8/2 9:19 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "ProjectMonitorVO", description = "项目监控VO") | |||
public class ProjectMonitorVO { | |||
@ApiModelProperty("项目ID") | |||
private Long id; | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("申报单位code") | |||
private String buildOrgCode; | |||
@ApiModelProperty("申报单位名") | |||
private String buildOrgName; | |||
@ApiModelProperty("项目年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("项目类型名") | |||
private String projectTypeName; | |||
public String getProjectTypeName() { | |||
if (Objects.nonNull(this.projectType)) { | |||
Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType)) | |||
.ifPresent(desc -> this.projectTypeName = desc); | |||
} | |||
return this.projectTypeName; | |||
} | |||
@ApiModelProperty("项目阶段") | |||
private Integer stage; | |||
@ApiModelProperty("项目状态") | |||
private Integer status; | |||
@ApiModelProperty("项目阶段中文") | |||
private String stageName; | |||
public String getStageName(){ | |||
if(Objects.nonNull(this.stage)){ | |||
return ProjectStatusEnum.getDesc(this.stage); | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
@ApiModelProperty("项目状态中文") | |||
private String statusName; | |||
public String getStatusName(){ | |||
if(Objects.nonNull(this.status)){ | |||
return ProjectStatusEnum.getDesc(this.status); | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
package com.ningdatech.pmapi.safety.model.vo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @Classname SafetyMonitorVO | |||
* @Description | |||
* @Date 2023/8/2 9:19 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "SafetyMonitorVO", description = "监控VO") | |||
public class SafetyMonitorVO { | |||
@ApiModelProperty("人员安全信息") | |||
private List<PersonSafetyInfoVO> personSafetyInfo; | |||
@ApiModelProperty("供应商安全资质") | |||
private List<SupplierSafetyQualificationVO> supplierSafetyQualification; | |||
} |
@@ -0,0 +1,43 @@ | |||
package com.ningdatech.pmapi.safety.model.vo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* 供应商安全资质 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-02 | |||
*/ | |||
@Data | |||
@ApiModel(value = "SupplierSafetyQualification对象", description = "供应商安全资质") | |||
public class SupplierSafetyQualificationVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
private Long id; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("安全资质") | |||
private String safetyQualification; | |||
@ApiModelProperty("安全协议") | |||
private String safetyProtocol; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.ningdatech.pmapi.safety.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo; | |||
/** | |||
* @Classname IPersonSafetyInfoService | |||
* @Description | |||
* @Date 2023/8/2 10:47 | |||
* @Author PoffyZhang | |||
*/ | |||
public interface IPersonSafetyInfoService extends IService<PersonSafetyInfo> { | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.ningdatech.pmapi.safety.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification; | |||
/** | |||
* @Classname ISupplierSafetyQulificationService | |||
* @Description | |||
* @Date 2023/8/2 10:47 | |||
* @Author PoffyZhang | |||
*/ | |||
public interface ISupplierSafetyQualificationService extends IService<SupplierSafetyQualification> { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.safety.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.pmapi.safety.mapper.PersonSafetyInfoMapper; | |||
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo; | |||
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-2 | |||
*/ | |||
@Service | |||
public class PersonSafetyInfoServiceImpl extends ServiceImpl<PersonSafetyInfoMapper, | |||
PersonSafetyInfo> implements IPersonSafetyInfoService { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.safety.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.pmapi.safety.mapper.SupplierSafetyQualificationMapper; | |||
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification; | |||
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-08-2 | |||
*/ | |||
@Service | |||
public class SupplierSafetyQualificationServiceImpl extends ServiceImpl<SupplierSafetyQualificationMapper, | |||
SupplierSafetyQualification> implements ISupplierSafetyQualificationService { | |||
} |
@@ -0,0 +1,128 @@ | |||
package com.ningdatech.pmapi.scheduler.listener; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; | |||
import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; | |||
import com.ningdatech.pmapi.sys.manage.EarlyWarningManage; | |||
import com.ningdatech.pmapi.sys.manage.NoticeManage; | |||
import com.ningdatech.pmapi.sys.model.entity.Notify; | |||
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; | |||
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; | |||
import com.ningdatech.pmapi.sys.service.INotifyService; | |||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.yxt.model.cmd.SendSmsCmd; | |||
import com.wflow.enums.WarningRuleTypeEnum; | |||
import com.wflow.workflow.notify.event.EarlyWarningEvent; | |||
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.flowable.engine.history.HistoricProcessInstance; | |||
import org.springframework.context.event.EventListener; | |||
import org.springframework.scheduling.annotation.Async; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.time.ZoneId; | |||
import java.util.List; | |||
import java.util.Objects; | |||
/** | |||
* 预警规则触发 | |||
* | |||
* @author ZPF | |||
* @return | |||
* @since 2023/08/03 14:19 | |||
*/ | |||
@Slf4j | |||
@Component | |||
@RequiredArgsConstructor | |||
public class EarlyWarningListener { | |||
private final HistoryService historyService; | |||
private final IProjectInstService projectInstService; | |||
private final IProjectService projectService; | |||
private final EarlyWarningManage earlyWarningManage; | |||
@Async | |||
@EventListener | |||
public void onApplicationEvent(EarlyWarningEvent event) { | |||
log.info("进入预警规则触发的 事件监听!"); | |||
log.info("event:{}", JSON.toJSONString(event)); | |||
String nodeId = event.getNodeId(); | |||
Integer timeout = event.getTimeout(); | |||
String noticeMethod = event.getNoticeMethod(); | |||
String noticeContent = event.getNoticeContent(); | |||
//1.根据nodeId 查询到 node 去查找 未完成 项目实例关系表 找到实例 | |||
List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery() | |||
.activityId(nodeId) | |||
.unfinished() | |||
.orderByHistoricActivityInstanceStartTime() | |||
.asc() | |||
.list(); | |||
if (CollUtil.isEmpty(hais)) { | |||
log.info("没有查到 历史实例"); | |||
return; | |||
} | |||
String instanceId = hais.get(0).getProcessInstanceId(); | |||
//查询当前未完成的此实例 | |||
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() | |||
.processInstanceId(instanceId) | |||
.unfinished() | |||
.singleResult(); | |||
if (Objects.isNull(instance)) { | |||
log.info("没有查到实例 或者 实例已经结束"); | |||
return; | |||
} | |||
//2.查到 此流程实例的 项目 | |||
ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.eq(ProjectInst::getInstCode, instanceId) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(pi)) { | |||
log.info("没有查到实例项目关联信息"); | |||
return; | |||
} | |||
Long projectId = pi.getProjectId(); | |||
Project project = projectService.getById(projectId); | |||
if (Objects.isNull(project)) { | |||
log.info("没有查到该项目信息"); | |||
return; | |||
} | |||
if(StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
for(HistoricActivityInstance hai : hais){ | |||
String employeeCode = hai.getAssignee(); | |||
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,pi.getInstType(), | |||
hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() | |||
,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode()); | |||
} | |||
} | |||
} |
@@ -0,0 +1,290 @@ | |||
package com.ningdatech.pmapi.scheduler.task; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.date.StopWatch; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; | |||
import com.ningdatech.pmapi.projectdeclared.service.IContractService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IOperationService; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.WarningOperationTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.sys.manage.EarlyWarningManage; | |||
import com.wflow.bean.entity.WflowEarlyWarning; | |||
import com.wflow.enums.WarningRuleTypeEnum; | |||
import com.wflow.service.IEarlyWarningService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import java.net.InetAddress; | |||
import java.net.UnknownHostException; | |||
import java.time.*; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @author ZPF | |||
* @date 2023/8/3 上午9:53 | |||
* 预警填报 超时任务 | |||
*/ | |||
@Component | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
public class EarlyWarningInstanceNotStartTask { | |||
@Value("${hostname}") | |||
private String HOST_NAME; | |||
private final IEarlyWarningService earlyWarningService; | |||
private final IProjectService projectService; | |||
private final EarlyWarningManage earlyWarningManage; | |||
private final IContractService contractService; | |||
private final IOperationService operationService; | |||
@Scheduled(cron = "0 0/2 * * * ?") | |||
public void doEarlyWarningDeclared() throws UnknownHostException { | |||
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { | |||
return; | |||
} | |||
log.info("=========== 预警填报超时任务开始 ========"); | |||
StopWatch stopWatch = new StopWatch(); | |||
stopWatch.start(); | |||
// 1.查询 填报的 预警规则 填报类型的 每个区域 每个规则 | |||
List<WflowEarlyWarning> warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) | |||
.eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.DECLARED_WARNING.getCode())); | |||
for(WflowEarlyWarning warning : warnings){ | |||
//2. 取出rule的数据 | |||
if(!warning.getIsOpen()){ | |||
log.info(warning.getId() + " 此规则关闭了"); | |||
continue; | |||
} | |||
String noticeMethod = warning.getNoticeMethod(); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
String noticeContent = warning.getNoticeContent(); | |||
String rule = warning.getRule(); | |||
if(StringUtils.isNotBlank(rule)){ | |||
JSONArray ruleArray = JSON.parseArray(rule); | |||
if(CollUtil.isNotEmpty(ruleArray)){ | |||
ruleArray.forEach(r -> { | |||
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); | |||
Integer time = rJson.getInteger("time"); | |||
Integer biz = rJson.getInteger("biz"); | |||
if(Objects.isNull(time) || Objects.isNull(biz)){ | |||
log.info("规则数据 错误 :{}",rJson); | |||
return; | |||
} | |||
WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); | |||
if(Objects.isNull(flowTypeEnum)){ | |||
log.info("匹配不到 业务类型"); | |||
return; | |||
} | |||
//得出 对应待提交的项目状态 | |||
Integer projectStutas = flowTypeEnum.getProjectStutas(); | |||
String areaCode = warning.getAreaCode(); | |||
//测试先用分钟 | |||
//查询 所有这个区域的项目 未提交的项目 | |||
List<Project> needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getAreaCode, areaCode) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getStatus,projectStutas)); | |||
//需要发通知的项目 | |||
List<Project> needToWaringProjects = needNextProjects.stream() | |||
.filter(p -> { | |||
//判断 当状态在 建设中的时候 是不是要初验了 | |||
if(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)){ | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(p); | |||
//如果合同信息提交过了 才是 待初验状态 | |||
if(StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())){ | |||
if(0L == contractService.count(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId))){ | |||
return Boolean.FALSE; | |||
} | |||
} | |||
} | |||
log.info("projectId :{}",p.getId()); | |||
log.info("秒数差 :{}",Duration.between(p.getUpdateOn(),LocalDateTime.now()).getSeconds()); | |||
if(Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}) | |||
.collect(Collectors.toList()); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
for(Project needToWaringProject : needToWaringProjects){ | |||
//去预警通知 | |||
String employeeCode = needToWaringProject.getSponsor(); | |||
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,biz, | |||
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, | |||
WarningRuleTypeEnum.DECLARED_WARNING.getCode()); | |||
} | |||
}); | |||
} | |||
} | |||
} | |||
stopWatch.stop(); | |||
log.info("=========== 预警填报超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); | |||
} | |||
@Scheduled(cron = "10 0/2 * * * ?") | |||
public void doEarlyWarningOperation() throws UnknownHostException { | |||
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { | |||
return; | |||
} | |||
log.info("=========== 预警实施超时任务开始 ========"); | |||
StopWatch stopWatch = new StopWatch(); | |||
stopWatch.start(); | |||
// 1.查询 填报的 预警规则 填报类型的 每个区域 每个规则 | |||
List<WflowEarlyWarning> warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) | |||
.eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode())); | |||
for(WflowEarlyWarning warning : warnings){ | |||
//2. 取出rule的数据 | |||
if(!warning.getIsOpen()){ | |||
log.info(warning.getId() + " 此规则关闭了"); | |||
continue; | |||
} | |||
String noticeMethod = warning.getNoticeMethod(); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
String noticeContent = warning.getNoticeContent(); | |||
String rule = warning.getRule(); | |||
if(StringUtils.isNotBlank(rule)){ | |||
JSONArray ruleArray = JSON.parseArray(rule); | |||
if(CollUtil.isNotEmpty(ruleArray)){ | |||
ruleArray.forEach(r -> { | |||
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); | |||
Integer time = rJson.getInteger("time"); | |||
Integer biz = rJson.getInteger("biz"); | |||
if(Objects.isNull(time) || Objects.isNull(biz)){ | |||
log.info("规则数据 错误 :{}",rJson); | |||
return; | |||
} | |||
WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); | |||
if(Objects.isNull(operationTypeEnum)){ | |||
log.info("匹配不到 业务类型"); | |||
return; | |||
} | |||
//得出 对应待提交的项目状态 | |||
Integer projectStutas = operationTypeEnum.getProjectStutas(); | |||
String areaCode = warning.getAreaCode(); | |||
//测试先用分钟 | |||
//查询 所有这个区域的项目 未提交的项目 | |||
List<Project> needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getAreaCode, areaCode) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getStatus,projectStutas)); | |||
log.info("needNextProjects :{}",needNextProjects.size()); | |||
List<String> projectCodes = needNextProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | |||
List<Operation> operations = operationService.list(Wrappers.lambdaQuery(Operation.class) | |||
.in(Operation::getProjectCode, projectCodes)); | |||
Map<String,Operation> operationMap = operations.stream().collect(Collectors.toMap(Operation::getProjectCode,o -> o)); | |||
//需要发通知的项目 | |||
List<Project> needToWaringProjects = needNextProjects.stream() | |||
.filter(p -> { | |||
//判断 当状态在 建设中的时候 是不是要初验了 | |||
if(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)){ | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(p); | |||
//如果合同信息提交过了 才是 待初验状态 | |||
if(StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())){ | |||
if(0L == contractService.count(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId))){ | |||
return Boolean.FALSE; | |||
} | |||
} | |||
} | |||
//判断 实施信息中 初验和终验的时间 | |||
if(!operationMap.containsKey(p.getProjectCode())){ | |||
return Boolean.FALSE; | |||
} | |||
Operation operation = operationMap.get(p.getProjectCode()); | |||
if(WarningOperationTypeEnum.CHUYAN.getCode().equals(biz)){ | |||
//初验 | |||
if(Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 | |||
return Boolean.TRUE; | |||
} | |||
}else if(WarningOperationTypeEnum.ZHONGYAN.getCode().equals(biz)){ | |||
//终验 | |||
if(Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 | |||
return Boolean.TRUE; | |||
} | |||
} | |||
return Boolean.FALSE; | |||
}) | |||
.collect(Collectors.toList()); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
for(Project needToWaringProject : needToWaringProjects){ | |||
//去预警通知 | |||
String employeeCode = needToWaringProject.getSponsor(); | |||
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,biz, | |||
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, | |||
WarningRuleTypeEnum.OPERATION_WARNING.getCode()); | |||
} | |||
}); | |||
} | |||
} | |||
} | |||
stopWatch.stop(); | |||
log.info("=========== 预警实施超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); | |||
} | |||
} |
@@ -31,6 +31,7 @@ public class ProjectStatusFlowUtil { | |||
* value: lambda表达式,最终会获取发起实例的函数 | |||
*/ | |||
public ProjectStatusFlowUtil(){ | |||
intervalTimeMap.put(0,60); | |||
intervalTimeMap.put(1,60 * 2); | |||
intervalTimeMap.put(2,60 * 6); | |||
intervalTimeMap.put(3,60 * 15); | |||
@@ -0,0 +1,33 @@ | |||
package com.ningdatech.pmapi.sys.contants; | |||
/** | |||
* @Classname UserGuidanceContant | |||
* @Description | |||
* @Date 2023/8/8 14:56 | |||
* @Author PoffyZhang | |||
*/ | |||
public interface UserGuidanceContant { | |||
Integer ALL_FINISHED_NUM = 3; | |||
class OrgModel { | |||
public static final String GUIDANCE_NAME = "配置单位流程"; | |||
public static final String GUIDANCE_REMARK = "用户项目审核,请先配置单位默认流程"; | |||
public static final String GUIDANCE_PATH1 = "unitSet/flowPathConfiguration"; | |||
public static final String GUIDANCE_PATH2 = "unitSet/unitConfigEdit?processDefId="; | |||
public static final String EMPTY_PROCESS = "{}"; | |||
} | |||
class FiscalCode { | |||
public static final String GUIDANCE_NAME = "配置财政编码"; | |||
public static final String GUIDANCE_REMARK = "用于生成项目唯一编码"; | |||
public static final String GUIDANCE_PATH = "unitSet/fiscalCodeSet"; | |||
} | |||
class Signature { | |||
public static final String GUIDANCE_NAME = "配置印章编码"; | |||
public static final String GUIDANCE_REMARK = "用于电子签章"; | |||
public static final String GUIDANCE_PATH = "unitSet/fiscalCodeSet"; | |||
} | |||
} |
@@ -0,0 +1,56 @@ | |||
package com.ningdatech.pmapi.sys.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.sys.model.req.WarningListReq; | |||
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO; | |||
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; | |||
import com.wflow.bean.dto.WflowEarlyWarningDTO; | |||
import com.wflow.bean.vo.WflowEarlyWarningVO; | |||
import com.wflow.service.IEarlyWarningService; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
/** | |||
* @Classname EarlyWarningController | |||
* @Description | |||
* @Date 2023/8/01 14:28 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
@Validated | |||
@RestController | |||
@RequestMapping("/api/v1/sys/early-warning") | |||
@Api(value = "EarlyWarning", tags = "预警管理") | |||
@RequiredArgsConstructor | |||
public class EarlyWarningController { | |||
private final IEarlyWarningService earlyWarningService; | |||
private final IEarlyWarningRecordsService earlyWarningRecordsService; | |||
@ApiOperation(value = "预警规则获取", notes = "预警规则获取") | |||
@GetMapping("/detail/{areaCode}") | |||
public List<WflowEarlyWarningVO> detail(@PathVariable String areaCode) { | |||
return earlyWarningService.detailByRegion(areaCode); | |||
} | |||
@ApiOperation(value = "预警规则保存", notes = "预警规则保存") | |||
@PostMapping("/save") | |||
@WebLog("预警规则保存") | |||
public String save(@Validated @RequestBody WflowEarlyWarningDTO dto) { | |||
return earlyWarningService.saveByDto(dto); | |||
} | |||
@ApiOperation(value = "预警记录查询", notes = "预警记录查询") | |||
@GetMapping("/records/{ruleType}") | |||
public PageVo<WflowEarlyWarningRecordsVO> records(@PathVariable Integer ruleType, WarningListReq req) { | |||
return earlyWarningRecordsService.records(ruleType,req); | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.ningdatech.pmapi.sys.controller; | |||
import com.ningdatech.pmapi.sys.manage.UserGuidanceManage; | |||
import com.ningdatech.pmapi.sys.model.vo.UserGuidanceVO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import java.util.List; | |||
/** | |||
* @Classname UserGuidanceController | |||
* @Description | |||
* @Date 2023/8/8 13:46 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
@Validated | |||
@RestController | |||
@RequestMapping("/api/v1/sys/user-guidanc") | |||
@Api(value = "UserGuidance", tags = "用户引导") | |||
@RequiredArgsConstructor | |||
public class UserGuidanceController { | |||
private final UserGuidanceManage userGuidanceManage; | |||
@ApiOperation(value = "获取当前用户单位的一些配置是否完成", notes = "获取当前用户单位的一些配置是否完成") | |||
@GetMapping("/detail") | |||
public UserGuidanceVO detail() { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
return userGuidanceManage.detailUserGuidance(user); | |||
} | |||
} |