gongdecai преди 3 години
родител
ревизия
4fec9130e6
променени са 1 файла, в които са добавени 22 реда и са изтрити 19 реда
  1. 22 19
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/BiInfoController.java

+ 22 - 19
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/BiInfoController.java

@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.io.FileInputStream;
@@ -56,6 +57,7 @@ public class BiInfoController {
     private ICostManagementInfoService costManagementInfoService;
     @Autowired
     private IWarehouseBaseInfoService warehouseBaseInfoService;
+    private String companyId;
 
     /**
      * 查询
@@ -63,11 +65,12 @@ public class BiInfoController {
      * @return
      */
     @GetMapping("/selectBiInfo")
-    public List<BiViewInfo> selectBiInfo() {
+    public List<BiViewInfo> selectBiInfo(String compId) {
+        companyId = compId;
         List<BiViewInfo> biViewInfos = new ArrayList<>();
         // 销售合同   执行中的合同
         List<ContractManagementInfo> contractManagementInfos = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>().eq("contract_type", "2")
-                .eq("status_flag", "1").eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId()));
+                .eq("status_flag", "1").eq("comp_id", compId));
         // 执行中的所有合同-已完成量、待完成量   2  执行中的合同额  -已开票、待开票 3 已付款 未付款
         getCompletedAndNotQuantity(contractManagementInfos, biViewInfos);
         // 采购
@@ -91,7 +94,7 @@ public class BiInfoController {
         List<BiViewInfo> biViewInfoList = new ArrayList<>();
         BiViewInfo biViewInfoa = new BiViewInfo();
         List<TranTaskInfo> tranTaskInfos = tranTaskInfoService.selectList(new EntityWrapper<TranTaskInfo>()
-                .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId()));
+                .eq("comp_id", companyId));
         if (CollectionUtils.isNotEmpty(tranTaskInfos)) {
             for (int i = 0; i < tranTaskInfos.size(); i++) {
                 TranTaskInfo tranTaskInfo = tranTaskInfos.get(i);
@@ -100,30 +103,30 @@ public class BiInfoController {
 
                         BiViewInfo biViewInfo = new BiViewInfo();
                         WarehouseBaseInfo warehouseBaseInfo = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
-                                .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
+                                .eq("comp_id", companyId)
                                 .eq("warehouse_name", tranTaskInfo.getSendWarehouse()));
                         ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", tranTaskInfo.getContractNo())
-                                .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId()));
+                                .eq("comp_id", companyId));
                         if (warehouseBaseInfo != null && contractManagementInfo != null) {
                             biViewInfo.setStartPlace(warehouseBaseInfo.getWarehousePositioning());
                             biViewInfo.setEndPlace(contractManagementInfo.getDeliveryLocation());
-                            biViewInfo.setName(warehouseBaseInfo.getWarehouseName()+" → "+contractManagementInfo.getPlaceDelivery()+"  在途");
+                            biViewInfo.setName(warehouseBaseInfo.getWarehouseName() + " → " + contractManagementInfo.getPlaceDelivery() + "  在途");
                             biViewInfoList.add(biViewInfo);
                         }
 
                     } else if ("4".equals(tranTaskInfo.getTaskTypeKey())) {
                         BiViewInfo biViewInfo = new BiViewInfo();
                         WarehouseBaseInfo warehouseBaseInfo = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
-                                .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
+                                .eq("comp_id", companyId)
                                 .eq("warehouse_name", tranTaskInfo.getSendWarehouse()));
                         WarehouseBaseInfo warehouseBaseInfo1 = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
-                                .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
+                                .eq("comp_id", companyId)
                                 .eq("warehouse_name", tranTaskInfo.getReceiveWarehouse()));
                         if (warehouseBaseInfo != null && warehouseBaseInfo1 != null) {
                             biViewInfo.setStartPlace(warehouseBaseInfo.getWarehousePositioning());
                             biViewInfo.setEndPlace(warehouseBaseInfo1.getWarehousePositioning());
-                            biViewInfo.setName(warehouseBaseInfo.getWarehouseName()+" → "+warehouseBaseInfo1.getWarehouseName()+"  在途");
+                            biViewInfo.setName(warehouseBaseInfo.getWarehouseName() + " → " + warehouseBaseInfo1.getWarehouseName() + "  在途");
                             biViewInfoList.add(biViewInfo);
                         }
                     }
