Преглед изворни кода

利润预算表头部统计

caozj пре 1 година
родитељ
комит
8b27248b78

+ 8 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/contract/ContractController.java

@@ -208,6 +208,14 @@ public class ContractController {
     }
 
     /**
+     * 利润预算
+     */
+    @PostMapping("/getProfitBudgetHeadStatistic")
+    public Map<String,Object> getProfitBudgetHeadStatistic(@RequestBody ContractSelectDto dto) {
+        return contractService.getProfitBudgetHeadStatistic(dto);
+    }
+
+    /**
      * 利润结算
      */
     @PostMapping("/getProfitClearingPage")

+ 1 - 1
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractBudgetVo.java

@@ -130,7 +130,7 @@ public class ContractBudgetVo extends Contract {
     private BigDecimal peritectoidAmount;
 
     /**
-     * 辅材
+     * 配件
      */
     private BigDecimal accessoriesAmount;
 

+ 164 - 131
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -66,6 +66,7 @@ import com.fjhx.sale.entity.purchase.po.EhsdPurchase;
 import com.fjhx.sale.entity.purchase.po.EhsdPurchaseProduct;
 import com.fjhx.sale.entity.purchase.vo.EhsdPurchaseProductVo;
 import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
+import com.fjhx.sale.entity.statement.vo.ProfitSettlementVo;
 import com.fjhx.sale.mapper.contract.ContractMapper;
 import com.fjhx.sale.service.claim.ClaimContractService;
 import com.fjhx.sale.service.contract.*;
@@ -384,109 +385,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             customerService.attributeAssign(list, Contract::getBuyCorporationId, (item, customer) -> {
                 item.setCustomerName(customer.getName());
             });
-            //取出EHSD采购所有金额和货币-通过合同ID分组
-            List<Long> contractIds = list.stream().map(ContractBudgetVo::getContractId).collect(Collectors.toList());
-            List<EhsdPurchaseProductVo> ehsdAmountList = ehsdPurchaseProductService.getPurchaseByContractId(contractIds);
-            Map<Long, List<EhsdPurchaseProductVo>> ehsdAmountMap = ehsdAmountList.stream().collect(Collectors.groupingBy(EhsdPurchaseProductVo::getDataResourceId));
-            for (ContractBudgetVo v : list) {
-                BigDecimal purchaseAmount = BigDecimal.ZERO;
-                BigDecimal peritectoidAmount = BigDecimal.ZERO;
-                BigDecimal accessoriesAmount = BigDecimal.ZERO;
-                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));
-                    /**
-                     * 处理应付款金额-包材金额-配件金额
-                     */
-                    List<EhsdPurchaseProductVo> pList = ehsdAmountMap.getOrDefault(v.getContractId(), null);
-                    if (CollectionUtils.isNotEmpty(pList)) {
-                        for(EhsdPurchaseProductVo e : pList){
-                            //获取汇率
-                            BigDecimal rate = map.getOrDefault(e.getCurrency(), BigDecimal.ONE);
-                            // 获取认领金额
-                            BigDecimal money = e.getAmount();
-                            //总金额
-                            BigDecimal amount = rate.multiply(money);
-                            purchaseAmount = purchaseAmount.add(amount);
-                            if(ObjectUtil.isNotEmpty(e.getProductCategoryIds())){
-                                if(e.getProductCategoryIds().contains("1685534140512616449")||e.getProductCategoryId()==1685534140512616449L){//包材
-                                    peritectoidAmount = peritectoidAmount.add(amount);
-                                }
-                                if(e.getProductCategoryIds().contains("1685534141821239297")||e.getProductCategoryId()==1685534141821239297L){//配件
-                                    accessoriesAmount = accessoriesAmount.add(amount);
-                                }
-                            }
-                        }
-                        v.setEhsdSumAmount(purchaseAmount);
-                        v.setPeritectoidAmount(peritectoidAmount);
-                        v.setAccessoriesAmount(accessoriesAmount);
-                    }
-                    //计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
-                    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())
-                    );
-                    //处理退税金额
-                    handleRefundTax(v);
-                    v.setRmbContractAmount(v.getAmount().multiply(new BigDecimal(map.getOrDefault(v.getCurrency(), BigDecimal.ONE).toString())));
-                    //计算收入总计=合同金额(转人民币)+应退税金额(转人民币)
-                    v.setIncomeAmount(v.getAmount().multiply(new BigDecimal(map.getOrDefault(v.getCurrency(), BigDecimal.ONE).toString())).add(v.getRefundableAmount()));
-                } else {//没有汇率取默认汇率
-                    /**
-                     * 处理应付款金额-包材金额-配件金额
-                     */
-                    List<EhsdPurchaseProductVo> pList = ehsdAmountMap.getOrDefault(v.getContractId(), null);
-                    if (CollectionUtils.isNotEmpty(pList)) {
-                        for(EhsdPurchaseProductVo e : pList){
-                            //获取汇率
-                            BigDecimal rate = e.getRate();
-                            // 获取认领金额
-                            BigDecimal money = e.getAmount();
-                            //总金额
-                            BigDecimal amount = rate.multiply(money);
-                            purchaseAmount = purchaseAmount.add(amount);
-                            if(ObjectUtil.isNotEmpty(e.getProductCategoryIds())){
-                                if(e.getProductCategoryIds().contains("1685534140512616449")||e.getProductCategoryId()==1685534140512616449L){//包材
-                                    peritectoidAmount = peritectoidAmount.add(amount);
-                                }
-                                if(e.getProductCategoryIds().contains("1685534141821239297")||e.getProductCategoryId()==1685534141821239297L){//配件
-                                    accessoriesAmount = accessoriesAmount.add(amount);
-                                }
-                            }
-                        }
-                        v.setEhsdSumAmount(purchaseAmount);
-                        v.setPeritectoidAmount(peritectoidAmount);
-                        v.setAccessoriesAmount(accessoriesAmount);
-                    }
-                    BigDecimal rate = v.getRate();
-
-                    //计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
-                    v.setExpenditureAmount(
-                            v.getTrailerFee() == null ? BigDecimal.ZERO : v.getTrailerFee().add
-                                    (v.getCustomsFee() == null ? BigDecimal.ZERO : v.getCustomsFee()).add
-                                    (v.getAgencyFee() == null ? BigDecimal.ZERO : v.getAgencyFee()).add
-                                    (v.getPortMixedFee() == null ? BigDecimal.ZERO : v.getPortMixedFee()).add
-                                    (v.getInspectionRedPack() == null ? BigDecimal.ZERO : v.getInspectionRedPack()).add
-                                    (v.getCommission() == null ? BigDecimal.ZERO : v.getCommission()).add
-                                    (v.getOther() == null ? BigDecimal.ZERO : v.getOther()).add
-                                    (v.getEhsdSumAmount() == null ? BigDecimal.ZERO : v.getEhsdSumAmount())
-                    );
-                    //处理退税金额
-                    handleRefundTax(v);
-                    v.setRmbContractAmount(v.getAmount().multiply(rate));
-                    //计算收入总计=合同金额(转人民币)+应退税金额(转人民币)
-                    v.setIncomeAmount(v.getAmount().multiply(rate).add(v.getRefundableAmount()));
-                }
-                //计算毛利 收入-支出
-                v.setGross(v.getIncomeAmount().subtract(v.getExpenditureAmount()));
-                //计算毛利率 毛利/收入
-                v.setGrossRate(v.getGross().divide(v.getIncomeAmount(), RoundingMode.CEILING).multiply(new BigDecimal("100")));
-            }
+            statisticCommon(list);
         }
         return page;
     }
