mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-01 02:38:43 +08:00 
			
		
		
		
	[fix] 优化外包合同管理功能
This commit is contained in:
		| @@ -62,10 +62,10 @@ public class OutsContractController { | ||||
|  | ||||
|     @GetMapping("/get") | ||||
|     @Operation(summary = "获得外包合同") | ||||
|     @Parameter(name = "contractId", description = "主合同编号", required = true, example = "1") | ||||
|     @Parameter(name = "id", description = "主合同编号", required = true, example = "1") | ||||
|     @PreAuthorize("@ss.hasPermission('cms:outs-contract:query')") | ||||
|     public CommonResult<OutsContractRespVO> getOutsContract(@RequestParam("contractId") Long contractId) { | ||||
|         OutsContractRespVO outsContractRespVO = outsContractService.getOutsContract(contractId); | ||||
|     public CommonResult<OutsContractRespVO> getOutsContract(@RequestParam("id") Long id) { | ||||
|         OutsContractRespVO outsContractRespVO = outsContractService.getOutsContract(id); | ||||
|         return success(outsContractRespVO); | ||||
|     } | ||||
|  | ||||
| @@ -89,5 +89,4 @@ public class OutsContractController { | ||||
|         ExcelUtils.write(response, "外包合同.xls", "数据", OutsContractRespVO.class, | ||||
|                         BeanUtils.toBean(list, OutsContractRespVO.class)); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -29,7 +29,8 @@ public class OutsContractRespVO { | ||||
|  | ||||
|     @Schema(description = "签订合同总额") | ||||
|     @ExcelProperty("签订合同总额") | ||||
|     private BigDecimal amount; | ||||
|     private BigDecimal outsAmount; | ||||
|  | ||||
|  | ||||
|     @Schema(description = "外包合同编号") | ||||
|     @ExcelProperty("编号") | ||||
| @@ -49,11 +50,9 @@ public class OutsContractRespVO { | ||||
|     @DictFormat("contract_billing_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 | ||||
|     private String countType; | ||||
|  | ||||
|  | ||||
|     @Schema(description = "外包合同金额") | ||||
|     @ExcelProperty("外包合同金额") | ||||
|     private BigDecimal outsAmount; | ||||
|  | ||||
|     @Schema(description = "外包合同总额") | ||||
|     @ExcelProperty("外包合同总额") | ||||
|     private BigDecimal amount; | ||||
|  | ||||
|     @Schema(description = "专业") | ||||
|     @ExcelProperty(value = "专业", converter = DictConvert.class) | ||||
|   | ||||
| @@ -44,11 +44,11 @@ public class OutsContractDO extends BaseDO { | ||||
|     /** | ||||
|      * 类型 | ||||
|      * | ||||
|      * 枚举 | ||||
|      * 枚举 //// TODO 搞成枚举 | ||||
|      */ | ||||
|     private String countType; | ||||
|     /** | ||||
|      * 合同金额 | ||||
|      * 外包合同金额 | ||||
|      */ | ||||
|     private BigDecimal amount; | ||||
|     /** | ||||
| @@ -58,7 +58,7 @@ public class OutsContractDO extends BaseDO { | ||||
|     /** | ||||
|      * 专业 | ||||
|      * | ||||
|      * 枚举 | ||||
|      * 枚举 // TODO 搞成枚举 | ||||
|      */ | ||||
|     private String major; | ||||
|     /** | ||||
|   | ||||
| @@ -118,8 +118,8 @@ public class ContractServiceImpl implements ContractService { | ||||
|         contractRespVO.setProjectManager(projectDetail.getProjectManagerName()); | ||||
|  | ||||
|         //分包合同商议提示 TODO 待优化 | ||||
|         ExtContractDO extContractDO = extContractMapper.selectOne("project_id", projectId); | ||||
|         LocalDateTime reminderTime = extContractDO.getReminderTime(); | ||||
| //        ExtContractDO extContractDO = extContractMapper.selectOne("project_id", projectId); | ||||
| //        LocalDateTime reminderTime = extContractDO.getReminderTime(); | ||||
|         contractRespVO.setReminderTime(LocalDateTime.now()); | ||||
|  | ||||
|         //暂定结算数 | ||||
|   | ||||
| @@ -3,7 +3,6 @@ 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.contract.ContractDO; | ||||
| 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; | ||||
| @@ -93,7 +92,7 @@ public class ExtContractServiceImpl implements ExtContractService { | ||||
|     //        3.项目经理 pms_project找到的是id 需要联表 √ | ||||
|     //        4.客户公司名称 pms_project 联表 √ | ||||
|     //        5.合同总金额 √ | ||||
|     //        6.合同商议提示(和分包提示不一样) | ||||
|     //        6.合同商议提示(和分包提示不一样)√ | ||||
|     @Override | ||||
|     public ExtContractRespVO getExtContract(Long id) { | ||||
|         //校验 | ||||
|   | ||||
| @@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContract | ||||
| import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO; | ||||
| import jakarta.validation.Valid; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 外包合同 Service 接口 | ||||
|  * | ||||
|   | ||||
| @@ -2,19 +2,24 @@ package cn.iocoder.yudao.module.cms.service.outscontract; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractRespVO; | ||||
| import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractPageReqVO; | ||||
| import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractRespVO; | ||||
| import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractSaveReqVO; | ||||
| import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO; | ||||
| import cn.iocoder.yudao.module.cms.dal.mysql.outscontract.OutsContractMapper; | ||||
| import cn.iocoder.yudao.module.cms.service.contract.ContractService; | ||||
| import cn.iocoder.yudao.module.pms.api.ProjectApi; | ||||
| import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Objects; | ||||
|  | ||||
| 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.cms.enums.ErrorCodeConstants.OUTS_CONTRACT_NOT_EXISTS; | ||||
| import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*; | ||||
|  | ||||
| /** | ||||
|  * 外包合同 Service 实现类 | ||||
| @@ -31,9 +36,26 @@ public class OutsContractServiceImpl implements OutsContractService { | ||||
|     @Resource | ||||
|     private ContractService contractService; | ||||
|  | ||||
|     @Resource | ||||
|     private ProjectApi projectApi; | ||||
|  | ||||
|     @Override | ||||
|     public Long createOutsContract(OutsContractSaveReqVO createReqVO) { | ||||
|         OutsContractDO outsContract = BeanUtils.toBean(createReqVO, OutsContractDO.class); | ||||
|         //TODO 待优化 把校验逻辑提取 | ||||
|         Long contractId = outsContract.getContractId(); | ||||
|  | ||||
|         ContractRespVO contract = contractService.getContract(contractId); | ||||
|         if (contract == null) { | ||||
|             throw exception(CONTRACT_NOT_EXISTS); | ||||
|         } | ||||
|  | ||||
|         Long projectId = outsContract.getProjectId(); | ||||
|         ProjectRespDTO project = projectApi.getProject(projectId); | ||||
|         if (project == null) { | ||||
|             throw exception(PROJECT_NOT_EXISTS); | ||||
|         } | ||||
|  | ||||
|         outsContractMapper.insert(outsContract); | ||||
|         return outsContract.getId(); | ||||
|     } | ||||
| @@ -42,6 +64,16 @@ public class OutsContractServiceImpl implements OutsContractService { | ||||
|     public void updateOutsContract(OutsContractSaveReqVO updateReqVO) { | ||||
|         // 校验 | ||||
|         validateOutsContractExists(updateReqVO.getId()); | ||||
|         //TODO 待优化 把校验逻辑提取 | ||||
|         Long contractId = updateReqVO.getContractId(); | ||||
|         ContractRespVO contract = contractService.getContract(contractId); | ||||
|         if (contract == null) { | ||||
|             throw exception(CONTRACT_NOT_EXISTS); | ||||
|         } | ||||
|         OutsContractDO outsContractDO = outsContractMapper.selectById(updateReqVO.getId()); | ||||
|         if (!Objects.equals(updateReqVO.getProjectId(), outsContractDO.getProjectId())) { | ||||
|             throw exception(PROJECT_NOT_EXISTS); | ||||
|         } | ||||
|         // 更新 | ||||
|         OutsContractDO updateObj = BeanUtils.toBean(updateReqVO, OutsContractDO.class); | ||||
|         outsContractMapper.updateById(updateObj); | ||||
| @@ -55,14 +87,29 @@ public class OutsContractServiceImpl implements OutsContractService { | ||||
|         outsContractMapper.deleteById(id); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public OutsContractRespVO getOutsContract(Long contractId) { | ||||
|         //校验 | ||||
|         if (contractId == null){ | ||||
|             throw exception(CONTRACT_NOT_EXISTS); | ||||
|         } | ||||
|     //        需要联表查询 | ||||
|     //        1.合同名称 √ | ||||
|     //        2.主控部门(跟踪部门) √ | ||||
|     //        3.项目经理 √ | ||||
|     //        4.签订合同总额 √ | ||||
|  | ||||
|         return null; | ||||
|     @Override | ||||
|     public OutsContractRespVO getOutsContract(Long id) { | ||||
|         //校验 | ||||
|         if (id == null) { | ||||
|             throw exception(OUTS_CONTRACT_NOT_EXISTS); | ||||
|         } | ||||
|         OutsContractDO outsContractDO = outsContractMapper.selectById(id); | ||||
|         OutsContractRespVO outsContractRespVO = BeanUtils.toBean(outsContractDO, OutsContractRespVO.class); | ||||
|         Long contractId = outsContractDO.getContractId(); | ||||
|         ContractRespVO contract = contractService.getContract(contractId); | ||||
|  | ||||
|         outsContractRespVO.setName(contract.getName()); | ||||
|         outsContractRespVO.setTrackingDep(contract.getTrackingDep()); | ||||
|         outsContractRespVO.setProjectManager(contract.getProjectManager()); | ||||
|         outsContractRespVO.setOutsAmount(contract.getAmount()); | ||||
|  | ||||
|         return outsContractRespVO; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 wyw
					wyw