移除获得未关联合同列表
新增获得上游未关联合同列表 新增获得下游未关联合同列表
This commit is contained in:
@@ -155,11 +155,18 @@ public class ContractController implements BusinessControllerMarker {
|
|||||||
return success(contractService.submitErp(ids));
|
return success(contractService.submitErp(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list/not-relation")
|
@GetMapping("/list/up-not-relation")
|
||||||
@Operation(summary = "获得未关联合同列表")
|
@Operation(summary = "获得上游未关联合同列表")
|
||||||
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||||
public CommonResult<List<ContractRespVO>> getListNotRelation(@RequestParam("id") Long id) {
|
public CommonResult<List<ContractRespVO>> getListUpNotRelation(@RequestParam("id") Long id) {
|
||||||
return success(contractService.getListNotRelation(id));
|
return success(contractService.getListUpNotRelation(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list/down-not-relation")
|
||||||
|
@Operation(summary = "获得下游未关联合同列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||||
|
public CommonResult<List<ContractRespVO>> getListDownNotRelation(@RequestParam("id") Long id) {
|
||||||
|
return success(contractService.getListDownNotRelation(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/up-relation")
|
@GetMapping("/get/up-relation")
|
||||||
|
|||||||
@@ -120,9 +120,35 @@ public interface ContractService {
|
|||||||
*/
|
*/
|
||||||
ContractRespVO getBySystemContractNumber(String systemContractNumber);
|
ContractRespVO getBySystemContractNumber(String systemContractNumber);
|
||||||
|
|
||||||
List<ContractRespVO> getListNotRelation(Long id);
|
/**
|
||||||
|
* 获得上游未关联合同列表
|
||||||
|
*
|
||||||
|
* @param id 合同ID
|
||||||
|
* @return 上游未关联的合同列表
|
||||||
|
*/
|
||||||
|
List<ContractRespVO> getListUpNotRelation(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得下游未关联合同列表
|
||||||
|
*
|
||||||
|
* @param id 合同ID
|
||||||
|
* @return 下游未关联的合同列表
|
||||||
|
*/
|
||||||
|
List<ContractRespVO> getListDownNotRelation(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得上游关联的合同数据
|
||||||
|
*
|
||||||
|
* @param id 合同ID
|
||||||
|
* @return 关联的上游合同数据
|
||||||
|
*/
|
||||||
ContractRespVO getUpRelation(Long id);
|
ContractRespVO getUpRelation(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得下游关联的合同数据
|
||||||
|
*
|
||||||
|
* @param id 合同ID
|
||||||
|
* @return 关联的下游合同数据
|
||||||
|
*/
|
||||||
ContractRespVO getDownRelation(Long id);
|
ContractRespVO getDownRelation(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -465,7 +466,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ContractRespVO> getListNotRelation(Long id) {
|
public List<ContractRespVO> getListUpNotRelation(Long id) {
|
||||||
|
|
||||||
// 查询合同信息
|
// 查询合同信息
|
||||||
ContractMainDO contractMainDO = contractMainMapper.selectById(id);
|
ContractMainDO contractMainDO = contractMainMapper.selectById(id);
|
||||||
@@ -480,15 +481,14 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 乙方公司编号
|
// 乙方公司编号
|
||||||
String salesCompanyNumber = contractMainDO.getSalesCompanyNumber();
|
String salesCompanyNumber = contractMainDO.getSalesCompanyNumber();
|
||||||
|
|
||||||
// 已关联合同id集合
|
// 已关联的上游合同id集合
|
||||||
/*List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
|
List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
|
||||||
LinkedHashSet<Long> relationIds = new LinkedHashSet<>();
|
LinkedHashSet<Long> relationIds = new LinkedHashSet<>();
|
||||||
if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) {
|
if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) {
|
||||||
systemRelativityDOS.forEach(systemRelativityDO -> {
|
systemRelativityDOS.forEach(systemRelativityDO -> {
|
||||||
relationIds.add(systemRelativityDO.getUpId());
|
relationIds.add(systemRelativityDO.getUpId());
|
||||||
relationIds.add(systemRelativityDO.getDownId());
|
|
||||||
});
|
});
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// 返回结果集
|
// 返回结果集
|
||||||
List<ContractRespVO> result = new ArrayList<>();
|
List<ContractRespVO> result = new ArrayList<>();
|
||||||
@@ -501,6 +501,9 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 查询条件
|
// 查询条件
|
||||||
LambdaQueryWrapperX<ContractMainDO> conditon = new LambdaQueryWrapperX<>();
|
LambdaQueryWrapperX<ContractMainDO> conditon = new LambdaQueryWrapperX<>();
|
||||||
conditon.eq(ContractMainDO::getSalesCompanyNumber, purchaseCompanyNumber);
|
conditon.eq(ContractMainDO::getSalesCompanyNumber, purchaseCompanyNumber);
|
||||||
|
if (!relationIds.isEmpty()) {
|
||||||
|
conditon.notIn(ContractMainDO::getId, relationIds);
|
||||||
|
}
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
||||||
@@ -515,6 +518,77 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 查询条件
|
// 查询条件
|
||||||
LambdaQueryWrapperX<ContractMainDO> conditon = new LambdaQueryWrapperX<>();
|
LambdaQueryWrapperX<ContractMainDO> conditon = new LambdaQueryWrapperX<>();
|
||||||
conditon.eq(ContractMainDO::getPurchaseCompanyNumber, salesCompanyNumber);
|
conditon.eq(ContractMainDO::getPurchaseCompanyNumber, salesCompanyNumber);
|
||||||
|
if (!relationIds.isEmpty()) {
|
||||||
|
conditon.notIn(ContractMainDO::getId, relationIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
||||||
|
result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class);
|
||||||
|
} else {
|
||||||
|
// 不存在的收支类型或收支类型为空
|
||||||
|
throw exception(CONTRACT_ERP_RCV_DLVY_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ContractRespVO> getListDownNotRelation(Long id) {
|
||||||
|
|
||||||
|
// 查询合同信息
|
||||||
|
ContractMainDO contractMainDO = contractMainMapper.selectById(id);
|
||||||
|
if (contractMainDO == null) {
|
||||||
|
throw exception(CONTRACT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收支性质
|
||||||
|
String direction = contractMainDO.getDirection();
|
||||||
|
// 甲方公司编号
|
||||||
|
String purchaseCompanyNumber = contractMainDO.getPurchaseCompanyNumber();
|
||||||
|
// 乙方公司编号
|
||||||
|
String salesCompanyNumber = contractMainDO.getSalesCompanyNumber();
|
||||||
|
|
||||||
|
// 已关联的上游合同id集合
|
||||||
|
List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
|
||||||
|
LinkedHashSet<Long> relationIds = new LinkedHashSet<>();
|
||||||
|
if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) {
|
||||||
|
systemRelativityDOS.forEach(systemRelativityDO -> {
|
||||||
|
relationIds.add(systemRelativityDO.getDownId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回结果集
|
||||||
|
List<ContractRespVO> result = new ArrayList<>();
|
||||||
|
if (DictEnum.ERP_RCV_DLVY_INCOME.getCode().equals(direction)) { // 收入
|
||||||
|
// 如果“收支性质”字段为收入,用“甲方公司编号”字段筛选“合同主信息”表中字段等于“乙方公司编号”的数据
|
||||||
|
if (StringUtils.isEmpty(purchaseCompanyNumber)) {
|
||||||
|
// 甲方公司编号不存在
|
||||||
|
throw exception(CONTRACT_DATA_NOT_EXISTS, TableFieldConstants.BSE_CTRT_MAIN_PRCH_CPN_NUM_LABEL);
|
||||||
|
}
|
||||||
|
// 查询条件
|
||||||
|
LambdaQueryWrapperX<ContractMainDO> conditon = new LambdaQueryWrapperX<>();
|
||||||
|
conditon.eq(ContractMainDO::getSalesCompanyNumber, purchaseCompanyNumber);
|
||||||
|
if (!relationIds.isEmpty()) {
|
||||||
|
conditon.notIn(ContractMainDO::getId, relationIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
||||||
|
result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class);
|
||||||
|
} else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)){ // 支出
|
||||||
|
// 如果“收支性质”字段为支出,用“乙方公司编号”字段筛选“合同主信息”表中字段等于“甲方公司编号”的数据
|
||||||
|
if (StringUtils.isEmpty(salesCompanyNumber)) {
|
||||||
|
// 乙方公司编号不存在
|
||||||
|
throw exception(CONTRACT_DATA_NOT_EXISTS, TableFieldConstants.BSE_CTRT_MAIN_SALE_CPN_NUM_LABEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询条件
|
||||||
|
LambdaQueryWrapperX<ContractMainDO> conditon = new LambdaQueryWrapperX<>();
|
||||||
|
conditon.eq(ContractMainDO::getPurchaseCompanyNumber, salesCompanyNumber);
|
||||||
|
if (!relationIds.isEmpty()) {
|
||||||
|
conditon.notIn(ContractMainDO::getId, relationIds);
|
||||||
|
}
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
||||||
@@ -530,6 +604,11 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
@Override
|
@Override
|
||||||
public ContractRespVO getUpRelation(Long id) {
|
public ContractRespVO getUpRelation(Long id) {
|
||||||
|
|
||||||
|
// 查询合同信息
|
||||||
|
if (contractMainMapper.selectById(id) == null) {
|
||||||
|
throw exception(CONTRACT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
// 查询关联表
|
// 查询关联表
|
||||||
SystemRelativityDO systemRelativityDO = systemRelativityMapper.selectOne(TableFieldConstants.BSE_SYS_REL_DOWN_ID, id);
|
SystemRelativityDO systemRelativityDO = systemRelativityMapper.selectOne(TableFieldConstants.BSE_SYS_REL_DOWN_ID, id);
|
||||||
if (systemRelativityDO == null) {
|
if (systemRelativityDO == null) {
|
||||||
@@ -551,6 +630,11 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
@Override
|
@Override
|
||||||
public ContractRespVO getDownRelation(Long id) {
|
public ContractRespVO getDownRelation(Long id) {
|
||||||
|
|
||||||
|
// 查询合同信息
|
||||||
|
if (contractMainMapper.selectById(id) == null) {
|
||||||
|
throw exception(CONTRACT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
// 查询关联表
|
// 查询关联表
|
||||||
SystemRelativityDO systemRelativityDO = systemRelativityMapper.selectOne(TableFieldConstants.BSE_SYS_REL_UP_ID, id);
|
SystemRelativityDO systemRelativityDO = systemRelativityMapper.selectOne(TableFieldConstants.BSE_SYS_REL_UP_ID, id);
|
||||||
if (systemRelativityDO == null) {
|
if (systemRelativityDO == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user