@@ -513,46 +412,180 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             wrapper.keyword(dto.getKeyword(), new SqlField("t1.code"));
         }
         List<ContractBudgetVo> list = this.baseMapper.getProfitBudgetHeadStatistic(wrapper);
-        List<Long> contractIds = list.stream().map(ContractBudgetVo::getContractId).collect(Collectors.toList());
         if (CollectionUtils.isNotEmpty(list)) {
-
-            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));
-                    BigDecimal rate = map.getOrDefault(v.getCurrency(),BigDecimal.ONE);
-                } else {//没有汇率取默认汇率
-                    BigDecimal rate = v.getRate();
-                    v.setRmbContractAmount(v.getAmount().multiply(rate));
-                }
-            }
+            statisticCommon(list);
         }
         //统计金额
         return sumStatistic(list);
     }
 
     /**
+     * 利润预算表统计公共方法
+     * @param list
+     */
+    private void statisticCommon(List<ContractBudgetVo> list){
+        //取出EHSD采购所有金额和货币-通过合同ID分组
+        List<Long> contractIds = list.stream().map(ContractBudgetVo::getContractId).collect(Collectors.toList());
+        List<EhsdPurchaseProductVo> ehsdAmountList = ehsdPurchaseProductService.getPurchaseByContractId(contractIds);
+        Map<Long, List<EhsdPurchaseProductVo>> ehsdAmountMap = ehsdAmountList.stream().collect(Collectors.groupingBy(EhsdPurchaseProductVo::getDataResourceId));
+        for (ContractBudgetVo v : list) {
+            BigDecimal purchaseAmount = BigDecimal.ZERO;
+            BigDecimal peritectoidAmount = BigDecimal.ZERO;
+            BigDecimal accessoriesAmount = BigDecimal.ZERO;
+            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));
+                /**
+                 * 处理应付款金额-包材金额-配件金额
+                 */
+                List<EhsdPurchaseProductVo> pList = ehsdAmountMap.getOrDefault(v.getContractId(), null);
+                if (CollectionUtils.isNotEmpty(pList)) {
+                    for(EhsdPurchaseProductVo e : pList){
+                        //获取汇率
+                        BigDecimal rate = map.getOrDefault(e.getCurrency(), BigDecimal.ONE);
+                        // 获取认领金额
+                        BigDecimal money = e.getAmount();
+                        //总金额
+                        BigDecimal amount = rate.multiply(money);
+                        purchaseAmount = purchaseAmount.add(amount);
+                        if(ObjectUtil.isNotEmpty(e.getProductCategoryIds())){
+                            if(e.getProductCategoryIds().contains("1685534140512616449")||e.getProductCategoryId()==1685534140512616449L){//包材
+                                peritectoidAmount = peritectoidAmount.add(amount);
+                            }
+                            if(e.getProductCategoryIds().contains("1685534141821239297")||e.getProductCategoryId()==1685534141821239297L){//配件
+                                accessoriesAmount = accessoriesAmount.add(amount);
+                            }
+                        }
+                    }
+                    v.setEhsdSumAmount(purchaseAmount);
+                    v.setPeritectoidAmount(peritectoidAmount);
+                    v.setAccessoriesAmount(accessoriesAmount);
+                }
+                //计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
+                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())
+                );
+                //处理退税金额
+                handleRefundTax(v);
+                v.setRmbContractAmount(v.getAmount().multiply(new BigDecimal(map.getOrDefault(v.getCurrency(), BigDecimal.ONE).toString())));
+                //计算收入总计=合同金额(转人民币)+应退税金额(转人民币)
+                v.setIncomeAmount(v.getAmount().multiply(new BigDecimal(map.getOrDefault(v.getCurrency(), BigDecimal.ONE).toString())).add(v.getRefundableAmount()));
+            } else {//没有汇率取默认汇率
+                /**
+                 * 处理应付款金额-包材金额-配件金额
+                 */
+                List<EhsdPurchaseProductVo> pList = ehsdAmountMap.getOrDefault(v.getContractId(), null);
+                if (CollectionUtils.isNotEmpty(pList)) {
+                    for(EhsdPurchaseProductVo e : pList){
+                        //获取汇率
+                        BigDecimal rate = e.getRate();
+                        // 获取认领金额
+                        BigDecimal money = e.getAmount();
+                        //总金额
+                        BigDecimal amount = rate.multiply(money);
+                        purchaseAmount = purchaseAmount.add(amount);
+                        if(ObjectUtil.isNotEmpty(e.getProductCategoryIds())){
+                            if(e.getProductCategoryIds().contains("1685534140512616449")||e.getProductCategoryId()==1685534140512616449L){//包材
+                                peritectoidAmount = peritectoidAmount.add(amount);
+                            }
+                            if(e.getProductCategoryIds().contains("1685534141821239297")||e.getProductCategoryId()==1685534141821239297L){//配件
+                                accessoriesAmount = accessoriesAmount.add(amount);
+                            }
+                        }
+                    }
+                    v.setEhsdSumAmount(purchaseAmount);
+                    v.setPeritectoidAmount(peritectoidAmount);
+                    v.setAccessoriesAmount(accessoriesAmount);
+                }
+                BigDecimal rate = v.getRate();
+
+                //计算支出总计 除合同金额(转人民币)+应退税金额(转人民币) 其他金额相加
+                v.setExpenditureAmount(
+                        v.getTrailerFee() == null ? BigDecimal.ZERO : v.getTrailerFee().add
+                                (v.getCustomsFee() == null ? BigDecimal.ZERO : v.getCustomsFee()).add
+                                (v.getAgencyFee() == null ? BigDecimal.ZERO : v.getAgencyFee()).add
+                                (v.getPortMixedFee() == null ? BigDecimal.ZERO : v.getPortMixedFee()).add
+                                (v.getInspectionRedPack() == null ? BigDecimal.ZERO : v.getInspectionRedPack()).add
+                                (v.getCommission() == null ? BigDecimal.ZERO : v.getCommission()).add
+                                (v.getOther() == null ? BigDecimal.ZERO : v.getOther()).add
+                                (v.getEhsdSumAmount() == null ? BigDecimal.ZERO : v.getEhsdSumAmount())
+                );
+                //处理退税金额
+                handleRefundTax(v);
+                v.setRmbContractAmount(v.getAmount().multiply(rate));
+                //计算收入总计=合同金额(转人民币)+应退税金额(转人民币)
+                v.setIncomeAmount(v.getAmount().multiply(rate).add(v.getRefundableAmount()));
+            }
+            //计算毛利 收入-支出
+            v.setGross(v.getIncomeAmount().subtract(v.getExpenditureAmount()));
+            //计算毛利率 毛利/收入
+            v.setGrossRate(v.getGross().divide(v.getIncomeAmount(), RoundingMode.CEILING).multiply(new BigDecimal("100")));
+        }
+    }
+    /**
      * 统计金额
      * @return
      */
     private Map<String,Object> sumStatistic(List<ContractBudgetVo> list){
         Map<String,Object> map = new HashMap<>();
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("purchaseAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
-        map.put("contractAmount",BigDecimal.ZERO);
+        BigDecimal contractSumAmount = BigDecimal.ZERO;
+        BigDecimal taxReturnMoneySumAmount = BigDecimal.ZERO;
+        BigDecimal purchaseSumAmount = BigDecimal.ZERO;
+        BigDecimal peritectoidSumAmount = BigDecimal.ZERO;
+        BigDecimal accessoriesSumAmount = BigDecimal.ZERO;
+        BigDecimal trailerFeeSumAmount = BigDecimal.ZERO;
+        BigDecimal customsFeeSumAmount = BigDecimal.ZERO;
+        BigDecimal agencyFeeSumAmount = BigDecimal.ZERO;
+        BigDecimal portMixedFeeSumAmount = BigDecimal.ZERO;
+        BigDecimal inspectionRedPackSumAmount = BigDecimal.ZERO;
+        BigDecimal commissionSumAmount = BigDecimal.ZERO;
+        BigDecimal otherSumAmount = BigDecimal.ZERO;
+        BigDecimal totalIncomeSumAmount = BigDecimal.ZERO;
+        BigDecimal totalExpensesSumAmount = BigDecimal.ZERO;
+        BigDecimal grossProfitMargin = BigDecimal.ZERO;
+        for (ContractBudgetVo p : list) {
+            contractSumAmount = contractSumAmount.add(ObjectUtil.isEmpty(p.getRmbContractAmount())?BigDecimal.ZERO:p.getRmbContractAmount());//合同金额
+            taxReturnMoneySumAmount = taxReturnMoneySumAmount.add(ObjectUtil.isEmpty(p.getRefundableAmount())?BigDecimal.ZERO:p.getRefundableAmount());//退税
+            purchaseSumAmount = purchaseSumAmount.add(ObjectUtil.isEmpty(p.getEhsdSumAmount())?BigDecimal.ZERO:p.getEhsdSumAmount());//采购金额
+            peritectoidSumAmount = peritectoidSumAmount.add(ObjectUtil.isEmpty(p.getPeritectoidAmount())?BigDecimal.ZERO:p.getPeritectoidAmount());//包材
+            accessoriesSumAmount = accessoriesSumAmount.add(ObjectUtil.isEmpty(p.getAccessoriesAmount())?BigDecimal.ZERO:p.getAccessoriesAmount());//配件
+            trailerFeeSumAmount = trailerFeeSumAmount.add(ObjectUtil.isEmpty(p.getTrailerFee())?BigDecimal.ZERO:p.getTrailerFee());//拖车费
+            customsFeeSumAmount = customsFeeSumAmount.add(ObjectUtil.isEmpty(p.getCustomsFee())?BigDecimal.ZERO:p.getCustomsFee());//报关费
+            agencyFeeSumAmount = agencyFeeSumAmount.add(ObjectUtil.isEmpty(p.getAgencyFee())?BigDecimal.ZERO:p.getAgencyFee());//代理费
+            portMixedFeeSumAmount = portMixedFeeSumAmount.add(ObjectUtil.isEmpty(p.getProfitAgencyFee())?BigDecimal.ZERO:p.getProfitAgencyFee());//港杂费
+            inspectionRedPackSumAmount = inspectionRedPackSumAmount.add(ObjectUtil.isEmpty(p.getInspectionRedPack())?BigDecimal.ZERO:p.getInspectionRedPack());//验货红包
+            commissionSumAmount = commissionSumAmount.add(ObjectUtil.isEmpty(p.getCommission())?BigDecimal.ZERO:p.getCommission());//佣金
+            otherSumAmount = otherSumAmount.add(ObjectUtil.isEmpty(p.getOther())?BigDecimal.ZERO:p.getOther());//其他
+            totalIncomeSumAmount = totalIncomeSumAmount.add(ObjectUtil.isEmpty(p.getIncomeAmount())?BigDecimal.ZERO:p.getIncomeAmount());//总收入
+            totalExpensesSumAmount = totalExpensesSumAmount.add(ObjectUtil.isEmpty(p.getExpenditureAmount())?BigDecimal.ZERO:p.getExpenditureAmount());//总支出
+        }
+        //计算总毛利和总毛利率
+        BigDecimal grossProfitSum = totalIncomeSumAmount.subtract(totalExpensesSumAmount);//毛利
+        if (totalIncomeSumAmount.compareTo(BigDecimal.ZERO)>0) {
+            grossProfitMargin = new BigDecimal("100").multiply(grossProfitSum).divide(totalIncomeSumAmount, 2, RoundingMode.HALF_UP);//毛利率
+        }
+        map.put("contractSumAmount",contractSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("taxReturnMoneySumAmount",taxReturnMoneySumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("purchaseSumAmount",purchaseSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("peritectoidSumAmount",peritectoidSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("accessoriesSumAmount",accessoriesSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("trailerFeeSumAmount",trailerFeeSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("customsFeeSumAmount",customsFeeSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("agencyFeeSumAmount",agencyFeeSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("portMixedFeeSumAmount",portMixedFeeSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("inspectionRedPackSumAmount",inspectionRedPackSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("commissionSumAmount",commissionSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("otherSumAmount",otherSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("totalIncomeSumAmount",totalIncomeSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("totalExpensesSumAmount",totalExpensesSumAmount.setScale(2, RoundingMode.HALF_UP));
+        map.put("grossProfitMargin",grossProfitMargin.setScale(2, RoundingMode.HALF_UP));
+        map.put("grossProfitSum",grossProfitSum.setScale(2, RoundingMode.HALF_UP));
         return map;
     }
     /**

+ 0 - 3
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -52,9 +52,6 @@
     <select id="getProfitBudgetHeadStatistic" resultType="com.fjhx.sale.entity.contract.vo.ContractBudgetVo">
         SELECT
             t1.id                                                                     AS contractId,
-            t1.`code`,
-            t1.buy_corporation_id ,
-            t1.user_name,
             t1.amount,
             t1.currency,
             t1.currency_rate_json,