yzc 1 år sedan
förälder
incheckning
7231db8ac5

+ 20 - 11
hx-sale/src/main/java/com/fjhx/sale/controller/contract/ContractController.java

@@ -76,7 +76,7 @@ public class ContractController {
      * 根据客户ID查询未包装的订单
      */
     @GetMapping("/getNoPackContractByCustomerId")
-    public List<ContractVo> getNoPackContractByCustomerId(@RequestParam("customerId")String customerId) {
+    public List<ContractVo> getNoPackContractByCustomerId(@RequestParam("customerId") String customerId) {
         return contractService.getNoPackContractByCustomerId(customerId);
     }
 
@@ -98,10 +98,11 @@ public class ContractController {
 
     /**
      * 销售趋势(数据看板-产品分析页面)
+     *
      * @param productInfoDto
      */
     @PostMapping("/saleTrend")
-    public  List<Map<String, Object>> saleTrend(@RequestBody ProductInfoSelectDto productInfoDto) {
+    public List<Map<String, Object>> saleTrend(@RequestBody ProductInfoSelectDto productInfoDto) {
         return contractService.saleTrend(productInfoDto);
     }
 
@@ -109,7 +110,7 @@ public class ContractController {
      * 销售统计(数据看板-销售分析页面开发)
      */
     @PostMapping("/salesStatistics")
-    public  Map<String, Object>  salesStatistics(@RequestBody ContractDto dto) {
+    public Map<String, Object> salesStatistics(@RequestBody ContractDto dto) {
         return contractService.salesStatistics(dto);
     }
 
@@ -118,7 +119,7 @@ public class ContractController {
      * 国家销售统计(数据看板-销售分析页面开发)
      */
     @PostMapping("/countrySalesStatistics")
-    public  List<ContractDto>  countrySalesStatistics(@RequestBody ContractDto dto) {
+    public List<ContractDto> countrySalesStatistics(@RequestBody ContractDto dto) {
         return contractService.countrySalesStatistics(dto);
     }
 
@@ -126,7 +127,7 @@ public class ContractController {
      * 客户销售统计(数据看板-销售分析页面开发)
      */
     @PostMapping("/customSalesStatistics")
-    public  List<ContractDto>  customSalesStatistics(@RequestBody ContractDto dto) {
+    public List<ContractDto> customSalesStatistics(@RequestBody ContractDto dto) {
         return contractService.customSalesStatistics(dto);
     }
 
@@ -134,7 +135,7 @@ public class ContractController {
      * 业务员销售统计(数据看板-销售分析页面开发)
      */
     @PostMapping("/salesmanSalesStatistics")
-    public  List<ContractDto>  salesmanSalesStatistics(@RequestBody ContractDto dto) {
+    public List<ContractDto> salesmanSalesStatistics(@RequestBody ContractDto dto) {
         return contractService.salesmanSalesStatistics(dto);
     }
 
@@ -142,7 +143,7 @@ public class ContractController {
      * 产品销售额统计(数据看板-销售分析页面开发)
      */
     @PostMapping("/productSalesStatistics")
-    public  List<ContractDto>  productSalesStatistics(@RequestBody ContractDto dto) {
+    public List<ContractDto> productSalesStatistics(@RequestBody ContractDto dto) {
         return contractService.productSalesStatistics(dto);
     }
 
@@ -150,7 +151,7 @@ public class ContractController {
      * 产品销售量统计(数据看板-销售分析页面开发)
      */
     @PostMapping("/salesVolumeStatistics")
-    public  List<ContractDto>  salesVolumeStatistics(@RequestBody ContractDto dto) {
+    public List<ContractDto> salesVolumeStatistics(@RequestBody ContractDto dto) {
         return contractService.salesVolumeStatistics(dto);
     }
 
@@ -166,15 +167,15 @@ public class ContractController {
      * 合同销售统计(合同列表)
      */
     @PostMapping("/covenantStatistics")
-    public  Map<String,Object> covenantStatistics(@RequestBody ContractDto dto){
-        return  contractService.covenantStatistics(dto);
+    public Map<String, Object> covenantStatistics(@RequestBody ContractDto dto) {
+        return contractService.covenantStatistics(dto);
     }
 
     /**
      * 利润预算
      */
     @PostMapping("/getProfitBudgetPage")
-    public  Page<ContractBudgetVo> getProfitBudgetPage(@RequestBody ContractSelectDto dto){
+    public Page<ContractBudgetVo> getProfitBudgetPage(@RequestBody ContractSelectDto dto) {
         return contractService.getProfitBudgetPage(dto);
     }
 
@@ -210,4 +211,12 @@ public class ContractController {
         return contractService.payDecisionAid(dto);
     }
 
+    /**
+     * 获取合同历史联系方式
+     */
+    @PostMapping("/contactList")
+    List<Contract> contactList(@RequestBody ContractDto dto) {
+        return contractService.contactList(dto);
+    }
+
 }

+ 6 - 1
hx-sale/src/main/java/com/fjhx/sale/entity/documents/vo/DocumentsVo.java

@@ -42,7 +42,7 @@ public class DocumentsVo extends Documents {
     private String code;
 
     /**
-     *承运方
+     * 承运方
      */
     private String acceptCarriage;
 
@@ -50,4 +50,9 @@ public class DocumentsVo extends Documents {
      * 货运单号
      */
     private String acceptCode;
+
+    /**
+     * 流程id
+     */
+    private Long flowId;
 }

+ 4 - 3
hx-sale/src/main/java/com/fjhx/sale/mapper/contract/ContractMapper.java

@@ -1,12 +1,11 @@
 package com.fjhx.sale.mapper.contract;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.customer.entity.customer.dto.CustomerDto;
 import com.fjhx.sale.entity.contract.dto.ContractDto;
 import com.fjhx.sale.entity.contract.po.Contract;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.sale.entity.contract.po.ContractBudget;
 import com.fjhx.sale.entity.contract.vo.ContractBudgetVo;
 import com.fjhx.sale.entity.contract.vo.ContractVo;
 import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
@@ -90,4 +89,6 @@ public interface ContractMapper extends BaseMapper<Contract> {
     List<ContractDto> productSalesStatistics(@Param("ew") QueryWrapper<Object> query);
 
     List<ContractDto> salesVolumeStatistics(@Param("ew") QueryWrapper<Object> query);
+
+    List<Contract> contactList(@Param("ew") IWrapper<Contract> wrapper);
 }

+ 4 - 0
hx-sale/src/main/java/com/fjhx/sale/service/contract/ContractService.java

@@ -160,4 +160,8 @@ public interface ContractService extends BaseService<Contract> {
      */
     PayDecisionAidVo payDecisionAid(PayDecisionAidDto dto);
 
+    /**
+     * 获取合同历史联系方式
+     */
+    List<Contract> contactList(ContractDto dto);
 }

+ 115 - 94
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -236,6 +236,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
     /**
      * 利润预算
+     *
      * @param dto
      * @return
      */
@@ -244,18 +245,18 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         IWrapper<Contract> wrapper = getWrapper();
         wrapper.orderByDesc("t1", Contract::getCreateTime);
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum.PASS.getKey(), FlowStatusEnum.CANCELLATION.getKey() - 1);
-        if(StringUtils.isNotEmpty(dto.getCustomerId())){
-            wrapper.eq("t1",Contract::getBuyCorporationId,dto.getCustomerId());
+        if (StringUtils.isNotEmpty(dto.getCustomerId())) {
+            wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
         }
-        if(StringUtils.isNotEmpty(dto.getUserId())){
-            wrapper.eq("t1",Contract::getCreateUser,dto.getUserId());
+        if (StringUtils.isNotEmpty(dto.getUserId())) {
+            wrapper.eq("t1", Contract::getCreateUser, dto.getUserId());
         }
-        if(StringUtils.isNotEmpty(dto.getKeyword())){
-            wrapper.keyword(dto.getKeyword(),new SqlField("t1.code"));
+        if (StringUtils.isNotEmpty(dto.getKeyword())) {
+            wrapper.keyword(dto.getKeyword(), new SqlField("t1.code"));
         }
         Page<ContractBudgetVo> page = this.baseMapper.getProfitBudgetPage(dto.getPage(), wrapper);
         List<ContractBudgetVo> list = page.getRecords();
-        if(CollectionUtils.isNotEmpty(list)){
+        if (CollectionUtils.isNotEmpty(list)) {
             // 赋值客户名称
             customerService.attributeAssign(list, Contract::getBuyCorporationId, (item, customer) -> {
                 item.setCustomerName(customer.getName());
@@ -264,65 +265,65 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             List<Long> contractIds = list.stream().map(ContractBudgetVo::getContractId).collect(Collectors.toList());
             List<EhsdPurchaseProductVo> ehsdAmountList = ehsdPurchaseProductService.getGroupSumAmount(contractIds);
             //取出采购所有金额和货币-通过合同ID分组
-            Map<Long,String> ehsdAmountMap = ehsdAmountList.stream().collect(Collectors.toMap(EhsdPurchaseProductVo::getContractId,EhsdPurchaseProductVo::getCurrencyAmount));
+            Map<Long, String> ehsdAmountMap = ehsdAmountList.stream().collect(Collectors.toMap(EhsdPurchaseProductVo::getContractId, EhsdPurchaseProductVo::getCurrencyAmount));
             List<PurchaseDetailVo> otherAmountList = purchaseDetailService.getSumCountInDataResourceIds(contractIds);
-            Map<Long,String> otherAmountMap = otherAmountList.stream().collect(Collectors.toMap(PurchaseDetailVo::getDataResourceId,PurchaseDetailVo::getSumAmountCurrency));
+            Map<Long, String> otherAmountMap = otherAmountList.stream().collect(Collectors.toMap(PurchaseDetailVo::getDataResourceId, PurchaseDetailVo::getSumAmountCurrency));
             //取出默认汇率
             List<CurrencyRate> currencyRateList = currencyRateService.getList();
-            Map<String,BigDecimal> currencyRateMap = currencyRateList.stream().collect(Collectors.toMap(CurrencyRate::getType,CurrencyRate::getRate));
-            for(ContractBudgetVo v : list){
-                if(StringUtils.isNotEmpty(v.getCurrencyRateJson())){//如果此条合同有汇率了
+            Map<String, BigDecimal> currencyRateMap = currencyRateList.stream().collect(Collectors.toMap(CurrencyRate::getType, CurrencyRate::getRate));
+            for (ContractBudgetVo v : list) {
+                if (StringUtils.isNotEmpty(v.getCurrencyRateJson())) {//如果此条合同有汇率了
                     List<ContractCurrencyRate> contractCurrencyRates = JSON.parseArray(v.getCurrencyRateJson(), ContractCurrencyRate.class);
-                    Map<String,BigDecimal> map = contractCurrencyRates.stream().collect(Collectors.toMap(ContractCurrencyRate::getType,ContractCurrencyRate::getRate));
+                    Map<String, BigDecimal> map = contractCurrencyRates.stream().collect(Collectors.toMap(ContractCurrencyRate::getType, ContractCurrencyRate::getRate));
                     v.setRefundableAmount(BigDecimal.ZERO);//暂时先设置退税金额为0
-                    if(MapUtils.isNotEmpty(ehsdAmountMap)){    //计算EHSD租户应付货款
-                        String concatAmountCurrency = ehsdAmountMap.getOrDefault(v.getContractId(),null);
-                        if(StringUtils.isNotEmpty(concatAmountCurrency)){
+                    if (MapUtils.isNotEmpty(ehsdAmountMap)) {    //计算EHSD租户应付货款
+                        String concatAmountCurrency = ehsdAmountMap.getOrDefault(v.getContractId(), null);
+                        if (StringUtils.isNotEmpty(concatAmountCurrency)) {
                             BigDecimal amount = new BigDecimal(concatAmountCurrency.split("-")[0]);
                             String currency = concatAmountCurrency.split("-")[1];
-                            BigDecimal rate = map.getOrDefault(currency,BigDecimal.ONE);
+                            BigDecimal rate = map.getOrDefault(currency, BigDecimal.ONE);
                             v.setEhsdSumAmount(amount.multiply(rate));
-                        }else{
+                        } else {
                             v.setEhsdSumAmount(BigDecimal.ZERO);
                         }
                     }
                     //计算收入总计=合同金额(转人民币)+应退税金额(转人民币)
                     v.setIncomeAmount(v.getAmount().multiply(new BigDecimal(map.getOrDefault(v.getCurrency(), BigDecimal.ONE).toString())).add(v.getRefundableAmount()));
                     //计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
-                    v.setExpenditureAmount(v.getTrailerFee()==null?BigDecimal.ZERO:v.getTrailerFee().multiply(new BigDecimal(map.getOrDefault(v.getTrailerFeeCurrency(),BigDecimal.ONE).toString())).add
-                            (v.getCustomsFee()==null?BigDecimal.ZERO:v.getCustomsFee().multiply(new BigDecimal(map.getOrDefault(v.getCustomsFeeCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getAgencyFee()==null?BigDecimal.ZERO:v.getAgencyFee().multiply(new BigDecimal(map.getOrDefault(v.getAgencyFeeCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getPortMixedFee()==null?BigDecimal.ZERO:v.getPortMixedFee().multiply(new BigDecimal(map.getOrDefault(v.getPortMixedFeeCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getInspectionRedPack()==null?BigDecimal.ZERO:v.getInspectionRedPack().multiply(new BigDecimal(map.getOrDefault(v.getInspectionRedPackCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getCommission()==null?BigDecimal.ZERO:v.getCommission().multiply(new BigDecimal(map.getOrDefault(v.getCommissionCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getOther()==null?BigDecimal.ZERO:v.getOther().multiply(new BigDecimal(map.getOrDefault(v.getOtherCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getEhsdSumAmount()==null?BigDecimal.ZERO:v.getEhsdSumAmount()).add
-                            (v.getOtherSumAmount()==null?BigDecimal.ZERO:v.getOtherSumAmount()));
-                }else{//没有汇率取默认汇率
+                    v.setExpenditureAmount(v.getTrailerFee() == null ? BigDecimal.ZERO : v.getTrailerFee().multiply(new BigDecimal(map.getOrDefault(v.getTrailerFeeCurrency(), BigDecimal.ONE).toString())).add
+                            (v.getCustomsFee() == null ? BigDecimal.ZERO : v.getCustomsFee().multiply(new BigDecimal(map.getOrDefault(v.getCustomsFeeCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getAgencyFee() == null ? BigDecimal.ZERO : v.getAgencyFee().multiply(new BigDecimal(map.getOrDefault(v.getAgencyFeeCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getPortMixedFee() == null ? BigDecimal.ZERO : v.getPortMixedFee().multiply(new BigDecimal(map.getOrDefault(v.getPortMixedFeeCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getInspectionRedPack() == null ? BigDecimal.ZERO : v.getInspectionRedPack().multiply(new BigDecimal(map.getOrDefault(v.getInspectionRedPackCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getCommission() == null ? BigDecimal.ZERO : v.getCommission().multiply(new BigDecimal(map.getOrDefault(v.getCommissionCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getOther() == null ? BigDecimal.ZERO : v.getOther().multiply(new BigDecimal(map.getOrDefault(v.getOtherCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getEhsdSumAmount() == null ? BigDecimal.ZERO : v.getEhsdSumAmount()).add
+                            (v.getOtherSumAmount() == null ? BigDecimal.ZERO : v.getOtherSumAmount()));
+                } else {//没有汇率取默认汇率
                     v.setRefundableAmount(BigDecimal.ZERO);//暂时先设置退税金额为0
-                    if(MapUtils.isNotEmpty(ehsdAmountMap)){    //计算EHSD租户应付货款
-                        String concatAmountCurrency = ehsdAmountMap.getOrDefault(v.getContractId(),null);
-                        if(StringUtils.isNotEmpty(concatAmountCurrency)){
+                    if (MapUtils.isNotEmpty(ehsdAmountMap)) {    //计算EHSD租户应付货款
+                        String concatAmountCurrency = ehsdAmountMap.getOrDefault(v.getContractId(), null);
+                        if (StringUtils.isNotEmpty(concatAmountCurrency)) {
                             BigDecimal amount = new BigDecimal(concatAmountCurrency.split("-")[0]);
                             String currency = concatAmountCurrency.split("-")[1];
-                            BigDecimal rate = currencyRateMap.getOrDefault(currency,BigDecimal.ONE);
+                            BigDecimal rate = currencyRateMap.getOrDefault(currency, BigDecimal.ONE);
                             v.setEhsdSumAmount(amount.multiply(rate));
-                        }else{
+                        } else {
                             v.setEhsdSumAmount(BigDecimal.ZERO);
                         }
                     }
                     //计算收入总计=合同金额(转人民币)+应退税金额(转人民币)
-                    v.setIncomeAmount(v.getAmount().multiply(currencyRateMap.getOrDefault(v.getContractId(),new BigDecimal("1"))).add(v.getRefundableAmount()));
+                    v.setIncomeAmount(v.getAmount().multiply(currencyRateMap.getOrDefault(v.getContractId(), new BigDecimal("1"))).add(v.getRefundableAmount()));
                     //计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
-                    v.setExpenditureAmount(v.getTrailerFee()==null?BigDecimal.ZERO:v.getTrailerFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getTrailerFeeCurrency(),BigDecimal.ONE).toString())).add
-                            (v.getCustomsFee()==null?BigDecimal.ZERO:v.getCustomsFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getCustomsFeeCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getAgencyFee()==null?BigDecimal.ZERO:v.getAgencyFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getAgencyFeeCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getPortMixedFee()==null?BigDecimal.ZERO:v.getPortMixedFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getPortMixedFeeCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getInspectionRedPack()==null?BigDecimal.ZERO:v.getInspectionRedPack().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getInspectionRedPackCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getCommission()==null?BigDecimal.ZERO:v.getCommission().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getCommissionCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getOther()==null?BigDecimal.ZERO:v.getOther().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getOtherCurrency(),BigDecimal.ONE).toString()))).add
-                            (v.getEhsdSumAmount()==null?BigDecimal.ZERO:v.getEhsdSumAmount()).add
-                            (v.getOtherSumAmount()==null?BigDecimal.ZERO:v.getOtherSumAmount()));
+                    v.setExpenditureAmount(v.getTrailerFee() == null ? BigDecimal.ZERO : v.getTrailerFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getTrailerFeeCurrency(), BigDecimal.ONE).toString())).add
+                            (v.getCustomsFee() == null ? BigDecimal.ZERO : v.getCustomsFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getCustomsFeeCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getAgencyFee() == null ? BigDecimal.ZERO : v.getAgencyFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getAgencyFeeCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getPortMixedFee() == null ? BigDecimal.ZERO : v.getPortMixedFee().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getPortMixedFeeCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getInspectionRedPack() == null ? BigDecimal.ZERO : v.getInspectionRedPack().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getInspectionRedPackCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getCommission() == null ? BigDecimal.ZERO : v.getCommission().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getCommissionCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getOther() == null ? BigDecimal.ZERO : v.getOther().multiply(new BigDecimal(currencyRateMap.getOrDefault(v.getOtherCurrency(), BigDecimal.ONE).toString()))).add
+                            (v.getEhsdSumAmount() == null ? BigDecimal.ZERO : v.getEhsdSumAmount()).add
+                            (v.getOtherSumAmount() == null ? BigDecimal.ZERO : v.getOtherSumAmount()));
                 }
                 //计算毛利 收入-支出
                 v.setGross(v.getIncomeAmount().subtract(v.getExpenditureAmount()));
@@ -335,6 +336,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
     /**
      * 利润结算表分页
+     *
      * @param dto
      * @return
      */
@@ -343,21 +345,21 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         IWrapper<Contract> wrapper = getWrapper();
         wrapper.orderByDesc("t1", Contract::getCreateTime);
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum.PASS.getKey(), FlowStatusEnum.CANCELLATION.getKey() - 1);
-        if(StringUtils.isNotEmpty(dto.getCustomerId())){
-            wrapper.eq("t1",Contract::getBuyCorporationId,dto.getCustomerId());
+        if (StringUtils.isNotEmpty(dto.getCustomerId())) {
+            wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
         }
-        if(StringUtils.isNotEmpty(dto.getUserId())){
-            wrapper.eq("t1",Contract::getCreateUser,dto.getUserId());
+        if (StringUtils.isNotEmpty(dto.getUserId())) {
+            wrapper.eq("t1", Contract::getCreateUser, dto.getUserId());
         }
-        if(StringUtils.isNotEmpty(dto.getKeyword())){
-            wrapper.keyword(dto.getKeyword(),new SqlField("t1.code"));
+        if (StringUtils.isNotEmpty(dto.getKeyword())) {
+            wrapper.keyword(dto.getKeyword(), new SqlField("t1.code"));
         }
         Page<ContractBudgetVo> page = this.baseMapper.getProfitClearingPage(dto.getPage(), wrapper);
         List<ContractBudgetVo> list = page.getRecords();
         //取出默认汇率
         List<CurrencyRate> defaultCurrencyRateList = currencyRateService.getList();
-        Map<String,BigDecimal> defaultCurrencyRateMap = defaultCurrencyRateList.stream().collect(Collectors.toMap(CurrencyRate::getType,CurrencyRate::getRate));
-        for(ContractBudgetVo v : list){
+        Map<String, BigDecimal> defaultCurrencyRateMap = defaultCurrencyRateList.stream().collect(Collectors.toMap(CurrencyRate::getType, CurrencyRate::getRate));
+        for (ContractBudgetVo v : list) {
             v.setRefundableAmount(BigDecimal.ZERO);//暂时先设置退税金额为0
             v.setOtherIncomeAmount(BigDecimal.ZERO);//暂时先设置其他收入为0
             v.setAccountPaid(BigDecimal.ZERO);//暂时先设置已付货款为0
@@ -365,28 +367,28 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             customerService.attributeAssign(list, Contract::getBuyCorporationId, (item, customer) -> {
                 item.setCustomerName(customer.getName());
             });
-            if(StringUtils.isNotEmpty(v.getCurrencyRateJson())) {//如果此条合同有汇率了
+            if (StringUtils.isNotEmpty(v.getCurrencyRateJson())) {//如果此条合同有汇率了
                 //取出汇率
                 List<CurrencyRate> assignCurrencyRatesList = JSON.parseArray(v.getCurrencyRateJson(), CurrencyRate.class);
-                Map<String,BigDecimal> assignCurrencyRatesMap = assignCurrencyRatesList.stream().collect(Collectors.toMap(CurrencyRate::getType,CurrencyRate::getRate));
-                v.setRmbContractAmount(v.getAmount().multiply(assignCurrencyRatesMap.getOrDefault(v.getCurrency(),BigDecimal.ONE)));//计算汇算人民币
+                Map<String, BigDecimal> assignCurrencyRatesMap = assignCurrencyRatesList.stream().collect(Collectors.toMap(CurrencyRate::getType, CurrencyRate::getRate));
+                v.setRmbContractAmount(v.getAmount().multiply(assignCurrencyRatesMap.getOrDefault(v.getCurrency(), BigDecimal.ONE)));//计算汇算人民币
                 //到账金额
-                v.setSumClaimMoney(this.getSumClaimMoney(v,assignCurrencyRatesMap));
+                v.setSumClaimMoney(this.getSumClaimMoney(v, assignCurrencyRatesMap));
                 //采购合同总金额
-                v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v,assignCurrencyRatesMap));
+                v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v, assignCurrencyRatesMap));
                 //支出费用
-                this.getGroupTypeMoney(v,assignCurrencyRatesMap);
-            }else{//没有取默认的汇率
-                v.setRmbContractAmount(v.getAmount().multiply(defaultCurrencyRateMap.getOrDefault(v.getCurrency(),BigDecimal.ONE)));//计算汇算人民币
+                this.getGroupTypeMoney(v, assignCurrencyRatesMap);
+            } else {//没有取默认的汇率
+                v.setRmbContractAmount(v.getAmount().multiply(defaultCurrencyRateMap.getOrDefault(v.getCurrency(), BigDecimal.ONE)));//计算汇算人民币
                 //到账金额
-                v.setSumClaimMoney(this.getSumClaimMoney(v,defaultCurrencyRateMap));
+                v.setSumClaimMoney(this.getSumClaimMoney(v, defaultCurrencyRateMap));
                 //采购合同总金额
-                v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v,defaultCurrencyRateMap));
+                v.setSumPurchaseContractMoney(this.getSumPurchaseContractMoney(v, defaultCurrencyRateMap));
                 //支出费用
-                this.getGroupTypeMoney(v,defaultCurrencyRateMap);
+                this.getGroupTypeMoney(v, defaultCurrencyRateMap);
             }
             //计算收入总计=合同金额(转人民币)+应退税金额(转人民币)+其他收入(转人民币)
-            v.setIncomeAmount(v.getRmbContractAmount()==null?BigDecimal.ZERO:v.getRmbContractAmount().add(v.getRefundableAmount()).add(v.getOtherIncomeAmount()));
+            v.setIncomeAmount(v.getRmbContractAmount() == null ? BigDecimal.ZERO : v.getRmbContractAmount().add(v.getRefundableAmount()).add(v.getOtherIncomeAmount()));
             //计算支出总计 除合同金额(转人民币)+应退税金额(转人民币)+其他收入(转人民币) 其他金额相加
             v.setExpenditureAmount(v.getTrailerFee().add
                     (v.getCustomsFee()).add
@@ -691,8 +693,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
      */
     @Override
     public void contractHandover(ContractDto dto) {
-        ObsFileUtil.editFile(dto.getFileList(),dto.getId(),1);
-        ObsFileUtil.editFile(dto.getPackageFileList(),dto.getId(),2);
+        ObsFileUtil.editFile(dto.getFileList(), dto.getId(), 1);
+        ObsFileUtil.editFile(dto.getPackageFileList(), dto.getId(), 2);
     }
 
     /**
@@ -705,15 +707,15 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         QueryWrapper<Contract> query = Wrappers.query();
         query.select("count(*) count,ifnull(sum(amount),0) amount,sell_corporation_id sellCorporationId");
         query.groupBy("sell_corporation_id");
-        query.eq("status",30);
+        query.eq("status", 30);
         List<Contract> contractList = baseMapper.selectList(query);
 
         //计算合计数量
         Integer countAmount = contractList.stream().map(Contract::getCount).reduce(Integer::sum).orElse(0);
         //计算合计金额
         BigDecimal amount = contractList.stream().map(Contract::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-        map.put("countAmount",countAmount);
-        map.put("amount",amount);
+        map.put("countAmount", countAmount);
+        map.put("amount", amount);
 
         //赋值归属公司名称
         DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
@@ -1261,49 +1263,52 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
     /**
      * 统计到账认领总金额
+     *
      * @param v
      * @param currencyRatesMap 汇率JSON
      * @return
      */
-    private BigDecimal getSumClaimMoney(ContractBudgetVo v,Map<String,BigDecimal> currencyRatesMap){
-        List<ClaimContract> claimContractList = claimContractService.list(Wrappers.<ClaimContract>query().lambda().eq(ClaimContract::getContractId,v.getContractId()));
+    private BigDecimal getSumClaimMoney(ContractBudgetVo v, Map<String, BigDecimal> currencyRatesMap) {
+        List<ClaimContract> claimContractList = claimContractService.list(Wrappers.<ClaimContract>query().lambda().eq(ClaimContract::getContractId, v.getContractId()));
         BigDecimal sumClaimMOney = BigDecimal.ZERO;
-        if(CollectionUtils.isNotEmpty(claimContractList)){
-            for(ClaimContract c:claimContractList){
-                sumClaimMOney = sumClaimMOney.add(c.getMoney().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+        if (CollectionUtils.isNotEmpty(claimContractList)) {
+            for (ClaimContract c : claimContractList) {
+                sumClaimMOney = sumClaimMOney.add(c.getMoney().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
             }
             return sumClaimMOney;
-        }else{
+        } else {
             return BigDecimal.ZERO;
         }
     }
 
     /**
      * 统采购合同总金额
+     *
      * @param v
      * @param currencyRatesMap 汇率JSON
      * @return
      */
-    private BigDecimal getSumPurchaseContractMoney(ContractBudgetVo v,Map<String,BigDecimal> currencyRatesMap){
+    private BigDecimal getSumPurchaseContractMoney(ContractBudgetVo v, Map<String, BigDecimal> currencyRatesMap) {
         List<EhsdPurchaseProductVo> list = ehsdPurchaseProductService.getListByContractId(v.getContractId());
         BigDecimal sumPurchaseContractMoney = BigDecimal.ZERO;
-        if(CollectionUtils.isNotEmpty(list)){
-            for(EhsdPurchaseProductVo c:list){
-                sumPurchaseContractMoney = sumPurchaseContractMoney.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+        if (CollectionUtils.isNotEmpty(list)) {
+            for (EhsdPurchaseProductVo c : list) {
+                sumPurchaseContractMoney = sumPurchaseContractMoney.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
             }
             return sumPurchaseContractMoney;
-        }else{
+        } else {
             return BigDecimal.ZERO;
         }
     }
 
     /**
      * 统计支出各种费用
+     *
      * @param v
      * @param currencyRatesMap 汇率JSON
      * @return
      */
-    private void getGroupTypeMoney(ContractBudgetVo v,Map<String,BigDecimal> currencyRatesMap){
+    private void getGroupTypeMoney(ContractBudgetVo v, Map<String, BigDecimal> currencyRatesMap) {
         List<AccountRequestFundsDetailVo> list = accountRequestFundsDetailService.getListByContractId(v.getContractId());
         /**
          * 拖车费
@@ -1353,40 +1358,40 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         /**
          * 其他费用
          */
-        BigDecimal other  = BigDecimal.ZERO;
+        BigDecimal other = BigDecimal.ZERO;
 
-        if(CollectionUtils.isNotEmpty(list)){
-            for(AccountRequestFundsDetailVo c:list){
-                switch (c.getCostType()){
+        if (CollectionUtils.isNotEmpty(list)) {
+            for (AccountRequestFundsDetailVo c : list) {
+                switch (c.getCostType()) {
                     case "1"://拖车费
-                        trailerFee = trailerFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        trailerFee = trailerFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     case "2"://报关费
-                        customsFee = customsFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        customsFee = customsFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     case "3"://港杂费
-                        portMixedFee = portMixedFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        portMixedFee = portMixedFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     case "4"://验收红包
-                        inspectionRedPack = inspectionRedPack.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        inspectionRedPack = inspectionRedPack.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     case "5"://佣金
-                        commission = commission.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        commission = commission.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     case "6"://检测费
-                        checkout = checkout.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        checkout = checkout.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     case "7"://验货费
-                        inspectionCharge = inspectionCharge.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        inspectionCharge = inspectionCharge.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     case "8"://运费
-                        freight = freight.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        freight = freight.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     case "9"://产地证费
-                        certificateOfOrigin = certificateOfOrigin.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        certificateOfOrigin = certificateOfOrigin.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                     default:
-                        other = other.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(),BigDecimal.ONE)));
+                        other = other.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;
                 }
             }
@@ -1402,4 +1407,20 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         v.setCertificateOfOrigin(certificateOfOrigin);
         v.setOther(other);
     }
+
+    /**
+     * 获取合同历史联系方式
+     */
+    @Override
+    public List<Contract> contactList(ContractDto dto) {
+        IWrapper<Contract> wrapper = IWrapper.getWrapper();
+        //根据卖方联系人名称/联系方式过滤
+        wrapper.or().like(Contract::getSellContactName, dto.getSellContactName());
+        wrapper.or().like(Contract::getSellContactNumber, dto.getSellContactNumber());
+        //根据买方联系人名称/联系方式过滤
+        wrapper.or().like(Contract::getBuyContactName, dto.getBuyContactName());
+        wrapper.or().like(Contract::getBuyContactNumber, dto.getBuyContactNumber());
+        List<Contract> list = baseMapper.contactList(wrapper);
+        return list;
+    }
 }

+ 42 - 33
hx-sale/src/main/java/com/fjhx/sale/service/documents/impl/DocumentsServiceImpl.java

@@ -15,6 +15,7 @@ import com.fjhx.common.entity.corporation.po.Corporation;
 import com.fjhx.common.service.corporation.CorporationService;
 import com.fjhx.customer.entity.customer.po.Customer;
 import com.fjhx.customer.service.customer.CustomerService;
+import com.fjhx.flow.service.flow.FlowExampleService;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.sale.entity.contract.po.Contract;
 import com.fjhx.sale.entity.contract.po.ContractProject;
@@ -93,6 +94,9 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
     @Autowired
     private ContractProjectService contractProjectService;
 
+    @Autowired
+    private FlowExampleService flowExampleService;
+
     private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy", Locale.ENGLISH);
 
     /**
@@ -110,13 +114,13 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
         DynamicDataSourceContextHolder.poll();
 
         List<DocumentsVo> records = page.getRecords();
-        if (ObjectUtil.isEmpty(records)){
+        if (ObjectUtil.isEmpty(records)) {
             return page;
         }
         for (DocumentsVo record : records) {
             //赋值归属公司名称
             List<Corporation> corporationList2 = corporationMap.get(record.getSellCorporationId());
-            if (ObjectUtil.isNotEmpty(corporationList2)){
+            if (ObjectUtil.isNotEmpty(corporationList2)) {
                 record.setSellCorporationName(corporationList2.get(0).getName());
             }
 
@@ -125,6 +129,8 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
         customerService.attributeAssign(records, DocumentsVo::getBuyCorporationId, (item, customer) -> {
             item.setBuyCorporationName(customer.getName());
         });
+        //  赋值流程id
+        flowExampleService.setFlowId(records, DocumentsVo::getContractId, DocumentsVo::setFlowId);
         return page;
     }
 
@@ -162,41 +168,42 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
         //删除单证表的数据
         this.removeById(id);
         //删除单证-产品表的数据
-        documentsProductService.remove(Wrappers.<DocumentsProduct>lambdaQuery().eq(DocumentsProduct::getDocumentsId,id));
+        documentsProductService.remove(Wrappers.<DocumentsProduct>lambdaQuery().eq(DocumentsProduct::getDocumentsId, id));
 
         //删除单证-货运表的数据
-        documentsTransportService.remove(Wrappers.<DocumentsTransport>lambdaQuery().eq(DocumentsTransport::getDocumentsId,id));
+        documentsTransportService.remove(Wrappers.<DocumentsTransport>lambdaQuery().eq(DocumentsTransport::getDocumentsId, id));
     }
 
     /**
      * 生成PDF---商业发票、装箱单
+     *
      * @return
      */
     @Override
     public Map<String, Object> generateInvoiceAPackPdf(Long id) {
-        Map<String,Object> map = new HashMap<>();
+        Map<String, Object> map = new HashMap<>();
         //查询单证
         Documents documents = this.getById(id);
-        if(ObjectUtil.isEmpty(documents)){
+        if (ObjectUtil.isEmpty(documents)) {
             throw new ServiceException("单证不存在");
         }
         setDocumentArea(documents);
         //查询合同
         Contract contract = contractService.getById(documents.getContractId());
-        if(ObjectUtil.isEmpty(contract)){
+        if (ObjectUtil.isEmpty(contract)) {
             throw new ServiceException("该单证合同不存在");
         }
         //查询合同
         ContractVo contractVo = BeanUtil.toBean(contract, ContractVo.class);
         setContractArea(contractVo);
         //查询收费项目
-        List<ContractProject> contractProjectList = contractProjectService.list(Wrappers.<ContractProject>query().lambda().eq(ContractProject::getContractId,contractVo.getId()));
+        List<ContractProject> contractProjectList = contractProjectService.list(Wrappers.<ContractProject>query().lambda().eq(ContractProject::getContractId, contractVo.getId()));
         //查询买方
         Customer customer = customerService.getById(contractVo.getBuyCorporationId());
         //查询卖方
         Corporation corporation = corporationService.getById(contractVo.getSellCorporationId());
         //查询单证货物
-        List<DocumentsProduct> documentsProducts = documentsProductService.list(Wrappers.<DocumentsProduct>query().lambda().eq(DocumentsProduct::getDocumentsId,documents.getId()));
+        List<DocumentsProduct> documentsProducts = documentsProductService.list(Wrappers.<DocumentsProduct>query().lambda().eq(DocumentsProduct::getDocumentsId, documents.getId()));
         // 赋值产品属性
         productInfoService.attributeAssign(documentsProducts, DocumentsProduct::getBusinessId, (item, product) -> {
             item.setProductCode(product.getCode());
@@ -218,31 +225,31 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
         BigDecimal sumPackQuantity = BigDecimal.ZERO;
         //装箱商品明细
         List<PackDetailGoods> packDetailGoodsList = new ArrayList<>();
-        if(ObjectUtil.isNotEmpty(packShipment)){//查询装箱单
+        if (ObjectUtil.isNotEmpty(packShipment)) {//查询装箱单
             packDetailList = packDetailService.list(Wrappers.<PackDetail>query().lambda().in(PackDetail::getId, Arrays.asList(packShipment.getPackDetailIds())));
             List<Long> packDetailIds = packDetailList.stream().map(PackDetail::getId).collect(Collectors.toList());
-            packDetailGoodsList = packDetailGoodsService.list(Wrappers.<PackDetailGoods>query().lambda().in(PackDetailGoods::getPackDetailId,packDetailIds));
-            Map<Long,List<PackDetailGoods>> packGoodMap = packDetailGoodsList.stream().collect(Collectors.groupingBy(PackDetailGoods::getPackDetailId));
-            for(PackDetail p:packDetailList){
-                p.setPackDetailGoodsList(packGoodMap.getOrDefault(p.getId(),null));
+            packDetailGoodsList = packDetailGoodsService.list(Wrappers.<PackDetailGoods>query().lambda().in(PackDetailGoods::getPackDetailId, packDetailIds));
+            Map<Long, List<PackDetailGoods>> packGoodMap = packDetailGoodsList.stream().collect(Collectors.groupingBy(PackDetailGoods::getPackDetailId));
+            for (PackDetail p : packDetailList) {
+                p.setPackDetailGoodsList(packGoodMap.getOrDefault(p.getId(), null));
             }
-            sumPackQuantity = packDetailList.stream().map(PackDetail::getPackQuantity).reduce(BigDecimal.ZERO,BigDecimal::add);
-            sumRoughWeight = packDetailList.stream().map(PackDetail::getRoughWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
-            sumNetWeight = packDetailList.stream().map(PackDetail::getNetWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
-            sumBomVolume = packDetailList.stream().map(PackDetail::getBomVolume).reduce(BigDecimal.ZERO,BigDecimal::add);
+            sumPackQuantity = packDetailList.stream().map(PackDetail::getPackQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
+            sumRoughWeight = packDetailList.stream().map(PackDetail::getRoughWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
+            sumNetWeight = packDetailList.stream().map(PackDetail::getNetWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
+            sumBomVolume = packDetailList.stream().map(PackDetail::getBomVolume).reduce(BigDecimal.ZERO, BigDecimal::add);
         }
-        map.put("contract",contractVo);//合同信息
-        map.put("date",sdf.format(contractVo.getCreateTime()));//日期
-        map.put("documents",documents);//单证信息
-        map.put("documentsProducts",documentsProducts);//单证信息货物
-        map.put("packDetailList",packDetailList);//单证信息货物
-        map.put("sumRoughWeight",sumRoughWeight);//总毛重
-        map.put("sumNetWeight",sumNetWeight);//总净重
-        map.put("sumBomVolume",sumBomVolume);//总体积
-        map.put("sumPackQuantity",sumPackQuantity);//总箱数
-        map.put("customer",customer);//买方信息
-        map.put("corporation",corporation);//卖方信息
-        map.put("contractProjectList",contractProjectList);//卖方信息
+        map.put("contract", contractVo);//合同信息
+        map.put("date", sdf.format(contractVo.getCreateTime()));//日期
+        map.put("documents", documents);//单证信息
+        map.put("documentsProducts", documentsProducts);//单证信息货物
+        map.put("packDetailList", packDetailList);//单证信息货物
+        map.put("sumRoughWeight", sumRoughWeight);//总毛重
+        map.put("sumNetWeight", sumNetWeight);//总净重
+        map.put("sumBomVolume", sumBomVolume);//总体积
+        map.put("sumPackQuantity", sumPackQuantity);//总箱数
+        map.put("customer", customer);//买方信息
+        map.put("corporation", corporation);//卖方信息
+        map.put("contractProjectList", contractProjectList);//卖方信息
 
 //        map.put("packDetailGoodsList",packDetailGoodsList);//装箱商品明细
         return map;
@@ -250,6 +257,7 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
 
     /**
      * 生成pdf----报关单
+     *
      * @param id
      * @return
      */
@@ -257,7 +265,7 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
     public DocumentsPdf generateClearanceePdf(Long id) {
         //获取单证PDF数据
         DocumentsPdf pdfData = documentsPdfService.getOne(Wrappers.<DocumentsPdf>query().lambda()
-                .eq(DocumentsPdf::getDocumentId,id).eq(DocumentsPdf::getDataType,0));
+                .eq(DocumentsPdf::getDocumentId, id).eq(DocumentsPdf::getDataType, 0));
         if (ObjectUtil.isEmpty(pdfData)) {
             JSONObject data = new JSONObject();
             List<JSONObject> productData = new ArrayList<>();
@@ -284,7 +292,7 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
             //发件公司清关负责人
             data.put("contacts", contract.getSellContactName());
             //发件公司清关负责人联系电话/手机
-            data.put("contactsMobile",contract.getSellContactNumber());
+            data.put("contactsMobile", contract.getSellContactNumber());
             //联系人邮箱
             data.put("contactsEmail", "");
             //境内发货人名称(填写发货公司中文名称)
@@ -393,7 +401,7 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
             pdfData.setDocumentId(documents.getId());
             pdfData.setContractCode(contract.getCode());
             pdfData.setDataType(0);//报关单
-            pdfData.setContent(JSONObject.toJSONString(data,JSONWriter.Feature.WriteLongAsString));
+            pdfData.setContent(JSONObject.toJSONString(data, JSONWriter.Feature.WriteLongAsString));
         }
         return pdfData;
     }
@@ -419,6 +427,7 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
         contractVo.setSellProvinceName(areaMap.get(contractVo.getSellProvinceId()));
         contractVo.setSellCityName(areaMap.get(contractVo.getSellCityId()));
     }
+
     /**
      * 赋值单证目的国家名称
      */

+ 11 - 6
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -145,14 +145,19 @@
     </select>
     <select id="salesVolumeStatistics" resultType="com.fjhx.sale.entity.contract.dto.ContractDto">
 
-        SELECT
-            SUM(cp.quantity) quantity,
-            pi.name productName
-        FROM
-            contract_product cp
-                LEFT JOIN bytesailing_item.product_info pi ON cp.product_id = pi.id
+        SELECT SUM(cp.quantity) quantity,
+               pi.name          productName
+        FROM contract_product cp
+                 LEFT JOIN bytesailing_item.product_info pi ON cp.product_id = pi.id
             ${ew.customSqlSegment}
     </select>
+    <select id="contactList" resultType="com.fjhx.sale.entity.contract.po.Contract">
+        SELECT c.sell_contact_name,
+               c.sell_contact_number,
+               c.buy_contact_name,
+               c.buy_contact_number
+        FROM contract c
+    </select>
 
 
 </mapper>