Kaynağa Gözat

销售合同问题

wanglang 1 ay önce
ebeveyn
işleme
2dca70b2a9

+ 11 - 10
trade-client/src/main/java/com/trade/client/trade/salescontract/service/impl/SalesServiceImpl.java

@@ -94,7 +94,8 @@ import cn.hutool.core.collection.CollectionUtil;
 @Service
 public class SalesServiceImpl implements SalesService {
 
-    private static final Logger log = LoggerUtil.logger(LoggerUtil.LogFileNameEnum.SERVICES_LOG);;
+    private static final Logger log = LoggerUtil.logger(LoggerUtil.LogFileNameEnum.SERVICES_LOG);
+    ;
     @Resource
     private CustomerUserService customerUserService;
     @Resource
@@ -590,13 +591,13 @@ public class SalesServiceImpl implements SalesService {
 
     /**
      * 校验销售合同参数
-     * 
+     *
      * @param salesContractDto
      * @param transferFile
      * @param salesContractExist
      */
     private void checkSalesContractParameter(SalesContractDto salesContractDto, MultipartFile transferFile,
-            SalesContract salesContractExist) {
+                                             SalesContract salesContractExist) {
         if (!salesContractDto.getTemplateType()) {
             if (salesContractDto.getContractNo() == null || salesContractDto.getSignDate() == null) {
                 throw new ValidatorException(HttpStatus.ERROR, "合同编号与签署日期不能为空!");
@@ -628,7 +629,7 @@ public class SalesServiceImpl implements SalesService {
 
     /***
      * 处理合同文件
-     * 
+     *
      * @param salesContractDto
      * @param customerUser
      * @param transferFile
@@ -636,7 +637,7 @@ public class SalesServiceImpl implements SalesService {
      * @return 合同文件信息
      */
     private ContractFile handleContractFile(SalesContractDto salesContractDto, CustomerUser customerUser,
-            MultipartFile transferFile, boolean isTemplate) {
+                                            MultipartFile transferFile, boolean isTemplate) {
         try {
             ContractFile contractFile = new ContractFile();
             contractFile.setSignFileType(FileTypeEnum.SALES_CONTRACT.getCode());
@@ -682,7 +683,7 @@ public class SalesServiceImpl implements SalesService {
 
     /**
      * 处理合同文件
-     * 
+     *
      * @param salesContract
      * @param customerUser
      * @param contractTerms
@@ -690,7 +691,7 @@ public class SalesServiceImpl implements SalesService {
      * @return
      */
     private ContractFile handleInkassoContractFile(SalesContract salesContract, CustomerUser customerUser,
-            ContractTerms contractTerms, List<ContractTermsExtend> paymentInfos, List<ContractTermsExtend> titleInfos) {
+                                                   ContractTerms contractTerms, List<ContractTermsExtend> paymentInfos, List<ContractTermsExtend> titleInfos) {
         try {
             List<SalesCommodity> salesCommodities = salesCommodityService.lambdaQuery()
                     .eq(SalesCommodity::getSalesContractId, salesContract.getId()).eq(SalesCommodity::getDeleted, 0)
@@ -757,7 +758,7 @@ public class SalesServiceImpl implements SalesService {
             contractTemplateDto.setAccountNumber(contractTerms.getAccountNumber());
             contractTemplateDto.setSwiftCode(contractTerms.getSwiftCode());
             contractTemplateDto.setOpeningBank(contractTerms.getOpeningBank());
-            ImporterEntity importerEntity = IImporterEntityService.getByEntityNo(salesContract.getImporterCertNo());
+            ImporterEntity importerEntity = IImporterEntityService.getByCertNo(salesContract.getImporterCertNo());
             if (importerEntity != null) {
                 contractTemplateDto.setBuyerContact(importerEntity.getContactName());
                 contractTemplateDto.setBuyerAddress(importerEntity.getBusinessAddress());
@@ -807,7 +808,7 @@ public class SalesServiceImpl implements SalesService {
                 SalesContract salesContract = salesContractService.getByContractNo(
                         salesContractDto.getSalesContract().getContractNo(),
                         salesContractDto.getSalesContract().getCustomerUserId());
-                if (salesContract != null) {
+                if (salesContract != null && !salesContract.getId().equals(salesContractDto.getSalesContract().getId())) {
                     throw new ValidatorException(HttpStatus.BAD_REQUEST, "请您检查合同编号,合同编号存在重复");
                 }
             }
@@ -849,7 +850,7 @@ public class SalesServiceImpl implements SalesService {
 
     /**
      * 校验合同条款
-     * 
+     *
      * @param contractTermsDto
      */
     private void checkContractTerms(ContractTermsDto contractTermsDto) {

+ 7 - 0
trade-service/src/main/java/com/trade/service/enterprise/companyrelated/service/IImporterEntityService.java

@@ -50,4 +50,11 @@ public interface IImporterEntityService extends IService<ImporterEntity> {
     List<ImporterEntityDict> getList4Dict();
 
     ImporterEntity getByEntityNo(String entityNo);
+
+    /**
+     * 根据证书编号获取进口商信息
+     * @param certNo
+     * @return
+     */
+    ImporterEntity getByCertNo(String certNo);
 }

+ 5 - 0
trade-service/src/main/java/com/trade/service/enterprise/companyrelated/service/impl/ImporterEntityServiceImpl.java

@@ -68,4 +68,9 @@ public class ImporterEntityServiceImpl extends ServiceImpl<ImporterEntityMapper,
     public ImporterEntity getByEntityNo(String entityNo) {
         return this.lambdaQuery().eq(ImporterEntity::getEntityNo, entityNo).one();
     }
+
+    @Override
+    public ImporterEntity getByCertNo(String certNo) {
+        return this.lambdaQuery().eq(ImporterEntity::getCertNo, certNo).one();
+    }
 }