@@ -37,7 +37,7 @@ public class PurchaseController { | |||||
@ApiOperation(value = "待采购结果备案列表", notes = "待采购结果备案列表") | @ApiOperation(value = "待采购结果备案列表", notes = "待采购结果备案列表") | ||||
@GetMapping("/project-list") | @GetMapping("/project-list") | ||||
public PageVo<ProjectLibListItemVO> projectlist(@ModelAttribute ProjectListReq req) { | |||||
public PageVo<ProjectLibListItemVO> projectList(@ModelAttribute ProjectListReq req) { | |||||
return purchaseManage.projectLibList(req); | return purchaseManage.projectLibList(req); | ||||
} | } | ||||
@@ -54,7 +54,7 @@ public class PurchaseController { | |||||
ExcelDownUtil.downXls(response, req, purchaseManage::exportList); | ExcelDownUtil.downXls(response, req, purchaseManage::exportList); | ||||
} | } | ||||
@ApiOperation(value = "填写采购结果", notes = "填写采购结果") | |||||
@ApiOperation(value = "填写采购结果") | |||||
@WebLog("填写采购结果") | @WebLog("填写采购结果") | ||||
@PostMapping("/submit-result") | @PostMapping("/submit-result") | ||||
public String submitResult(@Validated @RequestBody PurchaseSaveDTO dto) { | public String submitResult(@Validated @RequestBody PurchaseSaveDTO dto) { | ||||
@@ -79,7 +79,6 @@ public class ConstructionManage { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IPurchaseService purchaseService; | private final IPurchaseService purchaseService; | ||||
private final IPurchaseInstService purchaseInstService; | private final IPurchaseInstService purchaseInstService; | ||||
private final IContractService contractService; | private final IContractService contractService; | ||||
@@ -283,6 +282,13 @@ public class ConstructionManage { | |||||
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) | !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) | ||||
.throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); | .throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); | ||||
Purchase purchase = purchaseService.getById(req.getBidId()); | |||||
if (!TenderStatusEnum.TO_BE_SUBMIT_CONSTRUCTION_INFO.eq(purchase.getStatus())) { | |||||
throw BizException.wrap("该标段不支持填写合同信息"); | |||||
} | |||||
tenderStateMachineUtil.pass(purchase); | |||||
purchaseService.updateById(purchase); | |||||
LocalDateTime now = LocalDateTime.now(); | LocalDateTime now = LocalDateTime.now(); | ||||
Contract contract = new Contract(); | Contract contract = new Contract(); | ||||
contract.setContractTime(req.getContractTime()); | contract.setContractTime(req.getContractTime()); | ||||
@@ -4,17 +4,19 @@ import cn.hutool.core.bean.BeanUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Assert; | import com.baomidou.mybatisplus.core.toolkit.Assert; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | |||||
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil; | |||||
import com.hz.pm.api.projectdeclared.model.dto.OperationReq; | import com.hz.pm.api.projectdeclared.model.dto.OperationReq; | ||||
import com.hz.pm.api.projectdeclared.model.entity.Operation; | import com.hz.pm.api.projectdeclared.model.entity.Operation; | ||||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||||
import com.hz.pm.api.projectdeclared.model.vo.OperationVO; | import com.hz.pm.api.projectdeclared.model.vo.OperationVO; | ||||
import com.hz.pm.api.projectdeclared.service.IOperationService; | import com.hz.pm.api.projectdeclared.service.IOperationService; | ||||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||||
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.hz.pm.api.user.security.model.UserInfoDetails; | import com.hz.pm.api.user.security.model.UserInfoDetails; | ||||
import com.hz.pm.api.user.util.LoginUserUtil; | import com.hz.pm.api.user.util.LoginUserUtil; | ||||
import com.ningdatech.basic.function.VUtils; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
@@ -37,10 +39,9 @@ import java.util.Objects; | |||||
public class OperationManage { | public class OperationManage { | ||||
private final IOperationService operationService; | private final IOperationService operationService; | ||||
private final IPurchaseService purchaseService; | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final StateMachineUtil stateMachineUtil; | |||||
private final TenderStateMachineUtil tenderStateMachineUtil; | |||||
/** | /** | ||||
* 获取实施详情 | * 获取实施详情 | ||||
@@ -61,20 +62,14 @@ public class OperationManage { | |||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public String pushOperation(OperationReq req) { | public String pushOperation(OperationReq req) { | ||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | UserInfoDetails user = LoginUserUtil.loginUserDetail(); | ||||
Project project = projectService.getNewProject(req.getProjectId()); | |||||
Assert.notNull(project, "项目不存在!"); | |||||
//首先要判断 项目当前状态 是不是 待开工状态 | |||||
VUtils.isTrue(!ProjectStatusEnum.OPERATION.eq(project.getStatus()) || | |||||
!ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) | |||||
.throwMessage("提交失败 该项目不是 待开工或者已立项阶段"); | |||||
Purchase purchase = purchaseService.getById(req.getBidId()); | |||||
if (!TenderStatusEnum.TO_BE_SUBMIT_OPERATION_PLAN.eq(purchase.getStatus())) { | |||||
throw BizException.wrap("该标段不支持填写实施计划"); | |||||
} | |||||
Operation pre = operationService.getOne(Wrappers.lambdaQuery(Operation.class) | Operation pre = operationService.getOne(Wrappers.lambdaQuery(Operation.class) | ||||
.eq(Operation::getProjectCode, project.getProjectCode()) | |||||
.eq(Operation::getBidId, req.getBidId()) | .eq(Operation::getBidId, req.getBidId()) | ||||
.last(BizConst.LIMIT_1)); | .last(BizConst.LIMIT_1)); | ||||
Project project = projectService.getNewProject(req.getProjectId()); | |||||
LocalDateTime now = LocalDateTime.now(); | LocalDateTime now = LocalDateTime.now(); | ||||
Operation curr = BeanUtil.copyProperties(req, Operation.class); | Operation curr = BeanUtil.copyProperties(req, Operation.class); | ||||
if (Objects.nonNull(pre)) { | if (Objects.nonNull(pre)) { | ||||
@@ -87,6 +82,8 @@ public class OperationManage { | |||||
curr.setUpdateOn(now); | curr.setUpdateOn(now); | ||||
curr.setUpdateBy(user.getUsername()); | curr.setUpdateBy(user.getUsername()); | ||||
operationService.saveOrUpdate(curr); | operationService.saveOrUpdate(curr); | ||||
tenderStateMachineUtil.pass(purchase); | |||||
purchaseService.updateById(purchase); | |||||
return curr.getProjectCode(); | return curr.getProjectCode(); | ||||
} | } | ||||
} | } |
@@ -8,21 +8,26 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.hz.pm.api.common.helper.UserInfoHelper; | import com.hz.pm.api.common.helper.UserInfoHelper; | ||||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | ||||
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil; | |||||
import com.hz.pm.api.common.util.ExcelDownUtil; | import com.hz.pm.api.common.util.ExcelDownUtil; | ||||
import com.hz.pm.api.common.util.ExcelExportStyle; | import com.hz.pm.api.common.util.ExcelExportStyle; | ||||
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; | import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; | ||||
import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; | import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; | ||||
import com.hz.pm.api.projectdeclared.model.entity.Contract; | |||||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | import com.hz.pm.api.projectdeclared.model.entity.Purchase; | ||||
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq; | import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq; | ||||
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq; | import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq; | ||||
import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; | import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; | ||||
import com.hz.pm.api.projectdeclared.service.IContractService; | |||||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | import com.hz.pm.api.projectdeclared.service.IPurchaseService; | ||||
import com.hz.pm.api.projectlib.helper.ProjectHelper; | import com.hz.pm.api.projectlib.helper.ProjectHelper; | ||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | ||||
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; | |||||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | import com.hz.pm.api.projectlib.model.req.ProjectListReq; | ||||
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | import com.hz.pm.api.user.security.model.UserFullInfoDTO; | ||||
import com.hz.pm.api.user.security.model.UserInfoDetails; | import com.hz.pm.api.user.security.model.UserInfoDetails; | ||||
@@ -46,6 +51,7 @@ import java.util.List; | |||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Objects; | import java.util.Objects; | ||||
import java.util.concurrent.atomic.AtomicInteger; | import java.util.concurrent.atomic.AtomicInteger; | ||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* @Classname PurchaseManage | * @Classname PurchaseManage | ||||
@@ -60,9 +66,9 @@ public class PurchaseManage { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IContractService contractService; | |||||
private final IPurchaseService purchaseService; | private final IPurchaseService purchaseService; | ||||
private final TenderStateMachineUtil tenderStateMachineUtil; | |||||
private final StateMachineUtil stateMachineUtil; | private final StateMachineUtil stateMachineUtil; | ||||
/** | /** | ||||
@@ -72,7 +78,7 @@ public class PurchaseManage { | |||||
* @return | * @return | ||||
*/ | */ | ||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||||
Assert.notNull(user, "获取登录用户失败!"); | Assert.notNull(user, "获取登录用户失败!"); | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
//只能看自己单位的 | //只能看自己单位的 | ||||
@@ -88,6 +94,10 @@ public class PurchaseManage { | |||||
if ((total = page.getTotal()) == 0) { | if ((total = page.getTotal()) == 0) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
} | } | ||||
List<Long> projectIds = CollUtils.fieldList(page.getRecords(), Project::getId); | |||||
List<Purchase> purchases = purchaseService.listByProjectIds(projectIds); | |||||
Map<Long, List<Purchase>> purchaseMap = CollUtils.group(purchases, Purchase::getProjectId); | |||||
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds); | |||||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | ||||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | ProjectLibListItemVO item = new ProjectLibListItemVO(); | ||||
item.setId(w.getId()); | item.setId(w.getId()); | ||||
@@ -105,6 +115,22 @@ public class PurchaseManage { | |||||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | ||||
item.setApprovedAmount(w.getApprovalAmount()); | item.setApprovedAmount(w.getApprovalAmount()); | ||||
item.setApprovalDate(w.getApprovalDate()); | item.setApprovalDate(w.getApprovalDate()); | ||||
List<Purchase> currPurchases = purchaseMap.get(w.getId()); | |||||
if (currPurchases != null) { | |||||
List<TenderListInfoVO> tmpPurchases = CollUtils.convert(currPurchases, x -> { | |||||
TenderListInfoVO tender = new TenderListInfoVO(); | |||||
tender.setBidName(x.getBidName()); | |||||
tender.setBidId(x.getId()); | |||||
tender.setBidStatus(x.getStatus()); | |||||
tender.setBidStatusName(TenderStatusEnum.getDescByStatus(x.getStatus())); | |||||
Contract contract = contractMap.get(x.getId()); | |||||
if (contract != null) { | |||||
tender.setConstructionAmount(contract.getTotalAmount()); | |||||
} | |||||
return tender; | |||||
}); | |||||
item.setTenders(tmpPurchases); | |||||
} | |||||
return item; | return item; | ||||
}); | }); | ||||
return PageVo.of(records, total); | return PageVo.of(records, total); | ||||
@@ -228,33 +254,31 @@ public class PurchaseManage { | |||||
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus()) | VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus()) | ||||
|| !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) | || !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) | ||||
.throwMessage("提交失败,该项目不是待采购备案状态或者已立项阶段"); | .throwMessage("提交失败,该项目不是待采购备案状态或者已立项阶段"); | ||||
Purchase purchase = new Purchase(); | |||||
purchase.setPurchaseMethod(req.getPurchaseMethod()); | |||||
purchase.setBidAddress(req.getBidAddress()); | |||||
purchase.setBidName(req.getBidName()); | |||||
purchase.setBidBudget(req.getBidBudget()); | |||||
purchase.setBidDoc(req.getBidDoc()); | |||||
purchase.setBidStartTime(req.getBidStartTime()); | |||||
purchase.setBidEndTime(req.getBidEndTime()); | |||||
purchase.setId(req.getBidId()); | |||||
purchase.setProjectId(projectId); | |||||
if (purchase.getId() == null) { | |||||
purchase.setCreateBy(user.getUserIdStr()); | |||||
} | |||||
purchaseService.saveOrUpdate(purchase); | |||||
List<Purchase> purchases = req.getTenders().stream().map(w -> { | |||||
Purchase purchase = new Purchase(); | |||||
purchase.setPurchaseMethod(w.getPurchaseMethod()); | |||||
purchase.setBidAddress(w.getBidAddress()); | |||||
purchase.setBidName(w.getBidName()); | |||||
purchase.setBidBudget(w.getBidBudget()); | |||||
purchase.setBidDoc(w.getBidDoc()); | |||||
purchase.setBidStartTime(w.getBidStartTime()); | |||||
purchase.setBidEndTime(w.getBidEndTime()); | |||||
purchase.setId(w.getBidId()); | |||||
purchase.setProjectId(projectId); | |||||
if (purchase.getId() == null) { | |||||
purchase.setCreateBy(user.getUserIdStr()); | |||||
} | |||||
purchase.setStatus(TenderStatusEnum.TO_BE_SUBMIT_PURCHASE_INFO.getTenderStatus()); | |||||
return purchase; | |||||
}).collect(Collectors.toList()); | |||||
purchaseService.saveOrUpdateBatch(purchases); | |||||
} | } | ||||
public void submitPurchaseRecord(SubmitPurchaseRecordReq req) { | public void submitPurchaseRecord(SubmitPurchaseRecordReq req) { | ||||
Long projectId = req.getProjectId(); | |||||
Project project = projectService.getNewProject(projectId); | |||||
Assert.notNull(project, "提交失败 此项目不存在!"); | |||||
//首先要判断 项目当前状态 是不是 采购结果备案 | |||||
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus()) | |||||
|| !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) | |||||
.throwMessage("提交失败,该项目不是待采购备案状态或者已立项阶段"); | |||||
Purchase purchase = new Purchase(); | |||||
Purchase purchase = purchaseService.getById(req.getBidId()); | |||||
if (!TenderStatusEnum.TO_BE_SUBMIT_PURCHASE_INFO.eq(purchase.getStatus())) { | |||||
throw BizException.wrap("该标段无法进行采购信息备案"); | |||||
} | |||||
purchase.setId(req.getBidId()); | purchase.setId(req.getBidId()); | ||||
purchase.setAcceptanceLetter(req.getAcceptanceLetter()); | purchase.setAcceptanceLetter(req.getAcceptanceLetter()); | ||||
purchase.setBidBuildContent(req.getBidBuildContent()); | purchase.setBidBuildContent(req.getBidBuildContent()); | ||||
@@ -262,6 +286,7 @@ public class PurchaseManage { | |||||
purchase.setSupplier(req.getSupplier()); | purchase.setSupplier(req.getSupplier()); | ||||
purchase.setSupplierSocialCreditCode(req.getSupplierSocialCreditCode()); | purchase.setSupplierSocialCreditCode(req.getSupplierSocialCreditCode()); | ||||
purchase.setBidType(req.getBidType()); | purchase.setBidType(req.getBidType()); | ||||
tenderStateMachineUtil.pass(purchase); | |||||
purchaseService.saveOrUpdate(purchase); | purchaseService.saveOrUpdate(purchase); | ||||
} | } | ||||
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import lombok.Data; | import lombok.Data; | ||||
import javax.validation.constraints.NotEmpty; | |||||
import javax.validation.constraints.NotNull; | import javax.validation.constraints.NotNull; | ||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
@@ -27,31 +26,37 @@ public class SubmitPurchaseNoticeReq { | |||||
@NotNull(message = "请传项目ID") | @NotNull(message = "请传项目ID") | ||||
private Long projectId; | private Long projectId; | ||||
@ApiModelProperty("标段信息") | |||||
private List<PurchaseNoticeTenderDTO> tenders; | |||||
@ApiModelProperty("标段ID") | |||||
private Long bidId; | |||||
@Data | |||||
public static class PurchaseNoticeTenderDTO { | |||||
@ApiModelProperty("标段名称") | |||||
private String bidName; | |||||
@ApiModelProperty("标段ID") | |||||
private Long bidId; | |||||
@ApiModelProperty("标段预算") | |||||
private BigDecimal bidBudget; | |||||
@ApiModelProperty("标段名称") | |||||
private String bidName; | |||||
@ApiModelProperty("开标时间") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | |||||
private LocalDateTime bidStartTime; | |||||
@ApiModelProperty("标段预算") | |||||
private BigDecimal bidBudget; | |||||
@ApiModelProperty("投标截止时间") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | |||||
private LocalDateTime bidEndTime; | |||||
@ApiModelProperty("开标时间") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | |||||
private LocalDateTime bidStartTime; | |||||
@ApiModelProperty("投标地址") | |||||
private String bidAddress; | |||||
@ApiModelProperty("投标截止时间") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | |||||
private LocalDateTime bidEndTime; | |||||
@ApiModelProperty("采购方式") | |||||
private String purchaseMethod; | |||||
@ApiModelProperty("投标地址") | |||||
private String bidAddress; | |||||
@ApiModelProperty("招标文件") | |||||
private String bidDoc; | |||||
@ApiModelProperty("采购方式") | |||||
private String purchaseMethod; | |||||
@ApiModelProperty("招标文件") | |||||
private String bidDoc; | |||||
} | |||||
} | } |
@@ -1,11 +1,17 @@ | |||||
package com.hz.pm.api.projectdeclared.service; | package com.hz.pm.api.projectdeclared.service; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import com.hz.pm.api.projectdeclared.model.entity.Contract; | import com.hz.pm.api.projectdeclared.model.entity.Contract; | ||||
import com.ningdatech.basic.util.CollUtils; | |||||
import java.util.Collection; | |||||
import java.util.Map; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 服务类 | |||||
* 服务类 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author zpf | * @author zpf | ||||
@@ -13,4 +19,16 @@ import com.hz.pm.api.projectdeclared.model.entity.Contract; | |||||
*/ | */ | ||||
public interface IContractService extends IService<Contract> { | public interface IContractService extends IService<Contract> { | ||||
default Map<Long, Contract> listByBidIds(Collection<Long> bidIds) { | |||||
LambdaQueryWrapper<Contract> query = Wrappers.lambdaQuery(Contract.class) | |||||
.in(Contract::getBidId, bidIds); | |||||
return CollUtils.listToMap(list(query), Contract::getBidId); | |||||
} | |||||
default Map<Long, Contract> listByProjectIds(Collection<Long> projectIds) { | |||||
LambdaQueryWrapper<Contract> query = Wrappers.lambdaQuery(Contract.class) | |||||
.in(Contract::getProjectId, projectIds); | |||||
return CollUtils.listToMap(list(query), Contract::getBidId); | |||||
} | |||||
} | } |
@@ -18,11 +18,14 @@ public interface IPurchaseService extends IService<Purchase> { | |||||
default List<Purchase> listByProjectId(Long projectId) { | default List<Purchase> listByProjectId(Long projectId) { | ||||
return list(Wrappers.lambdaQuery(Purchase.class) | return list(Wrappers.lambdaQuery(Purchase.class) | ||||
.eq(Purchase::getProjectId, projectId)); | |||||
.eq(Purchase::getProjectId, projectId) | |||||
.orderByAsc(Purchase::getId)); | |||||
} | } | ||||
default List<Purchase> listByProjectIds(List<Long> projectIds) { | default List<Purchase> listByProjectIds(List<Long> projectIds) { | ||||
return list(Wrappers.lambdaQuery(Purchase.class) | return list(Wrappers.lambdaQuery(Purchase.class) | ||||
.in(Purchase::getProjectId, projectIds)); | |||||
.in(Purchase::getProjectId, projectIds) | |||||
.orderByAsc(Purchase::getId)); | |||||
} | } | ||||
} | } |
@@ -10,6 +10,7 @@ import com.hz.pm.api.projectlib.model.entity.Project; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.wflow.bean.entity.WflowModels; | import com.wflow.bean.entity.WflowModels; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.enums.StepStatusEnum; | |||||
import com.wflow.workflow.service.ProcessModelService; | import com.wflow.workflow.service.ProcessModelService; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
@@ -60,7 +61,7 @@ public class ProcessExecuteChainHandle { | |||||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) | .eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) | ||||
.last(BizConst.LIMIT_1)); | .last(BizConst.LIMIT_1)); | ||||
if (Objects.nonNull(model) && (Boolean.FALSE.equals(model.getIsStop()))) { | if (Objects.nonNull(model) && (Boolean.FALSE.equals(model.getIsStop()))) { | ||||
handles.add(processBusinessHandle); | |||||
handles.add(processBusinessHandle); | |||||
} | } | ||||
} else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { | } else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { | ||||
//省级联审 | //省级联审 | ||||
@@ -75,6 +76,15 @@ public class ProcessExecuteChainHandle { | |||||
for (AbstractProcessBusinessHandle processBusinessHandle : handles) { | for (AbstractProcessBusinessHandle processBusinessHandle : handles) { | ||||
processBusinessHandle.businessHandle(projectId, processSchedule); | processBusinessHandle.businessHandle(projectId, processSchedule); | ||||
} | } | ||||
for (int i = processSchedule.size() - 1; i >= 1; i--) { | |||||
ProcessDetailVO curr = processSchedule.get(i); | |||||
if (curr.getStepStatus() == null || | |||||
curr.getStepStatus().equals(StepStatusEnum.NOT_START)) { | |||||
continue; | |||||
} | |||||
ProcessDetailVO pre = processSchedule.get(i - 1); | |||||
pre.setStepStatus(StepStatusEnum.COMPLETED); | |||||
} | |||||
return processSchedule; | return processSchedule; | ||||
} | } | ||||
return Collections.emptyList(); | return Collections.emptyList(); | ||||
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.model.constant.CommonConst; | import com.hz.pm.api.common.model.constant.CommonConst; | ||||
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.hz.pm.api.projectlib.manage.AnnualPlanLibManage; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
@@ -32,7 +31,8 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||||
private Integer order = 8; | private Integer order = 8; | ||||
public ProjectApprovalHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { | |||||
public ProjectApprovalHandle(INdProjectStatusChangeService projectStatusChangeService, | |||||
IProjectService projectService) { | |||||
this.projectStatusChangeService = projectStatusChangeService; | this.projectStatusChangeService = projectStatusChangeService; | ||||
this.projectService = projectService; | this.projectService = projectService; | ||||
} | } | ||||
@@ -40,46 +40,48 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||||
@Override | @Override | ||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | ||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ||||
processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); | |||||
Project project = projectService.getNewProject(projectId); | Project project = projectService.getNewProject(projectId); | ||||
//查出历史版本的 所有项目ID | //查出历史版本的 所有项目ID | ||||
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(project); | List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(project); | ||||
Integer status = project.getStatus(); | Integer status = project.getStatus(); | ||||
if (Objects.isNull(status)) { | if (Objects.isNull(status)) { | ||||
return; | return; | ||||
} | } | ||||
// 项目状态为待立项批复之前的状态 | // 项目状态为待立项批复之前的状态 | ||||
if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()) { | if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()) { | ||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | ||||
processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); | |||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
return; | return; | ||||
} | } | ||||
// 当前项目状态为待立项批复 | // 当前项目状态为待立项批复 | ||||
if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)) { | |||||
if (ProjectStatusEnum.TO_BE_APPROVED.eq(status) | |||||
|| ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.eq(status)) { | |||||
// 根据建设方案评审通过的时间获取 | // 根据建设方案评审通过的时间获取 | ||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | ||||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | .in(ProjectStatusChange::getProjectId, allVersionProjectIds) | ||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) | |||||
.in(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_SUBMIT, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_RESUBMIT) | |||||
.orderByDesc(ProjectStatusChange::getCreateOn) | .orderByDesc(ProjectStatusChange::getCreateOn) | ||||
.last(BizConst.LIMIT_1)); | .last(BizConst.LIMIT_1)); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | ||||
} else { | |||||
// 取 状态机 改变状态时间 | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PROJECT_APPROVAL.name()) | |||||
.last(BizConst.LIMIT_1)); | |||||
if (Objects.nonNull(projectStatusChange)) { | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||||
} | |||||
return; | |||||
} | } | ||||
processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); | |||||
// 取 状态机 改变状态时间 | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||||
.in(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_FAILED, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_PASS) | |||||
.last(BizConst.LIMIT_1)); | |||||
if (Objects.nonNull(projectStatusChange)) { | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||||
} | |||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@@ -5,15 +5,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.model.constant.CommonConst; | import com.hz.pm.api.common.model.constant.CommonConst; | ||||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | import com.hz.pm.api.projectlib.model.entity.ProjectInst; | ||||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||||
import com.hz.pm.api.projectlib.service.IProjectInstService; | import com.hz.pm.api.projectlib.service.IProjectInstService; | ||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; | import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; | ||||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | import com.hz.pm.api.todocenter.constant.TodoCenterConst; | ||||
import com.hz.pm.api.todocenter.utils.BuildUserUtils; | import com.hz.pm.api.todocenter.utils.BuildUserUtils; | ||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.util.NdDateUtils; | import com.ningdatech.basic.util.NdDateUtils; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | ||||
import com.wflow.workflow.bean.process.ProgressNode; | import com.wflow.workflow.bean.process.ProgressNode; | ||||
@@ -49,7 +48,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
private Integer order = 2; | private Integer order = 2; | ||||
public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ | |||||
public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService) { | |||||
this.projectInstService = projectInstService; | this.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
this.buildUserUtils = buildUserUtils; | this.buildUserUtils = buildUserUtils; | ||||
@@ -60,6 +59,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
@Override | @Override | ||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | ||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ||||
processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); | |||||
Project project = projectService.getById(projectId); | Project project = projectService.getById(projectId); | ||||
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(project); | List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(project); | ||||
// 根据项目ID查询出单位内部审核流程的流程状态 | // 根据项目ID查询出单位内部审核流程的流程状态 | ||||
@@ -74,19 +74,20 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
// 未找到当前版本项目的单位内部审核流程且当前项目版本号大于1(是被驳回重新申报的项目) | // 未找到当前版本项目的单位内部审核流程且当前项目版本号大于1(是被驳回重新申报的项目) | ||||
// 注意:已经在项目库中的项目,一定是单位内部审核已经开始的项目 | // 注意:已经在项目库中的项目,一定是单位内部审核已经开始的项目 | ||||
if (Objects.isNull(projectInst)) { | if (Objects.isNull(projectInst)) { | ||||
if (project.getVersion() > CommonConst.VERSION_ONE){ | |||||
if (project.getVersion() > CommonConst.VERSION_ONE) { | |||||
// 获取上个版本的信息 | // 获取上个版本的信息 | ||||
instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId, InstTypeEnum.UNIT_INNER_AUDIT); | instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId, InstTypeEnum.UNIT_INNER_AUDIT); | ||||
} | } | ||||
}else { | |||||
} else { | |||||
String instCode = projectInst.getInstCode(); | String instCode = projectInst.getInstCode(); | ||||
instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); | instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); | ||||
} | } | ||||
if (Objects.isNull(instanceDetail)){ | |||||
throw new BizException("未获取到单位内部审核流程详情!"); | |||||
processSchedule.add(processDetailVO); | |||||
if (Objects.isNull(instanceDetail)) { | |||||
return; | |||||
} | } | ||||
String status = instanceDetail.getStatus(); | String status = instanceDetail.getStatus(); | ||||
if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ | |||||
if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)) { | |||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | ||||
} else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { | } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { | ||||
processDetailVO.setStepStatus(StepStatusEnum.REJECTED); | processDetailVO.setStepStatus(StepStatusEnum.REJECTED); | ||||
@@ -107,13 +108,11 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | ||||
processDetailVO.setFinishTime(finishTime); | processDetailVO.setFinishTime(finishTime); | ||||
} | } | ||||
}else { | |||||
} else { | |||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); | LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); | ||||
processDetailVO.setFinishTime(finishTime); | processDetailVO.setFinishTime(finishTime); | ||||
} | } | ||||
processDetailVO.setProcessProgressVo(instanceDetail); | processDetailVO.setProcessProgressVo(instanceDetail); | ||||
processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); | |||||
processSchedule.add(processDetailVO); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -162,6 +162,10 @@ public class ProjectLibListItemVO { | |||||
@ApiModelProperty("年度投资金额总额") | @ApiModelProperty("年度投资金额总额") | ||||
private BigDecimal annualAccumulateAmount; | private BigDecimal annualAccumulateAmount; | ||||
private List<AnnualAmountVO> annualAccumulateAmountList; | private List<AnnualAmountVO> annualAccumulateAmountList; | ||||
@ApiModelProperty("标段信息") | |||||
private List<TenderListInfoVO> tenders; | |||||
} | } |
@@ -0,0 +1,35 @@ | |||||
package com.hz.pm.api.projectlib.model.vo; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.math.BigDecimal; | |||||
/** | |||||
* <p> | |||||
* TenderInfoVO | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 14:10 2024/2/25 | |||||
*/ | |||||
@Data | |||||
public class TenderListInfoVO { | |||||
@ApiModelProperty("标段ID") | |||||
private Long bidId; | |||||
@ApiModelProperty("标段名称") | |||||
private String bidName; | |||||
@ApiModelProperty("标段状态") | |||||
private Integer bidStatus; | |||||
@ApiModelProperty("标段状态描述") | |||||
private String bidStatusName; | |||||
@ApiModelProperty("合同金额") | |||||
private BigDecimal constructionAmount; | |||||
} |
@@ -1,11 +1,14 @@ | |||||
package com.hz.pm.api.projectlib.service; | package com.hz.pm.api.projectlib.service; | ||||
import com.hz.pm.api.projectlib.model.entity.MhProject; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import com.hz.pm.api.common.model.constant.BizConst; | |||||
import com.hz.pm.api.projectlib.model.entity.MhProject; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 服务类 | |||||
* 服务类 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author WendyYang | * @author WendyYang | ||||
@@ -13,4 +16,17 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||||
*/ | */ | ||||
public interface IMhProjectService extends IService<MhProject> { | public interface IMhProjectService extends IService<MhProject> { | ||||
default MhProject getByProjectCode(String projectCode) { | |||||
LambdaQueryWrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class) | |||||
.eq(MhProject::getProjectCode, projectCode); | |||||
return getOne(query); | |||||
} | |||||
default boolean existsByProjectCode(String projectCode) { | |||||
LambdaQueryWrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class) | |||||
.eq(MhProject::getProjectCode, projectCode) | |||||
.last(BizConst.LIMIT_1); | |||||
return count(query) > 0; | |||||
} | |||||
} | } |