计划相关Feign接口
This commit is contained in:
@@ -40,4 +40,12 @@ public class ContractPageReqVO extends PageParam {
|
|||||||
|
|
||||||
@Schema(description = "合同分类(字典:SPLY_BSN_TP)")
|
@Schema(description = "合同分类(字典:SPLY_BSN_TP)")
|
||||||
private String businessType;
|
private String businessType;
|
||||||
|
|
||||||
|
@Schema(description = "合同主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "甲方公司编号;与ERP(YQGHD)对应")
|
||||||
|
private String erpPurchaseCompanyNumber;
|
||||||
|
@Schema(description = "乙方公司编号;与ERP(YQGHD)对应")
|
||||||
|
private String erpSalesCompanyNumber;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.zt.plat.module.contractorder.api.vo.contract;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "绑定合同VO")
|
||||||
|
@Validated
|
||||||
|
public class RelationContractVO {
|
||||||
|
|
||||||
|
@Schema(description = "合同ID")
|
||||||
|
@NotNull(message = "合同ID不能为空")
|
||||||
|
private Long contractId;
|
||||||
|
|
||||||
|
@Schema(description = "被绑定的合同ID")
|
||||||
|
@NotNull(message = "被绑定的合同ID不能为空")
|
||||||
|
private Long relationContractId;
|
||||||
|
}
|
||||||
@@ -35,5 +35,6 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode CONTRACT_STATUS_NOT_CANCEL = new ErrorCode(1_027_000_020, "{}状态合同不允许作废");
|
ErrorCode CONTRACT_STATUS_NOT_CANCEL = new ErrorCode(1_027_000_020, "{}状态合同不允许作废");
|
||||||
ErrorCode AMOUNT_DISMANTLE_NOT_EXISTS = new ErrorCode(1_027_000_022, "资金拆分不存在");
|
ErrorCode AMOUNT_DISMANTLE_NOT_EXISTS = new ErrorCode(1_027_000_022, "资金拆分不存在");
|
||||||
ErrorCode CONTRACT_RECEIVE_SEND_NOT_EXISTS = new ErrorCode(1_027_000_021, "收发货规则不存在");
|
ErrorCode CONTRACT_RECEIVE_SEND_NOT_EXISTS = new ErrorCode(1_027_000_021, "收发货规则不存在");
|
||||||
|
ErrorCode PARAMETER_ID_EMPTY = new ErrorCode(1_027_000_023, "绑定的合同ID不能空");
|
||||||
|
ErrorCode PARAMETER_BUSINESS_TYPE_INVALID = new ErrorCode(1_027_000_024, "合同业务类型无效请参考字典(SPLY_BSN_TP)");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class OrderApiImpl implements OrderApi {
|
|||||||
if ("SALE".equals(f.getSplyBsnTp())) {
|
if ("SALE".equals(f.getSplyBsnTp())) {
|
||||||
// 销售订单
|
// 销售订单
|
||||||
salesOrdNoS.add(f.getId());
|
salesOrdNoS.add(f.getId());
|
||||||
} else {
|
} else if ("PUR".equals(f.getSplyBsnTp())) {
|
||||||
// 非销售订单(采购订单)
|
// 非销售订单(采购订单)
|
||||||
purchaseOrderNoS.add(f.getId());
|
purchaseOrderNoS.add(f.getId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.zt.plat.module.contractorder.api.vo.contract.international.IntPushCon
|
|||||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.ContractMainDO;
|
import com.zt.plat.module.contractorder.dal.dataobject.contract.ContractMainDO;
|
||||||
import com.zt.plat.module.contractorder.service.contract.ContractService;
|
import com.zt.plat.module.contractorder.service.contract.ContractService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@@ -223,4 +224,22 @@ public class ContractController implements BusinessControllerMarker {
|
|||||||
) {
|
) {
|
||||||
return success(contractService.transactionInfoByPaperNumber(contractPaperNumber));
|
return success(contractService.transactionInfoByPaperNumber(contractPaperNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/relationContract")
|
||||||
|
@Operation(summary = "关联合同-新")
|
||||||
|
// @PreAuthorize("@ss.hasAnyPermissions({'base:contract:get','purchaseContract:detail'})")
|
||||||
|
public CommonResult<Boolean> relationContract(@RequestBody RelationContractVO reqVo) {
|
||||||
|
contractService.relationContract(reqVo);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/page-no-permission")
|
||||||
|
@Operation(summary = "获得合同分页列表-没有权限")
|
||||||
|
@PreAuthorize("@ss.hasAnyPermissions({'base:contract:get','purchaseContract:detail'})")
|
||||||
|
public CommonResult<PageResult<ContractRespVO>> getPageNoPermission(@Valid ContractPageReqVO pageReqVO) {
|
||||||
|
PageResult<ContractMainDO> pageResult = contractService.getPageNoPermission(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, ContractRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -455,4 +455,10 @@ public class ContractMainDO extends BusinessBaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField("HS_CRDT")
|
@TableField("HS_CRDT")
|
||||||
private String hasCredit;
|
private String hasCredit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联合同ID
|
||||||
|
*/
|
||||||
|
@TableField(value = "REL_CTRT_ID")
|
||||||
|
private Long relatedContractId;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.zt.plat.module.contractorder.dal.mysql.contract;
|
package com.zt.plat.module.contractorder.dal.mysql.contract;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
|
import com.zt.plat.framework.datapermission.core.annotation.CompanyDataPermissionIgnore;
|
||||||
|
import com.zt.plat.framework.datapermission.core.annotation.DataPermission;
|
||||||
|
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
||||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.zt.plat.module.contractorder.api.vo.contract.ContractPageReqVO;
|
import com.zt.plat.module.contractorder.api.vo.contract.ContractPageReqVO;
|
||||||
@@ -27,4 +30,23 @@ public interface ContractMainMapper extends BaseMapperX<ContractMainDO> {
|
|||||||
.eqIfPresent(ContractMainDO::getBusinessType, reqVO.getBusinessType())
|
.eqIfPresent(ContractMainDO::getBusinessType, reqVO.getBusinessType())
|
||||||
.orderByDesc(ContractMainDO::getCreateTime));
|
.orderByDesc(ContractMainDO::getCreateTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CompanyDataPermissionIgnore
|
||||||
|
@DeptDataPermissionIgnore
|
||||||
|
default PageResult<ContractMainDO> selectContractPageNoPermission(ContractPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ContractMainDO>()
|
||||||
|
.eq(ContractMainDO::getId, reqVO.getId())
|
||||||
|
.likeIfPresent(ContractMainDO::getContractName, reqVO.getContractName())
|
||||||
|
.likeIfPresent(ContractMainDO::getContractPaperNumber, reqVO.getContractPaperNumber())
|
||||||
|
.eqIfPresent(ContractMainDO::getDirection, reqVO.getDirection())
|
||||||
|
.betweenIfPresent(ContractMainDO::getSignDate, reqVO.getSignDate())
|
||||||
|
.likeIfPresent(ContractMainDO::getPurchaseCompanyName, reqVO.getPurchaseCompanyName())
|
||||||
|
.likeIfPresent(ContractMainDO::getSalesCompanyName, reqVO.getSalesCompanyName())
|
||||||
|
.eqIfPresent(ContractMainDO::getBasicAmount, reqVO.getBasicAmount())
|
||||||
|
.eqIfPresent(ContractMainDO::getStatus, reqVO.getStatus())
|
||||||
|
.eqIfPresent(ContractMainDO::getBusinessType, reqVO.getBusinessType())
|
||||||
|
.eqIfPresent(ContractMainDO::getErpSalesCompanyNumber, reqVO.getErpSalesCompanyNumber())
|
||||||
|
.eqIfPresent(ContractMainDO::getErpPurchaseCompanyNumber, reqVO.getErpPurchaseCompanyNumber())
|
||||||
|
.orderByDesc(ContractMainDO::getCreateTime));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,14 @@ public interface ContractService {
|
|||||||
* @return 分页列表
|
* @return 分页列表
|
||||||
*/
|
*/
|
||||||
PageResult<ContractMainDO> getContractPage(@Valid ContractPageReqVO pageReqVO);
|
PageResult<ContractMainDO> getContractPage(@Valid ContractPageReqVO pageReqVO);
|
||||||
|
/**
|
||||||
|
* 获得合同分页列表--无权限
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页条件
|
||||||
|
* @return 分页列表
|
||||||
|
*/
|
||||||
|
PageResult<ContractMainDO> getPageNoPermission(@Valid ContractPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增合同
|
* 新增合同
|
||||||
@@ -247,4 +255,10 @@ public interface ContractService {
|
|||||||
* @return 交易信息
|
* @return 交易信息
|
||||||
*/
|
*/
|
||||||
TransactionInfoRespVO transactionInfoByPaperNumber(String contractPaperNumber);
|
TransactionInfoRespVO transactionInfoByPaperNumber(String contractPaperNumber);
|
||||||
|
/**
|
||||||
|
* 关联合同
|
||||||
|
*
|
||||||
|
* @param relationContractVO 关联合同信息
|
||||||
|
*/
|
||||||
|
void relationContract(RelationContractVO relationContractVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.zt.plat.framework.common.pojo.CommonResult;
|
|||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.zt.plat.framework.security.core.LoginUser;
|
||||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.zt.plat.framework.tenant.core.context.CompanyContextHolder;
|
import com.zt.plat.framework.tenant.core.context.CompanyContextHolder;
|
||||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscBsnRelRespVO;
|
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscBsnRelRespVO;
|
||||||
@@ -43,6 +44,7 @@ import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
|
|||||||
import com.zt.plat.module.erp.service.erp.ErpContractService;
|
import com.zt.plat.module.erp.service.erp.ErpContractService;
|
||||||
import com.zt.plat.module.infra.api.file.FileApi;
|
import com.zt.plat.module.infra.api.file.FileApi;
|
||||||
import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
|
import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
|
||||||
|
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||||
import com.zt.plat.module.system.api.user.AdminUserApi;
|
import com.zt.plat.module.system.api.user.AdminUserApi;
|
||||||
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
|
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -123,12 +125,47 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
private ContractReceiveSendService contractReceiveSendService;
|
private ContractReceiveSendService contractReceiveSendService;
|
||||||
@Resource
|
@Resource
|
||||||
private AmountDismantleService amountDismantleService;
|
private AmountDismantleService amountDismantleService;
|
||||||
|
@Resource
|
||||||
|
private DeptApi deptApi;
|
||||||
|
|
||||||
|
private static final Map<String, String> VALID_RELATIONS = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
VALID_RELATIONS.put("ENT", "ENTED");
|
||||||
|
VALID_RELATIONS.put("ENTED", "ENT");
|
||||||
|
VALID_RELATIONS.put("PUR", "SALE");
|
||||||
|
VALID_RELATIONS.put("SALE", "PUR");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||||
return contractMainMapper.selectContractPage(pageReqVO);
|
return contractMainMapper.selectContractPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ContractMainDO> getPageNoPermission(ContractPageReqVO pageReqVO) {
|
||||||
|
if (pageReqVO.getId() == null) {
|
||||||
|
throw exception(PARAMETER_ID_EMPTY);
|
||||||
|
}
|
||||||
|
ContractMainDO contractMainDO = contractMainMapper.selectById(pageReqVO.getId());
|
||||||
|
String businessType = VALID_RELATIONS.getOrDefault(contractMainDO.getBusinessType(), null);
|
||||||
|
if (businessType == null) {
|
||||||
|
throw exception(PARAMETER_BUSINESS_TYPE_INVALID);
|
||||||
|
}
|
||||||
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
String visitCompanyCode = loginUser.getVisitCompanyCode();
|
||||||
|
//判断当前人应该查询哪个公司
|
||||||
|
if (visitCompanyCode.equals(contractMainDO.getErpPurchaseCompanyNumber())) {
|
||||||
|
//查乙方
|
||||||
|
pageReqVO.setErpSalesCompanyNumber(contractMainDO.getErpSalesCompanyNumber());
|
||||||
|
} else if (visitCompanyCode.equals(contractMainDO.getErpSalesCompanyNumber())) {
|
||||||
|
//查甲方
|
||||||
|
pageReqVO.setErpPurchaseCompanyNumber(contractMainDO.getErpPurchaseCompanyNumber());
|
||||||
|
}
|
||||||
|
pageReqVO.setBusinessType(businessType);
|
||||||
|
return contractMainMapper.selectContractPageNoPermission(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
boolean isContractReceiveSendValid(List<ContractReceiveSendSaveReqVO> contractReceiveSends) {
|
boolean isContractReceiveSendValid(List<ContractReceiveSendSaveReqVO> contractReceiveSends) {
|
||||||
if (CollectionUtils.isEmpty(contractReceiveSends)) {
|
if (CollectionUtils.isEmpty(contractReceiveSends)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -2054,6 +2091,29 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
return infoRespVO;
|
return infoRespVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void relationContract(RelationContractVO relationContractVO) {
|
||||||
|
//查询当前订单是否已经绑定订单了
|
||||||
|
ContractMainDO contractMainDO = contractMainMapper.selectById(relationContractVO.getContractId());
|
||||||
|
if (contractMainDO != null && contractMainDO.getRelatedContractId() != null) {
|
||||||
|
ContractMainDO updateObj = contractMainMapper.selectById(contractMainDO.getRelatedContractId());
|
||||||
|
updateObj.setRelatedContractId(null);
|
||||||
|
contractMainMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
contractMainDO.setRelatedContractId(relationContractVO.getRelationContractId());
|
||||||
|
contractMainMapper.updateById(contractMainDO);// 绑定合同订单
|
||||||
|
ContractMainDO relationContract = contractMainMapper.selectById(relationContractVO.getRelationContractId());
|
||||||
|
if (relationContract != null) {
|
||||||
|
// 绑定合同订单
|
||||||
|
relationContract.setRelatedContractId(relationContractVO.getContractId());
|
||||||
|
contractMainMapper.updateById(relationContract);
|
||||||
|
}else {
|
||||||
|
throw exception(CONTRACT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验合同内容
|
* 校验合同内容
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user