关联合同接口
This commit is contained in:
@@ -157,29 +157,36 @@ public class ContractController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/list/up-not-relation")
|
||||
@Operation(summary = "获得上游未关联合同列表")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:relation')")
|
||||
public CommonResult<List<ContractRespVO>> getListUpNotRelation(@RequestParam("id") Long id) {
|
||||
return success(contractService.getListUpNotRelation(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list/down-not-relation")
|
||||
@Operation(summary = "获得下游未关联合同列表")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:relation')")
|
||||
public CommonResult<List<ContractRespVO>> getListDownNotRelation(@RequestParam("id") Long id) {
|
||||
return success(contractService.getListDownNotRelation(id));
|
||||
}
|
||||
|
||||
@GetMapping("/get/up-relation")
|
||||
@Operation(summary = "获得上游关联的合同数据")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:relation')")
|
||||
public CommonResult<ContractRespVO> getUpRelation(@RequestParam("id") Long id) {
|
||||
return success(contractService.getUpRelation(id));
|
||||
}
|
||||
|
||||
@GetMapping("/get/down-relation")
|
||||
@Operation(summary = "获得下游关联的合同数据")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:relation')")
|
||||
public CommonResult<ContractRespVO> getDownRelation(@RequestParam("id") Long 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -151,4 +151,12 @@ public interface ContractService {
|
||||
* @return 关联的下游合同数据
|
||||
*/
|
||||
ContractRespVO getDownRelation(Long id);
|
||||
|
||||
/**
|
||||
* 关联合同
|
||||
*
|
||||
* @param reqVo 上下游合同ID
|
||||
* @return 关联结果
|
||||
*/
|
||||
Boolean relation(RelationReqVo reqVo);
|
||||
}
|
||||
|
||||
@@ -1050,26 +1050,6 @@ public class ContractServiceImpl implements ContractService {
|
||||
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
|
||||
public List<NotRespVO> getNots(NotsQueryReqVO queryReqVO) {
|
||||
// 查合同ID集合
|
||||
@@ -1362,6 +1342,16 @@ public class ContractServiceImpl implements ContractService {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取合同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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user