mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-21 05:31:54 +08:00
Compare commits
6 Commits
feature-ou
...
feature-pm
Author | SHA1 | Date | |
---|---|---|---|
![]() |
92070e3c57 | ||
![]() |
1df906c0db | ||
![]() |
cb6816d4b7 | ||
![]() |
f2cfb723a9 | ||
![]() |
d9c2bc5ce6 | ||
![]() |
e166428f5e |
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.cms.api.contract;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractRespDTO;
|
||||
|
||||
public interface ContractApi {
|
||||
|
||||
/**
|
||||
* 获得合同部分信息
|
||||
*/
|
||||
ContractRespDTO getContract(Long id);
|
||||
|
||||
/**
|
||||
* 获得合同detail信息
|
||||
*/
|
||||
ContractDetailRespDTO getContractDetailById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 判断合同是否存在
|
||||
*/
|
||||
void vaildContractExist(Long id);
|
||||
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.cms.api.contract.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ContractDetailRespDTO {
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 合同类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 合同进展
|
||||
*/
|
||||
private String progress;
|
||||
/**
|
||||
* 合同状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 签订合同总额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 审定金额
|
||||
*/
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.cms.api.contract.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ContractRespDTO {
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 合同类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 合同进展
|
||||
*/
|
||||
private String progress;
|
||||
/**
|
||||
* 合同状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 签订合同总额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 审定金额
|
||||
*/
|
||||
private BigDecimal approvedAmount;
|
||||
/**
|
||||
* 计费方式
|
||||
*/
|
||||
private String countType;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.cms.api.outscontract;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractRespDTO;
|
||||
import cn.iocoder.yudao.module.cms.api.outscontract.dto.OutscontractRespDTO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface OutscontractApi {
|
||||
|
||||
OutscontractRespDTO getOutsContract(Long id);
|
||||
|
||||
BigDecimal getOutsContractAmount(Long contractId);
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.cms.api.outscontract.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class OutscontractRespDTO {
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 主合同id
|
||||
*/
|
||||
private Long contractId;
|
||||
/**
|
||||
* 外包合同金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String code;
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.cms.api.contract;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractRespDTO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.contract.ContractMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.CONTRACT_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.PROJECT_NOT_EXISTS;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class ContractImpl implements ContractApi{
|
||||
|
||||
@Resource
|
||||
private ContractMapper contractMapper;
|
||||
|
||||
@Override
|
||||
public ContractRespDTO getContract(Long id) {
|
||||
ContractDO contractDO = contractMapper.selectById(id);
|
||||
ContractRespDTO contractRespDTO = BeanUtils.toBean(contractDO, ContractRespDTO.class);
|
||||
return contractRespDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContractDetailRespDTO getContractDetailById(Long id) {
|
||||
// 优化
|
||||
ContractDO contractRespDTO1 = contractMapper.selectById(id);
|
||||
ContractDetailRespDTO contractDetailRespDTO = BeanUtils.toBean(contractRespDTO1, ContractDetailRespDTO.class);
|
||||
return contractDetailRespDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vaildContractExist(Long id) {
|
||||
if (contractMapper.selectById(id)==null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.cms.api.outscontract;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.cms.api.outscontract.dto.OutscontractRespDTO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.outscontract.OutsContractMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class OutscontractImpl implements OutscontractApi{
|
||||
|
||||
@Resource
|
||||
private OutsContractMapper outsContractMapper;
|
||||
|
||||
@Override
|
||||
public OutscontractRespDTO getOutsContract(Long id) {
|
||||
OutsContractDO outsContractDO = outsContractMapper.selectById(id);
|
||||
OutscontractRespDTO outscontractRespDTO = BeanUtils.toBean(outsContractDO, OutscontractRespDTO.class);
|
||||
return outscontractRespDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getOutsContractAmount(Long contractId) {
|
||||
List<OutsContractDO> contractIds = outsContractMapper.selectList("contract_id", contractId);
|
||||
BigDecimal res = new BigDecimal(0);
|
||||
for (OutsContractDO contract:contractIds){
|
||||
res = res.add(contract.getAmount());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
@@ -24,7 +24,6 @@ public interface ContractMapper extends BaseMapperX<ContractDO> {
|
||||
.eqIfPresent(ContractDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ContractDO::getCountType, reqVO.getCountType())
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -219,12 +219,12 @@ public class ContractServiceImpl implements ContractService {
|
||||
// 7.暂定结算数 √
|
||||
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
contractRespVO.setCode(project.getCode());
|
||||
contractRespVO.setDrawingCompany(project.getDrawingCompany());
|
||||
contractRespVO.setExpectedContractAmount(project.getContractAmount());
|
||||
contractRespVO.setCode(project.getCode()); // 项目编号
|
||||
contractRespVO.setDrawingCompany(project.getDrawingCompany()); // 出图公司
|
||||
contractRespVO.setExpectedContractAmount(project.getContractAmount()); // 预计合同金额
|
||||
ProjectDetailRespDTO projectDetail = projectApi.getProjectDetailById(projectId);
|
||||
contractRespVO.setTrackingDep(projectDetail.getTrackingDepName());
|
||||
contractRespVO.setProjectManager(projectDetail.getProjectManagerName());
|
||||
contractRespVO.setTrackingDep(projectDetail.getTrackingDepName()); // 主控部门
|
||||
contractRespVO.setProjectManager(projectDetail.getProjectManagerName()); // 项目经理
|
||||
|
||||
//分包合同商议提示 TODO 待优化
|
||||
// ExtContractDO extContractDO = extContractMapper.selectOne("project_id", projectId);
|
||||
|
@@ -19,4 +19,5 @@ public class ProjectDetailRespDTO {
|
||||
*/
|
||||
private String customerCompanyName;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.pms.api.project.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.enums.DictTypeConstants;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -8,7 +9,7 @@ import java.math.BigDecimal;
|
||||
* 项目基本信息 dto
|
||||
*/
|
||||
@Data
|
||||
public class ProjectRespDTO {
|
||||
public class ProjectRespDTO{
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,6 +42,23 @@ public class ProjectRespDTO {
|
||||
*/
|
||||
private BigDecimal contractAmount;
|
||||
|
||||
/**
|
||||
* 跟踪编号
|
||||
*/
|
||||
private String trackingCode;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*
|
||||
* 枚举 {@link DictTypeConstants}
|
||||
*/
|
||||
private String type;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -24,4 +24,17 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode RECEIVABLES_NOT_EXISTS = new ErrorCode(1_024_000_000, "应收款管理不存在");
|
||||
// ========== 应收款管理历史记录 1_024_000_000 ==========
|
||||
ErrorCode RECEIVABLES_HISTORY_NOT_EXISTS = new ErrorCode(1_024_000_000, "应收款管理历史记录不存在");
|
||||
|
||||
// ========== 请求参数不存在 1_025_000_000 ==========
|
||||
ErrorCode PARAM_NOT_EXISTS = new ErrorCode(1_024_100_000, "请求参数不存在");
|
||||
|
||||
ErrorCode PARAM_ERROR = new ErrorCode(1_024_200_000, "请求参数错误");
|
||||
|
||||
ErrorCode BUDGET_ALREADY_EXISTS = new ErrorCode(1_024_003_000, "该预算已经创建");
|
||||
|
||||
ErrorCode PROFIT_MARGIN_ERROR = new ErrorCode(1_024_004_000, "利润率计算错误");
|
||||
|
||||
ErrorCode RECEIVABLES_ALREADY_EXISTS = new ErrorCode(1_024_005_000, "该应收款已经创建");
|
||||
|
||||
ErrorCode RECEIVABLES_CALCULATION_ERROR = new ErrorCode(1_024_006_000, "合同应收款计算错误");
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
@@ -24,9 +23,9 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.budget.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDO;
|
||||
import cn.iocoder.yudao.module.pms.service.budget.BudgetService;
|
||||
|
||||
@Tag(name = "管理后台 - 预算管理")
|
||||
@@ -42,14 +41,14 @@ public class BudgetController {
|
||||
@Operation(summary = "创建预算管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget:create')")
|
||||
public CommonResult<Long> createBudget(@Valid @RequestBody BudgetSaveReqVO createReqVO) {
|
||||
return success(budgetService.createBudget(createReqVO));
|
||||
return success(budgetService.createBudget(getLoginUserId(),createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新预算管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget:update')")
|
||||
public CommonResult<Boolean> updateBudget(@Valid @RequestBody BudgetSaveReqVO updateReqVO) {
|
||||
budgetService.updateBudget(updateReqVO);
|
||||
budgetService.updateBudget(getLoginUserId(),updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -67,16 +66,16 @@ public class BudgetController {
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget:query')")
|
||||
public CommonResult<BudgetRespVO> getBudget(@RequestParam("id") Long id) {
|
||||
BudgetDO budget = budgetService.getBudget(id);
|
||||
return success(BeanUtils.toBean(budget, BudgetRespVO.class));
|
||||
BudgetRespVO budgetRespVO = budgetService.getBudget(id);
|
||||
return success(budgetRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得预算管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget:query')")
|
||||
public CommonResult<PageResult<BudgetRespVO>> getBudgetPage(@Valid BudgetPageReqVO pageReqVO) {
|
||||
PageResult<BudgetDO> pageResult = budgetService.getBudgetPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BudgetRespVO.class));
|
||||
PageResult<BudgetRespVO> pageResult = budgetService.getBudgetPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -86,7 +85,7 @@ public class BudgetController {
|
||||
public void exportBudgetExcel(@Valid BudgetPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BudgetDO> list = budgetService.getBudgetPage(pageReqVO).getList();
|
||||
List<BudgetRespVO> list = budgetService.getBudgetPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "预算管理.xls", "数据", BudgetRespVO.class,
|
||||
BeanUtils.toBean(list, BudgetRespVO.class));
|
||||
|
@@ -13,6 +13,55 @@ import com.alibaba.excel.annotation.*;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class BudgetRespVO {
|
||||
|
||||
@Schema(description = "跟踪项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS24001")
|
||||
@ExcelProperty("跟踪项目编号")
|
||||
private String trackingProjectCode;
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "跟踪项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "规划一路道路工程")
|
||||
@ExcelProperty("跟踪项目名称")
|
||||
private String trackingProjectName;
|
||||
|
||||
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "设计")
|
||||
@ExcelProperty("项目类型")
|
||||
private String projectType;
|
||||
|
||||
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED,example = "200.0000")
|
||||
@ExcelProperty("预计合同金额")
|
||||
private BigDecimal expectedContractAmount;
|
||||
|
||||
@Schema(description = "暂定结算数")
|
||||
@ExcelProperty("暂定结算数")
|
||||
private BigDecimal provisionalSettlement;
|
||||
|
||||
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("包干/审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "外包合同金额")
|
||||
@ExcelProperty("外包合同金额")
|
||||
private BigDecimal outAmount;
|
||||
|
||||
@Schema(description = "有效合同金额")
|
||||
@ExcelProperty("有效合同金额")
|
||||
private BigDecimal validContractAmount;
|
||||
|
||||
@Schema(description = "预估利润率")
|
||||
@ExcelProperty("预估利润率")
|
||||
private BigDecimal estimatedProfitMargin;
|
||||
|
||||
@Schema(description = "实际利润率")
|
||||
@ExcelProperty("实际利润率")
|
||||
private BigDecimal realProfitMargin;
|
||||
|
||||
@Schema(description = "利润预警")
|
||||
@ExcelProperty("利润预警")
|
||||
private String profitWarning;
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25375")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.pms.controller.admin.budget.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
@@ -10,6 +11,56 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class BudgetSaveReqVO {
|
||||
|
||||
@Schema(description = "跟踪项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS24001")
|
||||
@ExcelProperty("跟踪项目编号")
|
||||
private String trackingProjectCode;
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "跟踪项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "规划一路道路工程")
|
||||
@ExcelProperty("跟踪项目名称")
|
||||
private String trackingProjectName;
|
||||
|
||||
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "设计")
|
||||
@ExcelProperty("项目类型")
|
||||
private String projectType;
|
||||
|
||||
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED,example = "200.0000")
|
||||
@ExcelProperty("预计合同金额")
|
||||
private BigDecimal expectedContractAmount;
|
||||
|
||||
@Schema(description = "暂定结算数")
|
||||
@ExcelProperty("暂定结算数")
|
||||
private BigDecimal provisionalSettlement;
|
||||
|
||||
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("包干/审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "外包合同金额")
|
||||
@ExcelProperty("外包合同金额")
|
||||
private BigDecimal outAmount;
|
||||
|
||||
@Schema(description = "有效合同金额")
|
||||
@ExcelProperty("有效合同金额")
|
||||
private BigDecimal validContractAmount;
|
||||
|
||||
@Schema(description = "预估利润率")
|
||||
@ExcelProperty("预估利润率")
|
||||
private BigDecimal estimatedProfitMargin;
|
||||
|
||||
@Schema(description = "实际利润率")
|
||||
@ExcelProperty("实际利润率")
|
||||
private BigDecimal realProfitMargin;
|
||||
|
||||
@Schema(description = "利润预警")
|
||||
@ExcelProperty("利润预警")
|
||||
private String profitWarning;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25375")
|
||||
private Long id;
|
||||
|
||||
|
@@ -24,6 +24,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.budgethistory.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDO;
|
||||
@@ -38,27 +39,12 @@ public class BudgetHistoryController {
|
||||
@Resource
|
||||
private BudgetHistoryService budgetHistoryService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建历史预算管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget-history:create')")
|
||||
public CommonResult<Long> createBudgetHistory(@Valid @RequestBody BudgetHistorySaveReqVO createReqVO) {
|
||||
return success(budgetHistoryService.createBudgetHistory(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新历史预算管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget-history:update')")
|
||||
public CommonResult<Boolean> updateBudgetHistory(@Valid @RequestBody BudgetHistorySaveReqVO updateReqVO) {
|
||||
budgetHistoryService.updateBudgetHistory(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除历史预算管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget-history:delete')")
|
||||
public CommonResult<Boolean> deleteBudgetHistory(@RequestParam("id") Long id) {
|
||||
budgetHistoryService.deleteBudgetHistory(id);
|
||||
budgetHistoryService.updateBudgetHistory(getLoginUserId(), updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -67,16 +53,16 @@ public class BudgetHistoryController {
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget-history:query')")
|
||||
public CommonResult<BudgetHistoryRespVO> getBudgetHistory(@RequestParam("id") Long id) {
|
||||
BudgetHistoryDO budgetHistory = budgetHistoryService.getBudgetHistory(id);
|
||||
return success(BeanUtils.toBean(budgetHistory, BudgetHistoryRespVO.class));
|
||||
BudgetHistoryRespVO budgetHistory = budgetHistoryService.getBudgetHistory(id);
|
||||
return success(budgetHistory);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得历史预算管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget-history:query')")
|
||||
public CommonResult<PageResult<BudgetHistoryRespVO>> getBudgetHistoryPage(@Valid BudgetHistoryPageReqVO pageReqVO) {
|
||||
PageResult<BudgetHistoryDO> pageResult = budgetHistoryService.getBudgetHistoryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BudgetHistoryRespVO.class));
|
||||
PageResult<BudgetHistoryRespVO> pageResult = budgetHistoryService.getBudgetHistoryPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -86,7 +72,7 @@ public class BudgetHistoryController {
|
||||
public void exportBudgetHistoryExcel(@Valid BudgetHistoryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BudgetHistoryDO> list = budgetHistoryService.getBudgetHistoryPage(pageReqVO).getList();
|
||||
List<BudgetHistoryRespVO> list = budgetHistoryService.getBudgetHistoryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "历史预算管理.xls", "数据", BudgetHistoryRespVO.class,
|
||||
BeanUtils.toBean(list, BudgetHistoryRespVO.class));
|
||||
|
@@ -13,6 +13,55 @@ import com.alibaba.excel.annotation.*;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class BudgetHistoryRespVO {
|
||||
|
||||
@Schema(description = "跟踪项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS24001")
|
||||
@ExcelProperty("跟踪项目编号")
|
||||
private String trackingProjectCode;
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "跟踪项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "规划一路道路工程")
|
||||
@ExcelProperty("跟踪项目名称")
|
||||
private String trackingProjectName;
|
||||
|
||||
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "设计")
|
||||
@ExcelProperty("项目类型")
|
||||
private String projectType;
|
||||
|
||||
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED,example = "200.0000")
|
||||
@ExcelProperty("预计合同金额")
|
||||
private BigDecimal expectedContractAmount;
|
||||
|
||||
@Schema(description = "暂定结算数")
|
||||
@ExcelProperty("暂定结算数")
|
||||
private BigDecimal provisionalSettlement;
|
||||
|
||||
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("包干/审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "外包合同金额")
|
||||
@ExcelProperty("外包合同金额")
|
||||
private BigDecimal outAmount;
|
||||
|
||||
@Schema(description = "有效合同金额")
|
||||
@ExcelProperty("有效合同金额")
|
||||
private BigDecimal validContractAmount;
|
||||
|
||||
@Schema(description = "预估利润率")
|
||||
@ExcelProperty("预估利润率")
|
||||
private BigDecimal estimatedProfitMargin;
|
||||
|
||||
@Schema(description = "实际利润率")
|
||||
@ExcelProperty("实际利润率")
|
||||
private BigDecimal realProfitMargin;
|
||||
|
||||
@Schema(description = "利润预警")
|
||||
@ExcelProperty("利润预警")
|
||||
private String profitWarning;
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2972")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.pms.controller.admin.budgethistory.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
@@ -10,6 +11,55 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class BudgetHistorySaveReqVO {
|
||||
|
||||
@Schema(description = "跟踪项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS24001")
|
||||
@ExcelProperty("跟踪项目编号")
|
||||
private String trackingProjectCode;
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "跟踪项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "规划一路道路工程")
|
||||
@ExcelProperty("跟踪项目名称")
|
||||
private String trackingProjectName;
|
||||
|
||||
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "设计")
|
||||
@ExcelProperty("项目类型")
|
||||
private String projectType;
|
||||
|
||||
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED,example = "200.0000")
|
||||
@ExcelProperty("预计合同金额")
|
||||
private BigDecimal expectedContractAmount;
|
||||
|
||||
@Schema(description = "暂定结算数")
|
||||
@ExcelProperty("暂定结算数")
|
||||
private BigDecimal provisionalSettlement;
|
||||
|
||||
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("包干/审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "外包合同金额")
|
||||
@ExcelProperty("外包合同金额")
|
||||
private BigDecimal outAmount;
|
||||
|
||||
@Schema(description = "有效合同金额")
|
||||
@ExcelProperty("有效合同金额")
|
||||
private BigDecimal validContractAmount;
|
||||
|
||||
@Schema(description = "预估利润率")
|
||||
@ExcelProperty("预估利润率")
|
||||
private BigDecimal estimatedProfitMargin;
|
||||
|
||||
@Schema(description = "实际利润率")
|
||||
@ExcelProperty("实际利润率")
|
||||
private BigDecimal realProfitMargin;
|
||||
|
||||
@Schema(description = "利润预警")
|
||||
@ExcelProperty("利润预警")
|
||||
private String profitWarning;
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2972")
|
||||
private Long id;
|
||||
|
||||
|
@@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.pms.controller.admin.projectschedule;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.projectschedule.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.projectschedule.ProjectScheduleDO;
|
||||
import cn.iocoder.yudao.module.pms.service.projectschedule.ProjectScheduleService;
|
||||
|
||||
@Tag(name = "管理后台 - 项目进度管理")
|
||||
@RestController
|
||||
@RequestMapping("/pms/project-schedule")
|
||||
@Validated
|
||||
public class ProjectScheduleController {
|
||||
|
||||
@Resource
|
||||
private ProjectScheduleService projectScheduleService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建项目进度管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:project-schedule:create')")
|
||||
public CommonResult<Long> createProjectSchedule(@Valid @RequestBody ProjectScheduleSaveReqVO createReqVO) {
|
||||
return success(projectScheduleService.createProjectSchedule(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新项目进度管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:project-schedule:update')")
|
||||
public CommonResult<Boolean> updateProjectSchedule(@Valid @RequestBody ProjectScheduleSaveReqVO updateReqVO) {
|
||||
projectScheduleService.updateProjectSchedule(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除项目进度管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('pms:project-schedule:delete')")
|
||||
public CommonResult<Boolean> deleteProjectSchedule(@RequestParam("id") Long id) {
|
||||
projectScheduleService.deleteProjectSchedule(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得项目进度管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pms:project-schedule:query')")
|
||||
public CommonResult<ProjectScheduleRespVO> getProjectSchedule(@RequestParam("id") Long id) {
|
||||
ProjectScheduleDO projectSchedule = projectScheduleService.getProjectSchedule(id);
|
||||
return success(BeanUtils.toBean(projectSchedule, ProjectScheduleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得项目进度管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('pms:project-schedule:query')")
|
||||
public CommonResult<PageResult<ProjectScheduleRespVO>> getProjectSchedulePage(@Valid ProjectSchedulePageReqVO pageReqVO) {
|
||||
PageResult<ProjectScheduleDO> pageResult = projectScheduleService.getProjectSchedulePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ProjectScheduleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出项目进度管理 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('pms:project-schedule:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportProjectScheduleExcel(@Valid ProjectSchedulePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ProjectScheduleDO> list = projectScheduleService.getProjectSchedulePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "项目进度管理.xls", "数据", ProjectScheduleRespVO.class,
|
||||
BeanUtils.toBean(list, ProjectScheduleRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
package cn.iocoder.yudao.module.pms.controller.admin.projectschedule.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 项目进度管理分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProjectSchedulePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "项目id", example = "26813")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "项目负责人")
|
||||
private String projectLeader;
|
||||
|
||||
@Schema(description = "主专业")
|
||||
private String major;
|
||||
|
||||
@Schema(description = "其他专业")
|
||||
private String minorMajors;
|
||||
|
||||
@Schema(description = "其他主要项目组成员")
|
||||
private String minorUserIds;
|
||||
|
||||
@Schema(description = "规模")
|
||||
private String scale;
|
||||
|
||||
@Schema(description = "项目概况")
|
||||
private String survey;
|
||||
|
||||
@Schema(description = "相关批复文件url", example = "https://www.iocoder.cn")
|
||||
private String replyFileUrl;
|
||||
|
||||
@Schema(description = "当前阶段")
|
||||
private String stage;
|
||||
|
||||
@Schema(description = "已完成的项目阶段")
|
||||
private String preStage;
|
||||
|
||||
@Schema(description = "工作进展")
|
||||
private String progress;
|
||||
|
||||
@Schema(description = "外部合同商议时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] contractNegotiationTime;
|
||||
|
||||
@Schema(description = "已完成百分比")
|
||||
private BigDecimal completed;
|
||||
|
||||
@Schema(description = "截至本月累计完成百分比")
|
||||
private BigDecimal accumulatedCompletion;
|
||||
|
||||
@Schema(description = "本月新增完工比")
|
||||
private BigDecimal newlyIncreasedCompletion;
|
||||
|
||||
@Schema(description = "已完成产值")
|
||||
private BigDecimal finishOutput;
|
||||
|
||||
@Schema(description = "本月新增产值")
|
||||
private BigDecimal newlyIncreasedOutput;
|
||||
|
||||
@Schema(description = "累积产值")
|
||||
private BigDecimal accumulatedOutput;
|
||||
|
||||
@Schema(description = "竣工时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] completionTime;
|
||||
|
||||
@Schema(description = "单选")
|
||||
private Boolean choose;
|
||||
|
||||
@Schema(description = "竣工报告附件url", example = "https://www.iocoder.cn")
|
||||
private String completionFileUrl;
|
||||
|
||||
@Schema(description = "最后编辑人")
|
||||
private String finalEditor;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "更新人")
|
||||
private String updator;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] updateTime;
|
||||
|
||||
@Schema(description = "是否删除")
|
||||
private Boolean deleted;
|
||||
|
||||
@Schema(description = "租户id", example = "1")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
@@ -0,0 +1,132 @@
|
||||
package cn.iocoder.yudao.module.pms.controller.admin.projectschedule.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 项目进度管理 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ProjectScheduleRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28495")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26813")
|
||||
@ExcelProperty("项目id")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "项目负责人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("项目负责人")
|
||||
private String projectLeader;
|
||||
|
||||
@Schema(description = "主专业", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("主专业")
|
||||
private String major;
|
||||
|
||||
@Schema(description = "其他专业")
|
||||
@ExcelProperty("其他专业")
|
||||
private String minorMajors;
|
||||
|
||||
@Schema(description = "其他主要项目组成员")
|
||||
@ExcelProperty("其他主要项目组成员")
|
||||
private String minorUserIds;
|
||||
|
||||
@Schema(description = "规模", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("规模")
|
||||
private String scale;
|
||||
|
||||
@Schema(description = "项目概况", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("项目概况")
|
||||
private String survey;
|
||||
|
||||
@Schema(description = "相关批复文件url", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("相关批复文件url")
|
||||
private String replyFileUrl;
|
||||
|
||||
@Schema(description = "当前阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("当前阶段")
|
||||
private String stage;
|
||||
|
||||
@Schema(description = "已完成的项目阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("已完成的项目阶段")
|
||||
private String preStage;
|
||||
|
||||
@Schema(description = "工作进展", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("工作进展")
|
||||
private String progress;
|
||||
|
||||
@Schema(description = "外部合同商议时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("外部合同商议时间")
|
||||
private LocalDateTime contractNegotiationTime;
|
||||
|
||||
@Schema(description = "已完成百分比", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("已完成百分比")
|
||||
private BigDecimal completed;
|
||||
|
||||
@Schema(description = "截至本月累计完成百分比")
|
||||
@ExcelProperty("截至本月累计完成百分比")
|
||||
private BigDecimal accumulatedCompletion;
|
||||
|
||||
@Schema(description = "本月新增完工比")
|
||||
@ExcelProperty("本月新增完工比")
|
||||
private BigDecimal newlyIncreasedCompletion;
|
||||
|
||||
@Schema(description = "已完成产值")
|
||||
@ExcelProperty("已完成产值")
|
||||
private BigDecimal finishOutput;
|
||||
|
||||
@Schema(description = "本月新增产值")
|
||||
@ExcelProperty("本月新增产值")
|
||||
private BigDecimal newlyIncreasedOutput;
|
||||
|
||||
@Schema(description = "累积产值")
|
||||
@ExcelProperty("累积产值")
|
||||
private BigDecimal accumulatedOutput;
|
||||
|
||||
@Schema(description = "竣工时间")
|
||||
@ExcelProperty("竣工时间")
|
||||
private LocalDateTime completionTime;
|
||||
|
||||
@Schema(description = "单选")
|
||||
@ExcelProperty("单选")
|
||||
private Boolean choose;
|
||||
|
||||
@Schema(description = "竣工报告附件url", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("竣工报告附件url")
|
||||
private String completionFileUrl;
|
||||
|
||||
@Schema(description = "最后编辑人")
|
||||
@ExcelProperty("最后编辑人")
|
||||
private String finalEditor;
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("更新人")
|
||||
private String updator;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否删除")
|
||||
private Boolean deleted;
|
||||
|
||||
@Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
@@ -0,0 +1,116 @@
|
||||
package cn.iocoder.yudao.module.pms.controller.admin.projectschedule.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 项目进度管理新增/修改 Request VO")
|
||||
@Data
|
||||
public class ProjectScheduleSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28495")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26813")
|
||||
@NotNull(message = "项目id不能为空")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "项目负责人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "项目负责人不能为空")
|
||||
private String projectLeader;
|
||||
|
||||
@Schema(description = "主专业", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "主专业不能为空")
|
||||
private String major;
|
||||
|
||||
@Schema(description = "其他专业")
|
||||
private String minorMajors;
|
||||
|
||||
@Schema(description = "其他主要项目组成员")
|
||||
private String minorUserIds;
|
||||
|
||||
@Schema(description = "规模", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "规模不能为空")
|
||||
private String scale;
|
||||
|
||||
@Schema(description = "项目概况", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "项目概况不能为空")
|
||||
private String survey;
|
||||
|
||||
@Schema(description = "相关批复文件url", example = "https://www.iocoder.cn")
|
||||
private String replyFileUrl;
|
||||
|
||||
@Schema(description = "当前阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "当前阶段不能为空")
|
||||
private String stage;
|
||||
|
||||
@Schema(description = "已完成的项目阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "已完成的项目阶段不能为空")
|
||||
private String preStage;
|
||||
|
||||
@Schema(description = "工作进展", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "工作进展不能为空")
|
||||
private String progress;
|
||||
|
||||
@Schema(description = "外部合同商议时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "外部合同商议时间不能为空")
|
||||
private LocalDateTime contractNegotiationTime;
|
||||
|
||||
@Schema(description = "已完成百分比", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "已完成百分比不能为空")
|
||||
private BigDecimal completed;
|
||||
|
||||
@Schema(description = "截至本月累计完成百分比")
|
||||
private BigDecimal accumulatedCompletion;
|
||||
|
||||
@Schema(description = "本月新增完工比")
|
||||
private BigDecimal newlyIncreasedCompletion;
|
||||
|
||||
@Schema(description = "已完成产值")
|
||||
private BigDecimal finishOutput;
|
||||
|
||||
@Schema(description = "本月新增产值")
|
||||
private BigDecimal newlyIncreasedOutput;
|
||||
|
||||
@Schema(description = "累积产值")
|
||||
private BigDecimal accumulatedOutput;
|
||||
|
||||
@Schema(description = "竣工时间")
|
||||
private LocalDateTime completionTime;
|
||||
|
||||
@Schema(description = "单选")
|
||||
private Boolean choose;
|
||||
|
||||
@Schema(description = "竣工报告附件url", example = "https://www.iocoder.cn")
|
||||
private String completionFileUrl;
|
||||
|
||||
@Schema(description = "最后编辑人")
|
||||
private String finalEditor;
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "创建人不能为空")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "更新人不能为空")
|
||||
private String updator;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否删除不能为空")
|
||||
private Boolean deleted;
|
||||
|
||||
@Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "租户id不能为空")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
@@ -24,6 +24,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.receivables.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.receivables.ReceivablesDO;
|
||||
@@ -42,14 +43,14 @@ public class ReceivablesController {
|
||||
@Operation(summary = "创建应收款管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables:create')")
|
||||
public CommonResult<Long> createReceivables(@Valid @RequestBody ReceivablesSaveReqVO createReqVO) {
|
||||
return success(receivablesService.createReceivables(createReqVO));
|
||||
return success(receivablesService.createReceivables(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新应收款管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables:update')")
|
||||
public CommonResult<Boolean> updateReceivables(@Valid @RequestBody ReceivablesSaveReqVO updateReqVO) {
|
||||
receivablesService.updateReceivables(updateReqVO);
|
||||
receivablesService.updateReceivables(getLoginUserId(), updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -67,16 +68,16 @@ public class ReceivablesController {
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables:query')")
|
||||
public CommonResult<ReceivablesRespVO> getReceivables(@RequestParam("id") Long id) {
|
||||
ReceivablesDO receivables = receivablesService.getReceivables(id);
|
||||
return success(BeanUtils.toBean(receivables, ReceivablesRespVO.class));
|
||||
ReceivablesRespVO receivables = receivablesService.getReceivables(id);
|
||||
return success(receivables);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得应收款管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables:query')")
|
||||
public CommonResult<PageResult<ReceivablesRespVO>> getReceivablesPage(@Valid ReceivablesPageReqVO pageReqVO) {
|
||||
PageResult<ReceivablesDO> pageResult = receivablesService.getReceivablesPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ReceivablesRespVO.class));
|
||||
PageResult<ReceivablesRespVO> pageResult = receivablesService.getReceivablesPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -86,7 +87,7 @@ public class ReceivablesController {
|
||||
public void exportReceivablesExcel(@Valid ReceivablesPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ReceivablesDO> list = receivablesService.getReceivablesPage(pageReqVO).getList();
|
||||
List<ReceivablesRespVO> list = receivablesService.getReceivablesPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "应收款管理.xls", "数据", ReceivablesRespVO.class,
|
||||
BeanUtils.toBean(list, ReceivablesRespVO.class));
|
||||
|
@@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.pms.controller.admin.receivables.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -12,6 +14,39 @@ import com.alibaba.excel.annotation.*;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ReceivablesRespVO {
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "规划一路道路工程勘察设计合同")
|
||||
@ExcelProperty("合同名称")
|
||||
private String contractName;
|
||||
|
||||
@Schema(description = "签订合同总额", requiredMode = Schema.RequiredMode.REQUIRED, example = "80.0000")
|
||||
@ExcelProperty("签订合同总额")
|
||||
private BigDecimal signedAmount;
|
||||
|
||||
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("包干/审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "已完成设计阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("已完成设计阶段")
|
||||
private String completedDesignStage;
|
||||
|
||||
@Schema(description = "应收款取数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("应收款取数")
|
||||
private BigDecimal receivableAccount;
|
||||
|
||||
@Schema(description = "合同应收款", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("合同应收款")
|
||||
private BigDecimal contractualReceivables;
|
||||
|
||||
@Schema(description = "应收款差额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("应收款差额")
|
||||
private BigDecimal receivableDifference;
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
@@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.pms.controller.admin.receivables.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@@ -9,6 +12,39 @@ import jakarta.validation.constraints.*;
|
||||
@Data
|
||||
public class ReceivablesSaveReqVO {
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "规划一路道路工程勘察设计合同")
|
||||
@ExcelProperty("合同名称")
|
||||
private String contractName;
|
||||
|
||||
@Schema(description = "签订合同总额", requiredMode = Schema.RequiredMode.REQUIRED, example = "80.0000")
|
||||
@ExcelProperty("签订合同总额")
|
||||
private BigDecimal signedAmount;
|
||||
|
||||
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("包干/审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "已完成设计阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("已完成设计阶段")
|
||||
private String completedDesignStage;
|
||||
|
||||
@Schema(description = "应收款取数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("应收款取数")
|
||||
private BigDecimal receivableAccount;
|
||||
|
||||
@Schema(description = "合同应收款", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("合同应收款")
|
||||
private BigDecimal contractualReceivables;
|
||||
|
||||
@Schema(description = "应收款差额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("应收款差额")
|
||||
private BigDecimal receivableDifference;
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
|
@@ -24,6 +24,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
||||
@@ -38,27 +39,11 @@ public class ReceivablesHistoryController {
|
||||
@Resource
|
||||
private ReceivablesHistoryService receivablesHistoryService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建应收款管理历史记录")
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:create')")
|
||||
public CommonResult<Long> createReceivablesHistory(@Valid @RequestBody ReceivablesHistorySaveReqVO createReqVO) {
|
||||
return success(receivablesHistoryService.createReceivablesHistory(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新应收款管理历史记录")
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:update')")
|
||||
public CommonResult<Boolean> updateReceivablesHistory(@Valid @RequestBody ReceivablesHistorySaveReqVO updateReqVO) {
|
||||
receivablesHistoryService.updateReceivablesHistory(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除应收款管理历史记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:delete')")
|
||||
public CommonResult<Boolean> deleteReceivablesHistory(@RequestParam("id") Long id) {
|
||||
receivablesHistoryService.deleteReceivablesHistory(id);
|
||||
public CommonResult<Boolean> updateReceivablesHistory(Long loginUserId, @Valid @RequestBody ReceivablesHistorySaveReqVO updateReqVO) {
|
||||
receivablesHistoryService.updateReceivablesHistory(getLoginUserId(), updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -67,16 +52,16 @@ public class ReceivablesHistoryController {
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:query')")
|
||||
public CommonResult<ReceivablesHistoryRespVO> getReceivablesHistory(@RequestParam("id") Long id) {
|
||||
ReceivablesHistoryDO receivablesHistory = receivablesHistoryService.getReceivablesHistory(id);
|
||||
return success(BeanUtils.toBean(receivablesHistory, ReceivablesHistoryRespVO.class));
|
||||
ReceivablesHistoryRespVO receivablesHistory = receivablesHistoryService.getReceivablesHistory(id);
|
||||
return success(receivablesHistory);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得应收款管理历史记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('pms:receivables-history:query')")
|
||||
public CommonResult<PageResult<ReceivablesHistoryRespVO>> getReceivablesHistoryPage(@Valid ReceivablesHistoryPageReqVO pageReqVO) {
|
||||
PageResult<ReceivablesHistoryDO> pageResult = receivablesHistoryService.getReceivablesHistoryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ReceivablesHistoryRespVO.class));
|
||||
PageResult<ReceivablesHistoryRespVO> pageResult = receivablesHistoryService.getReceivablesHistoryPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -86,7 +71,7 @@ public class ReceivablesHistoryController {
|
||||
public void exportReceivablesHistoryExcel(@Valid ReceivablesHistoryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ReceivablesHistoryDO> list = receivablesHistoryService.getReceivablesHistoryPage(pageReqVO).getList();
|
||||
List<ReceivablesHistoryRespVO> list = receivablesHistoryService.getReceivablesHistoryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "应收款管理历史记录.xls", "数据", ReceivablesHistoryRespVO.class,
|
||||
BeanUtils.toBean(list, ReceivablesHistoryRespVO.class));
|
||||
|
@@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -12,6 +14,39 @@ import com.alibaba.excel.annotation.*;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ReceivablesHistoryRespVO {
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "规划一路道路工程勘察设计合同")
|
||||
@ExcelProperty("合同名称")
|
||||
private String contractName;
|
||||
|
||||
@Schema(description = "签订合同总额", requiredMode = Schema.RequiredMode.REQUIRED, example = "80.0000")
|
||||
@ExcelProperty("签订合同总额")
|
||||
private BigDecimal signedAmount;
|
||||
|
||||
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("包干/审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "已完成设计阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("已完成设计阶段")
|
||||
private String completedDesignStage;
|
||||
|
||||
@Schema(description = "应收款取数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("应收款取数")
|
||||
private BigDecimal receivableAccount;
|
||||
|
||||
@Schema(description = "合同应收款", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("合同应收款")
|
||||
private BigDecimal contractualReceivables;
|
||||
|
||||
@Schema(description = "应收款差额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("应收款差额")
|
||||
private BigDecimal receivableDifference;
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20822")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
@@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@@ -9,6 +12,39 @@ import jakarta.validation.constraints.*;
|
||||
@Data
|
||||
public class ReceivablesHistorySaveReqVO {
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "规划一路道路工程勘察设计合同")
|
||||
@ExcelProperty("合同名称")
|
||||
private String contractName;
|
||||
|
||||
@Schema(description = "签订合同总额", requiredMode = Schema.RequiredMode.REQUIRED, example = "80.0000")
|
||||
@ExcelProperty("签订合同总额")
|
||||
private BigDecimal signedAmount;
|
||||
|
||||
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("包干/审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "已完成设计阶段", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("已完成设计阶段")
|
||||
private String completedDesignStage;
|
||||
|
||||
@Schema(description = "应收款取数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("应收款取数")
|
||||
private BigDecimal receivableAccount;
|
||||
|
||||
@Schema(description = "合同应收款", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("合同应收款")
|
||||
private BigDecimal contractualReceivables;
|
||||
|
||||
@Schema(description = "应收款差额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("应收款差额")
|
||||
private BigDecimal receivableDifference;
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20822")
|
||||
private Long id;
|
||||
|
||||
|
@@ -14,12 +14,15 @@ public class ProjectDetailDO extends ProjectDO {
|
||||
* 跟踪部门
|
||||
*/
|
||||
private String trackingDepName;
|
||||
|
||||
/**
|
||||
* 项目经理
|
||||
*/
|
||||
private String projectManagerName;
|
||||
|
||||
/**
|
||||
* 客户公司
|
||||
*/
|
||||
private String customerCompanyName;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,131 @@
|
||||
package cn.iocoder.yudao.module.pms.dal.dataobject.projectschedule;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 项目进度管理 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("pms_project_schedule")
|
||||
@KeySequence("pms_project_schedule_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProjectScheduleDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 项目负责人
|
||||
*/
|
||||
private String projectLeader;
|
||||
/**
|
||||
* 主专业
|
||||
*/
|
||||
private String major;
|
||||
/**
|
||||
* 其他专业
|
||||
*/
|
||||
private String minorMajors;
|
||||
/**
|
||||
* 其他主要项目组成员
|
||||
*/
|
||||
private String minorUserIds;
|
||||
/**
|
||||
* 规模
|
||||
*/
|
||||
private String scale;
|
||||
/**
|
||||
* 项目概况
|
||||
*/
|
||||
private String survey;
|
||||
/**
|
||||
* 相关批复文件url
|
||||
*/
|
||||
private String replyFileUrl;
|
||||
/**
|
||||
* 当前阶段
|
||||
*/
|
||||
private String stage;
|
||||
/**
|
||||
* 已完成的项目阶段
|
||||
*/
|
||||
private String preStage;
|
||||
/**
|
||||
* 工作进展
|
||||
*/
|
||||
private String progress;
|
||||
/**
|
||||
* 外部合同商议时间
|
||||
*/
|
||||
private LocalDateTime contractNegotiationTime;
|
||||
/**
|
||||
* 已完成百分比
|
||||
*/
|
||||
private BigDecimal completed;
|
||||
/**
|
||||
* 截至本月累计完成百分比
|
||||
*/
|
||||
private BigDecimal accumulatedCompletion;
|
||||
/**
|
||||
* 本月新增完工比
|
||||
*/
|
||||
private BigDecimal newlyIncreasedCompletion;
|
||||
/**
|
||||
* 已完成产值
|
||||
*/
|
||||
private BigDecimal finishOutput;
|
||||
/**
|
||||
* 本月新增产值
|
||||
*/
|
||||
private BigDecimal newlyIncreasedOutput;
|
||||
/**
|
||||
* 累积产值
|
||||
*/
|
||||
private BigDecimal accumulatedOutput;
|
||||
/**
|
||||
* 竣工时间
|
||||
*/
|
||||
private LocalDateTime completionTime;
|
||||
/**
|
||||
* 单选
|
||||
*/
|
||||
private Boolean choose;
|
||||
/**
|
||||
* 竣工报告附件url
|
||||
*/
|
||||
private String completionFileUrl;
|
||||
/**
|
||||
* 最后编辑人
|
||||
*/
|
||||
private String finalEditor;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updator;
|
||||
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.pms.dal.mysql.projectschedule;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.projectschedule.ProjectScheduleDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.projectschedule.vo.*;
|
||||
|
||||
/**
|
||||
* 项目进度管理 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectScheduleMapper extends BaseMapperX<ProjectScheduleDO> {
|
||||
|
||||
default PageResult<ProjectScheduleDO> selectPage(ProjectSchedulePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProjectScheduleDO>()
|
||||
.eqIfPresent(ProjectScheduleDO::getProjectId, reqVO.getProjectId())
|
||||
.eqIfPresent(ProjectScheduleDO::getProjectLeader, reqVO.getProjectLeader())
|
||||
.eqIfPresent(ProjectScheduleDO::getMajor, reqVO.getMajor())
|
||||
.eqIfPresent(ProjectScheduleDO::getMinorMajors, reqVO.getMinorMajors())
|
||||
.eqIfPresent(ProjectScheduleDO::getMinorUserIds, reqVO.getMinorUserIds())
|
||||
.eqIfPresent(ProjectScheduleDO::getScale, reqVO.getScale())
|
||||
.eqIfPresent(ProjectScheduleDO::getSurvey, reqVO.getSurvey())
|
||||
.eqIfPresent(ProjectScheduleDO::getReplyFileUrl, reqVO.getReplyFileUrl())
|
||||
.eqIfPresent(ProjectScheduleDO::getStage, reqVO.getStage())
|
||||
.eqIfPresent(ProjectScheduleDO::getPreStage, reqVO.getPreStage())
|
||||
.eqIfPresent(ProjectScheduleDO::getProgress, reqVO.getProgress())
|
||||
.betweenIfPresent(ProjectScheduleDO::getContractNegotiationTime, reqVO.getContractNegotiationTime())
|
||||
.eqIfPresent(ProjectScheduleDO::getCompleted, reqVO.getCompleted())
|
||||
.eqIfPresent(ProjectScheduleDO::getAccumulatedCompletion, reqVO.getAccumulatedCompletion())
|
||||
.eqIfPresent(ProjectScheduleDO::getNewlyIncreasedCompletion, reqVO.getNewlyIncreasedCompletion())
|
||||
.eqIfPresent(ProjectScheduleDO::getFinishOutput, reqVO.getFinishOutput())
|
||||
.eqIfPresent(ProjectScheduleDO::getNewlyIncreasedOutput, reqVO.getNewlyIncreasedOutput())
|
||||
.eqIfPresent(ProjectScheduleDO::getAccumulatedOutput, reqVO.getAccumulatedOutput())
|
||||
.betweenIfPresent(ProjectScheduleDO::getCompletionTime, reqVO.getCompletionTime())
|
||||
.eqIfPresent(ProjectScheduleDO::getChoose, reqVO.getChoose())
|
||||
.eqIfPresent(ProjectScheduleDO::getCompletionFileUrl, reqVO.getCompletionFileUrl())
|
||||
.eqIfPresent(ProjectScheduleDO::getFinalEditor, reqVO.getFinalEditor())
|
||||
.eqIfPresent(ProjectScheduleDO::getCreator, reqVO.getCreator())
|
||||
.betweenIfPresent(ProjectScheduleDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(ProjectScheduleDO::getUpdator, reqVO.getUpdator())
|
||||
.betweenIfPresent(ProjectScheduleDO::getUpdateTime, reqVO.getUpdateTime())
|
||||
.eqIfPresent(ProjectScheduleDO::getDeleted, reqVO.getDeleted())
|
||||
.orderByDesc(ProjectScheduleDO::getId));
|
||||
}
|
||||
|
||||
}
|
@@ -1,11 +1,9 @@
|
||||
package cn.iocoder.yudao.module.pms.service.budget;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.budget.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 预算管理 Service 接口
|
||||
@@ -20,14 +18,14 @@ public interface BudgetService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createBudget(@Valid BudgetSaveReqVO createReqVO);
|
||||
Long createBudget(Long loginUserId, @Valid BudgetSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新预算管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBudget(@Valid BudgetSaveReqVO updateReqVO);
|
||||
void updateBudget(Long loginUserId, @Valid BudgetSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除预算管理
|
||||
@@ -42,7 +40,7 @@ public interface BudgetService {
|
||||
* @param id 编号
|
||||
* @return 预算管理
|
||||
*/
|
||||
BudgetDO getBudget(Long id);
|
||||
BudgetRespVO getBudget(Long id);
|
||||
|
||||
/**
|
||||
* 获得预算管理分页
|
||||
@@ -50,6 +48,6 @@ public interface BudgetService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 预算管理分页
|
||||
*/
|
||||
PageResult<BudgetDO> getBudgetPage(BudgetPageReqVO pageReqVO);
|
||||
PageResult<BudgetRespVO> getBudgetPage(BudgetPageReqVO pageReqVO);
|
||||
|
||||
}
|
@@ -1,21 +1,34 @@
|
||||
package cn.iocoder.yudao.module.pms.service.budget;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.ContractApi;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractRespDTO;
|
||||
import cn.iocoder.yudao.module.cms.api.outscontract.OutscontractApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDO;
|
||||
import cn.iocoder.yudao.module.pms.dal.mysql.budgethistory.BudgetHistoryMapper;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.budget.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.dal.mysql.budget.BudgetMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.CONTRACT_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.PARAM_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 预算管理 Service 实现类
|
||||
@@ -26,24 +39,177 @@ import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
||||
@Validated
|
||||
public class BudgetServiceImpl implements BudgetService {
|
||||
|
||||
/**
|
||||
* 预算管理流程定义
|
||||
*/
|
||||
public static final String PROCESS_KEY = "budget_init";
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
public static String VERSION = "1";
|
||||
|
||||
@Resource
|
||||
private BudgetMapper budgetMapper;
|
||||
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private ContractApi contractApi;
|
||||
|
||||
@Resource
|
||||
private OutscontractApi OutscontractApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Resource
|
||||
private BudgetHistoryMapper budgetHistoryMapper;
|
||||
|
||||
@Override
|
||||
public Long createBudget(BudgetSaveReqVO createReqVO) {
|
||||
public Long createBudget(Long loginUserId, BudgetSaveReqVO createReqVO) {
|
||||
|
||||
// 校验 用户是否存在
|
||||
if (loginUserId == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
if (createReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 校验 项目,合同是否存在
|
||||
Long projectId = createReqVO.getProjectId();
|
||||
Long contractId = createReqVO.getContractId();
|
||||
projectApi.validProjectExist(projectId);
|
||||
contractApi.vaildContractExist(contractId);
|
||||
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
|
||||
// 校验联表的字段是否和所联系的表内容相同
|
||||
/**
|
||||
* 1. 跟踪项目编号 pms直接
|
||||
* 2. 项目编号 pms直接
|
||||
* 3. 跟踪项目名称 pms直接
|
||||
* 4. 项目类型 pms直接
|
||||
* 5. 预计合同金额 pms直接
|
||||
* 6. 暂定结算数 cms计算
|
||||
* 7. 包干/审定金额 cms直接
|
||||
* 8. 外包公司金额 cms求和
|
||||
*/
|
||||
String trackingProjectCode = createReqVO.getTrackingProjectCode(); // 跟踪项目编号
|
||||
String projectCode = createReqVO.getProjectCode(); // 项目编号
|
||||
String trackingProjectName = createReqVO.getTrackingProjectName(); // 跟踪项目名称
|
||||
String projectType = createReqVO.getProjectType(); // 项目类型
|
||||
BigDecimal expectedContractAmount = createReqVO.getExpectedContractAmount(); // 预计合同金额
|
||||
BigDecimal provisionalSettlement = createReqVO.getProvisionalSettlement(); // 暂定结算数
|
||||
BigDecimal approvedAmount = createReqVO.getApprovedAmount(); // 包干/审定金额
|
||||
BigDecimal outAmount = createReqVO.getOutAmount(); // 外包公司金额
|
||||
|
||||
String countType = contract.getCountType();
|
||||
BigDecimal amount = contract.getAmount();
|
||||
BigDecimal bigDecimal = new BigDecimal(String.valueOf(amount));
|
||||
BigDecimal mul = new BigDecimal("0.85");
|
||||
BigDecimal res = null;
|
||||
if ("费率合同".equals(countType)) {
|
||||
res = bigDecimal.multiply(mul);
|
||||
} else if ("总价合同".equals(countType)) {
|
||||
res = amount;
|
||||
}
|
||||
|
||||
BigDecimal outsContractAmount = OutscontractApi.getOutsContractAmount(contractId);
|
||||
|
||||
if (!project.getTrackingCode().equals(trackingProjectCode)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!project.getCode().equals(projectCode)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!project.getName().equals(trackingProjectName)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!project.getType().equals(projectType)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!Objects.equals(project.getContractAmount(),expectedContractAmount)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!Objects.equals(provisionalSettlement,res)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!Objects.equals(contract.getApprovedAmount(),approvedAmount)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!Objects.equals(outAmount,outsContractAmount)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
|
||||
// 插入
|
||||
BudgetDO budget = BeanUtils.toBean(createReqVO, BudgetDO.class);
|
||||
BudgetRespVO budgetResp = BeanUtils.toBean(budget, BudgetRespVO.class);
|
||||
budget.setCreator(userName);
|
||||
budget.setUpdater(userName);
|
||||
|
||||
// 判断预算是否已存在
|
||||
// 获得所有预算后,逐个比较各个字段是否完全一致
|
||||
// 查budget通过pms项目id查
|
||||
List<BudgetDO> budgetList = budgetMapper.selectList("project_id", projectId);
|
||||
List<BudgetRespVO> respVOList = BeanUtils.toBean(budgetList, BudgetRespVO.class);
|
||||
for (BudgetRespVO respVO : respVOList) {
|
||||
if (respVO.equals(budgetResp)) {
|
||||
throw exception(BUDGET_ALREADY_EXISTS);
|
||||
}
|
||||
}
|
||||
budgetMapper.insert(budget);
|
||||
|
||||
Long budgetId = budget.getId();
|
||||
BudgetHistoryDO budgetHistory = BeanUtils.toBean(budget, BudgetHistoryDO.class);
|
||||
|
||||
// 启动流程,同时写入历史预算
|
||||
if (createReqVO.getId() == null) {
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
|
||||
new BpmProcessInstanceCreateReqDTO()
|
||||
.setProcessDefinitionKey(PROCESS_KEY).setBusinessKey(String.valueOf(budgetId)));
|
||||
|
||||
// 写入工作流编号
|
||||
budgetHistory.setProcessInstanceId(processInstanceId);
|
||||
budgetHistory.setBudgetId(budgetId);
|
||||
|
||||
Long count = budgetHistoryMapper.selectCount("project_id", projectId);
|
||||
if (count < 1) {
|
||||
budgetHistory.setVersion(VERSION);
|
||||
} else {
|
||||
budgetHistory.setVersion(String.valueOf(count+1));
|
||||
}
|
||||
budgetHistory.setProcessStatus("0");
|
||||
budgetHistoryMapper.insert(budgetHistory);
|
||||
}
|
||||
|
||||
// 返回
|
||||
return budget.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBudget(BudgetSaveReqVO updateReqVO) {
|
||||
public void updateBudget(Long loginUserId, BudgetSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateBudgetExists(updateReqVO.getId());
|
||||
projectApi.validProjectExist(updateReqVO.getProjectId());
|
||||
contractApi.vaildContractExist(updateReqVO.getContractId());
|
||||
// 更新
|
||||
BudgetDO updateObj = BeanUtils.toBean(updateReqVO, BudgetDO.class);
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
updateObj.setUpdater(userName);
|
||||
budgetMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@@ -62,13 +228,144 @@ public class BudgetServiceImpl implements BudgetService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BudgetDO getBudget(Long id) {
|
||||
return budgetMapper.selectById(id);
|
||||
public BudgetRespVO getBudget(Long id) {
|
||||
// 校验
|
||||
if (id == null) {
|
||||
throw exception(BUDGET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
BudgetDO budgetDO = budgetMapper.selectById(id);
|
||||
if (budgetDO == null) {
|
||||
throw exception(BUDGET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = budgetDO.getProjectId();
|
||||
if (projectId == null) {
|
||||
throw exception(BUDGET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long contractId = budgetDO.getContractId();
|
||||
if (contractId == null) {
|
||||
throw exception(BUDGET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
BudgetRespVO budgetRespVO = BeanUtils.toBean(budgetDO, BudgetRespVO.class);
|
||||
|
||||
/** 查询数据,联表查询
|
||||
* 1. 跟踪项目编号 pms直接 √
|
||||
* 2. 项目编号 pms直接 √
|
||||
* 3. 跟踪项目名称 pms直接 √
|
||||
* 4. 项目类型 pms直接 √
|
||||
* 5. 预计合同金额 pms直接 √
|
||||
* 6. 暂定结算数 cms计算 √
|
||||
* 7. 包干/审定金额 cms直接 √
|
||||
* 8. 外包公司金额 cms求和 √
|
||||
* 9. 有效合同金额 计算公式 √
|
||||
* 10. 预估利润率 计算公式 √
|
||||
* 11. 实际利润率 计算公式 √
|
||||
* 12. 利润预警 计算公式 √
|
||||
*/
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
|
||||
budgetRespVO.setTrackingProjectCode(project.getTrackingCode()); // 跟踪项目编号
|
||||
budgetRespVO.setProjectCode(project.getCode()); // 项目编号
|
||||
budgetRespVO.setTrackingProjectName(project.getName()); // 跟踪项目名称
|
||||
budgetRespVO.setProjectType(project.getType()); // 项目类型
|
||||
budgetRespVO.setExpectedContractAmount(project.getContractAmount()); // 预计合同金额
|
||||
|
||||
String countType = contract.getCountType();
|
||||
BigDecimal amount = contract.getAmount();
|
||||
BigDecimal bigDecimal = new BigDecimal(String.valueOf(amount));
|
||||
BigDecimal mul = new BigDecimal("0.85");
|
||||
BigDecimal res = null;
|
||||
if ("费率合同".equals(countType)) {
|
||||
res = bigDecimal.multiply(mul);
|
||||
} else if ("总价合同".equals(countType)) {
|
||||
res = amount;
|
||||
}
|
||||
budgetRespVO.setProvisionalSettlement(res); // 暂定结算数
|
||||
|
||||
budgetRespVO.setApprovedAmount(contract.getApprovedAmount()); // 包干/审定金额
|
||||
budgetRespVO.setOutAmount(OutscontractApi.getOutsContractAmount(contractId)); // 外包公司金额
|
||||
|
||||
BigDecimal firstValue = new BigDecimal("0");
|
||||
BigDecimal secondValue = new BigDecimal("0");
|
||||
if (contract.getApprovedAmount() == null && res != null) {
|
||||
firstValue = res;
|
||||
} else if (contract.getApprovedAmount() != null) {
|
||||
firstValue = contract.getApprovedAmount();
|
||||
} else {
|
||||
firstValue = project.getContractAmount();
|
||||
}
|
||||
if (OutscontractApi.getOutsContractAmount(contractId) == null) {
|
||||
if (budgetDO.getOutsourcingCosts() != null) {
|
||||
secondValue = budgetDO.getOutsourcingCosts();
|
||||
}
|
||||
} else {
|
||||
secondValue = OutscontractApi.getOutsContractAmount(contractId);
|
||||
}
|
||||
budgetRespVO.setValidContractAmount(firstValue.subtract(secondValue)); // 有效合同金额
|
||||
|
||||
BigDecimal estimatedBaseValue = (res == null) ? project.getContractAmount() : res;
|
||||
if (estimatedBaseValue == null) {
|
||||
throw exception(PROFIT_MARGIN_ERROR);
|
||||
}
|
||||
BigDecimal estimatedNumerator = estimatedBaseValue
|
||||
.subtract(budgetDO.getOutsourcingCosts() != null ? budgetDO.getOutsourcingCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetDO.getLaborCosts() != null ? budgetDO.getLaborCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetDO.getProductCosts() != null ? budgetDO.getProductCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetDO.getFinancialCosts() != null ? budgetDO.getFinancialCosts() : BigDecimal.ZERO);
|
||||
budgetRespVO.setEstimatedProfitMargin(estimatedNumerator.divide(estimatedBaseValue, 4 , RoundingMode.HALF_UP)); // 预估利润率
|
||||
|
||||
BigDecimal realBaseValue = (contract.getApprovedAmount() == null) ? res : contract.getApprovedAmount();
|
||||
if (realBaseValue == null) {
|
||||
throw exception(PROFIT_MARGIN_ERROR);
|
||||
}
|
||||
BigDecimal realNumerator = realBaseValue
|
||||
.subtract(OutscontractApi.getOutsContractAmount(contractId) != null ? OutscontractApi.getOutsContractAmount(contractId) : BigDecimal.ZERO)
|
||||
.subtract(budgetDO.getAccumulatedLaborCosts() != null ? budgetDO.getAccumulatedLaborCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetDO.getAccumulatedProductCosts() != null ? budgetDO.getAccumulatedProductCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetDO.getAccumulatedFinancialCosts() != null ? budgetDO.getAccumulatedFinancialCosts() : BigDecimal.ZERO);
|
||||
BigDecimal realProfitMargin = realNumerator.divide(realBaseValue,4, RoundingMode.HALF_UP);
|
||||
budgetRespVO.setRealProfitMargin(realProfitMargin); // 实际利润率
|
||||
|
||||
BigDecimal threshold = new BigDecimal("0.25");
|
||||
String profitWarning = (realProfitMargin.compareTo(threshold) < 0) ? "利润预警" : "";
|
||||
budgetRespVO.setProfitWarning(profitWarning); // 利润预警
|
||||
|
||||
return budgetRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BudgetDO> getBudgetPage(BudgetPageReqVO pageReqVO) {
|
||||
return budgetMapper.selectPage(pageReqVO);
|
||||
public PageResult<BudgetRespVO> getBudgetPage(BudgetPageReqVO pageReqVO) {
|
||||
// 校验
|
||||
if (pageReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = pageReqVO.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
Long contractId = pageReqVO.getContractId();
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
PageResult<BudgetDO> budgetDOPageResult = budgetMapper.selectPage(pageReqVO);
|
||||
List<BudgetDO> budgetDOList = budgetDOPageResult.getList();
|
||||
List<BudgetRespVO> budgetRespVOList = new ArrayList<>();
|
||||
for (BudgetDO budgetDO : budgetDOList) {
|
||||
Long id = budgetDO.getId();
|
||||
BudgetRespVO budget = getBudget(id);
|
||||
budgetRespVOList.add(budget);
|
||||
}
|
||||
PageResult<BudgetRespVO> pageResult = new PageResult<>();
|
||||
pageResult.setList(budgetRespVOList);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
}
|
@@ -14,42 +14,27 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
*/
|
||||
public interface BudgetHistoryService {
|
||||
|
||||
/**
|
||||
* 创建预算管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createBudgetHistory(@Valid BudgetHistorySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新预算管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBudgetHistory(@Valid BudgetHistorySaveReqVO updateReqVO);
|
||||
void updateBudgetHistory(Long loginUserId, @Valid BudgetHistorySaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除预算管理
|
||||
* 获得历史预算管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @param id 现有预算管理编号
|
||||
* @return 历史预算管理
|
||||
*/
|
||||
void deleteBudgetHistory(Long id);
|
||||
BudgetHistoryRespVO getBudgetHistory(Long id);
|
||||
|
||||
/**
|
||||
* 获得预算管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 预算管理
|
||||
*/
|
||||
BudgetHistoryDO getBudgetHistory(Long id);
|
||||
|
||||
/**
|
||||
* 获得预算管理分页
|
||||
* 获得历史预算管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 预算管理分页
|
||||
*/
|
||||
PageResult<BudgetHistoryDO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO);
|
||||
PageResult<BudgetHistoryRespVO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO);
|
||||
|
||||
}
|
@@ -1,10 +1,19 @@
|
||||
package cn.iocoder.yudao.module.pms.service.budgethistory;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.api.contract.ContractApi;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractRespDTO;
|
||||
import cn.iocoder.yudao.module.cms.api.outscontract.OutscontractApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.service.budget.BudgetService;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.budgethistory.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDO;
|
||||
@@ -15,7 +24,10 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.pms.dal.mysql.budgethistory.BudgetHistoryMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.CONTRACT_HISTORY_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.CONTRACT_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 预算管理 Service 实现类
|
||||
@@ -29,30 +41,197 @@ public class BudgetHistoryServiceImpl implements BudgetHistoryService {
|
||||
@Resource
|
||||
private BudgetHistoryMapper budgetHistoryMapper;
|
||||
|
||||
@Override
|
||||
public Long createBudgetHistory(BudgetHistorySaveReqVO createReqVO) {
|
||||
// 插入
|
||||
BudgetHistoryDO budgetHistory = BeanUtils.toBean(createReqVO, BudgetHistoryDO.class);
|
||||
budgetHistoryMapper.insert(budgetHistory);
|
||||
// 返回
|
||||
return budgetHistory.getId();
|
||||
}
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private ContractApi contractApi;
|
||||
|
||||
@Resource
|
||||
private OutscontractApi outscontractApi;
|
||||
|
||||
@Resource
|
||||
private BudgetService budgetService;
|
||||
|
||||
@Override
|
||||
public void updateBudgetHistory(BudgetHistorySaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateBudgetHistoryExists(updateReqVO.getId());
|
||||
public void updateBudgetHistory(Long loginUserId, BudgetHistorySaveReqVO updateReqVO) {
|
||||
// 校验
|
||||
Long id = updateReqVO.getId();
|
||||
validateBudgetHistoryExists(id);
|
||||
if (loginUserId == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
Long projectId = updateReqVO.getProjectId();
|
||||
Long contractId = updateReqVO.getContractId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新
|
||||
BudgetHistoryDO updateObj = BeanUtils.toBean(updateReqVO, BudgetHistoryDO.class);
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
updateObj.setUpdater(userName);
|
||||
budgetHistoryMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBudgetHistory(Long id) {
|
||||
// 校验存在
|
||||
validateBudgetHistoryExists(id);
|
||||
// 删除
|
||||
budgetHistoryMapper.deleteById(id);
|
||||
public BudgetHistoryRespVO getBudgetHistory(Long id) {
|
||||
|
||||
// 校验
|
||||
if (id == null) {
|
||||
throw exception(BUDGET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
BudgetHistoryDO budgetHistoryDO = budgetHistoryMapper.selectById(id);
|
||||
if (budgetHistoryDO == null) {
|
||||
throw exception(BUDGET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long budgetId = budgetHistoryDO.getBudgetId();
|
||||
if (budgetId == null) {
|
||||
throw exception(BUDGET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = budgetHistoryDO.getProjectId();
|
||||
if (projectId == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long contractId = budgetHistoryDO.getContractId();
|
||||
if (contractId == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
BudgetHistoryRespVO budgetHistoryRespVO = BeanUtils.toBean(budgetHistoryDO, BudgetHistoryRespVO.class);
|
||||
|
||||
/** 联表查询
|
||||
* 1. 跟踪项目编号 √
|
||||
* 2. 项目编号 √
|
||||
* 3. 跟踪项目名称 √
|
||||
* 4. 项目类型 √
|
||||
* 5. 预计合同金额 √
|
||||
* 6. 暂定结算数 √
|
||||
* 7. 包干/审定金额 √
|
||||
* 8. 外包公司金额 √
|
||||
*
|
||||
* 9. 有效合同金额 √
|
||||
* 10. 预估利润率 √
|
||||
* 11. 实际利润率 √
|
||||
* 12. 利润预警 √
|
||||
*/
|
||||
|
||||
budgetHistoryRespVO.setTrackingProjectCode(project.getTrackingCode()); // 跟踪项目编号
|
||||
budgetHistoryRespVO.setProjectCode(project.getCode()); // 项目编号
|
||||
budgetHistoryRespVO.setTrackingProjectName(project.getName()); // 跟踪项目名称
|
||||
budgetHistoryRespVO.setProjectType(project.getType()); // 项目类型
|
||||
budgetHistoryRespVO.setExpectedContractAmount(project.getContractAmount()); // 预计合同金额
|
||||
|
||||
String countType = contract.getCountType();
|
||||
BigDecimal amount = contract.getAmount();
|
||||
BigDecimal bigDecimal = new BigDecimal(String.valueOf(amount));
|
||||
BigDecimal mul = new BigDecimal("0.85");
|
||||
BigDecimal res = null;
|
||||
if ("费率合同".equals(countType)) {
|
||||
res = bigDecimal.multiply(mul);
|
||||
} else if ("总价合同".equals(countType)) {
|
||||
res = amount;
|
||||
}
|
||||
budgetHistoryRespVO.setProvisionalSettlement(res); // 暂定结算数
|
||||
|
||||
budgetHistoryRespVO.setApprovedAmount(contract.getApprovedAmount()); // 包干/审定金额
|
||||
budgetHistoryRespVO.setOutAmount(outscontractApi.getOutsContractAmount(contractId)); // 外包公司金额
|
||||
|
||||
BigDecimal firstValue = new BigDecimal("0");
|
||||
BigDecimal secondValue = new BigDecimal("0");
|
||||
if (contract.getApprovedAmount() == null && res != null) {
|
||||
firstValue = res;
|
||||
} else if (contract.getApprovedAmount() != null) {
|
||||
firstValue = contract.getApprovedAmount();
|
||||
} else {
|
||||
firstValue = project.getContractAmount();
|
||||
}
|
||||
if (outscontractApi.getOutsContractAmount(contractId) == null) {
|
||||
if (budgetHistoryDO.getOutsourcingCosts() != null) {
|
||||
secondValue = budgetHistoryDO.getOutsourcingCosts();
|
||||
}
|
||||
} else {
|
||||
secondValue = outscontractApi.getOutsContractAmount(contractId);
|
||||
}
|
||||
budgetHistoryRespVO.setValidContractAmount(firstValue.subtract(secondValue)); // 有效合同金额
|
||||
|
||||
BigDecimal estimatedBaseValue = (res == null) ? project.getContractAmount() : res;
|
||||
if (estimatedBaseValue == null) {
|
||||
throw exception(PROFIT_MARGIN_ERROR);
|
||||
}
|
||||
BigDecimal estimatedNumerator = estimatedBaseValue
|
||||
.subtract(budgetHistoryDO.getOutsourcingCosts() != null ? budgetHistoryDO.getOutsourcingCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetHistoryDO.getLaborCosts() != null ? budgetHistoryDO.getLaborCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetHistoryDO.getProductCosts() != null ? budgetHistoryDO.getProductCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetHistoryDO.getFinancialCosts() != null ? budgetHistoryDO.getFinancialCosts() : BigDecimal.ZERO);
|
||||
budgetHistoryRespVO.setEstimatedProfitMargin(estimatedNumerator.divide(estimatedBaseValue, 4 , RoundingMode.HALF_UP)); // 预估利润率
|
||||
|
||||
BigDecimal realBaseValue = (contract.getApprovedAmount() == null) ? res : contract.getApprovedAmount();
|
||||
if (realBaseValue == null) {
|
||||
throw exception(PROFIT_MARGIN_ERROR);
|
||||
}
|
||||
BigDecimal realNumerator = realBaseValue
|
||||
.subtract(outscontractApi.getOutsContractAmount(contractId) != null ? outscontractApi.getOutsContractAmount(contractId) : BigDecimal.ZERO)
|
||||
.subtract(budgetHistoryDO.getAccumulatedLaborCosts() != null ? budgetHistoryDO.getAccumulatedLaborCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetHistoryDO.getAccumulatedProductCosts() != null ? budgetHistoryDO.getAccumulatedProductCosts() : BigDecimal.ZERO)
|
||||
.subtract(budgetHistoryDO.getAccumulatedFinancialCosts() != null ? budgetHistoryDO.getAccumulatedFinancialCosts() : BigDecimal.ZERO);
|
||||
BigDecimal realProfitMargin = realNumerator.divide(realBaseValue,4, RoundingMode.HALF_UP);
|
||||
budgetHistoryRespVO.setRealProfitMargin(realProfitMargin); // 实际利润率
|
||||
|
||||
BigDecimal threshold = new BigDecimal("0.25");
|
||||
String profitWarning = (realProfitMargin.compareTo(threshold) < 0) ? "利润预警" : "";
|
||||
budgetHistoryRespVO.setProfitWarning(profitWarning); // 利润预警
|
||||
|
||||
return budgetHistoryRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BudgetHistoryRespVO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO) {
|
||||
|
||||
// 校验
|
||||
if (pageReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = pageReqVO.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
Long contractId = pageReqVO.getContractId();
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
PageResult<BudgetHistoryDO> budgetHistoryDOPageResult = budgetHistoryMapper.selectPage(pageReqVO);
|
||||
List<BudgetHistoryDO> pageResultList = budgetHistoryDOPageResult.getList();
|
||||
List<BudgetHistoryRespVO> budgetHistoryRespVOS = new ArrayList<>();
|
||||
|
||||
for (BudgetHistoryDO budgetHistoryDO : pageResultList) {
|
||||
Long id = budgetHistoryDO.getId();
|
||||
BudgetHistoryRespVO budgetHistory = getBudgetHistory(id);
|
||||
budgetHistoryRespVOS.add(budgetHistory);
|
||||
}
|
||||
|
||||
PageResult<BudgetHistoryRespVO> pageResult = new PageResult<>();
|
||||
pageResult.setList(budgetHistoryRespVOS);
|
||||
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
private void validateBudgetHistoryExists(Long id) {
|
||||
@@ -60,15 +239,5 @@ public class BudgetHistoryServiceImpl implements BudgetHistoryService {
|
||||
throw exception(BUDGET_HISTORY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BudgetHistoryDO getBudgetHistory(Long id) {
|
||||
return budgetHistoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BudgetHistoryDO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO) {
|
||||
return budgetHistoryMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.pms.service.projectschedule;
|
||||
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.projectschedule.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.projectschedule.ProjectScheduleDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 项目进度管理 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ProjectScheduleService {
|
||||
|
||||
/**
|
||||
* 创建项目进度管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createProjectSchedule(@Valid ProjectScheduleSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新项目进度管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProjectSchedule(@Valid ProjectScheduleSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除项目进度管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProjectSchedule(Long id);
|
||||
|
||||
/**
|
||||
* 获得项目进度管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 项目进度管理
|
||||
*/
|
||||
ProjectScheduleDO getProjectSchedule(Long id);
|
||||
|
||||
/**
|
||||
* 获得项目进度管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 项目进度管理分页
|
||||
*/
|
||||
PageResult<ProjectScheduleDO> getProjectSchedulePage(ProjectSchedulePageReqVO pageReqVO);
|
||||
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
package cn.iocoder.yudao.module.pms.service.projectschedule;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.projectschedule.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.projectschedule.ProjectScheduleDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.dal.mysql.projectschedule.ProjectScheduleMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 项目进度管理 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProjectScheduleServiceImpl implements ProjectScheduleService {
|
||||
|
||||
@Resource
|
||||
private ProjectScheduleMapper projectScheduleMapper;
|
||||
|
||||
@Override
|
||||
public Long createProjectSchedule(ProjectScheduleSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ProjectScheduleDO projectSchedule = BeanUtils.toBean(createReqVO, ProjectScheduleDO.class);
|
||||
projectScheduleMapper.insert(projectSchedule);
|
||||
// 返回
|
||||
return projectSchedule.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProjectSchedule(ProjectScheduleSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateProjectScheduleExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ProjectScheduleDO updateObj = BeanUtils.toBean(updateReqVO, ProjectScheduleDO.class);
|
||||
projectScheduleMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProjectSchedule(Long id) {
|
||||
// 校验存在
|
||||
validateProjectScheduleExists(id);
|
||||
// 删除
|
||||
projectScheduleMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateProjectScheduleExists(Long id) {
|
||||
if (projectScheduleMapper.selectById(id) == null) {
|
||||
throw exception(PROJECT_SCHEDULE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectScheduleDO getProjectSchedule(Long id) {
|
||||
return projectScheduleMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProjectScheduleDO> getProjectSchedulePage(ProjectSchedulePageReqVO pageReqVO) {
|
||||
return projectScheduleMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@@ -20,14 +20,14 @@ public interface ReceivablesService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createReceivables(@Valid ReceivablesSaveReqVO createReqVO);
|
||||
Long createReceivables(Long loginUserId, @Valid ReceivablesSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新应收款管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateReceivables(@Valid ReceivablesSaveReqVO updateReqVO);
|
||||
void updateReceivables(Long loginUserId, @Valid ReceivablesSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除应收款管理
|
||||
@@ -42,7 +42,7 @@ public interface ReceivablesService {
|
||||
* @param id 编号
|
||||
* @return 应收款管理
|
||||
*/
|
||||
ReceivablesDO getReceivables(Long id);
|
||||
ReceivablesRespVO getReceivables(Long id);
|
||||
|
||||
/**
|
||||
* 获得应收款管理分页
|
||||
@@ -50,6 +50,6 @@ public interface ReceivablesService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 应收款管理分页
|
||||
*/
|
||||
PageResult<ReceivablesDO> getReceivablesPage(ReceivablesPageReqVO pageReqVO);
|
||||
PageResult<ReceivablesRespVO> getReceivablesPage(ReceivablesPageReqVO pageReqVO);
|
||||
|
||||
}
|
@@ -1,21 +1,33 @@
|
||||
package cn.iocoder.yudao.module.pms.service.receivables;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.ContractApi;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.projectschedule.ProjectScheduleDO;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
||||
import cn.iocoder.yudao.module.pms.dal.mysql.receivableshistory.ReceivablesHistoryMapper;
|
||||
import cn.iocoder.yudao.module.pms.service.projectschedule.ProjectScheduleService;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.receivables.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.receivables.ReceivablesDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.pms.dal.mysql.receivables.ReceivablesMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.CONTRACT_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 应收款管理 Service 实现类
|
||||
@@ -26,27 +38,157 @@ import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
||||
@Validated
|
||||
public class ReceivablesServiceImpl implements ReceivablesService {
|
||||
|
||||
/**
|
||||
* 应收款管理流程定义
|
||||
*/
|
||||
public static final String PROCESS_KEY = "receivables_init";
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
public static String VERSION = "1";
|
||||
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private ContractApi contractApi;
|
||||
|
||||
@Resource
|
||||
private ProjectScheduleService projectScheduleService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Resource
|
||||
private ReceivablesMapper receivablesMapper;
|
||||
|
||||
@Resource
|
||||
private ReceivablesHistoryMapper receivablesHistoryMapper;
|
||||
|
||||
@Override
|
||||
public Long createReceivables(ReceivablesSaveReqVO createReqVO) {
|
||||
public Long createReceivables(Long loginUserId, ReceivablesSaveReqVO createReqVO) {
|
||||
|
||||
// 校验 用户是否存在
|
||||
if (loginUserId == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
if (createReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
// 校验 对应项目汉语合同是否存在
|
||||
Long projectId = createReqVO.getProjectId();
|
||||
Long contractId = createReqVO.getContractId();
|
||||
projectApi.validProjectExist(projectId);
|
||||
contractApi.vaildContractExist(contractId);
|
||||
|
||||
// 获取实例
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
ProjectScheduleDO projectSchedule = projectScheduleService.getProjectSchedule(projectId);
|
||||
|
||||
// 检验联表的字段是否与联系表的字段相同
|
||||
|
||||
/**
|
||||
* 1. 项目编号
|
||||
* 2. 合同名称
|
||||
* 3. 签订合同总额
|
||||
* 4. 包干/审定金额
|
||||
* 5. 已完成设计阶段
|
||||
*/
|
||||
|
||||
String projectCode = createReqVO.getProjectCode();
|
||||
String contractName = createReqVO.getContractName();
|
||||
BigDecimal signedAmount = createReqVO.getSignedAmount();
|
||||
BigDecimal approvedAmount = createReqVO.getApprovedAmount();
|
||||
String completedDesignStage = createReqVO.getCompletedDesignStage();
|
||||
|
||||
if (!project.getCode().equals(projectCode)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!contract.getName().equals(contractName)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!Objects.equals(contract.getAmount(),signedAmount)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!Objects.equals(contract.getApprovedAmount(), approvedAmount)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!projectSchedule.getStage().equals(completedDesignStage)) {
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
|
||||
// 插入
|
||||
ReceivablesDO receivables = BeanUtils.toBean(createReqVO, ReceivablesDO.class);
|
||||
ReceivablesRespVO receivablesResp = BeanUtils.toBean(receivables, ReceivablesRespVO.class);
|
||||
receivables.setCreator(userName);
|
||||
receivables.setUpdater(userName);
|
||||
|
||||
// 判断应收款是否已存在
|
||||
// 获得所有应收款后,逐个比较各个字段是否完全一致
|
||||
// 查receivables通过pms项目id查
|
||||
List<ReceivablesDO> receivablesDOList = receivablesMapper.selectList("project_id", projectId);
|
||||
List<ReceivablesRespVO> receivablesRespVOList = BeanUtils.toBean(receivablesDOList, ReceivablesRespVO.class);
|
||||
for (ReceivablesRespVO respVO : receivablesRespVOList) {
|
||||
if (respVO.equals(receivablesResp)) {
|
||||
throw exception(RECEIVABLES_ALREADY_EXISTS);
|
||||
}
|
||||
}
|
||||
// 插入应收款
|
||||
receivablesMapper.insert(receivables);
|
||||
|
||||
// 启动流程,同时写入历史应收款
|
||||
Long receivablesId = receivables.getId();
|
||||
ReceivablesHistoryDO receivablesHistory = BeanUtils.toBean(receivables, ReceivablesHistoryDO.class);
|
||||
if (createReqVO.getId() == null) {
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
|
||||
new BpmProcessInstanceCreateReqDTO()
|
||||
.setProcessDefinitionKey(PROCESS_KEY).setBusinessKey(String.valueOf(receivablesId)));
|
||||
|
||||
// 写入工作流编号
|
||||
receivablesHistory.setProcessInstanceId(processInstanceId);
|
||||
receivablesHistory.setReceivableId(receivablesId);
|
||||
|
||||
Long count = receivablesHistoryMapper.selectCount("project_id", projectId);
|
||||
if (count < 1) {
|
||||
receivablesHistory.setVersion(VERSION);
|
||||
} else {
|
||||
receivablesHistory.setVersion(String.valueOf(count+1));
|
||||
}
|
||||
receivablesHistory.setProcessStatus("0");
|
||||
receivablesHistoryMapper.insert(receivablesHistory);
|
||||
}
|
||||
|
||||
// 返回
|
||||
return receivables.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReceivables(ReceivablesSaveReqVO updateReqVO) {
|
||||
public void updateReceivables(Long loginUserId, ReceivablesSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateReceivablesExists(updateReqVO.getId());
|
||||
projectApi.validProjectExist(updateReqVO.getProjectId());
|
||||
contractApi.vaildContractExist(updateReqVO.getContractId());
|
||||
|
||||
// 更新
|
||||
ReceivablesDO updateObj = BeanUtils.toBean(updateReqVO, ReceivablesDO.class);
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
updateObj.setUpdater(userName);
|
||||
receivablesMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteReceivables(Long id) {
|
||||
// 校验存在
|
||||
@@ -62,13 +204,122 @@ public class ReceivablesServiceImpl implements ReceivablesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReceivablesDO getReceivables(Long id) {
|
||||
return receivablesMapper.selectById(id);
|
||||
public ReceivablesRespVO getReceivables(Long id) {
|
||||
|
||||
// 校验
|
||||
if (id == null) {
|
||||
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||
}
|
||||
ReceivablesDO receivablesDO = receivablesMapper.selectById(id);
|
||||
if (receivablesDO == null) {
|
||||
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = receivablesDO.getProjectId();
|
||||
if (projectId == null) {
|
||||
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||
}
|
||||
Long contractId = receivablesDO.getContractId();
|
||||
if (contractId == null) {
|
||||
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||
}
|
||||
|
||||
ReceivablesRespVO receivablesRespVO = BeanUtils.toBean(receivablesDO, ReceivablesRespVO.class);
|
||||
|
||||
/**
|
||||
* 1. 项目编号 √
|
||||
* 2. 合同名称 √
|
||||
* 3. 签订合同总额 √
|
||||
* 4. 包干/审定金额 √
|
||||
* 5. 已完成设计阶段 √
|
||||
* 6. 应收款取数 √
|
||||
* 7. 合同应收款 √
|
||||
* 8. 应收款差额 √
|
||||
*/
|
||||
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
ProjectScheduleDO projectSchedule = projectScheduleService.getProjectSchedule(projectId);
|
||||
|
||||
receivablesRespVO.setProjectCode(project.getCode()); // 项目编号
|
||||
receivablesRespVO.setContractName(contract.getName()); // 合同名称
|
||||
receivablesRespVO.setSignedAmount(contract.getAmount()); // 签订合同总额
|
||||
receivablesRespVO.setApprovedAmount(contract.getApprovedAmount()); // 包干/审定金额
|
||||
receivablesRespVO.setCompletedDesignStage(projectSchedule.getStage()); // 已完成设计阶段
|
||||
|
||||
BigDecimal receivableAccount = (contract.getApprovedAmount() == null) ? contract.getAmount() : contract.getApprovedAmount();
|
||||
receivablesRespVO.setReceivableAccount(receivableAccount); // 应收款取数
|
||||
|
||||
if (receivableAccount == null) {
|
||||
throw exception(RECEIVABLES_CALCULATION_ERROR);
|
||||
}
|
||||
|
||||
// 根据设计阶段计算合同应收款
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
BigDecimal planStage = parseRate(receivablesDO.getPlanStage()); // 方案阶段收款比例
|
||||
BigDecimal initialDesignStage = parseRate(receivablesDO.getInitialDesignStage()); // 初设阶段收款比例
|
||||
BigDecimal constructionDrawingStage = parseRate(receivablesDO.getConstructionDrawingStage()); // 施工图阶段比例
|
||||
BigDecimal constructionStage = parseRate(receivablesDO.getConstructionStage()); // 施工配合收款比例
|
||||
BigDecimal approveStage = parseRate(receivablesDO.getApproveStage()); // 审定阶段
|
||||
|
||||
amount = switch (projectSchedule.getStage()) {
|
||||
case "方案设计" -> receivableAccount.multiply(planStage);
|
||||
case "初步设计" -> receivableAccount.multiply(initialDesignStage);
|
||||
case "施工图" -> receivableAccount.multiply(constructionDrawingStage);
|
||||
case "施工配合" -> receivableAccount.multiply(constructionStage);
|
||||
case "竣工" -> receivableAccount.multiply(approveStage);
|
||||
default -> BigDecimal.ZERO;
|
||||
};
|
||||
receivablesRespVO.setContractualReceivables(amount); // 合同应收款
|
||||
|
||||
BigDecimal collectionAmount = parseRate(receivablesDO.getCollectionSituation());
|
||||
BigDecimal differenceAmount = amount.subtract(collectionAmount);
|
||||
receivablesRespVO.setReceivableDifference(differenceAmount); // 应收款差额
|
||||
|
||||
return receivablesRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ReceivablesDO> getReceivablesPage(ReceivablesPageReqVO pageReqVO) {
|
||||
return receivablesMapper.selectPage(pageReqVO);
|
||||
public PageResult<ReceivablesRespVO> getReceivablesPage(ReceivablesPageReqVO pageReqVO) {
|
||||
// 校验
|
||||
if (pageReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
Long projectId = pageReqVO.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
Long contractId = pageReqVO.getContractId();
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
PageResult<ReceivablesDO> receivablesDOPageResult = receivablesMapper.selectPage(pageReqVO);
|
||||
List<ReceivablesDO> receivablesDOList = receivablesDOPageResult.getList();
|
||||
List<ReceivablesRespVO> receivablesRespVOList = new ArrayList<>();
|
||||
|
||||
for (ReceivablesDO receivablesDO : receivablesDOList) {
|
||||
Long id = receivablesDO.getId();
|
||||
ReceivablesRespVO receivables = getReceivables(id);
|
||||
receivablesRespVOList.add(receivables);
|
||||
}
|
||||
|
||||
PageResult<ReceivablesRespVO> pageResult = new PageResult<>();
|
||||
pageResult.setList(receivablesRespVOList);
|
||||
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
private BigDecimal parseRate(String rateStr) {
|
||||
// 将字符串转换为 BigDecimal,处理可能的 null 和格式错误
|
||||
try {
|
||||
return (rateStr == null || rateStr.trim().isEmpty()) ? BigDecimal.ZERO : new BigDecimal(rateStr);
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果字符串格式错误,返回零
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -14,27 +14,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
*/
|
||||
public interface ReceivablesHistoryService {
|
||||
|
||||
/**
|
||||
* 创建应收款管理历史记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createReceivablesHistory(@Valid ReceivablesHistorySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新应收款管理历史记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateReceivablesHistory(@Valid ReceivablesHistorySaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除应收款管理历史记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteReceivablesHistory(Long id);
|
||||
void updateReceivablesHistory(Long loginUserId, @Valid ReceivablesHistorySaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 获得应收款管理历史记录
|
||||
@@ -42,7 +27,7 @@ public interface ReceivablesHistoryService {
|
||||
* @param id 编号
|
||||
* @return 应收款管理历史记录
|
||||
*/
|
||||
ReceivablesHistoryDO getReceivablesHistory(Long id);
|
||||
ReceivablesHistoryRespVO getReceivablesHistory(Long id);
|
||||
|
||||
/**
|
||||
* 获得应收款管理历史记录分页
|
||||
@@ -50,6 +35,6 @@ public interface ReceivablesHistoryService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 应收款管理历史记录分页
|
||||
*/
|
||||
PageResult<ReceivablesHistoryDO> getReceivablesHistoryPage(ReceivablesHistoryPageReqVO pageReqVO);
|
||||
PageResult<ReceivablesHistoryRespVO> getReceivablesHistoryPage(ReceivablesHistoryPageReqVO pageReqVO);
|
||||
|
||||
}
|
@@ -1,10 +1,19 @@
|
||||
package cn.iocoder.yudao.module.pms.service.receivableshistory;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.api.contract.ContractApi;
|
||||
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.projectschedule.ProjectScheduleDO;
|
||||
import cn.iocoder.yudao.module.pms.service.projectschedule.ProjectScheduleService;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.pms.controller.admin.receivableshistory.vo.*;
|
||||
import cn.iocoder.yudao.module.pms.dal.dataobject.receivableshistory.ReceivablesHistoryDO;
|
||||
@@ -15,7 +24,9 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.pms.dal.mysql.receivableshistory.ReceivablesHistoryMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.CONTRACT_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 应收款管理历史记录 Service 实现类
|
||||
@@ -29,32 +40,44 @@ public class ReceivablesHistoryServiceImpl implements ReceivablesHistoryService
|
||||
@Resource
|
||||
private ReceivablesHistoryMapper receivablesHistoryMapper;
|
||||
|
||||
@Override
|
||||
public Long createReceivablesHistory(ReceivablesHistorySaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ReceivablesHistoryDO receivablesHistory = BeanUtils.toBean(createReqVO, ReceivablesHistoryDO.class);
|
||||
receivablesHistoryMapper.insert(receivablesHistory);
|
||||
// 返回
|
||||
return receivablesHistory.getId();
|
||||
}
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private ContractApi contractApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private ProjectScheduleService projectScheduleService;
|
||||
|
||||
|
||||
@Override
|
||||
public void updateReceivablesHistory(ReceivablesHistorySaveReqVO updateReqVO) {
|
||||
public void updateReceivablesHistory(Long loginUserId, ReceivablesHistorySaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateReceivablesHistoryExists(updateReqVO.getId());
|
||||
if (loginUserId == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
Long projectId = updateReqVO.getProjectId();
|
||||
Long contractId = updateReqVO.getContractId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新
|
||||
ReceivablesHistoryDO updateObj = BeanUtils.toBean(updateReqVO, ReceivablesHistoryDO.class);
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
updateObj.setUpdater(userName);
|
||||
receivablesHistoryMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReceivablesHistory(Long id) {
|
||||
// 校验存在
|
||||
validateReceivablesHistoryExists(id);
|
||||
// 删除
|
||||
receivablesHistoryMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateReceivablesHistoryExists(Long id) {
|
||||
if (receivablesHistoryMapper.selectById(id) == null) {
|
||||
throw exception(RECEIVABLES_HISTORY_NOT_EXISTS);
|
||||
@@ -62,13 +85,128 @@ public class ReceivablesHistoryServiceImpl implements ReceivablesHistoryService
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReceivablesHistoryDO getReceivablesHistory(Long id) {
|
||||
return receivablesHistoryMapper.selectById(id);
|
||||
public ReceivablesHistoryRespVO getReceivablesHistory(Long id) {
|
||||
|
||||
// 校验
|
||||
if (id == null) {
|
||||
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||
}
|
||||
|
||||
ReceivablesHistoryDO receivablesHistoryDO = receivablesHistoryMapper.selectById(id);
|
||||
if (receivablesHistoryDO == null) {
|
||||
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long receivableId = receivablesHistoryDO.getReceivableId();
|
||||
if (receivableId == null) {
|
||||
throw exception(RECEIVABLES_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = receivablesHistoryDO.getProjectId();
|
||||
if (projectId == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long contractId = receivablesHistoryDO.getContractId();
|
||||
if (contractId == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
ProjectScheduleDO projectSchedule = projectScheduleService.getProjectSchedule(projectId);
|
||||
ReceivablesHistoryRespVO receivablesHistoryRespVO = BeanUtils.toBean(receivablesHistoryDO, ReceivablesHistoryRespVO.class);
|
||||
|
||||
/** 联表查询
|
||||
* 1. 项目编号 √
|
||||
* 2. 合同名称 √
|
||||
* 3. 签订合同总额 √
|
||||
* 4. 包干/审定金额 √
|
||||
* 5. 已完成设计阶段 √
|
||||
* 6. 应收款取数 √
|
||||
* 7. 合同应收款 √
|
||||
* 8. 应收款差额 √
|
||||
*/
|
||||
|
||||
receivablesHistoryRespVO.setProjectCode(project.getCode());
|
||||
receivablesHistoryRespVO.setContractName(contract.getName());
|
||||
receivablesHistoryRespVO.setSignedAmount(contract.getAmount());
|
||||
receivablesHistoryRespVO.setApprovedAmount(contract.getApprovedAmount());
|
||||
receivablesHistoryRespVO.setCompletedDesignStage(projectSchedule.getStage());
|
||||
|
||||
BigDecimal receivableAccount = (contract.getApprovedAmount() == null) ? contract.getAmount() : contract.getApprovedAmount();
|
||||
receivablesHistoryRespVO.setReceivableAccount(receivableAccount);
|
||||
|
||||
if (receivableAccount == null) {
|
||||
throw exception(RECEIVABLES_CALCULATION_ERROR);
|
||||
}
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
BigDecimal planStage = parseRate(receivablesHistoryDO.getPlanStage()); // 方案阶段收款比例
|
||||
BigDecimal initialDesignStage = parseRate(receivablesHistoryDO.getInitialDesignStage()); // 初设阶段收款比例
|
||||
BigDecimal constructionDrawingStage = parseRate(receivablesHistoryDO.getConstructionDrawingStage()); // 施工图阶段比例
|
||||
BigDecimal constructionStage = parseRate(receivablesHistoryDO.getConstructionStage()); // 施工配合收款比例
|
||||
BigDecimal approveStage = parseRate(receivablesHistoryDO.getApproveStage()); // 审定阶段
|
||||
amount = switch (projectSchedule.getStage()) {
|
||||
case "方案设计" -> receivableAccount.multiply(planStage);
|
||||
case "初步设计" -> receivableAccount.multiply(initialDesignStage);
|
||||
case "施工图" -> receivableAccount.multiply(constructionDrawingStage);
|
||||
case "施工配合" -> receivableAccount.multiply(constructionStage);
|
||||
case "竣工" -> receivableAccount.multiply(approveStage);
|
||||
default -> BigDecimal.ZERO;
|
||||
};
|
||||
receivablesHistoryRespVO.setContractualReceivables(amount);
|
||||
|
||||
BigDecimal collectionAmount = parseRate(receivablesHistoryDO.getCollectionSituation());
|
||||
BigDecimal differenceAmount = amount.subtract(collectionAmount);
|
||||
receivablesHistoryRespVO.setReceivableDifference(differenceAmount);
|
||||
|
||||
return receivablesHistoryRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ReceivablesHistoryDO> getReceivablesHistoryPage(ReceivablesHistoryPageReqVO pageReqVO) {
|
||||
return receivablesHistoryMapper.selectPage(pageReqVO);
|
||||
public PageResult<ReceivablesHistoryRespVO> getReceivablesHistoryPage(ReceivablesHistoryPageReqVO pageReqVO) {
|
||||
|
||||
// 校验
|
||||
if (pageReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = pageReqVO.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long contractId = pageReqVO.getContractId();
|
||||
ContractRespDTO contract = contractApi.getContract(contractId);
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
PageResult<ReceivablesHistoryDO> receivablesHistoryDOPageResult = receivablesHistoryMapper.selectPage(pageReqVO);
|
||||
List<ReceivablesHistoryDO> pageResultList = receivablesHistoryDOPageResult.getList();
|
||||
List<ReceivablesHistoryRespVO> receivablesHistoryRespVOS = new ArrayList<>();
|
||||
|
||||
for (ReceivablesHistoryDO receivablesHistoryDO : pageResultList) {
|
||||
Long id = receivablesHistoryDO.getId();
|
||||
ReceivablesHistoryRespVO receivablesHistory = getReceivablesHistory(id);
|
||||
receivablesHistoryRespVOS.add(receivablesHistory);
|
||||
}
|
||||
|
||||
PageResult<ReceivablesHistoryRespVO> pageResult = new PageResult<>();
|
||||
pageResult.setList(receivablesHistoryRespVOS);
|
||||
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
private BigDecimal parseRate(String rateStr) {
|
||||
// 将字符串转换为 BigDecimal,处理可能的 null 和格式错误
|
||||
try {
|
||||
return (rateStr == null || rateStr.trim().isEmpty()) ? BigDecimal.ZERO : new BigDecimal(rateStr);
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果字符串格式错误,返回零
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 项目进度管理 VO
|
||||
export interface ProjectScheduleVO {
|
||||
id: number // 主键
|
||||
projectId: number // 项目id
|
||||
projectLeader: string // 项目负责人
|
||||
major: string // 主专业
|
||||
minorMajors: string // 其他专业
|
||||
minorUserIds: string // 其他主要项目组成员
|
||||
scale: string // 规模
|
||||
survey: string // 项目概况
|
||||
replyFileUrl: string // 相关批复文件url
|
||||
stage: string // 当前阶段
|
||||
preStage: string // 已完成的项目阶段
|
||||
progress: string // 工作进展
|
||||
contractNegotiationTime: Date // 外部合同商议时间
|
||||
completed: number // 已完成百分比
|
||||
accumulatedCompletion: number // 截至本月累计完成百分比
|
||||
newlyIncreasedCompletion: number // 本月新增完工比
|
||||
finishOutput: number // 已完成产值
|
||||
newlyIncreasedOutput: number // 本月新增产值
|
||||
accumulatedOutput: number // 累积产值
|
||||
completionTime: Date // 竣工时间
|
||||
choose: boolean // 单选
|
||||
completionFileUrl: string // 竣工报告附件url
|
||||
finalEditor: string // 最后编辑人
|
||||
creator: string // 创建人
|
||||
createTime: Date // 创建时间
|
||||
updator: string // 更新人
|
||||
updateTime: Date // 更新时间
|
||||
deleted: boolean // 是否删除
|
||||
tenantId: number // 租户id
|
||||
}
|
||||
|
||||
// 项目进度管理 API
|
||||
export const ProjectScheduleApi = {
|
||||
// 查询项目进度管理分页
|
||||
getProjectSchedulePage: async (params: any) => {
|
||||
return await request.get({ url: `/pms/project-schedule/page`, params })
|
||||
},
|
||||
|
||||
// 查询项目进度管理详情
|
||||
getProjectSchedule: async (id: number) => {
|
||||
return await request.get({ url: `/pms/project-schedule/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增项目进度管理
|
||||
createProjectSchedule: async (data: ProjectScheduleVO) => {
|
||||
return await request.post({ url: `/pms/project-schedule/create`, data })
|
||||
},
|
||||
|
||||
// 修改项目进度管理
|
||||
updateProjectSchedule: async (data: ProjectScheduleVO) => {
|
||||
return await request.put({ url: `/pms/project-schedule/update`, data })
|
||||
},
|
||||
|
||||
// 删除项目进度管理
|
||||
deleteProjectSchedule: async (id: number) => {
|
||||
return await request.delete({ url: `/pms/project-schedule/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出项目进度管理 Excel
|
||||
exportProjectSchedule: async (params) => {
|
||||
return await request.download({ url: `/pms/project-schedule/export-excel`, params })
|
||||
},
|
||||
}
|
@@ -0,0 +1,270 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="项目id" prop="projectId">
|
||||
<el-input v-model="formData.projectId" placeholder="请输入项目id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目负责人" prop="projectLeader">
|
||||
<el-input v-model="formData.projectLeader" placeholder="请输入项目负责人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主专业" prop="major">
|
||||
<el-select v-model="formData.major" placeholder="请选择主专业">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他专业" prop="minorMajors">
|
||||
<el-input v-model="formData.minorMajors" placeholder="请输入其他专业" />
|
||||
</el-form-item>
|
||||
<el-form-item label="其他主要项目组成员" prop="minorUserIds">
|
||||
<el-input v-model="formData.minorUserIds" placeholder="请输入其他主要项目组成员" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规模" prop="scale">
|
||||
<el-select v-model="formData.scale" placeholder="请选择规模">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目概况" prop="survey">
|
||||
<el-input v-model="formData.survey" placeholder="请输入项目概况" />
|
||||
</el-form-item>
|
||||
<el-form-item label="相关批复文件url" prop="replyFileUrl">
|
||||
<UploadFile v-model="formData.replyFileUrl" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前阶段" prop="stage">
|
||||
<el-input v-model="formData.stage" placeholder="请输入当前阶段" />
|
||||
</el-form-item>
|
||||
<el-form-item label="已完成的项目阶段" prop="preStage">
|
||||
<el-input v-model="formData.preStage" placeholder="请输入已完成的项目阶段" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工作进展" prop="progress">
|
||||
<el-input v-model="formData.progress" placeholder="请输入工作进展" />
|
||||
</el-form-item>
|
||||
<el-form-item label="外部合同商议时间" prop="contractNegotiationTime">
|
||||
<el-date-picker
|
||||
v-model="formData.contractNegotiationTime"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择外部合同商议时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="已完成百分比" prop="completed">
|
||||
<el-select v-model="formData.completed" placeholder="请选择已完成百分比">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="截至本月累计完成百分比" prop="accumulatedCompletion">
|
||||
<el-input v-model="formData.accumulatedCompletion" placeholder="请输入截至本月累计完成百分比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="本月新增完工比" prop="newlyIncreasedCompletion">
|
||||
<el-input v-model="formData.newlyIncreasedCompletion" placeholder="请输入本月新增完工比" />
|
||||
</el-form-item>
|
||||
<el-form-item label="已完成产值" prop="finishOutput">
|
||||
<el-input v-model="formData.finishOutput" placeholder="请输入已完成产值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="本月新增产值" prop="newlyIncreasedOutput">
|
||||
<el-input v-model="formData.newlyIncreasedOutput" placeholder="请输入本月新增产值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="累积产值" prop="accumulatedOutput">
|
||||
<el-input v-model="formData.accumulatedOutput" placeholder="请输入累积产值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="竣工时间" prop="completionTime">
|
||||
<el-date-picker
|
||||
v-model="formData.completionTime"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择竣工时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单选" prop="choose">
|
||||
<el-radio-group v-model="formData.choose">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="竣工报告附件url" prop="completionFileUrl">
|
||||
<UploadFile v-model="formData.completionFileUrl" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最后编辑人" prop="finalEditor">
|
||||
<el-input v-model="formData.finalEditor" placeholder="请输入最后编辑人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creator">
|
||||
<el-input v-model="formData.creator" placeholder="请输入创建人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="formData.createTime"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择创建时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updator">
|
||||
<el-input v-model="formData.updator" placeholder="请输入更新人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-date-picker
|
||||
v-model="formData.updateTime"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择更新时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="deleted">
|
||||
<el-radio-group v-model="formData.deleted">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="租户id" prop="tenantId">
|
||||
<el-input v-model="formData.tenantId" placeholder="请输入租户id" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ProjectScheduleApi, ProjectScheduleVO } from '@/api/pms/projectschedule'
|
||||
|
||||
/** 项目进度管理 表单 */
|
||||
defineOptions({ name: 'ProjectScheduleForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
projectId: undefined,
|
||||
projectLeader: undefined,
|
||||
major: undefined,
|
||||
minorMajors: undefined,
|
||||
minorUserIds: undefined,
|
||||
scale: undefined,
|
||||
survey: undefined,
|
||||
replyFileUrl: undefined,
|
||||
stage: undefined,
|
||||
preStage: undefined,
|
||||
progress: undefined,
|
||||
contractNegotiationTime: undefined,
|
||||
completed: undefined,
|
||||
accumulatedCompletion: undefined,
|
||||
newlyIncreasedCompletion: undefined,
|
||||
finishOutput: undefined,
|
||||
newlyIncreasedOutput: undefined,
|
||||
accumulatedOutput: undefined,
|
||||
completionTime: undefined,
|
||||
choose: undefined,
|
||||
completionFileUrl: undefined,
|
||||
finalEditor: undefined,
|
||||
creator: undefined,
|
||||
createTime: undefined,
|
||||
updator: undefined,
|
||||
updateTime: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
|
||||
projectLeader: [{ required: true, message: '项目负责人不能为空', trigger: 'blur' }],
|
||||
major: [{ required: true, message: '主专业不能为空', trigger: 'change' }],
|
||||
scale: [{ required: true, message: '规模不能为空', trigger: 'change' }],
|
||||
survey: [{ required: true, message: '项目概况不能为空', trigger: 'blur' }],
|
||||
stage: [{ required: true, message: '当前阶段不能为空', trigger: 'blur' }],
|
||||
preStage: [{ required: true, message: '已完成的项目阶段不能为空', trigger: 'blur' }],
|
||||
progress: [{ required: true, message: '工作进展不能为空', trigger: 'blur' }],
|
||||
contractNegotiationTime: [{ required: true, message: '外部合同商议时间不能为空', trigger: 'blur' }],
|
||||
completed: [{ required: true, message: '已完成百分比不能为空', trigger: 'change' }],
|
||||
creator: [{ required: true, message: '创建人不能为空', trigger: 'blur' }],
|
||||
updator: [{ required: true, message: '更新人不能为空', trigger: 'blur' }],
|
||||
deleted: [{ required: true, message: '是否删除不能为空', trigger: 'blur' }],
|
||||
tenantId: [{ required: true, message: '租户id不能为空', trigger: 'blur' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectScheduleApi.getProjectSchedule(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as ProjectScheduleVO
|
||||
if (formType.value === 'create') {
|
||||
await ProjectScheduleApi.createProjectSchedule(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ProjectScheduleApi.updateProjectSchedule(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
projectId: undefined,
|
||||
projectLeader: undefined,
|
||||
major: undefined,
|
||||
minorMajors: undefined,
|
||||
minorUserIds: undefined,
|
||||
scale: undefined,
|
||||
survey: undefined,
|
||||
replyFileUrl: undefined,
|
||||
stage: undefined,
|
||||
preStage: undefined,
|
||||
progress: undefined,
|
||||
contractNegotiationTime: undefined,
|
||||
completed: undefined,
|
||||
accumulatedCompletion: undefined,
|
||||
newlyIncreasedCompletion: undefined,
|
||||
finishOutput: undefined,
|
||||
newlyIncreasedOutput: undefined,
|
||||
accumulatedOutput: undefined,
|
||||
completionTime: undefined,
|
||||
choose: undefined,
|
||||
completionFileUrl: undefined,
|
||||
finalEditor: undefined,
|
||||
creator: undefined,
|
||||
createTime: undefined,
|
||||
updator: undefined,
|
||||
updateTime: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
@@ -0,0 +1,484 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="项目id" prop="projectId">
|
||||
<el-input
|
||||
v-model="queryParams.projectId"
|
||||
placeholder="请输入项目id"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目负责人" prop="projectLeader">
|
||||
<el-input
|
||||
v-model="queryParams.projectLeader"
|
||||
placeholder="请输入项目负责人"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="主专业" prop="major">
|
||||
<el-select
|
||||
v-model="queryParams.major"
|
||||
placeholder="请选择主专业"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他专业" prop="minorMajors">
|
||||
<el-input
|
||||
v-model="queryParams.minorMajors"
|
||||
placeholder="请输入其他专业"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他主要项目组成员" prop="minorUserIds">
|
||||
<el-input
|
||||
v-model="queryParams.minorUserIds"
|
||||
placeholder="请输入其他主要项目组成员"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规模" prop="scale">
|
||||
<el-select
|
||||
v-model="queryParams.scale"
|
||||
placeholder="请选择规模"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目概况" prop="survey">
|
||||
<el-input
|
||||
v-model="queryParams.survey"
|
||||
placeholder="请输入项目概况"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="当前阶段" prop="stage">
|
||||
<el-input
|
||||
v-model="queryParams.stage"
|
||||
placeholder="请输入当前阶段"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="已完成的项目阶段" prop="preStage">
|
||||
<el-input
|
||||
v-model="queryParams.preStage"
|
||||
placeholder="请输入已完成的项目阶段"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工作进展" prop="progress">
|
||||
<el-input
|
||||
v-model="queryParams.progress"
|
||||
placeholder="请输入工作进展"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部合同商议时间" prop="contractNegotiationTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.contractNegotiationTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="已完成百分比" prop="completed">
|
||||
<el-select
|
||||
v-model="queryParams.completed"
|
||||
placeholder="请选择已完成百分比"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="截至本月累计完成百分比" prop="accumulatedCompletion">
|
||||
<el-input
|
||||
v-model="queryParams.accumulatedCompletion"
|
||||
placeholder="请输入截至本月累计完成百分比"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="本月新增完工比" prop="newlyIncreasedCompletion">
|
||||
<el-input
|
||||
v-model="queryParams.newlyIncreasedCompletion"
|
||||
placeholder="请输入本月新增完工比"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="已完成产值" prop="finishOutput">
|
||||
<el-input
|
||||
v-model="queryParams.finishOutput"
|
||||
placeholder="请输入已完成产值"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="本月新增产值" prop="newlyIncreasedOutput">
|
||||
<el-input
|
||||
v-model="queryParams.newlyIncreasedOutput"
|
||||
placeholder="请输入本月新增产值"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="累积产值" prop="accumulatedOutput">
|
||||
<el-input
|
||||
v-model="queryParams.accumulatedOutput"
|
||||
placeholder="请输入累积产值"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="竣工时间" prop="completionTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.completionTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单选" prop="choose">
|
||||
<el-select
|
||||
v-model="queryParams.choose"
|
||||
placeholder="请选择单选"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="最后编辑人" prop="finalEditor">
|
||||
<el-input
|
||||
v-model="queryParams.finalEditor"
|
||||
placeholder="请输入最后编辑人"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creator">
|
||||
<el-input
|
||||
v-model="queryParams.creator"
|
||||
placeholder="请输入创建人"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updator">
|
||||
<el-input
|
||||
v-model="queryParams.updator"
|
||||
placeholder="请输入更新人"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.updateTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="deleted">
|
||||
<el-select
|
||||
v-model="queryParams.deleted"
|
||||
placeholder="请选择是否删除"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="租户id" prop="tenantId">
|
||||
<el-input
|
||||
v-model="queryParams.tenantId"
|
||||
placeholder="请输入租户id"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['pms:project-schedule:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['pms:project-schedule:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="主键" align="center" prop="id" />
|
||||
<el-table-column label="项目id" align="center" prop="projectId" />
|
||||
<el-table-column label="项目负责人" align="center" prop="projectLeader" />
|
||||
<el-table-column label="主专业" align="center" prop="major" />
|
||||
<el-table-column label="其他专业" align="center" prop="minorMajors" />
|
||||
<el-table-column label="其他主要项目组成员" align="center" prop="minorUserIds" />
|
||||
<el-table-column label="规模" align="center" prop="scale" />
|
||||
<el-table-column label="项目概况" align="center" prop="survey" />
|
||||
<el-table-column label="相关批复文件url" align="center" prop="replyFileUrl" />
|
||||
<el-table-column label="当前阶段" align="center" prop="stage" />
|
||||
<el-table-column label="已完成的项目阶段" align="center" prop="preStage" />
|
||||
<el-table-column label="工作进展" align="center" prop="progress" />
|
||||
<el-table-column
|
||||
label="外部合同商议时间"
|
||||
align="center"
|
||||
prop="contractNegotiationTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="已完成百分比" align="center" prop="completed" />
|
||||
<el-table-column label="截至本月累计完成百分比" align="center" prop="accumulatedCompletion" />
|
||||
<el-table-column label="本月新增完工比" align="center" prop="newlyIncreasedCompletion" />
|
||||
<el-table-column label="已完成产值" align="center" prop="finishOutput" />
|
||||
<el-table-column label="本月新增产值" align="center" prop="newlyIncreasedOutput" />
|
||||
<el-table-column label="累积产值" align="center" prop="accumulatedOutput" />
|
||||
<el-table-column
|
||||
label="竣工时间"
|
||||
align="center"
|
||||
prop="completionTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="单选" align="center" prop="choose" />
|
||||
<el-table-column label="竣工报告附件url" align="center" prop="completionFileUrl" />
|
||||
<el-table-column label="最后编辑人" align="center" prop="finalEditor" />
|
||||
<el-table-column label="创建人" align="center" prop="creator" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="更新人" align="center" prop="updator" />
|
||||
<el-table-column
|
||||
label="更新时间"
|
||||
align="center"
|
||||
prop="updateTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="是否删除" align="center" prop="deleted" />
|
||||
<el-table-column label="租户id" align="center" prop="tenantId" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['pms:project-schedule:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['pms:project-schedule:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ProjectScheduleForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { ProjectScheduleApi, ProjectScheduleVO } from '@/api/pms/projectschedule'
|
||||
import ProjectScheduleForm from './ProjectScheduleForm.vue'
|
||||
|
||||
/** 项目进度管理 列表 */
|
||||
defineOptions({ name: 'ProjectSchedule' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<ProjectScheduleVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectId: undefined,
|
||||
projectLeader: undefined,
|
||||
major: undefined,
|
||||
minorMajors: undefined,
|
||||
minorUserIds: undefined,
|
||||
scale: undefined,
|
||||
survey: undefined,
|
||||
replyFileUrl: undefined,
|
||||
stage: undefined,
|
||||
preStage: undefined,
|
||||
progress: undefined,
|
||||
contractNegotiationTime: [],
|
||||
completed: undefined,
|
||||
accumulatedCompletion: undefined,
|
||||
newlyIncreasedCompletion: undefined,
|
||||
finishOutput: undefined,
|
||||
newlyIncreasedOutput: undefined,
|
||||
accumulatedOutput: undefined,
|
||||
completionTime: [],
|
||||
choose: undefined,
|
||||
completionFileUrl: undefined,
|
||||
finalEditor: undefined,
|
||||
creator: undefined,
|
||||
createTime: [],
|
||||
updator: undefined,
|
||||
updateTime: [],
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ProjectScheduleApi.getProjectSchedulePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await ProjectScheduleApi.deleteProjectSchedule(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ProjectScheduleApi.exportProjectSchedule(queryParams)
|
||||
download.excel(data, '项目进度管理.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
Reference in New Issue
Block a user