mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 20:28:44 +08:00 
			
		
		
		
	[fix] 优化合同管理功能
This commit is contained in:
		@@ -16,6 +16,7 @@ import io.swagger.v3.oas.annotations.Operation;
 | 
			
		||||
import jakarta.validation.*;
 | 
			
		||||
import jakarta.servlet.http.*;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 | 
			
		||||
@@ -51,7 +52,7 @@ public class ContractController {
 | 
			
		||||
 | 
			
		||||
    @DeleteMapping("/delete")
 | 
			
		||||
    @Operation(summary = "删除合同")
 | 
			
		||||
    @Parameter(name = "id", description = "项目id", required = true)
 | 
			
		||||
    @Parameter(name = "id", description = "合同id", required = true)
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract:delete')")
 | 
			
		||||
    public CommonResult<Boolean> deleteContract(@RequestParam("id") Long id) {
 | 
			
		||||
        contractService.deleteContract(id);
 | 
			
		||||
@@ -60,19 +61,19 @@ public class ContractController {
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/get")
 | 
			
		||||
    @Operation(summary = "获得合同")
 | 
			
		||||
    @Parameter(name = "projectId", description = "项目id", required = true)
 | 
			
		||||
    @Parameter(name = "id", description = "合同id", required = true)
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract:query')")
 | 
			
		||||
    public CommonResult<ContractRespVO> getContract(@RequestParam("projectId") Long projectId) {
 | 
			
		||||
        ContractRespVO contractRespVO = contractService.getContract(projectId);
 | 
			
		||||
    public CommonResult<ContractRespVO> getContract(@RequestParam("id") Long id) {
 | 
			
		||||
        ContractRespVO contractRespVO = contractService.getContract(id);
 | 
			
		||||
        return success(contractRespVO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/page")
 | 
			
		||||
    @Operation(summary = "获得合同分页")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract:query')")
 | 
			
		||||
    public CommonResult<PageResult<ContractRespVO>> getContractPage(@Valid ContractPageReqVO pageReqVO) {
 | 
			
		||||
    public CommonResult<PageResult<ContractDO>> getContractPage(@Valid ContractPageReqVO pageReqVO) {
 | 
			
		||||
        PageResult<ContractDO> pageResult = contractService.getContractPage(pageReqVO);
 | 
			
		||||
        return success(BeanUtils.toBean(pageResult, ContractRespVO.class));
 | 
			
		||||
        return success(pageResult);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/export-excel")
 | 
			
		||||
@@ -88,6 +89,4 @@ public class ContractController {
 | 
			
		||||
                        BeanUtils.toBean(list, ContractRespVO.class));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -97,19 +97,4 @@ public class ContractSaveReqVO {
 | 
			
		||||
    @Schema(description = "其他费")
 | 
			
		||||
    private BigDecimal otherFee;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "创建者")
 | 
			
		||||
    private String creator;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "创建时间不能为空")
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "更新者")
 | 
			
		||||
    private String updater;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "更新时间不能为空")
 | 
			
		||||
    private LocalDateTime updateTime;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
package cn.iocoder.yudao.module.cms.dal.dataobject.contract;
 | 
			
		||||
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import jakarta.validation.constraints.NotNull;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
@@ -144,4 +146,25 @@ public class ContractDO extends BaseDO {
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal otherFee;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建者
 | 
			
		||||
     */
 | 
			
		||||
    private String creator;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建时间
 | 
			
		||||
     */
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新者
 | 
			
		||||
     */
 | 
			
		||||
    private String updater;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新时间
 | 
			
		||||
     */
 | 
			
		||||
    private LocalDateTime updateTime;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -5,6 +5,8 @@ import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.*;
 | 
			
		||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 合同 Service 接口
 | 
			
		||||
 *
 | 
			
		||||
@@ -50,4 +52,10 @@ public interface ContractService {
 | 
			
		||||
     */
 | 
			
		||||
    PageResult<ContractDO> getContractPage(ContractPageReqVO pageReqVO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获得暂定结算金额
 | 
			
		||||
     * @param id 合同编号
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    BigDecimal getProvisionalSettlement(Long  id);
 | 
			
		||||
}
 | 
			
		||||
@@ -15,6 +15,8 @@ import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 | 
			
		||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
 | 
			
		||||
 | 
			
		||||
@@ -66,8 +68,10 @@ public class ContractServiceImpl implements ContractService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
        public ContractRespVO getContract(Long projectId) {
 | 
			
		||||
        ContractDO contractDO = contractMapper.selectOne("project_id",projectId);
 | 
			
		||||
    public ContractRespVO getContract(Long id) {
 | 
			
		||||
 | 
			
		||||
        ContractDO contractDO = contractMapper.selectById(id);
 | 
			
		||||
        Long projectId = contractDO.getProjectId();
 | 
			
		||||
        ContractRespVO contractRespVO = BeanUtils.toBean(contractDO, ContractRespVO.class);
 | 
			
		||||
 | 
			
		||||
//        需要联表查询
 | 
			
		||||
@@ -77,7 +81,7 @@ public class ContractServiceImpl implements ContractService {
 | 
			
		||||
//        4.出图公司 pms_project 直接 √
 | 
			
		||||
//        5.预计合同金额 pms_project 直接 √
 | 
			
		||||
//        6.分包合同商议提示  pms_project_schedule
 | 
			
		||||
//        7.暂定结算数
 | 
			
		||||
//        7.暂定结算数 √
 | 
			
		||||
        ProjectRespDTO project = projectApi.getProject(projectId);
 | 
			
		||||
        contractRespVO.setCode(project.getCode());
 | 
			
		||||
        contractRespVO.setDrawingCompany(project.getDrawingCompany());
 | 
			
		||||
@@ -87,7 +91,9 @@ public class ContractServiceImpl implements ContractService {
 | 
			
		||||
        contractRespVO.setTrackingDep(projectDetail.getTrackingDepName());
 | 
			
		||||
        contractRespVO.setProjectManager(projectDetail.getProjectManagerName());
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //暂定结算数
 | 
			
		||||
        BigDecimal provisionalSettlement = getProvisionalSettlement(id);
 | 
			
		||||
        contractRespVO.setProvisionalSettlement(provisionalSettlement);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        return contractRespVO;
 | 
			
		||||
@@ -98,4 +104,21 @@ public class ContractServiceImpl implements ContractService {
 | 
			
		||||
        return contractMapper.selectPage(pageReqVO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public BigDecimal getProvisionalSettlement(Long id) {
 | 
			
		||||
        ContractDO contractDO = contractMapper.selectById(id);
 | 
			
		||||
        String type = contractDO.getType();
 | 
			
		||||
        BigDecimal amount = contractDO.getAmount();
 | 
			
		||||
        BigDecimal bigDecimal = new BigDecimal(String.valueOf(amount));
 | 
			
		||||
        BigDecimal mul = new BigDecimal("0.85");
 | 
			
		||||
        BigDecimal res = null;
 | 
			
		||||
        if ("费率合同".equals(type)) {
 | 
			
		||||
            res = bigDecimal.multiply(mul);
 | 
			
		||||
        } else if ("总价合同".equals(type)) {
 | 
			
		||||
            res = amount;
 | 
			
		||||
        }
 | 
			
		||||
        return res;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user