Selaa lähdekoodia

报关单页面文件不存在时返回null

zhangchenm 1 viikko sitten
vanhempi
commit
5c999af103

+ 1 - 1
trade-service/src/main/java/com/trade/service/enterprise/companyrelated/domain/ImporterEntity.java

@@ -116,7 +116,7 @@ public class ImporterEntity extends BizBaseEntity {
     /**
      * 结算周期(天)
      */
-    @NotBlank(message = "结算周期(天)不能为空")
+    @NotNull(message = "结算周期(天)不能为空")
     private Integer settlementPeriod;
     /**
      * 过去一年双方交易额

+ 5 - 4
trade-service/src/main/java/com/trade/service/trade/salesorder/service/impl/CustomsDeclarationServiceImpl.java

@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * <p>
@@ -69,10 +70,10 @@ public class CustomsDeclarationServiceImpl extends ServiceImpl<CustomsDeclaratio
                 .setHggq(customsDeclarationDtlVO.getSbhggqkajc() + "(" + customsDeclarationDtlVO.getSbhggqkaDm() + ")");
         customsDeclarationDtlVO.setCustomsDeclarationGoodsDtlVOList(customsDeclarationGoodsService
                 .listWithCustomsDeclarationDtlByOrderId(customsDeclarationDtlVO.getOrderId()));
-        customsDeclarationDtlVO.setEntrustFile(new FileAbstractDto(
-                tFileStorageService.getFileStorageById(customsDeclarationDtlVO.getEntrustFileId())));
-        customsDeclarationDtlVO.setCustomsFile(new FileAbstractDto(
-                tFileStorageService.getFileStorageById(customsDeclarationDtlVO.getCustomsFileId())));
+        Optional.ofNullable(customsDeclarationDtlVO.getEntrustFileId()).ifPresent(fileId -> customsDeclarationDtlVO
+                .setEntrustFile(new FileAbstractDto(tFileStorageService.getFileStorageById(fileId))));
+        Optional.ofNullable(customsDeclarationDtlVO.getCustomsFileId()).ifPresent(fileId -> customsDeclarationDtlVO
+                .setCustomsFile(new FileAbstractDto(tFileStorageService.getFileStorageById(fileId))));
         return customsDeclarationDtlVO;
     }
 

+ 1 - 1
trade-service/src/main/resources/data.init/v1.1/20241031_zhangchenming.sql

@@ -1,7 +1,7 @@
 -- 20241022
 -- 进口商新增字段
 ALTER TABLE `importer_entity`
-    ADD COLUMN `business_category` varchar(2) DEFAULT '' COMMENT '经营品类' AFTER `vat_no`;
+    ADD COLUMN `business_category` varchar(64) DEFAULT '' COMMENT '经营品类' AFTER `vat_no`;
 
 ALTER TABLE `importer_entity`
     ADD COLUMN `trading_life` varchar(16) DEFAULT '' COMMENT '交易年限(M/Y)' AFTER `business_category`;