获得未关联合同列表
This commit is contained in:
@@ -23,4 +23,5 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode CONTRACT_STATUS_NOT_APPROVAL = new ErrorCode(1_027_000_008, "{}状态合同不允许审核");
|
ErrorCode CONTRACT_STATUS_NOT_APPROVAL = new ErrorCode(1_027_000_008, "{}状态合同不允许审核");
|
||||||
ErrorCode CONTRACT_ERP_COMPANY_PLEASE_BIND = new ErrorCode(1_027_000_009, "请先绑定{}ERP公司信息");
|
ErrorCode CONTRACT_ERP_COMPANY_PLEASE_BIND = new ErrorCode(1_027_000_009, "请先绑定{}ERP公司信息");
|
||||||
ErrorCode CONTRACT_STATUS_NOT_DELETE = new ErrorCode(1_027_000_010, "{}状态合同不允许删除");
|
ErrorCode CONTRACT_STATUS_NOT_DELETE = new ErrorCode(1_027_000_010, "{}状态合同不允许删除");
|
||||||
|
ErrorCode CONTRACT_ERP_RCV_DLVY_NOT_EXISTS = new ErrorCode(1_027_000_010, "不存在的收支类型或收支类型为空");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class TableFieldConstants {
|
|||||||
public static final String BSE_CTRT_MAIN_CTRT_PPR_NUM = "CTRT_PPR_NUM";
|
public static final String BSE_CTRT_MAIN_CTRT_PPR_NUM = "CTRT_PPR_NUM";
|
||||||
public static final String BSE_CTRT_MAIN_CTRT_PPR_NUM_LABEL = "合同编号";
|
public static final String BSE_CTRT_MAIN_CTRT_PPR_NUM_LABEL = "合同编号";
|
||||||
// 甲方公司编号
|
// 甲方公司编号
|
||||||
|
public static final String BSE_CTRT_MAIN_PRCH_CPN_NUM = "PRCH_CPN_NUM";
|
||||||
public static final String BSE_CTRT_MAIN_PRCH_CPN_NUM_LABEL = "甲方公司编号";
|
public static final String BSE_CTRT_MAIN_PRCH_CPN_NUM_LABEL = "甲方公司编号";
|
||||||
// 甲方公司名称
|
// 甲方公司名称
|
||||||
public static final String BSE_CTRT_MAIN_PRCH_CPN_NAME_LABEL = "甲方公司名称";
|
public static final String BSE_CTRT_MAIN_PRCH_CPN_NAME_LABEL = "甲方公司名称";
|
||||||
@@ -28,6 +29,7 @@ public class TableFieldConstants {
|
|||||||
// 甲方法定代表人
|
// 甲方法定代表人
|
||||||
public static final String BSE_CTRT_MAIN_PRCH_LDR_LABEL = "甲方法定代表人";
|
public static final String BSE_CTRT_MAIN_PRCH_LDR_LABEL = "甲方法定代表人";
|
||||||
// 乙方公司编号
|
// 乙方公司编号
|
||||||
|
public static final String BSE_CTRT_MAIN_SALE_CPN_NUM = "SALE_CPN_NUM_LABEL";
|
||||||
public static final String BSE_CTRT_MAIN_SALE_CPN_NUM_LABEL = "乙方公司编号";
|
public static final String BSE_CTRT_MAIN_SALE_CPN_NUM_LABEL = "乙方公司编号";
|
||||||
// 乙方公司名称
|
// 乙方公司名称
|
||||||
public static final String BSE_CTRT_MAIN_SALE_CPN_NAME_LABEL = "乙方公司名称";
|
public static final String BSE_CTRT_MAIN_SALE_CPN_NAME_LABEL = "乙方公司名称";
|
||||||
|
|||||||
@@ -154,4 +154,11 @@ public class ContractController implements BusinessControllerMarker {
|
|||||||
public CommonResult<List<String>> submitErp(@RequestBody List<Long> ids) {
|
public CommonResult<List<String>> submitErp(@RequestBody List<Long> ids) {
|
||||||
return success(contractService.submitErp(ids));
|
return success(contractService.submitErp(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list/not-relation")
|
||||||
|
@Operation(summary = "获得未关联合同列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||||
|
public CommonResult<List<ContractRespVO>> getListNotRelation(@RequestParam("id") Long id) {
|
||||||
|
return success(contractService.getListNotRelation(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.zt.plat.module.contractorder.dal.dataobject.contract;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务关联 DO
|
||||||
|
*
|
||||||
|
* @author 后台管理-1
|
||||||
|
*/
|
||||||
|
@TableName("bse_sys_rel")
|
||||||
|
@KeySequence("bse_sys_rel_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
/**
|
||||||
|
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||||
|
*/
|
||||||
|
public class SystemRelativityDO extends BusinessBaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 上游主键
|
||||||
|
*/
|
||||||
|
@TableField("UP_ID")
|
||||||
|
private Long upId;
|
||||||
|
/**
|
||||||
|
* 下游主键
|
||||||
|
*/
|
||||||
|
@TableField("DOWN_ID")
|
||||||
|
private Long downId;
|
||||||
|
/**
|
||||||
|
* 方式系统;内关联/系统外关联
|
||||||
|
*/
|
||||||
|
@TableField("WY")
|
||||||
|
private String way;
|
||||||
|
/**
|
||||||
|
* 类型;合同/订单
|
||||||
|
*/
|
||||||
|
@TableField("STS")
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.zt.plat.module.contractorder.dal.mysql.contract;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.zt.plat.module.contractorder.dal.dataobject.contract.SystemRelativityDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务关联 Mapper
|
||||||
|
*
|
||||||
|
* @author 后台管理-1
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SystemRelativityMapper extends BaseMapperX<SystemRelativityDO> {
|
||||||
|
}
|
||||||
@@ -119,4 +119,6 @@ public interface ContractService {
|
|||||||
* @return 合同信息
|
* @return 合同信息
|
||||||
*/
|
*/
|
||||||
ContractRespVO getBySystemContractNumber(String systemContractNumber);
|
ContractRespVO getBySystemContractNumber(String systemContractNumber);
|
||||||
|
|
||||||
|
List<ContractRespVO> getListNotRelation(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
private ErpCompanyService erpCompanyService;
|
private ErpCompanyService erpCompanyService;
|
||||||
@Resource
|
@Resource
|
||||||
private ErpContractService erpContractService;
|
private ErpContractService erpContractService;
|
||||||
|
@Resource
|
||||||
|
private SystemRelativityMapper systemRelativityMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||||
@@ -462,6 +464,69 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ContractRespVO> getListNotRelation(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.getUpId());
|
||||||
|
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);
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
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);
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
||||||
|
result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class);
|
||||||
|
} else {
|
||||||
|
// 不存在的收支类型或收支类型为空
|
||||||
|
throw exception(CONTRACT_ERP_RCV_DLVY_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Boolean update(ContractSaveReqVO reqVO) {
|
public Boolean update(ContractSaveReqVO reqVO) {
|
||||||
|
|||||||
Reference in New Issue
Block a user