@@ -145,7 +148,7 @@ public class BiInfoController {
      * @return
      */
     private List<BiViewInfo> getCostCount(List<BiViewInfo> biViewInfos) {
-        List<CostManagementInfo> costManagementInfos = costManagementInfoService.selectList(new EntityWrapper<CostManagementInfo>().eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId()));
+        List<CostManagementInfo> costManagementInfos = costManagementInfoService.selectList(new EntityWrapper<CostManagementInfo>().eq("comp_id", companyId));
         Float sumTotal = 0f;
         Float sumCost = 0f;
         if (CollectionUtils.isNotEmpty(costManagementInfos)) {
@@ -172,7 +175,7 @@ public class BiInfoController {
 
         // 粮食储存总量
         List<CostManagementInfo> costManagementInfoList = costManagementInfoService.selectList(new EntityWrapper<CostManagementInfo>()
-                .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
+                .eq("comp_id", companyId)
                 .groupBy("goods_name_key"));
         BiViewInfo biViewInfo4 = new BiViewInfo();
         List<BiViewInfo> biViewInfos1 = new ArrayList<>();
@@ -181,7 +184,7 @@ public class BiInfoController {
                 CostManagementInfo costManagementInfo = costManagementInfoList.get(i);
                 BiViewInfo biViewInfo3 = new BiViewInfo();
                 List<CostManagementInfo> costManagementInfoList1 = costManagementInfoService.selectList(new EntityWrapper<CostManagementInfo>()
-                        .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
+                        .eq("comp_id", companyId)
                         .eq("goods_name_key", costManagementInfo.getGoodsNameKey()));
                 Float weight = 0f;
                 for (int j = 0; j < costManagementInfoList1.size(); j++) {
@@ -336,12 +339,12 @@ public class BiInfoController {
         List<BiViewInfo> biViewInfosa1 = new ArrayList<>();
         BiViewInfo biViewInfoa1 = new BiViewInfo();
         biViewInfoa1.setName("已开票");
-        BigDecimal bg12= new BigDecimal(invoicingTotal);
+        BigDecimal bg12 = new BigDecimal(invoicingTotal);
         biViewInfoa1.setCount(String.valueOf(bg12));
         biViewInfoa1.setPercentage(invoicingTotal != 0 ? invoicingTotal / moneyTotal * 100 + "%" : 0 + "%");
         BiViewInfo biViewInfoa2 = new BiViewInfo();
         biViewInfoa2.setName("待开票");
-        BigDecimal bg00= new BigDecimal(moneyTotal - (invoicingTotal != null ? invoicingTotal : 0));
+        BigDecimal bg00 = new BigDecimal(moneyTotal - (invoicingTotal != null ? invoicingTotal : 0));
         biViewInfoa2.setCount(String.valueOf(bg00));
         biViewInfoa2.setPercentage((moneyTotal - (invoicingTotal != null ? invoicingTotal : 0)) / moneyTotal * 100 + "%");
         biViewInfosa1.add(biViewInfoa1);
@@ -357,7 +360,7 @@ public class BiInfoController {
         List<BiViewInfo> biViewInfosb1 = new ArrayList<>();
         BiViewInfo biViewInfob1 = new BiViewInfo();
         biViewInfob1.setName("已付款");
-        BigDecimal bg45= new BigDecimal(payTotal);
+        BigDecimal bg45 = new BigDecimal(payTotal);
         biViewInfob1.setCount(String.valueOf(bg45));
         biViewInfob1.setPercentage(payTotal != 0 ? payTotal / moneyTotal * 100 + "%" : 0 + "%");
         BiViewInfo biViewInfob2 = new BiViewInfo();
@@ -488,12 +491,12 @@ public class BiInfoController {
         List<BiViewInfo> biViewInfosa1 = new ArrayList<>();
         BiViewInfo biViewInfoa1 = new BiViewInfo();
         biViewInfoa1.setName("已开票");
-        BigDecimal bg45= new BigDecimal(invoicingTotal);
+        BigDecimal bg45 = new BigDecimal(invoicingTotal);
         biViewInfoa1.setCount(String.valueOf(bg45));
         biViewInfoa1.setPercentage(invoicingTotal != 0 ? invoicingTotal / moneyTotal * 100 + "%" : 0 + "%");
         BiViewInfo biViewInfoa2 = new BiViewInfo();
         biViewInfoa2.setName("待开票");
-        BigDecimal bg4= new BigDecimal(moneyTotal - (invoicingTotal != null ? invoicingTotal : 0));
+        BigDecimal bg4 = new BigDecimal(moneyTotal - (invoicingTotal != null ? invoicingTotal : 0));
         biViewInfoa2.setCount(String.valueOf(bg4));
         biViewInfoa2.setPercentage((moneyTotal - (invoicingTotal != null ? invoicingTotal : 0)) / moneyTotal * 100 + "%");
         biViewInfosa1.add(biViewInfoa1);
@@ -509,12 +512,12 @@ public class BiInfoController {
         List<BiViewInfo> biViewInfosb1 = new ArrayList<>();
         BiViewInfo biViewInfob1 = new BiViewInfo();
         biViewInfob1.setName("已付款");
-        BigDecimal bg9= new BigDecimal(payTotal);
+        BigDecimal bg9 = new BigDecimal(payTotal);
         biViewInfob1.setCount(String.valueOf(bg9));
         biViewInfob1.setPercentage(payTotal != 0 ? payTotal / moneyTotal * 100 + "%" : 0 + "%");
         BiViewInfo biViewInfob2 = new BiViewInfo();
         biViewInfob2.setName("待付款");
-        BigDecimal bg6= new BigDecimal(moneyTotal - (payTotal != null ? payTotal : 0));
+        BigDecimal bg6 = new BigDecimal(moneyTotal - (payTotal != null ? payTotal : 0));
         biViewInfob2.setCount(String.valueOf(bg6));
         biViewInfob2.setPercentage((moneyTotal - (payTotal != null ? payTotal : 0)) / moneyTotal * 100 + "%");
         biViewInfosb1.add(biViewInfoa1);