mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 10:18:42 +08:00 
			
		
		
		
	Merge remote-tracking branch 'origin/feature-extContract-7.25-wyw' into feature-merage-7.26-zqc
# Conflicts: # yudao-module-cms/yudao-module-cms-api/src/main/java/cn/iocoder/yudao/module/cms/enums/ErrorCodeConstants.java # yudao-module-cms/yudao-module-cms-biz/src/main/java/cn/iocoder/yudao/module/cms/service/extcontract/ExtContractServiceImpl.java
This commit is contained in:
		| @@ -8,17 +8,32 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; | |||||||
|  * @date 2024/7/3 |  * @date 2024/7/3 | ||||||
|  */ |  */ | ||||||
| public interface ErrorCodeConstants { | public interface ErrorCodeConstants { | ||||||
|     ErrorCode CUSTOMER_COMPANY_NOT_EXISTS = new ErrorCode(2_019_000_000, "客户信息表不存在"); |     ErrorCode CUSTOMER_COMPANY_NOT_EXISTS = new ErrorCode(1_020_000_000, "客户公司管理不存在"); | ||||||
|     ErrorCode CONTRACT_NOT_EXISTS = new ErrorCode(2_020_000_000, "合同不存在"); |  | ||||||
|     ErrorCode CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_021_000_000, "历史合同不存在"); |  | ||||||
|  |  | ||||||
|     ErrorCode EXT_CONTRACT_NOT_EXISTS = new ErrorCode(2_022_000_000, "外部合同不存在"); |     ErrorCode CONTRACT_NOT_EXISTS = new ErrorCode(2_024_000_000, "合同不存在"); | ||||||
|  |  | ||||||
|     ErrorCode CONTRACT_OUTS_NOT_EXISTS = new ErrorCode(2_023_000_000, "外部合同不存在"); |     ErrorCode CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_025_000_000, "历史合同不存在"); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     ErrorCode EXT_CONTRACT_NOT_EXISTS = new ErrorCode(2_026_000_000, "外部合同不存在"); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     ErrorCode EXT_CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_027_000_000, "历史外部合同不存在"); | ||||||
|  |  | ||||||
|  |     ErrorCode CONTRACT_EXT_NOT_EXISTS = new ErrorCode(2_028_000_000, "外部合同关联不存在"); | ||||||
|  |  | ||||||
|  |     // ========== 外包合同 2_021_000_000 ========== | ||||||
|  |     ErrorCode OUTS_CONTRACT_NOT_EXISTS = new ErrorCode(2_021_000_000, "外包合同不存在"); | ||||||
|  |  | ||||||
|  |     // ========== 外包合同历史 2_022_000_000 ========== | ||||||
|  |     ErrorCode OUTS_CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_022_000_000, "外包合同历史不存在"); | ||||||
|  |  | ||||||
|  |     // ========== 外包合同关联 2_023_000_000 ========== | ||||||
|  |     ErrorCode CONTRACT_OUTS_NOT_EXISTS = new ErrorCode(2_023_000_000, "外包合同关联不存在"); | ||||||
|  |  | ||||||
|  |     ErrorCode PROJECT_NOT_EXISTS = new ErrorCode(1_021_000_000, "项目信息不存在"); | ||||||
|  |  | ||||||
|     ErrorCode OUTS_CONTRACT_NOT_EXISTS = new ErrorCode(2_024_000_000, "外包合同不存在"); |  | ||||||
|  |  | ||||||
|     ErrorCode OUTS_CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_025_000_000, "外包合同不存在"); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| package cn.iocoder.yudao.module.cms.controller.admin.contract.vo; | package cn.iocoder.yudao.module.cms.controller.admin.contract.vo; | ||||||
|  | import com.alibaba.excel.annotation.ExcelProperty; | ||||||
| import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.Schema; | ||||||
| import lombok.*; | import lombok.*; | ||||||
| import jakarta.validation.constraints.*; | import jakarta.validation.constraints.*; | ||||||
| @@ -12,9 +13,37 @@ public class ContractSaveReqVO { | |||||||
|     @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED) |     @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED) | ||||||
|     private Long id; |     private Long id; | ||||||
|  |  | ||||||
|     @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") |     @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") | ||||||
|     private Long projectId; |     private Long projectId; | ||||||
|  |  | ||||||
|  |     @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001") | ||||||
|  |     @ExcelProperty("项目编号") | ||||||
|  |     private String code; | ||||||
|  |  | ||||||
|  |     @Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部") | ||||||
|  |     @ExcelProperty("主控部门") | ||||||
|  |     private String trackingDep; | ||||||
|  |  | ||||||
|  |     @Schema(description = "项目经理", requiredMode = Schema.RequiredMode.REQUIRED) | ||||||
|  |     @ExcelProperty("项目经理") | ||||||
|  |     private String projectManager; | ||||||
|  |  | ||||||
|  |     @Schema(description = "分包合同提示时间") | ||||||
|  |     @ExcelProperty("分包合同提示时间") | ||||||
|  |     private LocalDateTime ReminderTime; | ||||||
|  |  | ||||||
|  |     @Schema(description = "暂定结算数") | ||||||
|  |     @ExcelProperty("暂定结算数") | ||||||
|  |     private BigDecimal provisionalSettlement; | ||||||
|  |  | ||||||
|  |     @Schema(description = "出图公司", requiredMode = Schema.RequiredMode.REQUIRED,example = "***设计院") | ||||||
|  |     @ExcelProperty("出图公司") | ||||||
|  |     private String drawingCompany; | ||||||
|  |  | ||||||
|  |     @Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED,example = "200.0000") | ||||||
|  |     @ExcelProperty("预计合同金额") | ||||||
|  |     private BigDecimal expectedContractAmount; | ||||||
|  |  | ||||||
|     @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") |     @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | ||||||
|     @NotEmpty(message = "合同名称不能为空") |     @NotEmpty(message = "合同名称不能为空") | ||||||
|     private String name; |     private String name; | ||||||
|   | |||||||
| @@ -17,7 +17,6 @@ public class ExtContractRespVO { | |||||||
|     @ExcelProperty("项目编号") |     @ExcelProperty("项目编号") | ||||||
|     private String code; |     private String code; | ||||||
|  |  | ||||||
|  |  | ||||||
|     @Schema(description = "合同名称", example = "芋艿") |     @Schema(description = "合同名称", example = "芋艿") | ||||||
|     @ExcelProperty("合同名称") |     @ExcelProperty("合同名称") | ||||||
|     private String name; |     private String name; | ||||||
| @@ -39,9 +38,10 @@ public class ExtContractRespVO { | |||||||
|     @ExcelProperty("项目经理") |     @ExcelProperty("项目经理") | ||||||
|     private String projectManager; |     private String projectManager; | ||||||
|  |  | ||||||
|     @Schema(description = "分包合同提示时间") |     @Schema(description = "合同提示时间") | ||||||
|     @ExcelProperty("分包合同提示时间") |     @ExcelProperty("合同提示时间") | ||||||
|     private LocalDateTime reminderTime; |     private LocalDateTime exReminderTime; | ||||||
|  |  | ||||||
|  |  | ||||||
|     @Schema(description = "合同进展") |     @Schema(description = "合同进展") | ||||||
|     @ExcelProperty("合同进展") |     @ExcelProperty("合同进展") | ||||||
| @@ -107,10 +107,9 @@ public class ExtContractRespVO { | |||||||
|     @ExcelProperty("资金来源") |     @ExcelProperty("资金来源") | ||||||
|     private String source; |     private String source; | ||||||
|  |  | ||||||
|  |     @Schema(description = "分包合同提示时间") | ||||||
|     @Schema(description = "合同提示时间") |     @ExcelProperty("分包合同提示时间") | ||||||
|     @ExcelProperty("合同提示时间") |     private LocalDateTime reminderTime; | ||||||
|     private LocalDateTime exReminderTime; |  | ||||||
|  |  | ||||||
|     @Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED) |     @Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED) | ||||||
|     @ExcelProperty("收费标准") |     @ExcelProperty("收费标准") | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| package cn.iocoder.yudao.module.cms.controller.admin.extContract.vo; | package cn.iocoder.yudao.module.cms.controller.admin.extContract.vo; | ||||||
|  |  | ||||||
|  | import com.alibaba.excel.annotation.ExcelProperty; | ||||||
| import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.Schema; | ||||||
| import lombok.*; | import lombok.*; | ||||||
| import jakarta.validation.constraints.*; | import jakarta.validation.constraints.*; | ||||||
| @@ -18,15 +19,39 @@ public class ExtContractSaveReqVO { | |||||||
|     @NotNull(message = "项目id不能为空") |     @NotNull(message = "项目id不能为空") | ||||||
|     private Long projectId; |     private Long projectId; | ||||||
|  |  | ||||||
|     @Schema(description = "合同名称", example = "芋艿") |     @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001") | ||||||
|     private String name; |     @ExcelProperty("项目编号") | ||||||
|  |     private String code; | ||||||
|  |  | ||||||
|     @Schema(description = "合同类型", example = "1") |     @Schema(description = "客户名称") | ||||||
|     private String type; |     @ExcelProperty("客户名称") | ||||||
|  |     private String customerCompanyName; | ||||||
|  |  | ||||||
|  |     @Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部") | ||||||
|  |     @ExcelProperty("主控部门") | ||||||
|  |     private String trackingDep; | ||||||
|  |  | ||||||
|  |     @Schema(description = "项目经理", requiredMode = Schema.RequiredMode.REQUIRED) | ||||||
|  |     @ExcelProperty("项目经理") | ||||||
|  |     private String projectManager; | ||||||
|  |  | ||||||
|  |     @Schema(description = "合同提示时间") | ||||||
|  |     @ExcelProperty("合同提示时间") | ||||||
|  |     private LocalDateTime exReminderTime; | ||||||
|  |  | ||||||
|     @Schema(description = "客户公司id", example = "25191") |     @Schema(description = "客户公司id", example = "25191") | ||||||
|     private Long customerCompanyId; |     private Long customerCompanyId; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     @Schema(description = "合同名称", example = "芋艿") | ||||||
|  |     @ExcelProperty("合同名称") | ||||||
|  |     private String name; | ||||||
|  |  | ||||||
|  |     @Schema(description = "合同类型", example = "1") | ||||||
|  |     @ExcelProperty("合同类型") | ||||||
|  |     private String type; | ||||||
|  |  | ||||||
|     @Schema(description = "合同进展") |     @Schema(description = "合同进展") | ||||||
|     private String progress; |     private String progress; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| package cn.iocoder.yudao.module.cms.dal.mysql.extContract; | package cn.iocoder.yudao.module.cms.dal.mysql.extcontract; | ||||||
| 
 | 
 | ||||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||||
| import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||||||
| @@ -45,15 +45,28 @@ public class ContractServiceImpl implements ContractService { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Long createContract(ContractSaveReqVO createReqVO) { |     public Long createContract(ContractSaveReqVO createReqVO) { | ||||||
|         // 插入 |  | ||||||
|         ContractDO contract = BeanUtils.toBean(createReqVO, ContractDO.class); |         ContractDO contract = BeanUtils.toBean(createReqVO, ContractDO.class); | ||||||
|  |         Long projectId = createReqVO.getProjectId(); | ||||||
|  |         if (projectId != null) { | ||||||
|  |             //进行更新 | ||||||
|  |             updateContract(createReqVO); | ||||||
|  |         }else{ | ||||||
|  |             //插入 | ||||||
|             contractMapper.insert(contract); |             contractMapper.insert(contract); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         // 返回 |         // 返回 | ||||||
|         return contract.getId(); |         return contract.getId(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void updateContract(ContractSaveReqVO updateReqVO) { |     public void updateContract(ContractSaveReqVO updateReqVO) { | ||||||
|  |         Long id = updateReqVO.getId(); | ||||||
|  |         validateContractExists(id); | ||||||
|  |         Long projectId = updateReqVO.getProjectId(); | ||||||
|  |         if (projectId == null){ | ||||||
|  |             throw exception(CONTRACT_NOT_EXISTS); | ||||||
|  |         } | ||||||
|         // 更新 |         // 更新 | ||||||
|         ContractDO updateObj = BeanUtils.toBean(updateReqVO, ContractDO.class); |         ContractDO updateObj = BeanUtils.toBean(updateReqVO, ContractDO.class); | ||||||
|         contractMapper.updateById(updateObj); |         contractMapper.updateById(updateObj); | ||||||
| @@ -67,17 +80,16 @@ public class ContractServiceImpl implements ContractService { | |||||||
|         contractMapper.deleteById(id); |         contractMapper.deleteById(id); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void validateContractExists(Long projectId) { |  | ||||||
|         if (contractMapper.selectById(projectId) == null) { |  | ||||||
|             throw exception(CONTRACT_NOT_EXISTS); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public ContractRespVO getContract(Long id) { |     public ContractRespVO getContract(Long id) { | ||||||
|  |  | ||||||
|         ContractDO contractDO = contractMapper.selectById(id); |         ContractDO contractDO = contractMapper.selectById(id); | ||||||
|         Long projectId = contractDO.getProjectId(); |         Long projectId = contractDO.getProjectId(); | ||||||
|  |         //校验 | ||||||
|  |         if (projectId == null){ | ||||||
|  |             throw exception(PROJECT_NOT_EXISTS); | ||||||
|  |         } | ||||||
|         ContractRespVO contractRespVO = BeanUtils.toBean(contractDO, ContractRespVO.class); |         ContractRespVO contractRespVO = BeanUtils.toBean(contractDO, ContractRespVO.class); | ||||||
|  |  | ||||||
| //        需要联表查询 | //        需要联表查询 | ||||||
| @@ -144,4 +156,11 @@ public class ContractServiceImpl implements ContractService { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     private void validateContractExists(Long projectId) { | ||||||
|  |         if (contractMapper.selectById(projectId) == null) { | ||||||
|  |             throw exception(CONTRACT_NOT_EXISTS); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
| @@ -0,0 +1,63 @@ | |||||||
|  | package cn.iocoder.yudao.module.cms.service.extcontract; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractPageReqVO; | ||||||
|  | import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractRespVO; | ||||||
|  | import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractSaveReqVO; | ||||||
|  | import jakarta.validation.*; | ||||||
|  | import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||||
|  |  | ||||||
|  | import java.math.BigDecimal; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 外部合同 Service 接口 | ||||||
|  |  * | ||||||
|  |  * @author 管理员 | ||||||
|  |  */ | ||||||
|  | public interface ExtContractService { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 创建外部合同 | ||||||
|  |      * | ||||||
|  |      * @param createReqVO 创建信息 | ||||||
|  |      * @return 编号 | ||||||
|  |      */ | ||||||
|  |     Long createExtContract(@Valid ExtContractSaveReqVO createReqVO); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 更新外部合同 | ||||||
|  |      * | ||||||
|  |      * @param updateReqVO 更新信息 | ||||||
|  |      */ | ||||||
|  |     void updateExtContract(@Valid ExtContractSaveReqVO updateReqVO); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除外部合同 | ||||||
|  |      * | ||||||
|  |      * @param id 编号 | ||||||
|  |      */ | ||||||
|  |     void deleteExtContract(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获得外部合同 | ||||||
|  |      * | ||||||
|  |      * @param id 编号 | ||||||
|  |      * @return 外部合同 | ||||||
|  |      */ | ||||||
|  |     ExtContractRespVO getExtContract(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获得外部合同分页 | ||||||
|  |      * | ||||||
|  |      * @param pageReqVO 分页查询 | ||||||
|  |      * @return 外部合同分页 | ||||||
|  |      */ | ||||||
|  |     PageResult<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 合同总金额 | ||||||
|  |      * @param id | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     BigDecimal getContractAmount(Long id); | ||||||
|  | } | ||||||
| @@ -0,0 +1,145 @@ | |||||||
|  | package cn.iocoder.yudao.module.cms.service.extcontract; | ||||||
|  |  | ||||||
|  | import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractPageReqVO; | ||||||
|  | import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractRespVO; | ||||||
|  | import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractSaveReqVO; | ||||||
|  | import cn.iocoder.yudao.module.cms.dal.dataobject.customerCompany.CustomerCompanyDO; | ||||||
|  | import cn.iocoder.yudao.module.cms.dal.dataobject.extContract.ExtContractDO; | ||||||
|  | import cn.iocoder.yudao.module.cms.dal.mysql.customerCompany.CustomerCompanyMapper; | ||||||
|  | import cn.iocoder.yudao.module.cms.dal.mysql.extContract.ExtContractMapper; | ||||||
|  | import cn.iocoder.yudao.module.pms.api.ProjectApi; | ||||||
|  | import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO; | ||||||
|  | import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | import jakarta.annotation.Resource; | ||||||
|  | import org.springframework.validation.annotation.Validated; | ||||||
|  | import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||||
|  | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||||
|  |  | ||||||
|  | import java.math.BigDecimal; | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||||||
|  | import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.EXT_CONTRACT_NOT_EXISTS; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 外部合同 Service 实现类 | ||||||
|  |  * | ||||||
|  |  * @author 管理员 | ||||||
|  |  */ | ||||||
|  | @Service | ||||||
|  | @Validated | ||||||
|  | public class ExtContractServiceImpl implements ExtContractService { | ||||||
|  |  | ||||||
|  |     @Resource | ||||||
|  |     private ExtContractMapper extContractMapper; | ||||||
|  |  | ||||||
|  |     @Resource | ||||||
|  |     private ProjectApi projectApi; | ||||||
|  |  | ||||||
|  |     @Resource | ||||||
|  |     private CustomerCompanyMapper customerCompanyMapper; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public Long createExtContract(ExtContractSaveReqVO createReqVO) { | ||||||
|  |         // 插入 | ||||||
|  |         ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class); | ||||||
|  |         extContractMapper.insert(extContract); | ||||||
|  |         // 返回 | ||||||
|  |         return extContract.getId(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void updateExtContract(ExtContractSaveReqVO updateReqVO) { | ||||||
|  |         //校验 | ||||||
|  |         Long id = updateReqVO.getId(); | ||||||
|  |         validateExtContractExists(id); | ||||||
|  |         // 更新 | ||||||
|  |         ExtContractDO updateObj = BeanUtils.toBean(updateReqVO, ExtContractDO.class); | ||||||
|  |         extContractMapper.updateById(updateObj); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void deleteExtContract(Long id) { | ||||||
|  |         // 校验存在 | ||||||
|  |         validateExtContractExists(id); | ||||||
|  |         // 删除 | ||||||
|  |         extContractMapper.deleteById(id); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private void validateExtContractExists(Long id) { | ||||||
|  |         if (extContractMapper.selectById(id) == null) { | ||||||
|  |             throw exception(EXT_CONTRACT_NOT_EXISTS); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     //        需要联表查询 | ||||||
|  |     //        1.项目编号 pms_project 直接 √ | ||||||
|  |     //        2.主控部门(跟踪部门) pms_project找到的是id 需要联表 √ | ||||||
|  |     //        3.项目经理 pms_project找到的是id 需要联表 √ | ||||||
|  |     //        4.客户公司名称 pms_project 联表 √ | ||||||
|  |     //        5.合同总金额 √ | ||||||
|  |     //        6.合同商议提示(和分包提示不一样) | ||||||
|  |     @Override | ||||||
|  |     public ExtContractRespVO getExtContract(Long id) { | ||||||
|  |         ExtContractDO extContractDO = extContractMapper.selectById(id); | ||||||
|  |         Long projectId = extContractDO.getProjectId(); | ||||||
|  |         Long customerCompanyId = extContractDO.getCustomerCompanyId(); | ||||||
|  |         ExtContractRespVO extContractRespVO = BeanUtils.toBean(extContractDO, ExtContractRespVO.class); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         ProjectRespDTO project = projectApi.getProject(projectId); | ||||||
|  |         extContractRespVO.setCode(project.getCode()); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         ProjectDetailRespDTO projectDetail = projectApi.getProjectDetailById(projectId); | ||||||
|  |         extContractRespVO.setTrackingDep(projectDetail.getTrackingDepName()); | ||||||
|  |         extContractRespVO.setProjectManager(projectDetail.getProjectManagerName()); | ||||||
|  |  | ||||||
|  |         //用客户公司id查询 | ||||||
|  |         CustomerCompanyDO customerCompanyDO = customerCompanyMapper.selectById(customerCompanyId); | ||||||
|  |         String name = customerCompanyDO.getName(); | ||||||
|  |         extContractRespVO.setCustomerCompanyName(name); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         //合同总金额 | ||||||
|  |         BigDecimal contractAmount = getContractAmount(id); | ||||||
|  |         extContractRespVO.setAmount(contractAmount); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         return extContractRespVO; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public PageResult<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO) { | ||||||
|  |  | ||||||
|  |         PageResult<ExtContractDO> extContractDOPageResult = extContractMapper.selectPage(pageReqVO); | ||||||
|  |         List<ExtContractDO> excontractDOList = extContractDOPageResult.getList(); | ||||||
|  |         List<ExtContractRespVO> extContractRespVOList = new ArrayList<>(); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |         for (ExtContractDO extContractDO : excontractDOList) { | ||||||
|  |             Long id = extContractDO.getId(); | ||||||
|  |             ExtContractRespVO extContractRespVO = getExtContract(id); | ||||||
|  |             extContractRespVOList.add(extContractRespVO); | ||||||
|  |         } | ||||||
|  |         PageResult<ExtContractRespVO> pageResult = new PageResult<>(); | ||||||
|  |         pageResult.setList(extContractRespVOList); | ||||||
|  |         return pageResult; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public BigDecimal getContractAmount(Long id) { | ||||||
|  |         //前期+设计+地勘+其他+检测 | ||||||
|  |         ExtContractDO extContract = extContractMapper.selectById(id); | ||||||
|  |         BigDecimal preAmount = new BigDecimal(String.valueOf(extContract.getPreAmount())); | ||||||
|  |         BigDecimal designFee = new BigDecimal(String.valueOf(extContract.getDesignFee())); | ||||||
|  |         BigDecimal surveyFees = new BigDecimal(String.valueOf(extContract.getSurveyFees())); | ||||||
|  |         BigDecimal testingFee = new BigDecimal(String.valueOf(extContract.getTestingFee())); | ||||||
|  |         BigDecimal other = new BigDecimal(extContract.getOtherFee()); | ||||||
|  |         return preAmount.add(designFee).add(surveyFees).add(testingFee).add(other); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -6,8 +6,8 @@ import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractSa | |||||||
| import cn.iocoder.yudao.module.cms.dal.dataobject.customerCompany.CustomerCompanyDO; | import cn.iocoder.yudao.module.cms.dal.dataobject.customerCompany.CustomerCompanyDO; | ||||||
| import cn.iocoder.yudao.module.cms.dal.dataobject.extContract.ExtContractDO; | import cn.iocoder.yudao.module.cms.dal.dataobject.extContract.ExtContractDO; | ||||||
| import cn.iocoder.yudao.module.cms.dal.mysql.customerCompany.CustomerCompanyMapper; | import cn.iocoder.yudao.module.cms.dal.mysql.customerCompany.CustomerCompanyMapper; | ||||||
| import cn.iocoder.yudao.module.cms.dal.mysql.extContract.ExtContractMapper; | import cn.iocoder.yudao.module.cms.dal.mysql.extcontract.ExtContractMapper; | ||||||
| import cn.iocoder.yudao.module.pms.api.project.ProjectApi; | import cn.iocoder.yudao.module.pms.api.ProjectApi; | ||||||
| import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO; | import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO; | ||||||
| import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO; | import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| @@ -15,11 +15,9 @@ import jakarta.annotation.Resource; | |||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||||
|  |  | ||||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||||||
| import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.EXT_CONTRACT_NOT_EXISTS; | import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.EXT_CONTRACT_NOT_EXISTS; | ||||||
|  |  | ||||||
| @@ -44,10 +42,15 @@ public class ExtContractServiceImpl implements ExtContractService { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Long createExtContract(ExtContractSaveReqVO createReqVO) { |     public Long createExtContract(ExtContractSaveReqVO createReqVO) { | ||||||
|         // 插入 |         Long projectId = createReqVO.getProjectId(); | ||||||
|         ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class); |         ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class); | ||||||
|  |         if (projectId != null) { | ||||||
|  |             updateExtContract(createReqVO); | ||||||
|  |         } else { | ||||||
|  |             // 插入 | ||||||
|             extContractMapper.insert(extContract); |             extContractMapper.insert(extContract); | ||||||
|         // 返回 |         } | ||||||
|  |  | ||||||
|         return extContract.getId(); |         return extContract.getId(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Qiancheng Zhao
					Qiancheng Zhao