获得上游关联的合同数据接口

获得下游关联的合同数据接口
This commit is contained in:
guojunyun
2025-10-15 11:18:07 +08:00
parent 1bfff8f234
commit a00dd53d9f
4 changed files with 66 additions and 0 deletions

View File

@@ -137,4 +137,10 @@ public class TableFieldConstants {
/* 实例条款值表 */ /* 实例条款值表 */
// 关联实例主键 // 关联实例主键
public static final String BSE_TMPL_INSC_ITM_INSC_ID = "INSC_ID"; public static final String BSE_TMPL_INSC_ITM_INSC_ID = "INSC_ID";
/* 业务关联表 */
// 上游主键
public static final String BSE_SYS_REL_UP_ID = "UP_ID";
// 下游主键
public static final String BSE_SYS_REL_DOWN_ID = "DOWN_ID";
} }

View File

@@ -161,4 +161,18 @@ public class ContractController implements BusinessControllerMarker {
public CommonResult<List<ContractRespVO>> getListNotRelation(@RequestParam("id") Long id) { public CommonResult<List<ContractRespVO>> getListNotRelation(@RequestParam("id") Long id) {
return success(contractService.getListNotRelation(id)); return success(contractService.getListNotRelation(id));
} }
@GetMapping("/get/up-relation")
@Operation(summary = "获得上游关联的合同数据")
@PreAuthorize("@ss.hasPermission('base:contract:get')")
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')")
public CommonResult<ContractRespVO> getDownRelation(@RequestParam("id") Long id) {
return success(contractService.getDownRelation(id));
}
} }

View File

@@ -121,4 +121,8 @@ public interface ContractService {
ContractRespVO getBySystemContractNumber(String systemContractNumber); ContractRespVO getBySystemContractNumber(String systemContractNumber);
List<ContractRespVO> getListNotRelation(Long id); List<ContractRespVO> getListNotRelation(Long id);
ContractRespVO getUpRelation(Long id);
ContractRespVO getDownRelation(Long id);
} }

View File

@@ -527,6 +527,48 @@ public class ContractServiceImpl implements ContractService {
return result; return result;
} }
@Override
public ContractRespVO getUpRelation(Long id) {
// 查询关联表
SystemRelativityDO systemRelativityDO = systemRelativityMapper.selectOne(TableFieldConstants.BSE_SYS_REL_DOWN_ID, id);
if (systemRelativityDO == null) {
return null;
}
// 上游合同ID
Long upId = systemRelativityDO.getUpId();
// 获取上游合同信息
ContractMainDO contractMainDO = contractMainMapper.selectById(upId);
if (contractMainDO == null) {
throw exception(CONTRACT_NOT_EXISTS);
}
return BeanUtils.toBean(contractMainDO, ContractRespVO.class);
}
@Override
public ContractRespVO getDownRelation(Long id) {
// 查询关联表
SystemRelativityDO systemRelativityDO = systemRelativityMapper.selectOne(TableFieldConstants.BSE_SYS_REL_UP_ID, id);
if (systemRelativityDO == null) {
return null;
}
// 下游合同ID
Long upId = systemRelativityDO.getUpId();
// 获取下游合同信息
ContractMainDO contractMainDO = contractMainMapper.selectById(upId);
if (contractMainDO == null) {
throw exception(CONTRACT_NOT_EXISTS);
}
return BeanUtils.toBean(contractMainDO, ContractRespVO.class);
}
@Transactional @Transactional
@Override @Override
public Boolean update(ContractSaveReqVO reqVO) { public Boolean update(ContractSaveReqVO reqVO) {