Jelajahi Sumber

1.商品档案+客户经理过滤
2.地点档案+客户经理过滤
3.车辆档案+客户经理过滤
4.司机档案+客户经理过滤
5.贸易合同+客户经理过滤
6.物流合同+客户经理过滤
7.企业运需+客户经理过滤

lengfaqiang 2 tahun lalu
induk
melakukan
ea3efe600c
35 mengubah file dengan 511 tambahan dan 227 penghapusan
  1. 1 1
      sckw-modules-api/sckw-contract-api/src/main/java/com/sckw/contract/api/RemoteContractService.java
  2. 1 3
      sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/dubbo/TradeOrderStatisticsService.java
  3. 1 1
      sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/dubbo/PaymentDubboService.java
  4. 4 2
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/dubbo/TransportStatisticsService.java
  5. 2 1
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dao/KwcContractLogisticsMapper.java
  6. 1 1
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dao/KwcContractTradeMapper.java
  7. 28 10
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dubbo/RemoteContractServiceImpl.java
  8. 32 8
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java
  9. 40 16
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java
  10. 25 19
      sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractLogisticsMapper.xml
  11. 25 19
      sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml
  12. 3 1
      sckw-modules/sckw-example/src/main/java/com/sckw/example/service/TransportService.java
  13. 4 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverMapper.java
  14. 4 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java
  15. 23 3
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  16. 36 14
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  17. 50 38
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml
  18. 52 40
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml
  19. 18 12
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java
  20. 1 1
      sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwoTradeOrderMapper.java
  21. 4 4
      sckw-modules/sckw-order/src/main/java/com/sckw/order/dubbo/TradeOrderStatisticsServiceImpl.java
  22. 2 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java
  23. 95 4
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java
  24. 6 0
      sckw-modules/sckw-order/src/main/resources/mapper/KwoTradeOrderMapper.xml
  25. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerLogisticsMapper.java
  26. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerTradeMapper.java
  27. 5 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dubbo/PaymentDubboServiceImpl.java
  28. 2 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java
  29. 3 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java
  30. 6 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml
  31. 6 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml
  32. 14 9
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwWorkService.java
  33. 2 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java
  34. 7 4
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dubbo/TransportStatisticsServiceImpl.java
  35. 6 0
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

+ 1 - 1
sckw-modules-api/sckw-contract-api/src/main/java/com/sckw/contract/api/RemoteContractService.java

@@ -37,7 +37,7 @@ public interface RemoteContractService {
      * @author: czh
      * @date: 2023/9/8
      */
-    Map<Integer, Integer> queryContractValidCount(Long entId);
+    Map<Integer, Integer> queryContractValidCount(Long entId,List<Long> enterpriseIds);
 
 
 }

+ 1 - 3
sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/dubbo/TradeOrderStatisticsService.java

@@ -1,7 +1,5 @@
 package com.sckw.order.api.dubbo;
 
-import com.sckw.order.api.model.TradeOrderCountStatisticsDTO;
-
 import java.util.List;
 import java.util.Map;
 
@@ -19,5 +17,5 @@ public interface TradeOrderStatisticsService {
      * @Param topEntId:
      * @return: java.util.List<com.sckw.order.api.model.TradeOrderCountStatisticsDTO>
      */
-    Map<Integer, Integer> getOrderNumByTopEntId(Long topEntId);
+    Map<Integer, Integer> getOrderNumByTopEntId(Long topEntId,List<Long> enterpriseIds);
 }

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/dubbo/PaymentDubboService.java

@@ -49,7 +49,7 @@ public interface PaymentDubboService {
      * @param entId 集团id
      * @return
      */
-    LedgerCount countLedger(Long entId);
+    LedgerCount countLedger(Long entId,List<Long> enterpriseIds);
 
     //工作台金额统计数据四个接口
 

+ 4 - 2
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/dubbo/TransportStatisticsService.java

@@ -1,5 +1,7 @@
 package com.sckw.transport.api.dubbo;
 
+import java.util.List;
+
 /**
  * @author lfdc
  * @version 1.0
@@ -15,7 +17,7 @@ public interface TransportStatisticsService {
      * @param topEntId
      * @return
      */
-    Integer statisticsLogistics(Long topEntId);
+    Integer statisticsLogistics(Long topEntId, List<Long> enterpriseIds);
 
     /**
      * 统计托运订单
@@ -23,7 +25,7 @@ public interface TransportStatisticsService {
      * @param topEntId
      * @return
      */
-    Integer statisticsLogisticsByConsign(Long topEntId);
+    Integer statisticsLogisticsByConsign(Long topEntId,List<Long> enterpriseIds);
 
     /**
      * 统计调度派车

+ 2 - 1
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dao/KwcContractLogisticsMapper.java

@@ -6,6 +6,7 @@ import com.sckw.contract.model.dto.res.QueryListResDto;
 import com.sckw.contract.model.entity.KwcContractLogistics;
 import com.sckw.contract.model.vo.req.QueryListReqVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -34,7 +35,7 @@ public interface KwcContractLogisticsMapper extends BaseMapper<KwcContractLogist
      * @author: czh
      * @date: 2023/9/13
      */
-    List<QueryListResDto> queryLogisticsList(QueryListReqVo reqVo);
+    List<QueryListResDto> queryLogisticsList(@Param("reqVo") QueryListReqVo reqVo, @Param("authEntIdList") List<Long> authEntIdList);
 
 }
 

+ 1 - 1
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dao/KwcContractTradeMapper.java

@@ -46,7 +46,7 @@ public interface KwcContractTradeMapper extends BaseMapper<KwcContractTrade> {
      * @author: czh
      * @date: 2023/9/13
      */
-    List<QueryListResDto> queryTradeList(QueryListReqVo reqVo);
+    List<QueryListResDto> queryTradeList(@Param("reqVo") QueryListReqVo reqVo, @Param("authEntIdList") List<Long> authEntIdList);
 }
 
 

+ 28 - 10
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/dubbo/RemoteContractServiceImpl.java

