ccj 2 years ago
parent
commit
e0c5f3d382

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

@@ -124,7 +124,7 @@ public class BiInfoController {
         // 车辆
         getTranCount(biViewInfos, seachMoth);
         // 库存成本
-        getCostCount(biViewInfos, seachMoth);
+        getCostCount(biViewInfos, seachMoth,"");
         // 库点流向
         getMapInfo(biViewInfos, seachMoth);
         // 收入支出毛利润
@@ -148,16 +148,25 @@ public class BiInfoController {
 //                return listRedis;
 //            }
 //        }
-        List<BiViewInfo> listRedis = cacheComponent.getObjList(Const.ADMIN_BI_INFO+compId+seachMoth, BiViewInfo.class);
+        String userFlag = "";
+        String userId = "";
+        if(AuthSecurityUtils.getCurrentUserInfo() != null && AuthSecurityUtils.getCurrentUserInfo().getUserId() != null){
+            userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
+            //洮南瀚城合营人员查看
+            if("647b84ee01044e2a8d4fdc1943ce3d01,ec7024427b7347b98bcad422761e5bfc,23eff8bab2ed4af38a1be1315ce7046d,d958ef5aa62849039802356a63f6e7ca".contains(userId)){
+                userFlag = "taonan";
+            }
+        }
+        List<BiViewInfo> listRedis = cacheComponent.getObjList(Const.ADMIN_BI_INFO+compId+seachMoth+userFlag, BiViewInfo.class);
         if (listRedis != null && listRedis.size() > 0) {
-            return listRedis;
+//            return listRedis;
         }
         companyId = compId;
         List<BiViewInfo> biViewInfos = new ArrayList<>();
         // 车辆
         getTranCount(biViewInfos, seachMoth);
         // 库存成本
-        getCostCount(biViewInfos, seachMoth);
+        getCostCount(biViewInfos, seachMoth,userId);
         // 库点流向
         getMapInfo(biViewInfos, seachMoth);
         // 出入库分布
@@ -176,7 +185,7 @@ public class BiInfoController {
         contractManagementInfoEntityWrapper.eq("status_flag", "1");
         contractManagementInfoEntityWrapper.eq("comp_id", compId);
         if(AuthSecurityUtils.getCurrentUserInfo() != null && AuthSecurityUtils.getCurrentUserInfo().getUserId() != null){
-            String userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
+            userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
             //洮南瀚城合营人员查看
             if("647b84ee01044e2a8d4fdc1943ce3d01,ec7024427b7347b98bcad422761e5bfc,23eff8bab2ed4af38a1be1315ce7046d,d958ef5aa62849039802356a63f6e7ca".contains(userId)){
                 contractManagementInfoEntityWrapper.eq("joint_venture_parties", "洮南市二龙乡瀚城农产品有限公司");
@@ -203,7 +212,7 @@ public class BiInfoController {
 //            String userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
 //            cacheComponent.putRaw(Const.ADMIN_BI_INFO+userId+seachMoth, JSONObject.toJSONString(biViewInfos), 60 * 20);
 //        }
-        cacheComponent.putRaw(Const.ADMIN_BI_INFO+compId+seachMoth, JSONObject.toJSONString(biViewInfos), 60 * 20);
+        cacheComponent.putRaw(Const.ADMIN_BI_INFO+compId+seachMoth+userFlag, JSONObject.toJSONString(biViewInfos), 60 * 20);
 
         return biViewInfos;
     }
@@ -485,7 +494,7 @@ public class BiInfoController {
      *
      * @return
      */
-    private List<BiViewInfo> getCostCount(List<BiViewInfo> biViewInfos, String seachMoth) {
+    private List<BiViewInfo> getCostCount(List<BiViewInfo> biViewInfos, String seachMoth,String userId) {
         EntityWrapper<CostManagementInfo> costManagementInfoEntityWrapper = new EntityWrapper<CostManagementInfo>();
         costManagementInfoEntityWrapper.eq("comp_id", companyId);
 //        if(seachMoth != null) {
@@ -498,8 +507,12 @@ public class BiInfoController {
 //        }
 //        List<CostManagementInfo> costManagementInfos = costManagementInfoService.selectList(costManagementInfoEntityWrapper);
 //        Double sumAct = warehousePositionStorageInfoService.selectSumStoreage(companyId);
-        Double inWeight = warehousePositionStorageInfoMapper.selectSumWareNew(companyId, null,"2",seachMoth);
-        Double outWeight = warehousePositionStorageInfoMapper.selectSumWareNew(companyId, null,"1",seachMoth);
+        String jointVentureParties = null;
+        if("647b84ee01044e2a8d4fdc1943ce3d01,ec7024427b7347b98bcad422761e5bfc,23eff8bab2ed4af38a1be1315ce7046d,d958ef5aa62849039802356a63f6e7ca".contains(userId)){
+            jointVentureParties ="洮南市二龙乡瀚城农产品有限公司";
+        }
+        Double inWeight = warehousePositionStorageInfoMapper.selectSumWareNew(companyId, null,"2",seachMoth,jointVentureParties);
+        Double outWeight = warehousePositionStorageInfoMapper.selectSumWareNew(companyId, null,"1",seachMoth,jointVentureParties);
         if (inWeight == null) {
             inWeight = 0d;
         }

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/WarehousePositionStorageInfoMapper.java

@@ -17,5 +17,5 @@ public interface WarehousePositionStorageInfoMapper extends BaseMapper<Warehouse
 
     Double selectSumStoreage(Map<String, Object> pageView);
     Double selectSumWare(String compId,String baseId);
-    Double selectSumWareNew(String compId,String baseId,String flag,String seachMoth);
+    Double selectSumWareNew(String compId,String baseId,String flag,String seachMoth,String jointVentureParties);
 }

+ 6 - 3
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehousePositionStorageInfoMapper.xml

@@ -39,9 +39,12 @@
             AND wbi.delete_flag = 0
         WHERE
             wioi.delete_flag = 0
-        <if test="baseId != null">
-            and wbi.id = #{baseId}
-        </if>
+            <if test="baseId != null">
+                and wbi.id = #{baseId}
+            </if>
+            <if test="jointVentureParties != null">
+                and wbi.joint_venture_parties = #{jointVentureParties}
+            </if>
             and wbi.comp_id = #{compId}
             and wioi.in_out_flag = #{flag}
             and wioi.create_date >= #{seachMoth}