Browse Source

单证pdf

caozj 2 years ago
parent
commit
6ca1b35510

+ 30 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractVo.java

@@ -27,6 +27,36 @@ public class ContractVo extends Contract {
     private String sellCorporationName;
 
     /**
+     * 买方国家名称
+     */
+    private String buyCountryName;
+
+    /**
+     * 卖方国家名称
+     */
+    private String sellCountryName;
+
+    /**
+     * 买方省名称
+     */
+    private String buyProvinceName;
+
+    /**
+     * 卖方省名称
+     */
+    private String sellProvinceName;
+
+    /**
+     * 买方市名称
+     */
+    private String buyCityName;
+
+    /**
+     * 卖方市名称
+     */
+    private String sellCityName;
+
+    /**
      * 时间
      */
     private String time;

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/documents/po/Documents.java

@@ -37,6 +37,11 @@ public class Documents extends BasePo {
     /**
      * 国家表id
      */
+    private String countryName;
+
+    /**
+     * 目的港
+     */
     private String portOfDestination;
 
     /**

+ 35 - 0
hx-sale/src/main/java/com/fjhx/sale/service/documents/impl/DocumentsServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fjhx.area.utils.AreaUtil;
 import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.entity.corporation.po.Corporation;
 import com.fjhx.common.service.corporation.CorporationService;
@@ -163,12 +164,14 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
         if(ObjectUtil.isEmpty(documents)){
             throw new ServiceException("单证不存在");
         }
+        setDocumentArea(documents);
         //查询合同
         Contract contract = contractService.getById(documents.getContractId());
         if(ObjectUtil.isEmpty(contract)){
             throw new ServiceException("该单证合同不存在");
         }
         ContractVo contractVo = BeanUtil.toBean(contract, ContractVo.class);
+        setContractArea(contractVo);
         //查询买方
         Customer customer = customerService.getById(contractVo.getBuyCorporationId());
         //查询卖方
@@ -212,4 +215,36 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
 //        map.put("packDetailGoodsList",packDetailGoodsList);//装箱商品明细
         return map;
     }
+    /**
+     * 赋值买卖公司国家省市区名称
+     */
+    private void setContractArea(ContractVo contractVo) {
+
+        List<String> areaIdList = Arrays.asList(
+                contractVo.getBuyCountryId(),
+                contractVo.getBuyProvinceId(),
+                contractVo.getBuyCityId(),
+                contractVo.getSellCountryId(),
+                contractVo.getSellProvinceId(),
+                contractVo.getSellCityId()
+        );
+        Map<String, String> areaMap = AreaUtil.getAreaMapByIds(areaIdList);
+        contractVo.setBuyCountryName(areaMap.get(contractVo.getBuyCountryId()));
+        contractVo.setBuyProvinceName(areaMap.get(contractVo.getBuyProvinceId()));
+        contractVo.setBuyCityName(areaMap.get(contractVo.getBuyCityId()));
+        contractVo.setSellCountryName(areaMap.get(contractVo.getSellCountryId()));
+        contractVo.setSellProvinceName(areaMap.get(contractVo.getSellProvinceId()));
+        contractVo.setSellCityName(areaMap.get(contractVo.getSellCityId()));
+    }
+    /**
+     * 赋值单证目的国家名称
+     */
+    private void setDocumentArea(Documents documents) {
+
+        List<String> areaIdList = Arrays.asList(
+                documents.getCountryId()
+        );
+        Map<String, String> areaMap = AreaUtil.getAreaMapByIds(areaIdList);
+        documents.setCountryName(areaMap.get(documents.getCountryId()));
+    }
 }