@@ -110,17 +110,35 @@ public class RemoteContractServiceImpl implements RemoteContractService {
      * @date: 2023/9/8
      */
     @Override
-    public Map<Integer, Integer> queryContractValidCount(Long entId) {
+    public Map<Integer, Integer> queryContractValidCount(Long entId, List<Long> enterpriseIds) {
         List<Long> entIdList = new ArrayList<>();
-        if (Objects.nonNull(entId)) {
-            EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(entId);
-            if (Objects.isNull(entCacheResDto)) {
-                return Collections.emptyMap();
-            }
-            entIdList.add(entId);
-            List<EntCacheResDto> child = entCacheResDto.getChild();
-            if (CollectionUtils.isNotEmpty(child)) {
-                entIdList.addAll(child.stream().map(EntCacheResDto::getId).toList());
+        //原来的
+//        if (Objects.nonNull(entId)) {
+//            EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(entId);
+//            if (Objects.isNull(entCacheResDto)) {
+//                return Collections.emptyMap();
+//            }
+//            entIdList.add(entId);
+//            List<EntCacheResDto> child = entCacheResDto.getChild();
+//            if (CollectionUtils.isNotEmpty(child)) {
+//                entIdList.addAll(child.stream().map(EntCacheResDto::getId).toList());
+//            }
+//        }
+
+        //加客户经理数据过滤
+        enterpriseIds.add(entId);
+        enterpriseIds = enterpriseIds.stream().distinct().collect(Collectors.toList());
+        if (Objects.nonNull(enterpriseIds) && enterpriseIds.size() > 0) {
+            for (Long aLong : entIdList) {
+                EntCacheResDto entCacheResDto = remoteSystemService.queryEntTreeById(aLong);
+                if (Objects.isNull(entCacheResDto)) {
+                    return Collections.emptyMap();
+                }
+                entIdList.add(aLong);
+                List<EntCacheResDto> child = entCacheResDto.getChild();
+                if (CollectionUtils.isNotEmpty(child)) {
+                    entIdList.addAll(child.stream().map(EntCacheResDto::getId).toList());
+                }
             }
         }
 

+ 32 - 8
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java

@@ -1,9 +1,5 @@
 package com.sckw.contract.service;
 
-import java.io.File;
-import java.util.Date;
-
-import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -904,7 +900,18 @@ public class KwcContractLogisticsService {
      */
     public PageResult queryLogisticsByPage(QueryListReqVo reqVo) {
         PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
-        List<QueryListResDto> queryListResDtos = kwcContractLogisticsMapper.queryLogisticsList(reqVo);
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                return PageHelperUtil.getPageResult(new PageInfo<>());
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        List<QueryListResDto> queryListResDtos = kwcContractLogisticsMapper.queryLogisticsList(reqVo,authEntIdList);
         if (CollectionUtils.isEmpty(queryListResDtos)) {
             return PageHelperUtil.getPageResult(new PageInfo<>());
         }
@@ -962,8 +969,16 @@ public class KwcContractLogisticsService {
             findListGroupResVo.setCount(0);
             list.add(findListGroupResVo);
         }
-
-        List<QueryListResDto> queryListResDtoList = kwcContractLogisticsMapper.queryLogisticsList(reqVo);
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                return list;
+            }
+            authEntIdList.addAll(ids);
+        }
+        List<QueryListResDto> queryListResDtoList = kwcContractLogisticsMapper.queryLogisticsList(reqVo,authEntIdList);
         if (CollectionUtils.isNotEmpty(queryListResDtoList)) {
             Map<Integer, List<QueryListResDto>> collect = queryListResDtoList.stream().collect(Collectors.groupingBy(QueryListResDto::getStatus));
             for (FindListGroupResVo findListGroupResVo : list) {
@@ -985,7 +1000,16 @@ public class KwcContractLogisticsService {
      */
     public void exportLogisticsList(QueryListReqVo reqVo, HttpServletResponse response) {
         reqVo.setIdList(StringUtils.splitStrToList(reqVo.getIds(), Global.COMMA, Long.class));
-        List<QueryListResDto> queryListResDtos = kwcContractLogisticsMapper.queryLogisticsList(reqVo);
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
+            }
+            authEntIdList.addAll(ids);
+        }
+        List<QueryListResDto> queryListResDtos = kwcContractLogisticsMapper.queryLogisticsList(reqVo,authEntIdList);
         if (CollectionUtils.isEmpty(queryListResDtos)) {
             throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
         }

+ 40 - 16
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java

@@ -1,24 +1,19 @@
 package com.sckw.contract.service;
 
-import java.io.IOException;
-import java.util.Date;
-
-import cn.hutool.core.date.DatePattern;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.sckw.contract.dao.KwcContractTradeMapper;
 import com.sckw.contract.model.dto.req.QueryListReqDto;
 import com.sckw.contract.model.dto.res.QueryListResDto;
-import com.sckw.contract.model.entity.*;
-import com.sckw.contract.model.report.LogisticsListExport;
+import com.sckw.contract.model.entity.KwcContractTrade;
+import com.sckw.contract.model.entity.KwcContractTradeGoods;
+import com.sckw.contract.model.entity.KwcContractTradeUnit;
 import com.sckw.contract.model.report.TradeListExport;
 import com.sckw.contract.model.vo.req.*;
-
 import com.sckw.contract.model.vo.res.*;
 import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
@@ -33,7 +28,6 @@ import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
-import com.sckw.excel.utils.EasyExcelUtil;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.order.api.model.ContractSignCompletedParam;
@@ -41,6 +35,7 @@ import com.sckw.product.api.dubbo.GoodsInfoService;
 import com.sckw.product.api.model.KwpGoods;
 import com.sckw.stream.enums.MessageEnum;
 import com.sckw.stream.model.UserInfo;
+import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.KwsUserResDto;
@@ -53,15 +48,12 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import com.sckw.system.api.RemoteSystemService;
 
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
-import com.sckw.contract.dao.KwcContractTradeMapper;
-
 /**
  * @author PC
  * @description 针对表【kwc_contract_trade(交易合同(采购合同/销售合同))】的数据库操作Service实现
@@ -919,7 +911,18 @@ public class KwcContractTradeService {
      */
     public PageResult queryTradeByPage(QueryListReqVo reqVo) {
         PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
-        List<QueryListResDto> queryListResDtos = kwcContractTradeMapper.queryTradeList(reqVo);
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                return PageHelperUtil.getPageResult(new PageInfo<>());
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        List<QueryListResDto> queryListResDtos = kwcContractTradeMapper.queryTradeList(reqVo,authEntIdList);
         if (CollectionUtils.isEmpty(queryListResDtos)) {
             return PageHelperUtil.getPageResult(new PageInfo<>());
         }
@@ -976,7 +979,17 @@ public class KwcContractTradeService {
             list.add(findListGroupResVo);
         }
 
-        List<QueryListResDto> queryListResDtoList = kwcContractTradeMapper.queryTradeList(reqVo);
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                return list;
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        List<QueryListResDto> queryListResDtoList = kwcContractTradeMapper.queryTradeList(reqVo,authEntIdList);
         if (CollectionUtils.isNotEmpty(queryListResDtoList)) {
             Map<Integer, List<QueryListResDto>> collect = queryListResDtoList.stream().collect(Collectors.groupingBy(QueryListResDto::getStatus));
             for (FindListGroupResVo findListGroupResVo : list) {
@@ -998,7 +1011,18 @@ public class KwcContractTradeService {
      */
     public void exportTradeList(QueryListReqVo reqVo, HttpServletResponse response) {
         reqVo.setIdList(StringUtils.splitStrToList(reqVo.getIds(), Global.COMMA, Long.class));
-        List<QueryListResDto> queryListResDtos = kwcContractTradeMapper.queryTradeList(reqVo);
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        List<QueryListResDto> queryListResDtos = kwcContractTradeMapper.queryTradeList(reqVo,authEntIdList);
         if (CollectionUtils.isEmpty(queryListResDtos)) {
             throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
         }

+ 25 - 19
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractLogisticsMapper.xml

@@ -122,32 +122,38 @@
           left join kwc_contract_logistics f on f.id = a.contract_pid
          where a.del_flag = 0
            and a.status != 3
-        <if test="startTime != null">
-            and a.create_time >= #{startTime}
+        <if test="authEntIdList != null and authEntIdList.size() != 0">
+            and a.ent_id in
+            <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                #{item}
+            </foreach>
         </if>
-        <if test="endTime != null">
-            and a.create_time &lt;= #{endTime}
+        <if test="reqVo.startTime != null">
+            and a.create_time >= #{reqVo.startTime}
         </if>
-        <if test="status != null">
-            and a.status = #{status}
+        <if test="reqVo.endTime != null">
+            and a.create_time &lt;= #{reqVo.endTime}
         </if>
-        <if test="signingWay != null">
-            and a.signing_way = #{signingWay}
+        <if test="reqVo.status != null">
+            and a.status = #{reqVo.status}
         </if>
-        <if test="charging != null">
-            and a.charging = #{charging}
+        <if test="reqVo.signingWay != null">
+            and a.signing_way = #{reqVo.signingWay}
         </if>
-        <if test="keywords != null and keywords != ''">
-            and (b.firm_name like concat('%', #{keywords}, '%') or
-                 e.firm_name like concat('%', #{keywords}, '%') or
-                 b.contacts like concat('%', #{keywords}, '%') or
-                 e.contacts like concat('%', #{keywords}, '%') or
-                 a.contract_no like concat('%', #{keywords}, '%') or
-                 a.name like concat('%', #{keywords}, '%'))
+        <if test="reqVo.charging != null">
+            and a.charging = #{reqVo.charging}
         </if>
-        <if test="idList != null and idList.size() > 0">
+        <if test="reqVo.keywords != null and reqVo.keywords != ''">
+            and (b.firm_name like concat('%', #{reqVo.keywords}, '%') or
+                 e.firm_name like concat('%', #{reqVo.keywords}, '%') or
+                 b.contacts like concat('%', #{reqVo.keywords}, '%') or
+                 e.contacts like concat('%', #{reqVo.keywords}, '%') or
+                 a.contract_no like concat('%', #{reqVo.keywords}, '%') or
+                 a.name like concat('%', #{reqVo.keywords}, '%'))
+        </if>
+        <if test="reqVo.idList != null and reqVo.idList.size() > 0">
             and a.id in
-            <foreach collection="idList" open="(" close=")" separator="," item="item">
+            <foreach collection="reqVo.idList" open="(" close=")" separator="," item="item">
                 #{item}
             </foreach>
         </if>

+ 25 - 19
sckw-modules/sckw-contract/src/main/resources/mapper/KwcContractTradeMapper.xml

@@ -149,34 +149,40 @@
         left join kwc_contract_trade f on a.contract_pid = f.id
         where a.del_flag = 0
           and a.status != 3
-        <if test="startTime != null">
-            and a.create_time >= #{startTime}
+        <if test="authEntIdList != null and authEntIdList.size() != 0">
+            and a.ent_id in
+            <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
-        <if test="endTime != null">
-            and a.create_time &lt;= #{endTime}
+        <if test="reqVo.startTime != null">
+            and a.create_time >= #{reqVo.startTime}
         </if>
-        <if test="status != null">
-            and a.status = #{status}
+        <if test="reqVo.endTime != null">
+            and a.create_time &lt;= #{reqVo.endTime}
         </if>
-        <if test="keywords != null and keywords != ''">
-            and (b.firm_name like concat('%', #{keywords}, '%') or
-                 e.firm_name like concat('%', #{keywords}, '%') or
-                 b.contacts like concat('%', #{keywords}, '%') or
-                 e.contacts like concat('%', #{keywords}, '%') or
-                 a.contract_no like concat('%', #{keywords}, '%') or
-                 a.name like concat('%', #{keywords}, '%'))
+        <if test="reqVo.status != null">
+            and a.status = #{reqVo.status}
         </if>
-        <if test="idList != null and idList.size() > 0">
+        <if test="reqVo.keywords != null and reqVo.keywords != ''">
+            and (b.firm_name like concat('%', #{reqVo.keywords}, '%') or
+                 e.firm_name like concat('%', #{reqVo.keywords}, '%') or
+                 b.contacts like concat('%', #{reqVo.keywords}, '%') or
+                 e.contacts like concat('%', #{reqVo.keywords}, '%') or
+                 a.contract_no like concat('%', #{reqVo.keywords}, '%') or
+                 a.name like concat('%', #{reqVo.keywords}, '%'))
+        </if>
+        <if test="reqVo.idList != null and reqVo.idList.size() > 0">
             and a.id in
-            <foreach collection="idList" open="(" close=")" separator="," item="item">
+            <foreach collection="reqVo.idList" open="(" close=")" separator="," item="item">
                 #{item}
             </foreach>
         </if>
-        <if test="trading != null">
-            and a.trading = #{trading}
+        <if test="reqVo.trading != null">
+            and a.trading = #{reqVo.trading}
         </if>
-        <if test="signingWay != null">
-            and a.signing_way = #{signingWay}
+        <if test="reqVo.signingWay != null">
+            and a.signing_way = #{reqVo.signingWay}
         </if>
         order by a.create_time desc
     </select>

+ 3 - 1
sckw-modules/sckw-example/src/main/java/com/sckw/example/service/TransportService.java

@@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+
 /**
  * @author lfdc
  * @description 运输服务service
@@ -25,7 +27,7 @@ public class TransportService {
     private TransportStatisticsService statisticsService;
 
     public Integer statisticsLogistics(Long topEntId) {
-        return statisticsService.statisticsLogistics(topEntId);
+        return statisticsService.statisticsLogistics(topEntId,new ArrayList<>());
     }
 
     public Integer statisticsWaybillSendCar(Long topEntId) {

+ 4 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverMapper.java

@@ -20,10 +20,11 @@ public interface KwfDriverMapper extends BaseMapper<KwfDriver> {
 
     /**
      * 统计
+     *
      * @param params
      * @return
      */
-    List<KwfTableTopCount> statisticsAll(Map<String, Object> params);
+    List<KwfTableTopCount> statisticsAll(@Param("params") Map<String, Object> params, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 统计
@@ -34,10 +35,11 @@ public interface KwfDriverMapper extends BaseMapper<KwfDriver> {
 
     /**
      * 分页查询
+     *
      * @param params
      * @return
      */
-    List<KwfDriverVo> findPageAll(Map<String, Object> params);
+    List<KwfDriverVo> findPageAll(@Param("params") Map<String, Object> params, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 分页查询

+ 4 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java

@@ -21,10 +21,11 @@ public interface KwfTruckMapper extends BaseMapper<KwfTruck> {
 
     /**
      * 统计
+     *
      * @param params
      * @return
      */
-    List<KwfTableTopCount> statisticsAll(Map<String, Object> params);
+    List<KwfTableTopCount> statisticsAll(@Param("params") Map<String, Object> params, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 统计
@@ -35,10 +36,11 @@ public interface KwfTruckMapper extends BaseMapper<KwfTruck> {
 
     /**
      * 分页查询
+     *
      * @param params
      * @return
      */
-    List<KwfTruckVo> findPageAll(Map<String, Object> params);
+    List<KwfTruckVo> findPageAll(@Param("params") Map<String, Object> params, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 分页查询

+ 23 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java

@@ -25,6 +25,7 @@ import com.sckw.fleet.model.vo.*;
 import com.sckw.redis.constant.RedisConstant;
 import com.sckw.redis.utils.RedissonUtils;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
@@ -68,7 +69,8 @@ public class KwfDriverService {
     private RemoteSystemService remoteSystemService;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private FileApiDubboService remoteFileService;
-
+    @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
+    private RemoteUserService remoteUserService;
     /**
      * @param key 逐渐id
      * @desc 根据主键查询
@@ -194,7 +196,16 @@ public class KwfDriverService {
         int systemType = LoginUserHolder.getSystemType();
         /**统计数据**/
         if (systemType == SystemTypeEnum.MANAGE.getCode()) {
-            List<KwfTableTopCount> counts = driverDao.statisticsAll(params);
+            //新增客户经理权限过滤
+            List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    return new ArrayList<>();
+                }
+                authEntIdList.addAll(ids);
+            }
+            List<KwfTableTopCount> counts = driverDao.statisticsAll(params,authEntIdList);
             return counts;
         } else {
             params.put("entId", LoginUserHolder.getEntId());
@@ -258,7 +269,16 @@ public class KwfDriverService {
         int systemType = LoginUserHolder.getSystemType();
         /**统计数据**/
         if (systemType == SystemTypeEnum.MANAGE.getCode()) {
-            List<KwfDriverVo> drivers = driverDao.findPageAll(params);
+            //新增客户经理权限过滤
+            List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    return new ArrayList<>();
+                }
+                authEntIdList.addAll(ids);
+            }
+            List<KwfDriverVo> drivers = driverDao.findPageAll(params,authEntIdList);
             return drivers;
         } else {
             params.put("entId", LoginUserHolder.getEntId());

+ 36 - 14
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -183,7 +183,16 @@ public class KwfTruckService {
         int systemType = LoginUserHolder.getSystemType();
         /**统计数据**/
         if (systemType == SystemTypeEnum.MANAGE.getCode()) {
-            List<KwfTableTopCount> counts = truckDao.statisticsAll(params);
+            //新增客户经理权限过滤
+            List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    return new ArrayList<>();
+                }
+                authEntIdList.addAll(ids);
+            }
+            List<KwfTableTopCount> counts = truckDao.statisticsAll(params,authEntIdList);
             return counts;
         } else {
             Object keywords = params.get("keywords");
@@ -271,7 +280,16 @@ public class KwfTruckService {
         int systemType = LoginUserHolder.getSystemType();
         /**统计数据**/
         if (systemType == SystemTypeEnum.MANAGE.getCode()) {
-            List<KwfTruckVo> counts = truckDao.findPageAll(params);
+            //新增客户经理权限过滤
+            List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    return new ArrayList<>();
+                }
+                authEntIdList.addAll(ids);
+            }
+            List<KwfTruckVo> counts = truckDao.findPageAll(params,authEntIdList);
             return counts;
         } else {
             Object keywords = params.get("keywords");
@@ -704,10 +722,12 @@ public class KwfTruckService {
      * @author zk
      * @date 2023/9/5
      **/
-    public List<KwfTruckMonitorVo> findTruck(Map params){
+    public List<KwfTruckMonitorVo> findTruck(Map params) {
         long begTime = System.currentTimeMillis();
         /**车辆查询**/
-        Map queryParams = new HashMap<>(Global.NUMERICAL_SIXTEEN){{ put("truckNo", params.get("truckNo"));}};
+        Map queryParams = new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
+            put("truckNo", params.get("truckNo"));
+        }};
         List<KwfTruckMonitorVo> truckList = findTruckMonitor(queryParams);
         if (truckList == null || truckList.size() == 0) {
             return truckList;
@@ -716,29 +736,29 @@ public class KwfTruckService {
         /**数据配置**/
         List<Long> entIds = new ArrayList<>();
         List<String> truckNos = new ArrayList<>();
-        for (KwfTruckMonitorVo truck:truckList) {
+        for (KwfTruckMonitorVo truck : truckList) {
             entIds.add(truck.getEntId());
             truckNos.add(truck.getTruckNo());
         }
         long begTime1 = System.currentTimeMillis();
-        log.info("获取数据="+(begTime1 - begTime));
+        log.info("获取数据=" + (begTime1 - begTime));
         //企业数据集
         entIds = entIds.stream().distinct().collect(Collectors.toList());
         Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
         //车辆定位数据集
         Map<String, KwfTruckGpsVo> truckGpsMap = findTruckLocateHandle(truckNos);
         long begTime2 = System.currentTimeMillis();
-        log.info("获取GPS="+(begTime2 - begTime1));
+        log.info("获取GPS=" + (begTime2 - begTime1));
 
         /**数据组装**/
-        for (KwfTruckMonitorVo truck:truckList) {
+        for (KwfTruckMonitorVo truck : truckList) {
             EntCacheResDto ent = ents == null ? null : ents.get(truck.getEntId());
             KwfTruckGpsVo truckGps = truckGpsMap != null ? truckGpsMap.get(truck.getTruckNo()) : null;
             truck.setFirmName(ent != null ? ent.getFirmName() : null);
             truck.setRunStatus(truckGps != null ? truckGps.getRunStatus() : null);
         }
         long begTime3 = System.currentTimeMillis();
-        log.info("数据组装="+(begTime3 - begTime2));
+        log.info("数据组装=" + (begTime3 - begTime2));
         return truckList;
     }
 
@@ -751,7 +771,9 @@ public class KwfTruckService {
     public List<KwfTruckGpsVo> findTruckGps(List<String> truckNos) {
         /**车辆查询**/
         List<KwfTruckGpsVo> truckGpsList = new ArrayList<>();
-        Map<String, Object> queryParams = new HashMap<>(Global.NUMERICAL_SIXTEEN){{ put("truckNos", truckNos);}};
+        Map<String, Object> queryParams = new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
+            put("truckNos", truckNos);
+        }};
         List<KwfTruckMonitorVo> truckList = findTruckMonitor(queryParams);
         if (truckList == null || truckList.size() == 0) {
             return truckGpsList;
@@ -761,7 +783,7 @@ public class KwfTruckService {
         Map<String, KwfTruckGpsVo> truckGpsMap = findTruckLocateHandle(truckNos);
 
         /**数据组装**/
-        for (KwfTruckMonitorVo truck:truckList) {
+        for (KwfTruckMonitorVo truck : truckList) {
             KwfTruckGpsVo truckGps = truckGpsMap != null ? truckGpsMap.get(truck.getTruckNo()) : null;
             if (truckGps == null) {
                 continue;
@@ -807,14 +829,14 @@ public class KwfTruckService {
         //运营端+加客户经理数据过滤
         if (LoginUserHolder.getSystemType() == SystemTypeEnum.MANAGE.getCode()) {
             List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
-            if (CollectionUtils.isEmpty(authEntIdList)){
+            if (CollectionUtils.isEmpty(authEntIdList)) {
                 List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
-                if (CollectionUtils.isEmpty(ids)){
+                if (CollectionUtils.isEmpty(ids)) {
                     return new ArrayList<>();
                 }
                 authEntIdList.addAll(ids);
             }
-            return truckDao.findTruckByAll(params,authEntIdList);
+            return truckDao.findTruckByAll(params, authEntIdList);
         }
         return new ArrayList<>();
     }

+ 50 - 38
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml

@@ -10,31 +10,37 @@
         left join kwf_driver_license drl on drl.driver_id = dr.id and drl.del_flag = 0
         left join kwf_driver_qualification drq on drq.driver_id = dr.id and drq.del_flag = 0
         where dr.del_flag = 0
-        <if test="entId != null and entId != ''">
-            and dr.ent_id = #{entId, jdbcType=VARCHAR}
+        <if test="authEntIdList != null and authEntIdList.size() != 0">
+            and dr.ent_id in
+            <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
-        <if test="name != null and name != ''">
-            and dr.name = #{name, jdbcType=VARCHAR}
+        <if test="params.entId != null and params.entId != ''">
+            and dr.ent_id = #{params.entId, jdbcType=VARCHAR}
         </if>
-        <if test="idcard != null and idcard != ''">
-            and dr.idcard = #{idcard, jdbcType=VARCHAR}
+        <if test="params.name != null and params.name != ''">
+            and dr.name = #{params.name, jdbcType=VARCHAR}
         </if>
-        <if test="phone != null and phone != ''">
-            and dr.phone = #{phone, jdbcType=VARCHAR}
+        <if test="params.idcard != null and params.idcard != ''">
+            and dr.idcard = #{params.idcard, jdbcType=VARCHAR}
         </if>
-        <if test="licenseType != null and licenseType != ''">
-            and drl.type = #{licenseType, jdbcType=VARCHAR}
+        <if test="params.phone != null and params.phone != ''">
+            and dr.phone = #{params.phone, jdbcType=VARCHAR}
         </if>
-        <if test="startTime != null and startTime != '' " >
-            and DATE( dr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        <if test="params.licenseType != null and params.licenseType != ''">
+            and drl.type = #{params.licenseType, jdbcType=VARCHAR}
         </if>
-        <if test="endTime != null and endTime != '' " >
-            and DATE( dr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        <if test="params.startTime != null and params.startTime != '' " >
+            and DATE( dr.create_time) <![CDATA[ >= ]]> #{params.startTime,jdbcType=TIMESTAMP}
         </if>
-        <if test="keywords != null and keywords != ''">
+        <if test="params.endTime != null and params.endTime != '' " >
+            and DATE( dr.create_time ) <![CDATA[ <= ]]> #{params.endTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="params.keywords != null and params.keywords != ''">
             and (
-            dr.name like concat('%',#{keywords},'%')
-            or dr.phone like concat('%',#{keywords},'%')
+            dr.name like concat('%',#{params.keywords},'%')
+            or dr.phone like concat('%',#{params.keywords},'%')
             )
         </if>
         GROUP BY dr.`auth_status`
@@ -103,45 +109,51 @@
         left join kwf_driver_license drl on drl.driver_id = dr.id and drl.del_flag = 0
         left join kwf_driver_qualification drq on drq.driver_id = dr.id and drq.del_flag = 0
         where dr.del_flag = 0
-        <if test="entId != null and entId != ''">
-            and dr.ent_id = #{entId, jdbcType=VARCHAR}
+        <if test="authEntIdList != null and authEntIdList.size() != 0">
+            and dr.ent_id in
+            <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                #{item}
+            </foreach>
         </if>
-        <if test="name != null and name != ''">
-            and dr.name = #{name, jdbcType=VARCHAR}
+        <if test="params.entId != null and params.entId != ''">
+            and dr.ent_id = #{params.entId, jdbcType=VARCHAR}
         </if>
-        <if test="idcard != null and idcard != ''">
-            and dr.idcard = #{idcard, jdbcType=VARCHAR}
+        <if test="params.name != null and params.name != ''">
+            and dr.name = #{params.name, jdbcType=VARCHAR}
         </if>
-        <if test="phone != null and phone != ''">
-            and dr.phone = #{phone, jdbcType=VARCHAR}
+        <if test="params.idcard != null and params.idcard != ''">
+            and dr.idcard = #{params.idcard, jdbcType=VARCHAR}
         </if>
-        <if test="licenseType != null and licenseType != ''">
+        <if test="params.phone != null and params.phone != ''">
+            and dr.phone = #{params.phone, jdbcType=VARCHAR}
+        </if>
+        <if test="params.licenseType != null and params.licenseType != ''">
             and drl.type = #{licenseType, jdbcType=VARCHAR}
         </if>
-        <if test="status != null and status != ''">
+        <if test="sparams.tatus != null and params.status != ''">
             and dr.status = #{status, jdbcType=VARCHAR}
         </if>
-        <if test="authStatus != null and authStatus != '' and authStatus != 0">
-            and dr.auth_status = #{authStatus, jdbcType=VARCHAR}
+        <if test="params.authStatus != null and params.authStatus != '' and params.authStatus != 0">
+            and dr.auth_status = #{params.authStatus, jdbcType=VARCHAR}
         </if>
-        <if test="startTime != null and startTime != '' " >
-            and DATE( dr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        <if test="params.startTime != null and params.startTime != '' " >
+            and DATE( dr.create_time) <![CDATA[ >= ]]> #{params.startTime,jdbcType=TIMESTAMP}
         </if>
-        <if test="endTime != null and endTime != '' " >
-            and DATE( dr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        <if test="params.endTime != null and params.endTime != '' " >
+            and DATE( dr.create_time ) <![CDATA[ <= ]]> #{params.endTime,jdbcType=TIMESTAMP}
         </if>
         <choose>
-            <when test="ids != null and ids != '' and ids.size() > 0">
+            <when test="params.ids != null and params.ids != '' and params.ids.size() > 0">
                 and dr.id in
-                <foreach collection="ids" item="id" open="(" close=")" separator=",">
+                <foreach collection="params.ids" item="id" open="(" close=")" separator=",">
                     #{id,jdbcType=BIGINT}
                 </foreach>
             </when>
         </choose>
-        <if test="keywords != null and keywords != ''">
+        <if test="params.keywords != null and params.keywords != ''">
             and (
-            dr.name like concat('%',#{keywords},'%')
-            or dr.phone like concat('%',#{keywords},'%')
+            dr.name like concat('%',#{params.keywords},'%')
+            or dr.phone like concat('%',#{params.keywords},'%')
             )
         </if>
         ORDER BY dr.create_time desc

+ 52 - 40
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

@@ -9,33 +9,39 @@
         left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
         left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
         where tr.del_flag = 0
-        <if test="entId != null and entId != ''">
-            and tr.ent_id = #{entId, jdbcType=VARCHAR}
+        <if test="authEntIdList != null and authEntIdList.size() != 0">
+            and tr.ent_id in
+            <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                #{item}
+            </foreach>
         </if>
-        <if test="truckNo != null and truckNo != ''">
-            and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
+        <if test="params.entId != null and params.entId != ''">
+            and tr.ent_id = #{params.entId, jdbcType=VARCHAR}
         </if>
-        <if test="truckType != null and truckType != ''">
-            and tr.type = #{truckType, jdbcType=VARCHAR}
+        <if test="params.truckNo != null and params.truckNo != ''">
+            and tr.truck_no = #{params.truckNo, jdbcType=VARCHAR}
         </if>
-        <if test="energyType != null and energyType != ''">
-            and tr.energy_type = #{energyType, jdbcType=VARCHAR}
+        <if test="params.truckType != null and params.truckType != ''">
+            and tr.type = #{params.truckType, jdbcType=VARCHAR}
         </if>
-        <if test="useType != null and useType != ''">
-            and tr.use_type = #{useType, jdbcType=VARCHAR}
+        <if test="params.energyType != null and params.energyType != ''">
+            and tr.energy_type = #{params.energyType, jdbcType=VARCHAR}
         </if>
-        <if test="status != null and status != ''">
-            and tr.status = #{status, jdbcType=VARCHAR}
+        <if test="params.useType != null and params.useType != ''">
+            and tr.use_type = #{params.useType, jdbcType=VARCHAR}
         </if>
-        <if test="startTime != null and startTime != '' " >
-            and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        <if test="params.status != null and params.status != ''">
+            and tr.status = #{params.status, jdbcType=VARCHAR}
         </if>
-        <if test="endTime != null and endTime != '' " >
-            and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        <if test="params.tartTime != null and params.startTime != '' " >
+            and DATE( tr.create_time) <![CDATA[ >= ]]> #{params.startTime,jdbcType=TIMESTAMP}
         </if>
-        <if test="keywords != null and keywords != ''">
+        <if test="params.endTime != null and params.endTime != '' " >
+            and DATE( tr.create_time ) <![CDATA[ <= ]]> #{params.endTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="params.keywords != null and params.keywords != ''">
             and (
-            tr.truck_no like concat('%',#{keywords},'%')
+            tr.truck_no like concat('%',#{params.keywords},'%')
             )
         </if>
         GROUP BY tr.`auth_status`
@@ -117,44 +123,50 @@
         left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
         left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
         where tr.del_flag = 0
-        <if test="entId != null and entId != ''">
-            and tr.ent_id = #{entId, jdbcType=VARCHAR}
+        <if test="authEntIdList != null and authEntIdList.size() != 0">
+            and tr.ent_id in
+            <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
-        <if test="truckNo != null and truckNo != ''">
-            and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
+        <if test="params.entId != null and params.entId != ''">
+            and tr.ent_id = #{params.entId, jdbcType=VARCHAR}
         </if>
-        <if test="truckType != null and truckType != ''">
-            and tr.type = #{truckType, jdbcType=VARCHAR}
+        <if test="params.truckNo != null and params.truckNo != ''">
+            and tr.truck_no = #{params.truckNo, jdbcType=VARCHAR}
         </if>
-        <if test="energyType != null and energyType != ''">
-            and tr.energy_type = #{energyType, jdbcType=VARCHAR}
+        <if test="params.ruckType != null and params.truckType != ''">
+            and tr.type = #{params.truckType, jdbcType=VARCHAR}
         </if>
-        <if test="useType != null and useType != ''">
-            and tr.use_type = #{useType, jdbcType=VARCHAR}
+        <if test="params.energyType != null and params.energyType != ''">
+            and tr.energy_type = #{params.energyType, jdbcType=VARCHAR}
         </if>
-        <if test="status != null and status != ''">
-            and tr.status = #{status, jdbcType=VARCHAR}
+        <if test="params.useType != null and params.useType != ''">
+            and tr.use_type = #{params.useType, jdbcType=VARCHAR}
         </if>
-        <if test="authStatus != null and authStatus != '' and authStatus != 0">
-            and tr.auth_status = #{authStatus, jdbcType=VARCHAR}
+        <if test="params.status != null and params.status != ''">
+            and tr.status = #{params.status, jdbcType=VARCHAR}
         </if>
-        <if test="startTime != null and startTime != '' " >
-            and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        <if test="params.authStatus != null and params.authStatus != '' and params.authStatus != 0">
+            and tr.auth_status = #{params.authStatus, jdbcType=VARCHAR}
         </if>
-        <if test="endTime != null and endTime != '' " >
-            and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        <if test="params.startTime != null and params.startTime != '' " >
+            and DATE( tr.create_time) <![CDATA[ >= ]]> #{params.startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="params.endTime != null and params.endTime != '' " >
+            and DATE( tr.create_time ) <![CDATA[ <= ]]> #{params.endTime,jdbcType=TIMESTAMP}
         </if>
         <choose>
-            <when test="ids != null and ids != '' and ids.size() > 0">
+            <when test="params.ids != null and params.ids != '' and params.ids.size() > 0">
                 and tr.id in
-                <foreach collection="ids" item="id" open="(" close=")" separator=",">
+                <foreach collection="params.ids" item="id" open="(" close=")" separator=",">
                     #{id,jdbcType=BIGINT}
                 </foreach>
             </when>
         </choose>
-        <if test="keywords != null and keywords != ''">
+        <if test="params.keywords != null and params.keywords != ''">
             and (
-            tr.truck_no like concat('%',#{keywords},'%')
+            tr.truck_no like concat('%',#{params.keywords},'%')
             )
         </if>
         ORDER BY tr.create_time desc

+ 18 - 12
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java

@@ -84,13 +84,16 @@ public class KwmAddressService {
         PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
 
         //新增客户经理权限过滤
-        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
-        if (CollectionUtils.isEmpty(authEntIdList)) {
-            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
-            if (CollectionUtils.isEmpty(ids)) {
-                PageHelperUtil.getPageResult(new PageInfo<KwmAddress>(), new ArrayList<>(), reqVo.getPageSize());
+        List<Long> authEntIdList = new ArrayList<>();
+        if (SystemTypeEnum.MANAGE.getCode().equals(String.valueOf(LoginUserHolder.getSystemType()))) {
+            authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    PageHelperUtil.getPageResult(new PageInfo<KwmAddress>(), new ArrayList<>(), reqVo.getPageSize());
+                }
+                authEntIdList.addAll(ids);
             }
-            authEntIdList.addAll(ids);
         }
 
         List<KwmAddress> kwmAddressList = findList(reqVo,authEntIdList);
@@ -400,13 +403,16 @@ public class KwmAddressService {
     public void export(AddressQueryReqVo reqVo, HttpServletResponse response) {
 
         //新增客户经理权限过滤
-        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
-        if (CollectionUtils.isEmpty(authEntIdList)) {
-            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
-            if (CollectionUtils.isEmpty(ids)) {
-                PageHelperUtil.getPageResult(new PageInfo<KwmAddress>(), new ArrayList<>(), reqVo.getPageSize());
+        List<Long> authEntIdList = new ArrayList<>();
+        if (SystemTypeEnum.MANAGE.getCode().equals(String.valueOf(LoginUserHolder.getSystemType()))) {
+            authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    PageHelperUtil.getPageResult(new PageInfo<KwmAddress>(), new ArrayList<>(), reqVo.getPageSize());
+                }
+                authEntIdList.addAll(ids);
             }
-            authEntIdList.addAll(ids);
         }
         List<KwmAddress> kwmAddressList = findList(reqVo,authEntIdList);
         if (CollectionUtils.isEmpty(kwmAddressList)) {

+ 1 - 1
sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwoTradeOrderMapper.java

@@ -35,7 +35,7 @@ public interface KwoTradeOrderMapper extends BaseMapper<KwoTradeOrder> {
      * @Param topEntId:
      * @return: java.util.List<com.sckw.order.api.model.TradeOrderCountStatisticsDTO>
      */
-    List<TradeOrderCountStatisticsDTO> getOrderNumByTopEntId(@Param("topEntId") Long topEntId);
+    List<TradeOrderCountStatisticsDTO> getOrderNumByTopEntId(@Param("topEntId") Long topEntId, @Param("enterpriseIds") List<Long> enterpriseIds);
 
     /**
      * @desc: 工作台贸易订单表格统计

+ 4 - 4
sckw-modules/sckw-order/src/main/java/com/sckw/order/dubbo/TradeOrderStatisticsServiceImpl.java

@@ -4,16 +4,15 @@ import com.sckw.core.model.constant.Global;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.order.api.dubbo.TradeOrderStatisticsService;
 import com.sckw.order.api.model.TradeOrderCountStatisticsDTO;
-import com.sckw.order.enums.OrderTypeEnum;
 import com.sckw.order.serivce.KwoTradeOrderService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboService;
 
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @desc: 贸易订单统计dubbo接口实现
@@ -28,11 +27,12 @@ public class TradeOrderStatisticsServiceImpl implements TradeOrderStatisticsServ
     private final KwoTradeOrderService kwoTradeOrderService;
 
     @Override
-    public Map<Integer, Integer> getOrderNumByTopEntId(Long topEntId) {
+    public Map<Integer, Integer> getOrderNumByTopEntId(Long topEntId,List<Long> enterpriseIds) {
+        enterpriseIds=enterpriseIds.stream().distinct().collect(Collectors.toList());
         Map<Integer, Integer> map = new HashMap<>(Global.NUMERICAL_FOUR);
         map.put(Global.NUMERICAL_ONE, Global.NUMERICAL_ZERO);
         map.put(Global.NUMERICAL_TWO, Global.NUMERICAL_ZERO);
-        List<TradeOrderCountStatisticsDTO> list = kwoTradeOrderService.getOrderNumByTopEntId(topEntId);
+        List<TradeOrderCountStatisticsDTO> list = kwoTradeOrderService.getOrderNumByTopEntId(topEntId,enterpriseIds);
         if (CollectionUtils.isEmpty(list)) {
             return map;
         }

+ 2 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -1365,8 +1365,8 @@ public class KwoTradeOrderService {
      * @Param topEntId:
      * @return: java.util.List<com.sckw.order.api.model.TradeOrderCountStatisticsDTO>
      */
-    public List<TradeOrderCountStatisticsDTO> getOrderNumByTopEntId(Long topEntId) {
-        return kwoTradeOrderMapper.getOrderNumByTopEntId(topEntId);
+    public List<TradeOrderCountStatisticsDTO> getOrderNumByTopEntId(Long topEntId,List<Long> enterpriseIds) {
+        return kwoTradeOrderMapper.getOrderNumByTopEntId(topEntId,enterpriseIds);
     }
 
     /**

+ 95 - 4
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java

@@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.pagehelper.PageInfo;
 import com.google.common.collect.Lists;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.SystemTypeEnum;
+import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.model.vo.TableBottom;
 import com.sckw.core.model.vo.TableStatisticRes;
@@ -29,6 +31,7 @@ import com.sckw.order.model.vo.res.TransportDemandDetailRes;
 import com.sckw.order.model.vo.res.TransportDemandListRes;
 import com.sckw.order.model.vo.res.TransportDemandSquaresListRes;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import lombok.RequiredArgsConstructor;
@@ -54,6 +57,9 @@ public class KwoTransportDemandService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteUserService remoteUserService;
+
 
     /**
      * @desc: 添加草稿
@@ -217,7 +223,28 @@ public class KwoTransportDemandService {
      * @return: com.sckw.core.model.page.PageResult
      */
     public PageResult select(SelectTransportDemandParam param) {
-        LambdaQueryWrapper<KwoTransportDemand> wrapper = buildWrapper(BeanUtils.copyProperties(param, ExportTransportDemandParam.class));
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = new ArrayList<>();
+        if (SystemTypeEnum.MANAGE.getCode() == LoginUserHolder.getSystemType()) {
+
+            authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    return PageHelperUtil.getPageResult(new PageInfo<>());
+                }
+                authEntIdList.addAll(ids);
+            }
+        } else {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                return PageHelperUtil.getPageResult(new PageInfo<>());
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        LambdaQueryWrapper<KwoTransportDemand> wrapper = buildWrapper(BeanUtils.copyProperties(param, ExportTransportDemandParam.class), authEntIdList);
         IPage<KwoTransportDemand> page = new Page<>(param.getPage(), param.getPageSize());
         IPage<KwoTransportDemand> demandPage = kwoTransportDemandMapper.selectPage(page, wrapper);
         List<KwoTransportDemand> list = demandPage.getRecords();
@@ -271,8 +298,14 @@ public class KwoTransportDemandService {
      * @Param param:
      * @return: com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.sckw.order.model.KwoTransportDemand>
      */
-    private LambdaQueryWrapper<KwoTransportDemand> buildWrapper(ExportTransportDemandParam param) {
+    private LambdaQueryWrapper<KwoTransportDemand> buildWrapper(ExportTransportDemandParam param, List<Long> authEntIdList) {
         LambdaQueryWrapper<KwoTransportDemand> wrapper = new LambdaQueryWrapper<>();
+
+        if (authEntIdList.size() > 0) {
+            authEntIdList = authEntIdList.stream().distinct().collect(Collectors.toList());
+            wrapper.in(KwoTransportDemand::getEntId, authEntIdList);
+        }
+
         wrapper.eq(KwoTransportDemand::getDelFlag, Global.NO);
         if (!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode())) {
             wrapper.eq(KwoTransportDemand::getEntId, LoginUserHolder.getEntId());
@@ -322,7 +355,27 @@ public class KwoTransportDemandService {
      */
     public TableStatisticRes statistic(StatisticTransportDemandParam param) {
         TableStatisticRes res = new TableStatisticRes();
-        LambdaQueryWrapper<KwoTransportDemand> wrapper = buildWrapper(BeanUtils.copyProperties(param, ExportTransportDemandParam.class));
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = new ArrayList<>();
+        if (SystemTypeEnum.MANAGE.getCode() == LoginUserHolder.getSystemType()) {
+            authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    return getDefaultStatistic(res);
+                }
+                authEntIdList.addAll(ids);
+            }
+        } else {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                return getDefaultStatistic(res);
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        LambdaQueryWrapper<KwoTransportDemand> wrapper = buildWrapper(BeanUtils.copyProperties(param, ExportTransportDemandParam.class), authEntIdList);
         List<KwoTransportDemand> demands = kwoTransportDemandMapper.selectList(wrapper);
         Map<Integer, List<KwoTransportDemand>> map = demands.stream().collect(Collectors.groupingBy(KwoTransportDemand::getStatus));
 
@@ -352,6 +405,25 @@ public class KwoTransportDemandService {
         return res;
     }
 
+    private TableStatisticRes getDefaultStatistic(TableStatisticRes res) {
+        List<TableTop> tableTops = new ArrayList<>();
+        TableTop all = new TableTop();
+        all.setName("全部").setTotal(0);
+        tableTops.add(all);
+        List<TransportDemandStatusEnum> enums = TransportDemandStatusEnum.getSortList();
+        enums.forEach(e -> {
+            Integer value = e.getCode();
+            int total = 0;
+            TableTop tableTop = new TableTop();
+            tableTop.setName(e.getMsg()).setValue(value).setTotal(total);
+            tableTops.add(tableTop);
+        });
+        TableBottom tableBottom = new TableBottom();
+        tableBottom.setTotal(0);
+        res.setTableTops(tableTops).setTableBottom(tableBottom);
+        return res;
+    }
+
     /**
      * @desc: 运需导出
      * @author: yzc
@@ -360,7 +432,26 @@ public class KwoTransportDemandService {
      * @return: java.util.List<com.sckw.order.model.dto.TransportDemandExport>
      */
     public List<TransportDemandExport> export(ExportTransportDemandParam param) {
-        LambdaQueryWrapper<KwoTransportDemand> wrapper = buildWrapper(param);
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = new ArrayList<>();
+        if (SystemTypeEnum.MANAGE.getCode() == LoginUserHolder.getSystemType()) {
+
+            authEntIdList = LoginUserHolder.getAuthEntIdList();
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    return new ArrayList<>();
+                }
+                authEntIdList.addAll(ids);
+            }
+        } else {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                return new ArrayList<>();
+            }
+            authEntIdList.addAll(ids);
+        }
+        LambdaQueryWrapper<KwoTransportDemand> wrapper = buildWrapper(param, authEntIdList);
         List<KwoTransportDemand> demands = kwoTransportDemandMapper.selectList(wrapper);
         if (CollectionUtils.isEmpty(demands)) {
             return Collections.emptyList();

+ 6 - 0
sckw-modules/sckw-order/src/main/resources/mapper/KwoTradeOrderMapper.xml

@@ -20,6 +20,12 @@
             <if test="topEntId != null ">
                 and u.top_ent_id = #{topEntId}
             </if>
+            <if test="enterpriseIds != null and enterpriseIds.size() != 0">
+                and o.ent_id in
+                <foreach collection="enterpriseIds" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         GROUP BY u.unit_type
     </select>

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerLogisticsMapper.java

@@ -132,7 +132,7 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @param entId 顶级企业id
      * @return
      */
-    LedgerSize countSize(@Param("entId") Long entId);
+    LedgerSize countSize(@Param("entId") Long entId, @Param("enterpriseIds") List<Long> enterpriseIds);
 
     /**
      * 列表导出

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerTradeMapper.java

@@ -95,7 +95,7 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
      */
     List<String> selectJoin(@Param("entId") Long entId, @Param("entTarget") Long entTarget);
 
-    LedgerSize countSize(@Param("entId") Long entId);
+    LedgerSize countSize(@Param("entId") Long entId, @Param("enterpriseIds") List<Long> enterpriseIds);
 
     /**
      * 运营端通过ids查询,导出数据

+ 5 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dubbo/PaymentDubboServiceImpl.java

@@ -26,6 +26,7 @@ import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.time.LocalDateTime;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author xucaiqin
@@ -123,9 +124,10 @@ public class PaymentDubboServiceImpl implements PaymentDubboService {
     }
 
     @Override
-    public LedgerCount countLedger(Long entId) {
-        LedgerSize count = ledgerLogisticsService.count(entId);
-        LedgerSize ledgerSize = kwpLedgerTradeService.count(entId);
+    public LedgerCount countLedger(Long entId,List<Long> enterpriseIds) {
+        enterpriseIds = enterpriseIds.stream().distinct().collect(Collectors.toList());
+        LedgerSize count = ledgerLogisticsService.count(entId,enterpriseIds);
+        LedgerSize ledgerSize = kwpLedgerTradeService.count(entId,enterpriseIds);
         return new LedgerCount(ledgerSize.send(), ledgerSize.receive(), count.send(), count.receive());
     }
 

+ 2 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -814,8 +814,8 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         return logisticsMapper.selectJoin(entId, entTarget);
     }
 
-    public LedgerSize count(Long entId) {
-        return logisticsMapper.countSize(entId);
+    public LedgerSize count(Long entId,List<Long> enterpriseIds) {
+        return logisticsMapper.countSize(entId,enterpriseIds);
     }
 
     public List<LedgerLogisticsDto> exportList(LogisticsReq logisticsReq, List<Long> idList) {

+ 3 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java

@@ -918,8 +918,9 @@ public class KwpLedgerTradeService extends AbsLedger {
         tradeMapper.updatePrice(id, totalPrice);
     }
 
-    public LedgerSize count(Long entId) {
-        return tradeMapper.countSize(entId);
+    public LedgerSize count(Long entId,List<Long> enterpriseIds) {
+        enterpriseIds=enterpriseIds.stream().distinct().collect(Collectors.toList());
+        return tradeMapper.countSize(entId,enterpriseIds);
     }
 
     public List<LedgerTradeDto> exportList(TradeReq tradeReq, List<Long> idList) {

+ 6 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml

@@ -699,6 +699,12 @@
             kll.del_flag = 0
               and kll.status != 1
               and kllu.top_ent_id = #{entId,jdbcType=BIGINT}
+            <if test="enterpriseIds != null and enterpriseIds.size() != 0">
+                and kll.ent_id in
+                <foreach collection="enterpriseIds" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 

+ 6 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml

@@ -826,6 +826,12 @@
             klt.del_flag = 0
               and klt.status != 1
               and kltu.top_ent_id = #{entId,jdbcType=BIGINT}
+            <if test="enterpriseIds != null and enterpriseIds.size() != 0">
+                and klt.ent_id in
+                <foreach collection="enterpriseIds" separator="," close=")" open="(" item="item">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 

+ 14 - 9
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwWorkService.java

@@ -5,14 +5,13 @@ import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.CooperateTypeEnum;
 import com.sckw.core.model.enums.EntTypeEnum;
 import com.sckw.core.model.enums.SystemTypeEnum;
-import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.order.api.dubbo.TradeOrderStatisticsService;
-import com.sckw.order.api.model.TradeOrderCountStatisticsDTO;
 import com.sckw.payment.api.dubbo.PaymentDubboService;
 import com.sckw.payment.api.model.dto.LedgerCount;
 import com.sckw.report.service.vo.QueryBusinessStatisticsResVo;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.transport.api.dubbo.TransportStatisticsService;
 import lombok.extern.slf4j.Slf4j;
@@ -20,7 +19,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * @author czh
@@ -46,6 +44,9 @@ public class KwWorkService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteUserService remoteUserService;
+
 
     /**
      * @return QueryBusinessStatisticsResVo
@@ -57,7 +58,7 @@ public class KwWorkService {
         boolean isSystem = LoginUserHolder.getSystemType().equals(SystemTypeEnum.MANAGE.getCode());
         Long entId = null;
         String entTypes = "";
-
+        List<Long> enterpriseIds = new ArrayList<>();
         if (!isSystem) {
             EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(LoginUserHolder.getEntId());
             if (Objects.isNull(entCacheResDto)) {
@@ -65,6 +66,10 @@ public class KwWorkService {
             }
             entId = entCacheResDto.getId();
             entTypes = entCacheResDto.getEntTypes();
+            Long userId = LoginUserHolder.getUserId();
+            enterpriseIds = remoteUserService.findEnterpriseIds(userId);
+        }else {
+            enterpriseIds = remoteUserService.findAllEnterprise();
         }
         //承运
         boolean hasCarrier = entTypes.contains(String.valueOf(EntTypeEnum.LOGISTICS4.getCode())) || entTypes.contains(String.valueOf(EntTypeEnum.LOGISTICS3.getCode()));
@@ -77,7 +82,7 @@ public class KwWorkService {
 
         List<QueryBusinessStatisticsResVo> list = new ArrayList<>();
         //合同部分
-        Map<Integer, Integer> contractMap = remoteContractService.queryContractValidCount(entId);
+        Map<Integer, Integer> contractMap = remoteContractService.queryContractValidCount(entId,enterpriseIds);
         if (hasPurchase || isSystem) {
             QueryBusinessStatisticsResVo queryBusinessStatisticsResVo = new QueryBusinessStatisticsResVo();
             queryBusinessStatisticsResVo.setType("采购合同");
@@ -107,7 +112,7 @@ public class KwWorkService {
         }
 
         //订单部分
-        Map<Integer, Integer> orderNumByTopEntId = tradeOrderStatisticsService.getOrderNumByTopEntId(entId);
+        Map<Integer, Integer> orderNumByTopEntId = tradeOrderStatisticsService.getOrderNumByTopEntId(entId,enterpriseIds);
         if (hasSupplier || isSystem) {
             QueryBusinessStatisticsResVo queryBusinessStatisticsResVo = new QueryBusinessStatisticsResVo();
             queryBusinessStatisticsResVo.setType("销售订单");
@@ -123,7 +128,7 @@ public class KwWorkService {
         }
 
         //承运订单
-        Integer integer = transportStatisticsService.statisticsLogistics(entId);
+        Integer integer = transportStatisticsService.statisticsLogistics(entId,enterpriseIds);
         if (hasCarrier || isSystem) {
             QueryBusinessStatisticsResVo queryBusinessStatisticsResVo = new QueryBusinessStatisticsResVo();
             queryBusinessStatisticsResVo.setType("承运订单");
@@ -132,7 +137,7 @@ public class KwWorkService {
         }
 
         //托运订单
-        Integer integer1 = transportStatisticsService.statisticsLogisticsByConsign(entId);
+        Integer integer1 = transportStatisticsService.statisticsLogisticsByConsign(entId,enterpriseIds);
         if (hasCheck || isSystem) {
             QueryBusinessStatisticsResVo queryBusinessStatisticsResVo = new QueryBusinessStatisticsResVo();
             queryBusinessStatisticsResVo.setType("托运订单");
@@ -140,7 +145,7 @@ public class KwWorkService {
             list.add(queryBusinessStatisticsResVo);
         }
 
-        LedgerCount ledgerCount = paymentDubboService.countLedger(entId);
+        LedgerCount ledgerCount = paymentDubboService.countLedger(entId,enterpriseIds);
         if (hasSupplier || isSystem) {
             QueryBusinessStatisticsResVo queryBusinessStatisticsResVo = new QueryBusinessStatisticsResVo();
             queryBusinessStatisticsResVo.setType("销售对账");

+ 2 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java

@@ -368,7 +368,8 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
 
     List<Long> statisticsLogistics(@Param("topEntId") Long topEntId);
 
-    Integer statisticsLogisticsByTopEntIdAndOrderStatus(@Param("topEntId") Long topEntId, @Param("orderList") List<Integer> orderList,@Param("unitType") String unitType);
+    Integer statisticsLogisticsByTopEntIdAndOrderStatus(@Param("topEntId") Long topEntId, @Param("orderList") List<Integer> orderList,
+                                                        @Param("unitType") String unitType, @Param("enterpriseIds") List<Long> enterpriseIds);
 
     /**
      * @param statusList 单据状态集合

+ 7 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dubbo/TransportStatisticsServiceImpl.java

@@ -14,6 +14,7 @@ import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author lfdc
@@ -91,7 +92,8 @@ public class TransportStatisticsServiceImpl implements TransportStatisticsServic
      * @return
      */
     @Override
-    public Integer statisticsLogistics(Long topEntId) {
+    public Integer statisticsLogistics(Long topEntId,List<Long> enterpriseIds) {
+        enterpriseIds=enterpriseIds.stream().distinct().collect(Collectors.toList());
         //统计维度
         List<Integer> orderList = new ArrayList<>();
         orderList.add(LogisticsOrderEnum.WAIT_DELIVERY.getCode());
@@ -99,7 +101,7 @@ public class TransportStatisticsServiceImpl implements TransportStatisticsServic
         orderList.add(LogisticsOrderEnum.HAVE_FINISHED.getCode());
         orderList.add(LogisticsOrderEnum.HAVE_RECONCILED.getCode());
         orderList.add(LogisticsOrderEnum.HAVE_ALREADY_SETTLED.getCode());
-        Integer count = logisticsOrderMapper.statisticsLogisticsByTopEntIdAndOrderStatus(topEntId, orderList,"2");
+        Integer count = logisticsOrderMapper.statisticsLogisticsByTopEntIdAndOrderStatus(topEntId, orderList,"2",enterpriseIds);
         return count;
     }
 
@@ -110,7 +112,8 @@ public class TransportStatisticsServiceImpl implements TransportStatisticsServic
      * @return
      */
     @Override
-    public Integer statisticsLogisticsByConsign(Long topEntId) {
+    public Integer statisticsLogisticsByConsign(Long topEntId,List<Long> enterpriseIds) {
+        enterpriseIds=enterpriseIds.stream().distinct().collect(Collectors.toList());
         //统计维度
         List<Integer> orderList = new ArrayList<>();
         orderList.add(LogisticsOrderEnum.WAIT_DELIVERY.getCode());
@@ -118,7 +121,7 @@ public class TransportStatisticsServiceImpl implements TransportStatisticsServic
         orderList.add(LogisticsOrderEnum.HAVE_FINISHED.getCode());
         orderList.add(LogisticsOrderEnum.HAVE_RECONCILED.getCode());
         orderList.add(LogisticsOrderEnum.HAVE_ALREADY_SETTLED.getCode());
-        Integer count = logisticsOrderMapper.statisticsLogisticsByTopEntIdAndOrderStatus(topEntId, orderList,"1");
+        Integer count = logisticsOrderMapper.statisticsLogisticsByTopEntIdAndOrderStatus(topEntId, orderList,"1",enterpriseIds);
         return count;
     }
 }

+ 6 - 0
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -2039,6 +2039,12 @@
             AND (b.ent_id = #{topEntId} OR b.top_ent_id = #{topEntId})
         </if>
         AND b.unit_type = #{unitType}
+        <if test="enterpriseIds != null and enterpriseIds.size() != 0">
+            and a.ent_id in
+            <foreach collection="enterpriseIds" separator="," close=")" open="(" item="item">
+                #{item}
+            </foreach>
+        </if>
         And a.status in
         <foreach collection="orderList" open="(" close=")" separator="," item="item">
             #{item}