mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-19 04:31:53 +08:00
Compare commits
5 Commits
feature-Ou
...
feature-pm
Author | SHA1 | Date | |
---|---|---|---|
![]() |
92070e3c57 | ||
![]() |
1df906c0db | ||
![]() |
cb6816d4b7 | ||
![]() |
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);
|
||||
|
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user