关联合同接口

This commit is contained in:
guojunyun
2025-10-15 14:29:45 +08:00
parent 413fc19bbd
commit 568c309226
5 changed files with 70 additions and 24 deletions

View File

@@ -5,6 +5,9 @@ package com.zt.plat.module.contractorder.enums.contract;
*/ */
public enum DictEnum { public enum DictEnum {
/** 业务关联类型 */
BSE_SYS_REL_TP_ORDER("订单","ORDER",null),
BSE_SYS_REL_TP_CONTRACT("合同","CONTRACT",null),
/** 提交ERP合同状态 */ /** 提交ERP合同状态 */
SUBMIT_ERP_CTRT_STS_EF("正在执行","EF","其它所有状态"), SUBMIT_ERP_CTRT_STS_EF("正在执行","EF","其它所有状态"),
SUBMIT_ERP_CTRT_STS_BFZT("部分暂停","BFZT",null), SUBMIT_ERP_CTRT_STS_BFZT("部分暂停","BFZT",null),

View File

@@ -157,29 +157,36 @@ public class ContractController implements BusinessControllerMarker {
@GetMapping("/list/up-not-relation") @GetMapping("/list/up-not-relation")
@Operation(summary = "获得上游未关联合同列表") @Operation(summary = "获得上游未关联合同列表")
@PreAuthorize("@ss.hasPermission('base:contract:get')") @PreAuthorize("@ss.hasPermission('base:contract:relation')")
public CommonResult<List<ContractRespVO>> getListUpNotRelation(@RequestParam("id") Long id) { public CommonResult<List<ContractRespVO>> getListUpNotRelation(@RequestParam("id") Long id) {
return success(contractService.getListUpNotRelation(id)); return success(contractService.getListUpNotRelation(id));
} }
@GetMapping("/list/down-not-relation") @GetMapping("/list/down-not-relation")
@Operation(summary = "获得下游未关联合同列表") @Operation(summary = "获得下游未关联合同列表")
@PreAuthorize("@ss.hasPermission('base:contract:get')") @PreAuthorize("@ss.hasPermission('base:contract:relation')")
public CommonResult<List<ContractRespVO>> getListDownNotRelation(@RequestParam("id") Long id) { public CommonResult<List<ContractRespVO>> getListDownNotRelation(@RequestParam("id") Long id) {
return success(contractService.getListDownNotRelation(id)); return success(contractService.getListDownNotRelation(id));
} }
@GetMapping("/get/up-relation") @GetMapping("/get/up-relation")
@Operation(summary = "获得上游关联的合同数据") @Operation(summary = "获得上游关联的合同数据")
@PreAuthorize("@ss.hasPermission('base:contract:get')") @PreAuthorize("@ss.hasPermission('base:contract:relation')")
public CommonResult<ContractRespVO> getUpRelation(@RequestParam("id") Long id) { public CommonResult<ContractRespVO> getUpRelation(@RequestParam("id") Long id) {
return success(contractService.getUpRelation(id)); return success(contractService.getUpRelation(id));
} }
@GetMapping("/get/down-relation") @GetMapping("/get/down-relation")
@Operation(summary = "获得下游关联的合同数据") @Operation(summary = "获得下游关联的合同数据")
@PreAuthorize("@ss.hasPermission('base:contract:get')") @PreAuthorize("@ss.hasPermission('base:contract:relation')")
public CommonResult<ContractRespVO> getDownRelation(@RequestParam("id") Long id) { public CommonResult<ContractRespVO> getDownRelation(@RequestParam("id") Long id) {
return success(contractService.getDownRelation(id)); return success(contractService.getDownRelation(id));
} }
@PostMapping("/relation")
@Operation(summary = "关联合同")
@PreAuthorize("@ss.hasPermission('base:contract:relation')")
public CommonResult<Boolean> relation(@RequestBody RelationReqVo reqVo) {
return success(contractService.relation(reqVo));
}
} }

View File

@@ -0,0 +1,18 @@
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@Schema(description = "管理后台 - 合同关联请求对象 Request VO")
@Data
public class RelationReqVo {
@Schema(description = "上游主键", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "上游主键不能为空")
private Long upId;
@Schema(description = "下游主键", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "下游主键不能为空")
private Long downId;
}

View File

@@ -151,4 +151,12 @@ public interface ContractService {
* @return 关联的下游合同数据 * @return 关联的下游合同数据
*/ */
ContractRespVO getDownRelation(Long id); ContractRespVO getDownRelation(Long id);
/**
* 关联合同
*
* @param reqVo 上下游合同ID
* @return 关联结果
*/
Boolean relation(RelationReqVo reqVo);
} }

View File

@@ -1050,26 +1050,6 @@ public class ContractServiceImpl implements ContractService {
return ""; return "";
} }
/**
* 获取合同ID集合
*
* @param contractName 合同名称
* @param contractPaperNumber 合同编号
* @return 合同ID集合
*/
private List<Long> getContractIds(String contractName, String contractPaperNumber) {
List<Long> contractIds = new ArrayList<>();
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(new LambdaQueryWrapperX<ContractMainDO>()
.likeIfPresent(ContractMainDO::getContractName, contractName)
.likeIfPresent(ContractMainDO::getContractPaperNumber, contractPaperNumber));
if (CollectionUtils.isNotEmpty(contractMainDOS)) {
contractIds = contractMainDOS.stream()
.map(contractMainDO -> contractMainDO.getId())
.collect(Collectors.toList());
}
return contractIds;
}
@Override @Override
public List<NotRespVO> getNots(NotsQueryReqVO queryReqVO) { public List<NotRespVO> getNots(NotsQueryReqVO queryReqVO) {
// 查合同ID集合 // 查合同ID集合
@@ -1362,6 +1342,16 @@ public class ContractServiceImpl implements ContractService {
return result; return result;
} }
@Override
public Boolean relation(RelationReqVo reqVo) {
SystemRelativityDO saveDO = new SystemRelativityDO();
saveDO.setStatus(DictEnum.BSE_SYS_REL_TP_CONTRACT.getCode());
saveDO.setUpId(reqVo.getUpId());
saveDO.setDownId(reqVo.getDownId());
int insert = systemRelativityMapper.insert(saveDO);
return insert > 0;
}
/** /**
* 校验合同内容 * 校验合同内容
* *
@@ -1584,4 +1574,24 @@ public class ContractServiceImpl implements ContractService {
} }
return numPrefix + "-" + num; return numPrefix + "-" + num;
} }
/**
* 获取合同ID集合
*
* @param contractName 合同名称
* @param contractPaperNumber 合同编号
* @return 合同ID集合
*/
private List<Long> getContractIds(String contractName, String contractPaperNumber) {
List<Long> contractIds = new ArrayList<>();
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(new LambdaQueryWrapperX<ContractMainDO>()
.likeIfPresent(ContractMainDO::getContractName, contractName)
.likeIfPresent(ContractMainDO::getContractPaperNumber, contractPaperNumber));
if (CollectionUtils.isNotEmpty(contractMainDOS)) {
contractIds = contractMainDOS.stream()
.map(contractMainDO -> contractMainDO.getId())
.collect(Collectors.toList());
}
return contractIds;
}
} }