@@ -1,7 +1,9 @@ | |||||
package com.ningdatech.pmapi.projectlib.controller; | package com.ningdatech.pmapi.projectlib.controller; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.log.annotation.WebLog; | |||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; | import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | ||||
@@ -36,8 +38,16 @@ public class AnnualPlanController { | |||||
@PostMapping("/startProjectDeclared") | @PostMapping("/startProjectDeclared") | ||||
@ApiOperation("开启项目申报") | @ApiOperation("开启项目申报") | ||||
@WebLog("开启项目申报") | |||||
public void startProjectDeclared(@RequestBody @Valid StartProjectDeclareReq req) { | public void startProjectDeclared(@RequestBody @Valid StartProjectDeclareReq req) { | ||||
annualPlanLibManage.startProjectDeclared(req); | annualPlanLibManage.startProjectDeclared(req); | ||||
} | } | ||||
@PostMapping("/projectApproved") | |||||
@ApiOperation("立项批复") | |||||
@WebLog("立项批复") | |||||
public void projectApproved(@RequestBody @Valid ProjectApprovedReq req) throws Exception { | |||||
annualPlanLibManage.projectApproved(req); | |||||
} | |||||
} | } |
@@ -1,6 +1,8 @@ | |||||
package com.ningdatech.pmapi.projectlib.manage; | package com.ningdatech.pmapi.projectlib.manage; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
@@ -10,6 +12,7 @@ import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; | import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | ||||
@@ -106,4 +109,18 @@ public class AnnualPlanLibManage { | |||||
}); | }); | ||||
} | } | ||||
@Transactional(rollbackFor = Exception.class) | |||||
public void projectApproved(ProjectApprovedReq req) throws Exception { | |||||
Project project = projectService.getById(req.getProjectId()); | |||||
stateMachine.execute(project, ProjectStatusChangeEvent.PROJECT_APPROVAL); | |||||
LambdaUpdateWrapper<Project> update = Wrappers.lambdaUpdate(Project.class) | |||||
.set(Project::getApprovalAmount, req.getApprovedAmount()) | |||||
.set(Project::getApprovedFile, req.getApprovedFileId()) | |||||
.set(Project::getBuildCycle, req.getBuildCycle()) | |||||
.set(Project::getConstructionPlanFile, req.getBuildPlanFileId()) | |||||
.set(Project::getApprovalDate, req.getApprovedDate()) | |||||
.eq(Project::getId, req.getProjectId()); | |||||
projectService.update(update); | |||||
} | |||||
} | } |
@@ -9,6 +9,7 @@ import lombok.Data; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
import java.time.LocalDate; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
/** | /** | ||||
@@ -257,6 +258,9 @@ public class Project implements Serializable { | |||||
@ApiModelProperty("立项批复文件") | @ApiModelProperty("立项批复文件") | ||||
private String approvedFile; | private String approvedFile; | ||||
@ApiModelProperty("立项批复时间") | |||||
private LocalDate approvalDate; | |||||
@ApiModelProperty("批复金额") | @ApiModelProperty("批复金额") | ||||
private BigDecimal approvedTotalInvestmentIncrease; | private BigDecimal approvedTotalInvestmentIncrease; | ||||
@@ -0,0 +1,53 @@ | |||||
package com.ningdatech.pmapi.projectlib.model.req; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import org.hibernate.validator.constraints.Range; | |||||
import javax.validation.constraints.DecimalMax; | |||||
import javax.validation.constraints.DecimalMin; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.math.BigDecimal; | |||||
import java.time.LocalDate; | |||||
/** | |||||
* <p> | |||||
* 立项批复参数类 | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 20:04 2023/2/12 | |||||
*/ | |||||
@Data | |||||
@ApiModel("立项批复参数类") | |||||
public class ProjectApprovedReq { | |||||
@ApiModelProperty("项目ID") | |||||
@NotNull(message = "项目ID不能为空") | |||||
private Long projectId; | |||||
@ApiModelProperty("批复金额") | |||||
@NotNull(message = "批复金额不能为空") | |||||
@DecimalMax(value = "999999999.99", message = "批复金额无效") | |||||
@DecimalMin(value = "0.01", message = "批复金额无效") | |||||
private BigDecimal approvedAmount; | |||||
@NotNull(message = "批复时间不能为空") | |||||
@ApiModelProperty("批复时间") | |||||
private LocalDate approvedDate; | |||||
@ApiModelProperty("建设周期") | |||||
@NotNull(message = "建设周期不能为空") | |||||
@Range(min = 1, max = 99999, message = "建设周期无效") | |||||
private LocalDate buildCycle; | |||||
@ApiModelProperty("批复文件ID") | |||||
@NotNull(message = "批复文件不能为空") | |||||
private Long approvedFileId; | |||||
@ApiModelProperty("建设方案文件ID") | |||||
@NotNull(message = "建设方案不能为空") | |||||
private Long buildPlanFileId; | |||||
} |