Merge branch 'refs/heads/dev' into test
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_ERP_COMPANY_PLEASE_BIND = new ErrorCode(1_027_000_009, "请先绑定{}ERP公司信息");
|
||||
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_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_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_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_NAME_LABEL = "乙方公司名称";
|
||||
@@ -135,4 +137,10 @@ public class TableFieldConstants {
|
||||
/* 实例条款值表 */
|
||||
// 关联实例主键
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -154,4 +154,32 @@ public class ContractController implements BusinessControllerMarker {
|
||||
public CommonResult<List<String>> submitErp(@RequestBody List<Long> ids) {
|
||||
return success(contractService.submitErp(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/list/up-not-relation")
|
||||
@Operation(summary = "获得上游未关联合同列表")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||
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')")
|
||||
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')")
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,5 +143,11 @@ public class PurchaseOrderController implements BusinessControllerMarker {
|
||||
public CommonResult<List<PurchaseOrderDetailsRespVO>> getOrderByOrderNo(@RequestBody @Validated @NotEmpty(message = "采购订单不能为空") List<String> orderNos){
|
||||
return success(purchaseOrderService.getOrderByOrderNo(orderNos));
|
||||
}
|
||||
//根据订单id修改订单状态
|
||||
@PutMapping("/update-order-status")
|
||||
@Operation(summary = "根据订单id修改订单状态", description = "sts取值于字典名称'采购订单状态',字典类型'PRCH_ORD_STS'`")
|
||||
public CommonResult<Boolean> updateOrderStatus(@RequestParam("orderId") Long orderId, @RequestParam("sts") String sts){
|
||||
return success(purchaseOrderService.updateOrderStatus(orderId,sts));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,36 @@ public interface ContractService {
|
||||
* @return 合同信息
|
||||
*/
|
||||
ContractRespVO getBySystemContractNumber(String systemContractNumber);
|
||||
|
||||
/**
|
||||
* 获得上游未关联合同列表
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 获得下游关联的合同数据
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 关联的下游合同数据
|
||||
*/
|
||||
ContractRespVO getDownRelation(Long id);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -93,6 +94,8 @@ public class ContractServiceImpl implements ContractService {
|
||||
private ErpCompanyService erpCompanyService;
|
||||
@Resource
|
||||
private ErpContractService erpContractService;
|
||||
@Resource
|
||||
private SystemRelativityMapper systemRelativityMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||
@@ -462,6 +465,194 @@ public class ContractServiceImpl implements ContractService {
|
||||
return respVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContractRespVO> getListUpNotRelation(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());
|
||||
});
|
||||
}
|
||||
|
||||
// 返回结果集
|
||||
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);
|
||||
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);
|
||||
result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class);
|
||||
} else {
|
||||
// 不存在的收支类型或收支类型为空
|
||||
throw exception(CONTRACT_ERP_RCV_DLVY_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
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) {
|
||||
|
||||
// 查询合同信息
|
||||
if (contractMainMapper.selectById(id) == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 查询关联表
|
||||
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
|
||||
@Override
|
||||
public Boolean update(ContractSaveReqVO reqVO) {
|
||||
|
||||
Reference in New Issue
Block a user