@@ -3,13 +3,14 @@ package com.hz.pm.api.projectlib.controller; | |||
import com.hz.pm.api.projectlib.manage.MhProjectManage; | |||
import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; | |||
import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; | |||
import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO; | |||
import com.ningdatech.basic.model.PageVo; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.stereotype.Controller; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
@@ -34,5 +35,11 @@ public class MhProjectController { | |||
return mhProjectManage.pageDeclaredProject(req); | |||
} | |||
@ApiOperation("信产项目基本信息") | |||
@GetMapping("/baseInfo/{mhProjectId}") | |||
public MhProjectBaseInfoVO projectBaseInfo(@PathVariable Long mhProjectId) { | |||
return mhProjectManage.getProjectBaseInfo(mhProjectId); | |||
} | |||
} |
@@ -5,13 +5,19 @@ 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.hz.pm.api.projectlib.model.entity.MhProject; | |||
import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; | |||
import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; | |||
import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO; | |||
import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService; | |||
import com.hz.pm.api.projectlib.service.IMhProjectService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.hz.pm.api.user.model.dto.UnitDTO; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -37,7 +43,9 @@ import java.util.stream.Collectors; | |||
public class MhProjectManage { | |||
private final IMhProjectService mhProjectService; | |||
private final IMhProjectSchemaTargetDataService mhProjectSchemaTargetDataService; | |||
private final IProjectService projectService; | |||
private final MhUnitCache mhUnitCache; | |||
private LambdaQueryWrapper<MhProject> buildQuery(DeclaredProjectListReq req) { | |||
LambdaQueryWrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class) | |||
@@ -92,5 +100,28 @@ public class MhProjectManage { | |||
return PageVo.of(data, page.getTotal()); | |||
} | |||
public MhProjectBaseInfoVO getProjectBaseInfo(Long mhProjectId) { | |||
MhProject mhProject = mhProjectService.getById(mhProjectId); | |||
if (mhProject == null) { | |||
throw BizException.wrap("项目不存在"); | |||
} | |||
MhProjectBaseInfoVO detail = new MhProjectBaseInfoVO(); | |||
detail.setMhProjectId(mhProject.getId()); | |||
detail.setProjectName(mhProject.getProjectName()); | |||
detail.setDeclaredUnit(mhProject.getUnitName()); | |||
detail.setDeclaredUnitId(mhProject.getUnitId()); | |||
detail.setTotalInvestAmount(mhProject.getTotalMoney()); | |||
detail.setReviewInvestAmount(mhProject.getMoney()); | |||
MhProjectSchemaTargetData schemaTargetData = mhProjectSchemaTargetDataService.getByMhProjectId(mhProjectId); | |||
if (schemaTargetData != null) { | |||
detail.setTotalInvestBudgetAmount(schemaTargetData.getMoney()); | |||
} | |||
UnitDTO unit = mhUnitCache.getById(mhProject.getId()); | |||
if (unit != null) { | |||
detail.setDeclaredUnitUnifiedSocialCreditCode(unit.getUnifiedSocialCreditCode()); | |||
} | |||
return detail; | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
package com.hz.pm.api.projectlib.model.vo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.math.BigDecimal; | |||
/** | |||
* <p> | |||
* MhProjectDetailVO | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 00:39 2024/1/31 | |||
*/ | |||
@Data | |||
public class MhProjectBaseInfoVO { | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
@ApiModelProperty("申报单位") | |||
private String declaredUnit; | |||
@ApiModelProperty("申报单位ID") | |||
private Long declaredUnitId; | |||
@ApiModelProperty("申报单位社会信用代码") | |||
private String declaredUnitUnifiedSocialCreditCode; | |||
@ApiModelProperty("总投资") | |||
private BigDecimal totalInvestAmount; | |||
@ApiModelProperty("总投资预算金额") | |||
private BigDecimal totalInvestBudgetAmount; | |||
@ApiModelProperty("评审预算金额") | |||
private BigDecimal reviewInvestAmount; | |||
@ApiModelProperty("id") | |||
private Long mhProjectId; | |||
} |
@@ -1,5 +1,9 @@ | |||
package com.hz.pm.api.projectlib.service; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
@@ -13,4 +17,11 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||
*/ | |||
public interface IMhProjectSchemaTargetDataService extends IService<MhProjectSchemaTargetData> { | |||
default MhProjectSchemaTargetData getByMhProjectId(Long mhProjectId){ | |||
Wrapper<MhProjectSchemaTargetData> query = Wrappers.lambdaQuery(MhProjectSchemaTargetData.class) | |||
.eq(MhProjectSchemaTargetData::getMhProjectId,mhProjectId) | |||
.last(BizConst.LIMIT_1); | |||
return getOne(query); | |||
} | |||
} |