Selaa lähdekoodia

1.物流订单+客户经理过滤
2.运单列表+客户经理过滤
3.贸易对账+客户经理过滤
4.物流对账+客户经理过滤
5.贸易结算+客户经理过滤
6.物流结算+客户经理过滤
7.合作单位+客户经理过滤
8.商品档案+客户经理过滤

lengfaqiang 2 vuotta sitten
vanhempi
commit
173662ae56
32 muutettua tiedostoa jossa 1341 lisäystä ja 609 poistoa
  1. 4 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/RequestCheckFilter.java
  2. 30 0
      sckw-common/sckw-common-redis/src/main/java/com/sckw/redis/utils/RedissonUtils.java
  3. 7 1
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java
  4. 5 0
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/EntCacheResDto.java
  5. 25 0
      sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TransportController.java
  6. 1 1
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/dao/KwmCooperateMapper.java
  7. 30 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/QueryAllCooperateInfoResVo.java
  8. 18 13
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java
  9. 64 4
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java
  10. 6 0
      sckw-modules/sckw-manage/src/main/resources/mapper/KwmCooperateMapper.xml
  11. 2 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerLogisticsMapper.java
  12. 2 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerTradeMapper.java
  13. 7 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpSettlementLogisticsMapper.java
  14. 5 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpSettlementTradeMapper.java
  15. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/SettlementLogisticsSumVo.java
  16. 38 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/LedgerLogisticsService.java
  17. 38 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/LedgerTradeService.java
  18. 52 5
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/SettlementLogisticsService.java
  19. 50 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/SettlementTradeService.java
  20. 12 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml
  21. 12 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml
  22. 24 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementLogisticsMapper.xml
  23. 18 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementTradeMapper.xml
  24. 60 4
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/operation/GoodsManagerService.java
  25. 6 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java
  26. 24 4
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java
  27. 11 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java
  28. 13 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml
  29. 5 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java
  30. 63 7
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtManagementLogisticsOrderService.java
  31. 85 9
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtManagementWaybillOrderService.java
  32. 623 537
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

+ 4 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/filter/RequestCheckFilter.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.ClientTypeEnum;
 import com.sckw.core.model.enums.SystemTypeEnum;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.EncryUtil;
 import com.sckw.core.utils.NumberUtils;
 import com.sckw.core.utils.StringUtils;
@@ -136,7 +137,9 @@ public class RequestCheckFilter implements Filter {
             RSet<Object> set = RedissonUtils.getSet(managerKey);
             if (Objects.nonNull(set)){
                 List authUserIdList = JSONObject.parseObject(set.toString(), List.class);
-                loginUserInfo.setAuthEntIdList(authUserIdList);
+                if(CollectionUtils.isNotEmpty(authUserIdList)){
+                    loginUserInfo.setAuthEntIdList(authUserIdList);
+                }
             }
             LoginUserHolder.set(loginUserInfo);
             LoginEntHolder.set(loginEntInfo);

+ 30 - 0
sckw-common/sckw-common-redis/src/main/java/com/sckw/redis/utils/RedissonUtils.java

@@ -242,6 +242,36 @@ public class RedissonUtils {
         return set.addAll(list);
     }
 
+    /**
+     * 携带过期时间
+     * @param key
+     * @param list
+     * @param expired
+     * @return
+     * @param <T>
+     */
+    public static <T> boolean putSetSeconds(String key, List<T> list,long expired) {
+        log.debug("如果不存在则写入缓存【{}】 【{}】 【{}】开始", key, list, expired);
+        RSet<Object> set = redissonUtils.redissonClient.getSet(key);
+        set.expire(expired,TimeUnit.SECONDS);
+        return set.addAll(list);
+    }
+
+    /**
+     * 携带过期时间
+     * @param key
+     * @param list
+     * @param expired
+     * @return
+     * @param <T>
+     */
+    public static <T> boolean putSetHours(String key, List<T> list,long expired) {
+        log.debug("如果不存在则写入缓存【{}】 【{}】 【{}】开始", key, list, expired);
+        RSet<Object> set = redissonUtils.redissonClient.getSet(key);
+        set.expire(Duration.ofHours(expired));
+        return set.addAll(list);
+    }
+
     public static <T> boolean contains(String key, T value) {
         RSet<Object> set = redissonUtils.redissonClient.getSet(key);
         return set.isEmpty() ? Boolean.FALSE : set.contains(value);

+ 7 - 1
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java

@@ -1,6 +1,5 @@
 package com.sckw.system.api;
 
-import com.sckw.system.api.model.dto.res.REnterpriseVo;
 import com.sckw.system.api.model.dto.res.*;
 
 import java.util.List;
@@ -251,4 +250,11 @@ public interface RemoteSystemService {
      * @date 2023/12/14
      **/
     List<SpecialResVo> findSpecial();
+
+    /**
+     * 企业主键id查询数据库企业信息
+     * @param entIds 企业id查询数据库企业信息
+     * @return
+     */
+    Map<Long, KwsEnterpriseResDto> queryEnterpriseByEntIds(List<Long> entIds);
 }

+ 5 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/EntCacheResDto.java

@@ -134,4 +134,9 @@ public class EntCacheResDto implements Serializable {
      */
     private String special;
 
+    /**
+     * 专属客户经理(用户ID)
+     */
+    private Long manager;
+
 }

+ 25 - 0
sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TransportController.java

@@ -1,18 +1,23 @@
 package com.sckw.example.controller;
 
+import com.sckw.core.model.constant.Global;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.example.service.TransportService;
 import com.sckw.redis.config.RedisLockUtil;
+import com.sckw.redis.utils.RedissonUtils;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
+import org.redisson.api.RSet;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
+
 /**
  * @desc: 测试
  * @author: lfdc
@@ -82,6 +87,26 @@ public class TransportController {
 
     @RequestMapping(value = "/getRedissionDemo", method = RequestMethod.GET)
     public void getRedissionDemo() {
+        long l = System.currentTimeMillis();
+        RedissonUtils.putSet(String.valueOf(l),new ArrayList<Long>(){{add(789456L);add(456789L);add(123456789L);}});
+        RSet<Object> set = RedissonUtils.getSet(String.valueOf(l));
+        long l1 = System.currentTimeMillis();
+        RedissonUtils.put(String.valueOf(l1),new ArrayList<Long>(){{add(789456L);add(456789L);add(123456789L);}}, Global.APP_TOKEN_EXPIRE);
+        RSet<Object> set1 = RedissonUtils.getSet(String.valueOf(l1));
+
+        //redis  set方式
+        long l2 = System.currentTimeMillis();
+        RedissonUtils.putSet(String.valueOf(l2),new ArrayList<Long>(){{add(789456L);add(456789L);add(123456789L);}});
+        RSet<Object> set2 = RedissonUtils.getSet(String.valueOf(l2));
+
+        //redis  set方式 -带有时间
+        long l24 = System.currentTimeMillis();
+        long l241 = System.currentTimeMillis();
+        RedissonUtils.putSet(String.valueOf(l24),new ArrayList<Long>(){{add(789456L);add(456789L);add(123456789L);}});
+
+        RSet<Object> set24 = RedissonUtils.getSet(String.valueOf(l24));
+        RedissonUtils.putSetSeconds(String.valueOf(l241),new ArrayList<Long>(){{add(789456L);add(456789L);add(123456789L);}},Global.PC_BACKGROUND_TOKEN_EXPIRE);
+        RSet<Object> set241 = RedissonUtils.getSet(String.valueOf(l241));
         boolean b = redisLockUtil.tryLock("20231019A", 1);
         if (b) {
             System.out.println("获取到锁");

+ 1 - 1
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/dao/KwmCooperateMapper.java

@@ -64,7 +64,7 @@ public interface KwmCooperateMapper extends BaseMapper<KwmCooperate> {
      * @author: czh
      * @date: 2023/9/15
      */
-    List<CooperateManageQueryResDto> queryAllCooperateInfoList(@Param(value = "reqDto") QueryAllCooperateInfoReqDto reqDto);
+    List<CooperateManageQueryResDto> queryAllCooperateInfoList(@Param(value = "reqDto") QueryAllCooperateInfoReqDto reqDto, @Param("authEntIdList") List<Long> authEntIdList);
 }
 
 

+ 30 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/QueryAllCooperateInfoResVo.java

@@ -39,6 +39,21 @@ public class QueryAllCooperateInfoResVo implements Serializable {
      */
     private String inviterEntName;
 
+    /**
+     * 邀请单位客户经理id
+     */
+    private Long inviterEntUserId;
+
+    /**
+     * 邀请单位客户经理
+     */
+    private String inviterEntUserName;
+
+    /**
+     * 邀请单位客户经理
+     */
+    private String inviterEntUserPhone;
+
     /**
      * 受邀企业id
      */
@@ -49,6 +64,21 @@ public class QueryAllCooperateInfoResVo implements Serializable {
      */
     private String inviteeEntName;
 
+    /**
+     * 受邀单位客户经理id
+     */
+    private Long inviteeEntUserId;
+
+    /**
+     * 受邀单位客户经理
+     */
+    private String inviteeEntUserName;
+
+    /**
+     * 受邀经理电话
+     */
+    private String inviteeEntUserPhone;
+
     /**
      * 采购单位
      */

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

@@ -1,10 +1,5 @@
 package com.sckw.manage.service;
 
-import java.io.IOException;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -21,25 +16,19 @@ import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.StringUtils;
 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.manage.api.model.dto.res.EntAddressResDto;
 import com.sckw.manage.dao.KwmAddressMapper;
-import com.sckw.manage.dubbo.RemoteManageServiceImpl;
 import com.sckw.manage.model.entity.KwmAddress;
 import com.sckw.manage.model.report.AddressQueryExport;
 import com.sckw.manage.model.vo.req.*;
 import com.sckw.manage.model.vo.res.AddressDetailResVo;
 import com.sckw.manage.model.vo.res.AddressQueryResVo;
-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.AreaTreeFrontResDto;
 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;
-import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -48,6 +37,8 @@ import org.springframework.cloud.stream.function.StreamBridge;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.*;
+
 /**
  * @author czh
  * @desc 地址管理service
@@ -91,7 +82,18 @@ public class KwmAddressService {
         }
         reqVo.setCityCodeList(cityCodeList);
         PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
-        List<KwmAddress> kwmAddressList = findList(reqVo);
+
+        //新增客户经理权限过滤
+        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());
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        List<KwmAddress> kwmAddressList = findList(reqVo,authEntIdList);
         if (CollectionUtils.isEmpty(kwmAddressList)) {
             return PageHelperUtil.getPageResult(new PageInfo<>());
         }
@@ -106,8 +108,11 @@ public class KwmAddressService {
      * @author: czh
      * @date: 2023/7/12
      */
-    private List<KwmAddress> findList(AddressQueryReqVo reqVo) {
+    private List<KwmAddress> findList(AddressQueryReqVo reqVo,List<Long> authEntIdList ) {
         LambdaQueryWrapper<KwmAddress> wrapper = new LambdaQueryWrapper<>();
+        if (CollectionUtils.isNotEmpty(authEntIdList)){
+            wrapper.in(KwmAddress::getEntId,authEntIdList);
+        }
         wrapper.in(Objects.nonNull(reqVo.getCityCode()), KwmAddress::getCityCode, reqVo.getCityCodeList()).
                 eq(Objects.nonNull(reqVo.getType()), KwmAddress::getType, reqVo.getType()).
                 eq(KwmAddress::getDelFlag, Global.NO).

+ 64 - 4
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -36,6 +36,7 @@ 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.FindEntUserResDto;
+import com.sckw.system.api.model.dto.res.KwsEnterpriseResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import com.sckw.transport.api.dubbo.TransportService;
 import jakarta.servlet.http.HttpServletResponse;
@@ -164,7 +165,7 @@ public class KwmCooperateManageService {
         }
 
         List<FindEntUserResDto> entUser = remoteUserService.findEntUser(entId);
-        if(CollectionUtils.isEmpty(entUser)) {
+        if (CollectionUtils.isEmpty(entUser)) {
             cooperateManageQueryReqDto.setCurrentUserIdList(Collections.singletonList(LoginUserHolder.getUserId()));
         } else {
             cooperateManageQueryReqDto.setCurrentUserIdList(entUser.stream().map(FindEntUserResDto::getUserId).toList());
@@ -277,7 +278,7 @@ public class KwmCooperateManageService {
                 }
             }
         } catch (Exception e) {
-           log.error("合作关系恢复/解除消息出错:", e);
+            log.error("合作关系恢复/解除消息出错:", e);
         }
 
     }
@@ -723,7 +724,18 @@ public class KwmCooperateManageService {
      */
     public PageResult queryAllCooperateInfoByPage(CooperateManageQueryReqVo reqVo) {
         PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
-        List<CooperateManageQueryResDto> list = kwmCooperateMapper.queryAllCooperateInfoList(getQueryAllCooperateInfoReqDto(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<>(), new ArrayList<>(), reqVo.getPageSize());
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        List<CooperateManageQueryResDto> list = kwmCooperateMapper.queryAllCooperateInfoList(getQueryAllCooperateInfoReqDto(reqVo), authEntIdList);
         if (CollectionUtils.isEmpty(list)) {
             return PageHelperUtil.getPageResult(new PageInfo<>());
         }
@@ -767,6 +779,11 @@ public class KwmCooperateManageService {
         Map<Long, UserCacheResDto> userCacheResDtoMap = remoteSystemService.queryUserCacheMapByIds(userIds);
 
         List<QueryAllCooperateInfoResVo> result = new ArrayList<>();
+        //邀请客户经理id
+        List<Long> inviterEntUserIds = new ArrayList<>();
+        //受邀客户经理id
+        List<Long> inviteeEntUserIds = new ArrayList<>();
+        Map<Long, KwsEnterpriseResDto> mapList = remoteSystemService.queryEnterpriseByEntIds(allEntIds.stream().distinct().collect(Collectors.toList()));
         list.forEach(item -> {
             QueryAllCooperateInfoResVo queryAllCooperateInfoResVo = new QueryAllCooperateInfoResVo();
             queryAllCooperateInfoResVo.setStatus(item.getStatus());
@@ -793,8 +810,40 @@ public class KwmCooperateManageService {
             queryAllCooperateInfoResVo.setPhone(Objects.nonNull(userCacheResDto) ? userCacheResDto.getPhone() : "");
             queryAllCooperateInfoResVo.setUpdateTime(item.getUpdateTime());
             queryAllCooperateInfoResVo.setRemark(item.getRemark());
+
+            Long manager = mapList.get(item.getInviterEntId()) == null ? null : mapList.get(item.getInviterEntId()).getManager();
+            if (Objects.nonNull(manager)){
+                queryAllCooperateInfoResVo.setInviterEntUserId(manager);
+                inviterEntUserIds.add(manager);
+            }
+//            Long manager1 = entCacheResDto1.getManager();
+            Long manager1 = mapList.get(item.getInviterEntId()) == null ? null : mapList.get(item.getInviterEntId()).getManager();
+            if (Objects.nonNull(manager1)){
+                queryAllCooperateInfoResVo.setInviteeEntUserId(manager1);
+                inviteeEntUserIds.add(manager1);
+            }
             result.add(queryAllCooperateInfoResVo);
         });
+
+        List<Long> managerUserIds = new ArrayList<Long>() {{
+            addAll(inviterEntUserIds);
+            addAll(inviteeEntUserIds);
+        }}.stream().distinct().collect(Collectors.toList());
+        //客户经理查询
+        if (CollectionUtils.isNotEmpty(managerUserIds)){
+            Map<Long, UserCacheResDto> userCacheResMap = remoteSystemService.queryUserCacheMapByIds(managerUserIds);
+            result.forEach(item -> {
+                Long inviterEntUserId = item.getInviterEntUserId();
+                item.setInviterEntUserId(inviterEntUserId);
+                item.setInviterEntUserName(userCacheResMap.get(inviterEntUserId) == null ? null : userCacheResMap.get(inviterEntUserId).getName());
+                item.setInviterEntUserPhone(userCacheResMap.get(inviterEntUserId) == null ? null : userCacheResMap.get(inviterEntUserId).getPhone());
+
+                Long inviteeEntUserId = item.getInviteeEntUserId();
+                item.setInviteeEntUserId(inviteeEntUserId);
+                item.setInviteeEntUserName(userCacheResMap.get(inviteeEntUserId) == null ? null : userCacheResMap.get(inviteeEntUserId).getName());
+                item.setInviteeEntUserPhone(userCacheResMap.get(inviteeEntUserId) == null ? null : userCacheResMap.get(inviteeEntUserId).getPhone());
+            });
+        }
         return result;
     }
 
@@ -806,7 +855,18 @@ public class KwmCooperateManageService {
      * @date: 2023/7/11
      */
     public void exportAllCooperateInfo(CooperateManageQueryReqVo reqVo, HttpServletResponse response) {
-        List<CooperateManageQueryResDto> list = kwmCooperateMapper.queryAllCooperateInfoList(getQueryAllCooperateInfoReqDto(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<CooperateManageQueryResDto> list = kwmCooperateMapper.queryAllCooperateInfoList(getQueryAllCooperateInfoReqDto(reqVo), authEntIdList);
         if (CollectionUtils.isEmpty(list)) {
             throw new SystemException(HttpStatus.SUCCESS_CODE, "暂无数据,请确认!");
         }

+ 6 - 0
sckw-modules/sckw-manage/src/main/resources/mapper/KwmCooperateMapper.xml

@@ -278,6 +278,12 @@
           LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id and b.status = 1 and b.del_flag = 0
          WHERE a.del_flag = 0
            and a.status in (1,2)
+        <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="reqDto.cooperateTypes != null and reqDto.cooperateTypes.size() > 0">
             <foreach collection="reqDto.cooperateTypes" item="item">
                 and exists (select 1

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

@@ -38,7 +38,7 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @param logisticsReq
      * @return
      */
-    List<LedgerLogistics> list(@Param("logisticsReq") LogisticsReq logisticsReq);
+    List<LedgerLogistics> list(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 承运方 对账发起方,客户公司是托运方
@@ -79,7 +79,7 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @param logisticsReq
      * @return
      */
-    Map<String, Long> countOrder2(@Param("logisticsReq") LogisticsReq logisticsReq);
+    Map<String, Long> countOrder2(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     LedgerLogisticsDto selectId(@Param("id") Long id, @Param("unitType") Integer unitType);
 

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

@@ -31,7 +31,7 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
      * @param tradeReq
      * @return
      */
-    List<LedgerSell> list(@Param("tradeReq") TradeReq tradeReq);
+    List<LedgerSell> list(@Param("tradeReq") TradeReq tradeReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 采购方数据需要过滤已保存、已撤回状态的数据
@@ -60,7 +60,7 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
      * @param tradeReq
      * @return
      */
-    Map<String, Long> countOrder2(@Param("tradeReq") TradeReq tradeReq);
+    Map<String, Long> countOrder2(@Param("tradeReq") TradeReq tradeReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     LedgerTradeDto selectId(@Param("id") Long id, @Param("unitType") Integer unitType);
 

+ 7 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpSettlementLogisticsMapper.java

@@ -37,7 +37,7 @@ public interface KwpSettlementLogisticsMapper extends BaseMapper<KwpSettlementLo
      * @param settlementReq
      * @return
      */
-    List<SettlementLogistics> list(@Param("settlementReq") SettlementReq settlementReq);
+    List<SettlementLogistics> list(@Param("settlementReq") SettlementReq settlementReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 运费-物流订单各状态列表总数
@@ -47,7 +47,7 @@ public interface KwpSettlementLogisticsMapper extends BaseMapper<KwpSettlementLo
      */
     Long getCountList(@Param("settlementReq") SettlementReq settlementReq);
 
-    Map<String, Long> count(@Param("settlementReq") SettlementReq settlementReq);
+    Map<String, Long> count(@Param("settlementReq") SettlementReq settlementReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 运费-物流订单列表查询合计
@@ -63,7 +63,7 @@ public interface KwpSettlementLogisticsMapper extends BaseMapper<KwpSettlementLo
      * @param settlementReq
      * @return
      */
-    SettlementLogisticsSumVo sum(@Param("settlementReq") SettlementReq settlementReq);
+    SettlementLogisticsSumVo sum(@Param("settlementReq") SettlementReq settlementReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     /**
      * 运费-物流订单详情
@@ -88,7 +88,10 @@ public interface KwpSettlementLogisticsMapper extends BaseMapper<KwpSettlementLo
      * @param ids
      * @return
      */
-    List<SettlementLogistics> exportList(@Param("settlementReq") SettlementReq settlementReq, @Param("ids") List<Long> ids);
+    List<SettlementLogistics> exportList(@Param("settlementReq") SettlementReq settlementReq,
+                                         @Param("ids") List<Long> ids,
+                                         @Param("authEntIdList") List<Long> authEntIdList
+    );
 
     List<LedgerUnitDto> getListById(@Param("id") Long id);
 

+ 5 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpSettlementTradeMapper.java

@@ -31,7 +31,7 @@ public interface KwpSettlementTradeMapper extends BaseMapper<KwpSettlementTrade>
      * @param settlementReq
      * @return
      */
-    List<SettlementTrade> list(@Param("settlementReq") SettlementTradeReq settlementReq);
+    List<SettlementTrade> list(@Param("settlementReq") SettlementTradeReq settlementReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     SettlementSumVo sumMoney(@Param("settlementReq") SettlementTradeReq settlementReq);
 
@@ -51,7 +51,7 @@ public interface KwpSettlementTradeMapper extends BaseMapper<KwpSettlementTrade>
      * @param settlementReq
      * @return
      */
-    Map<String, Long> count(@Param("settlementReq") SettlementTradeReq settlementReq);
+    Map<String, Long> count(@Param("settlementReq") SettlementTradeReq settlementReq, @Param("authEntIdList") List<Long> authEntIdList);
 
     List<SettlementTradeDto> selectByIds(@Param("ids") List<Long> ids, @Param("unitType") Integer unitType);
 
@@ -96,5 +96,7 @@ public interface KwpSettlementTradeMapper extends BaseMapper<KwpSettlementTrade>
      * @param idList
      * @return
      */
-    List<SettlementTrade> operateExportList(@Param("settlementReq") SettlementTradeReq settlementReq, @Param("idList") List<Long> idList);
+    List<SettlementTrade> operateExportList(@Param("settlementReq") SettlementTradeReq settlementReq,
+                                            @Param("idList") List<Long> idList,
+                                            @Param("authEntIdList") List<Long> authEntIdList);
 }

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/SettlementLogisticsSumVo.java

@@ -30,6 +30,6 @@ public class SettlementLogisticsSumVo {
     /**
      * 合计
      */
-    public Long total;
+    public Long total=0L;
 
 }

+ 38 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/LedgerLogisticsService.java

@@ -4,10 +4,12 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringTimeUtil;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
 import com.sckw.payment.model.KwpLedgerLogistics;
 import com.sckw.payment.model.KwpLedgerLogisticsOrder;
@@ -21,6 +23,7 @@ import com.sckw.payment.model.vo.res.LedgerLogisticsDetailVo;
 import com.sckw.payment.service.AbsLedger;
 import com.sckw.payment.service.KwpLedgerLogisticsOrderService;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import com.sckw.transport.api.dubbo.TransportService;
@@ -49,6 +52,8 @@ public class LedgerLogisticsService extends AbsLedger {
     private RemoteSystemService remoteSystemService;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private TransportService transportDubboService;
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteUserService remoteUserService;
 
     private void changeDict(List<? extends ILedger> list) {
         List<SysDictResDto> taxRateDict = remoteSystemService.queryDictByType(DictTypeEnum.TAX_RATE.getType());
@@ -99,7 +104,18 @@ public class LedgerLogisticsService extends AbsLedger {
         if(!export){
             PageHelper.startPage(logisticsReq.getPage(), logisticsReq.getPageSize());
         }
-        List<LedgerLogistics> kwpLedgerLogisticsList = logisticsMapper.list(logisticsReq);
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)){
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                return new PageRes<>(new ArrayList<>());
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        List<LedgerLogistics> kwpLedgerLogisticsList = logisticsMapper.list(logisticsReq,authEntIdList);
         PageInfo<LedgerLogistics> ledgerShipperDtoPageInfo = new PageInfo<>(kwpLedgerLogisticsList);
         //字典转换
         if (!CollectionUtils.isEmpty(kwpLedgerLogisticsList)) {
@@ -129,10 +145,29 @@ public class LedgerLogisticsService extends AbsLedger {
      * @return 统计数据
      */
     public List<TableTop> orderCount(LogisticsReq logisticsReq) {
-        Map<String, Long> map = logisticsMapper.countOrder2(logisticsReq);
-        TableTop ledgerCountVo;
         /*统计数据转换*/
         List<TableTop> res = new ArrayList<>();
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)){
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                TableTop ledgerCountVo;
+                for (LedgerEnum value : LedgerEnum.values()) {
+                    ledgerCountVo = new TableTop();
+                    ledgerCountVo.setTotal(NumberConstant.ZERO);
+                    ledgerCountVo.setName(value.getDesc());
+                    ledgerCountVo.setValue(value.getStatus());
+                    res.add(ledgerCountVo);
+                }
+                return res;
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        Map<String, Long> map = logisticsMapper.countOrder2(logisticsReq,authEntIdList);
+        TableTop ledgerCountVo;
         for (LedgerEnum value : LedgerEnum.values()) {
             ledgerCountVo = new TableTop();
             ledgerCountVo.setTotal(Math.toIntExact(map.get(value.getLabel())));

+ 38 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/LedgerTradeService.java

@@ -5,11 +5,13 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringTimeUtil;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.order.api.model.*;
 import com.sckw.payment.dao.KwpLedgerTradeMapper;
@@ -26,6 +28,7 @@ import com.sckw.payment.model.vo.res.LedgerTradeDetailVo;
 import com.sckw.payment.service.AbsLedger;
 import com.sckw.payment.service.KwpLedgerTradeOrderService;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import lombok.RequiredArgsConstructor;
@@ -53,6 +56,8 @@ public class LedgerTradeService extends AbsLedger {
     private RemoteSystemService remoteSystemService;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private TradeOrderInfoService tradeOrderInfoService;
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteUserService remoteUserService;
 
     /**
      * 转换字典数据
@@ -106,13 +111,24 @@ public class LedgerTradeService extends AbsLedger {
      * @return
      */
     public PageRes<LedgerSell> list(TradeReq tradeReq) {
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)){
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                return new PageRes<>(new ArrayList<>());
+            }
+            authEntIdList.addAll(ids);
+        }
+
         fillPara(tradeReq);
         if (tradeReq.getPage() != 0 && tradeReq.getPageSize() != 0) {
             PageHelper.startPage(tradeReq.getPage(), tradeReq.getPageSize());
         }
         tradeReq.setUnitType(TradeUnitType.PURCHASE);
         tradeReq.setUnitTypeTwo(TradeUnitType.SELL);
-        List<LedgerSell> ledgerTradeDto = tradeMapper.list(tradeReq);
+        List<LedgerSell> ledgerTradeDto = tradeMapper.list(tradeReq,authEntIdList);
         //字典转换
         if (!CollectionUtils.isEmpty(ledgerTradeDto)) {
             changeDict(ledgerTradeDto);
@@ -128,9 +144,28 @@ public class LedgerTradeService extends AbsLedger {
      * @return
      */
     public List<TableTop> orderCount(TradeReq tradeReq) {
-        Map<String, Long> map = tradeMapper.countOrder2(tradeReq);
-        TableTop ledgerCountVo;
         List<TableTop> res = new ArrayList<>();
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)){
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                TableTop ledgerCountVo;
+                for (LedgerEnum value : LedgerEnum.values()) {
+                    ledgerCountVo = new TableTop();
+                    ledgerCountVo.setTotal(NumberConstant.ZERO);
+                    ledgerCountVo.setName(value.getDesc());
+                    ledgerCountVo.setValue(value.getStatus());
+                    res.add(ledgerCountVo);
+                }
+                return res;
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        Map<String, Long> map = tradeMapper.countOrder2(tradeReq,authEntIdList);
+        TableTop ledgerCountVo;
         for (LedgerEnum value : LedgerEnum.values()) {
             ledgerCountVo = new TableTop();
             ledgerCountVo.setTotal(Math.toIntExact(map.get(value.getLabel())));

+ 52 - 5
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/SettlementLogisticsService.java

@@ -4,9 +4,13 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.vo.TableTop;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringTimeUtil;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.payment.dao.KwpSettlementLogisticsMapper;
+import com.sckw.payment.model.constant.LedgerEnum;
 import com.sckw.payment.model.constant.LogisticsUnitType;
 import com.sckw.payment.model.constant.SettlementEnum;
 import com.sckw.payment.model.dto.ISettlement;
@@ -16,6 +20,7 @@ import com.sckw.payment.model.vo.res.SettlementLogisticsSumVo;
 import com.sckw.payment.utils.CommonValidator;
 import com.sckw.payment.utils.PageMoreRes;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import lombok.RequiredArgsConstructor;
@@ -34,6 +39,8 @@ import java.util.*;
 public class SettlementLogisticsService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteUserService remoteUserService;
     private final KwpSettlementLogisticsMapper settlementLogisticsMapper;
 
     /**
@@ -58,9 +65,27 @@ public class SettlementLogisticsService {
         settlementReq.setUnitType(LogisticsUnitType.SHIPPER);
         settlementReq.setUnitTypeTwo(LogisticsUnitType.CARRIER);
         validSettlementReq(settlementReq);
-
-        Map<String, Long> count = settlementLogisticsMapper.count(settlementReq);
         List<TableTop> res = new ArrayList<>(4);
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)){
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                TableTop ledgerCountVo;
+                for (LedgerEnum value : LedgerEnum.values()) {
+                    ledgerCountVo = new TableTop();
+                    ledgerCountVo.setTotal(NumberConstant.ZERO);
+                    ledgerCountVo.setName(value.getDesc());
+                    ledgerCountVo.setValue(value.getStatus());
+                    res.add(ledgerCountVo);
+                }
+                return res;
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        Map<String, Long> count = settlementLogisticsMapper.count(settlementReq,authEntIdList);
         for (SettlementEnum value : SettlementEnum.values()) {
             TableTop tableTop = new TableTop();
             tableTop.setName(value.getDesc());
@@ -84,10 +109,21 @@ public class SettlementLogisticsService {
         validSettlementReq(settlementReq);
         //添加默认分页数据
         PageHelper.startPage(settlementReq.getPage(), settlementReq.getPageSize());
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)){
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                return new PageMoreRes<>(new PageInfo<SettlementLogistics>(),new SettlementLogisticsSumVo());
+            }
+            authEntIdList.addAll(ids);
+        }
+
         //查询分页数据
-        List<SettlementLogistics> kwpLedgerLogisticsList = settlementLogisticsMapper.list(settlementReq);
+        List<SettlementLogistics> kwpLedgerLogisticsList = settlementLogisticsMapper.list(settlementReq,authEntIdList);
         //查询同样条件下的合计
-        SettlementLogisticsSumVo settlementLogisticsSum = settlementLogisticsMapper.sum(settlementReq);
+        SettlementLogisticsSumVo settlementLogisticsSum = settlementLogisticsMapper.sum(settlementReq,authEntIdList);
 
         // 对查询结果进行处理,转换 status 等状态值为对应中文描述
         return new PageMoreRes<>(getSettlementLogisticsDtoPageRes(kwpLedgerLogisticsList), settlementLogisticsSum);
@@ -96,7 +132,18 @@ public class SettlementLogisticsService {
 
     public List<SettlementLogistics> exportList(SettlementReq settlementReq) {
         validSettlementReq(settlementReq);
-        List<SettlementLogistics> settlementLogistics = settlementLogisticsMapper.exportList(settlementReq, settlementReq.getIdList());
+
+        //新增客户经理权限过滤
+        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<SettlementLogistics> settlementLogistics = settlementLogisticsMapper.exportList(settlementReq, settlementReq.getIdList(),authEntIdList);
         changeDict(settlementLogistics);
         for (SettlementLogistics tmp : settlementLogistics) {
             UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(tmp.getCreateBy());

+ 50 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/operate/SettlementTradeService.java

@@ -3,16 +3,20 @@ package com.sckw.payment.service.operate;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
+import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.payment.dao.KwpSettlementTradeMapper;
+import com.sckw.payment.model.constant.LedgerEnum;
 import com.sckw.payment.model.constant.SettlementEnum;
 import com.sckw.payment.model.dto.ISettlement;
 import com.sckw.payment.model.vo.SettlementTrade;
 import com.sckw.payment.model.vo.req.SettlementTradeReq;
 import com.sckw.payment.model.vo.res.SettlementSumVo;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import lombok.RequiredArgsConstructor;
@@ -36,6 +40,8 @@ public class SettlementTradeService {
     private final KwpSettlementTradeMapper settlementTradeMapper;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteUserService remoteUserService;
 
     /**
      * 字典转换
@@ -62,8 +68,19 @@ public class SettlementTradeService {
      * @return
      */
     public PageRes<SettlementTrade> list(SettlementTradeReq settlementReq) {
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)){
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                return new PageRes<>(new ArrayList<>());
+            }
+            authEntIdList.addAll(ids);
+        }
+
         PageHelper.startPage(settlementReq.getPage(), settlementReq.getPageSize());
-        List<SettlementTrade> kwpLedgerLogisticsList = settlementTradeMapper.list(settlementReq);
+        List<SettlementTrade> kwpLedgerLogisticsList = settlementTradeMapper.list(settlementReq,authEntIdList);
         PageInfo<SettlementTrade> settlementPageInfo = new PageInfo<>(kwpLedgerLogisticsList);
         if (!CollectionUtils.isEmpty(kwpLedgerLogisticsList)) {
             //根据企业类型转换对应的数据
@@ -86,8 +103,27 @@ public class SettlementTradeService {
      * @return
      */
     public List<TableTop> getCount(SettlementTradeReq settlementReq) {
-        Map<String, Long> stringIntegerMap = settlementTradeMapper.count(settlementReq);
         List<TableTop> res = new ArrayList<>(4);
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)){
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                TableTop ledgerCountVo;
+                for (LedgerEnum value : LedgerEnum.values()) {
+                    ledgerCountVo = new TableTop();
+                    ledgerCountVo.setTotal(NumberConstant.ZERO);
+                    ledgerCountVo.setName(value.getDesc());
+                    ledgerCountVo.setValue(value.getStatus());
+                    res.add(ledgerCountVo);
+                }
+                return res;
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        Map<String, Long> stringIntegerMap = settlementTradeMapper.count(settlementReq,authEntIdList);
         for (SettlementEnum value : SettlementEnum.values()) {
             TableTop tableTop = new TableTop();
             tableTop.setName(value.getDesc());
@@ -110,7 +146,18 @@ public class SettlementTradeService {
 
 
     public List<SettlementTrade> exportList(SettlementTradeReq settlementReq, List<Long> idList) {
-        List<SettlementTrade> settlementTradeDtos = settlementTradeMapper.operateExportList(settlementReq, idList);
+
+        //新增客户经理权限过滤
+        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<SettlementTrade> settlementTradeDtos = settlementTradeMapper.operateExportList(settlementReq, idList,authEntIdList);
         changeDict(settlementTradeDtos);
         for (SettlementTrade settlementTradeDto : settlementTradeDtos) {
             UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(settlementTradeDto.getCreateBy());

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

@@ -227,6 +227,12 @@
                                kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             kll.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and kll.ent_id in
+                <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
             <if test="logisticsReq.status != null">
                 and kll.status = #{logisticsReq.status}
             </if>
@@ -601,6 +607,12 @@
                             ON kll.id = kllu.l_ledger_id AND kllu.del_flag = 0
         <where>
             kll.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and kll.ent_id in
+                <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                    #{item}
+                </foreach>
+            </if>
             <if test="logisticsReq.trading != null">
                 AND kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
             </if>

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

@@ -223,6 +223,12 @@
                                                                                      #{tradeReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             klt.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and klt.ent_id in
+                <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+             </if>
             <if test="tradeReq.status != null">
                 and klt.status = #{tradeReq.status}
             </if>
@@ -654,6 +660,12 @@
                             on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
         <where>
             klt.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and klt.ent_id in
+                <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                    #{item}
+                </foreach>
+            </if>
             <if test="tradeReq.trading != null">
                 and klt.trading = #{tradeReq.trading,jdbcType=INTEGER}
             </if>

+ 24 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementLogisticsMapper.xml

@@ -193,6 +193,12 @@
                                 and lu2.unit_type = #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             s.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and s.ent_id in
+                <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                    #{item}
+                </foreach>
+            </if>
             <if test="settlementReq.status != null and settlementReq.status != 0">
                 and s.status = #{settlementReq.status}
             </if>
@@ -243,6 +249,12 @@
                                 and lu2.unit_type = #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             s.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and s.ent_id in
+                <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                    #{item}
+                </foreach>
+            </if>
             <if test="settlementReq.status != null and settlementReq.status != 0">
                 and s.status = #{settlementReq.status}
             </if>
@@ -294,6 +306,12 @@
             and lu2.unit_type = #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             ksl.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and ksl.ent_id in
+                <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
             <if test="settlementReq.status != null and settlementReq.status != 0">
                 and ksl.status = #{settlementReq.status}
             </if>
@@ -469,6 +487,12 @@
                                                                                         #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             s.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and s.ent_id in
+                <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                    #{item}
+                </foreach>
+            </if>
             <choose>
                 <when test="ids != null and ids.size() > 0">
                     and s.id in

+ 18 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementTradeMapper.xml

@@ -159,6 +159,12 @@
                                                            kltu2.unit_type = 1
         <where>
             kst.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and kst.ent_id in
+                <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
             <if test="settlementReq.keywords != null and settlementReq.keywords != ''">
                 and (
                             klt.name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
@@ -303,6 +309,12 @@
                                                            kltu2.unit_type = 1
         <where>
             kst.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and kst.ent_id in
+                <foreach collection="authEntIdList" separator="," close=")" open="(" item="item">
+                    #{item}
+                </foreach>
+            </if>
             <if test="settlementReq.keywords != null and settlementReq.keywords != ''">
                 and (
                             klt.name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
@@ -599,6 +611,12 @@
                                                            #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             kst.del_flag = 0
+            <if test="authEntIdList != null and authEntIdList.size() != 0">
+                and kst.ent_id in
+                <foreach collection="authEntIdList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
             <choose>
                 <when test="idList != null and idList.size() != 0">
                     and kst.id in

+ 60 - 4
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/operation/GoodsManagerService.java

@@ -11,6 +11,7 @@ import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.product.dao.KwpGoodsMapper;
 import com.sckw.product.enums.GoodsStatusEnum;
 import com.sckw.product.model.GoodsListExport;
@@ -66,7 +67,18 @@ public class GoodsManagerService {
      * @return: com.sckw.core.model.page.PageResult
      */
     public PageResult select(OperatorGoodsListQueryVO params) {
-        LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class));
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                PageResult.build(params.getPage(), params.getPageSize(), 0L, new ArrayList<>());
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class), authEntIdList);
         Page<KwpGoods> page = new Page<>(params.getPage(), params.getPageSize());
         IPage<KwpGoods> goodsIpage = kwpGoodsMapper.selectPage(page, wrapper);
         List<KwpGoods> list = goodsIpage.getRecords();
@@ -86,12 +98,16 @@ public class GoodsManagerService {
      * @Param list:
      * @return: java.util.List<com.sckw.product.model.vo.res.GoodsList>
      */
-    private LambdaQueryWrapper<KwpGoods> buildWrapper(OperatorGoodsListQueryDTO params) {
+    private LambdaQueryWrapper<KwpGoods> buildWrapper(OperatorGoodsListQueryDTO params, List<Long> authEntIdList) {
         LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
         if (StringUtils.isNotBlank(params.getIds())) {
             List<Long> ids = StringUtils.splitStrToList(params.getIds(), ",", Long.class);
             wrapper.in(KwpGoods::getId, ids);
         } else {
+            /**客户经理权限过滤*/
+            if (CollectionUtils.isNotEmpty(authEntIdList)) {
+                wrapper.in(KwpGoods::getEntId, authEntIdList);
+            }
             if (Objects.nonNull(params.getStartCreateTime())) {
                 wrapper.ge(KwpGoods::getCreateTime, params.getStartCreateTime());
             }
@@ -149,7 +165,18 @@ public class GoodsManagerService {
      */
     public TableStatisticRes statistic(OperatorGoodsStsQueryVO params) {
         TableStatisticRes res = new TableStatisticRes();
-        LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class));
+
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)) {
+                return getDefaultTops(res);
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class), authEntIdList);
         List<KwpGoods> goodsList = kwpGoodsMapper.selectList(wrapper);
         Map<Integer, List<KwpGoods>> map = goodsList.stream().collect(Collectors.groupingBy(KwpGoods::getStatus));
         List<TableTop> tableTops = new ArrayList<>();
@@ -171,6 +198,24 @@ public class GoodsManagerService {
         return res;
     }
 
+    private TableStatisticRes getDefaultTops(TableStatisticRes res) {
+        List<TableTop> tableTops = new ArrayList<>();
+        TableTop all = new TableTop();
+        all.setName("全部").setTotal(0);
+        tableTops.add(all);
+        List<GoodsStatusEnum> sortList = GoodsStatusEnum.getSortList();
+        sortList.remove(0);
+        sortList.forEach(e -> {
+            TableTop tableTop = new TableTop();
+            tableTop.setName(e.getMsg()).setValue(e.getCode()).setTotal(0);
+            tableTops.add(tableTop);
+        });
+        TableBottom tableBottom = new TableBottom();
+        tableBottom.setTotal(0);
+        res.setTableTops(tableTops).setTableBottom(tableBottom);
+        return res;
+    }
+
     /**
      * @desc: 导出
      * @author: lt
@@ -179,7 +224,18 @@ public class GoodsManagerService {
      * @return: void
      */
     public List<OperationGoodsListExport> export(OperatorGoodsExportQueryVO params) {
-        LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class));
+        //新增客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (StringUtils.isBlank(params.getIds())) {
+            if (CollectionUtils.isEmpty(authEntIdList)) {
+                List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+                if (CollectionUtils.isEmpty(ids)) {
+                    return new ArrayList<>();
+                }
+                authEntIdList.addAll(ids);
+            }
+        }
+        LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class), authEntIdList);
         List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
         if (CollectionUtils.isEmpty(list)) {
             return Collections.emptyList();

+ 6 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java

@@ -218,4 +218,10 @@ public interface KwsEnterpriseDao {
      */
     List<KwsEnterprise> findAllEnterprise();
 
+    /**
+     * 企业id获取企业信息
+     * @param entIds
+     * @return
+     */
+    List<KwsEnterprise> queryEnterpriseByEntIds(@Param("entIds") List<Long> entIds);
 }

+ 24 - 4
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteBaseService.java

@@ -4,7 +4,6 @@ import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
-import com.sckw.system.api.model.dto.res.REnterpriseVo;
 import com.sckw.system.api.model.dto.res.*;
 import com.sckw.system.api.model.pojo.DeptInfoPojo;
 import com.sckw.system.dao.KwsAuthorityDao;
@@ -21,6 +20,7 @@ import jakarta.annotation.Resource;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author czh
@@ -70,7 +70,7 @@ public class RemoteBaseService {
     }
 
     public KwsUserResDto getUserByAccount(String username) {
-        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN){{
+        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
             put("account", username);
         }};
         List<KwsUserResVo> list = kwsUserService.findList(params);
@@ -174,6 +174,7 @@ public class RemoteBaseService {
 
     /**
      * 根据用户姓名模糊查用户信息
+     *
      * @param name 用户姓名
      * @return list
      */
@@ -183,7 +184,7 @@ public class RemoteBaseService {
 
     /**
      * @param entId 企业ID
-     * @desc 企业详情(企业登录/司机登录)
+     * @desc 企业详情(企业登录 / 司机登录)
      * @author zk
      * @date 2023/8/10
      **/
@@ -199,7 +200,9 @@ public class RemoteBaseService {
      * @date: 2023/7/17
      */
     public EntCacheResDto queryEntByName(String entName) {
-        List<KwsEnterprise> ents = kwsEnterpriseService.findEnts(new HashMap<>(){{put("entName", entName);}});
+        List<KwsEnterprise> ents = kwsEnterpriseService.findEnts(new HashMap<>() {{
+            put("entName", entName);
+        }});
         if (CollectionUtils.isEmpty(ents)) {
             return null;
         }
@@ -266,4 +269,21 @@ public class RemoteBaseService {
         }
         return new ArrayList<>();
     }
+
+    public Map<Long, KwsEnterpriseResDto> queryEnterpriseByEntIds(List<Long> entIds) {
+        List<KwsEnterprise> enterpriseList = kwsEnterpriseDao.queryEnterpriseByEntIds(entIds);
+        List<KwsEnterpriseResDto> dtoList = new ArrayList<>();
+        Map<Long, KwsEnterpriseResDto> map = new HashMap<>();
+        if (enterpriseList.size() > 0) {
+            enterpriseList.forEach(enterprise -> {
+                KwsEnterpriseResDto dto = new KwsEnterpriseResDto();
+                org.springframework.beans.BeanUtils.copyProperties(enterprise, dto);
+                dtoList.add(dto);
+            });
+        }
+        if (dtoList.size() > 0) {
+            map = dtoList.stream().collect(Collectors.toMap(KwsEnterpriseResDto::getId, x -> x, (oldValue, newValue) -> newValue));
+        }
+        return map;
+    }
 }

+ 11 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -22,6 +22,7 @@ import com.sckw.system.service.SysAreaService;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.jetbrains.annotations.Nullable;
 import org.springframework.beans.factory.annotation.Autowired;
+
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -812,4 +813,14 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         return remoteBaseService.findSpecial();
     }
 
+    /**
+     * 企业主键id查询数据库企业信息
+     * @param entIds 企业id查询数据库企业信息
+     * @return
+     */
+    @Override
+    public Map<Long, KwsEnterpriseResDto> queryEnterpriseByEntIds(List<Long> entIds) {
+        return remoteBaseService.queryEnterpriseByEntIds(entIds);
+    }
+
 }

+ 13 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -913,4 +913,17 @@
       from kws_enterprise where status = 0
       and del_flag = 0
     </select>
+
+  <select id="queryEnterpriseByEntIds" resultMap="BaseResultMap">
+      select
+      <include refid="Base_Column_List" />
+      from kws_enterprise where status = 0
+      and del_flag = 0
+      <if test="entIds != null and entIds.size() != 0">
+          and id in
+          <foreach collection="entIds" separator="," close=")" open="(" item="item">
+              #{item}
+          </foreach>
+      </if>
+    </select>
 </mapper>

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

@@ -236,6 +236,7 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
      * @param query
      * @param orderList
      * @param entId
+     * @param authEntIdList 客户经理关联的企业id
      * @return
      */
     List<ManagementLogisticsOrderVO> selectManagementLogisticsOrderList(@Param("query") ManagementLogisticsOrderQuery query,
@@ -243,7 +244,8 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
                                                                         @Param("entId") Long entId,
                                                                         @Param("contactsIds") List<Long> contactsIds,
                                                                         @Param("userIds") List<Long> userIds,
-                                                                        @Param("idsList") List<Long> idsList
+                                                                        @Param("idsList") List<Long> idsList,
+                                                                        @Param("authEntIdList") List<Long> authEntIdList
 
     );
 
@@ -345,7 +347,8 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
                                                               @Param("orderList") List<Integer> orderList,
                                                               @Param("entId") Long entId,
                                                               @Param("contactsIds") List<Long> contactsIds,
-                                                              @Param("userIds") List<Long> userIds
+                                                              @Param("userIds") List<Long> userIds,
+                                                              @Param("authEntIdList") List<Long> authEntIdList
     );
 
     /**

+ 63 - 7
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtManagementLogisticsOrderService.java

@@ -5,11 +5,11 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.contract.api.RemoteContractService;
 import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
-import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.common.enums.enums.DictEnum;
 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.constant.NumberConstant;
 import com.sckw.core.model.enums.CarWaybillEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.model.page.PageRes;
@@ -25,6 +25,7 @@ import com.sckw.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.order.api.model.OrderDetailRes;
 import com.sckw.order.api.model.UnitInfoDetailRes;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import com.sckw.transport.dao.*;
@@ -70,6 +71,9 @@ public class KwtManagementLogisticsOrderService {
     @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
     RemoteContractService remoteContractService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
+    RemoteUserService remoteUserService;
+
     @Autowired
     public KwtLogisticsOrderGoodsMapper logisticsOrderGoodsMapper;
 
@@ -106,6 +110,27 @@ public class KwtManagementLogisticsOrderService {
         Long entId = LoginUserHolder.getEntId();
         PageHelper.startPage(query.getPage(), query.getPageSize());
         List<Integer> orderList = new ArrayList<>();
+
+        //客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        //获取redis
+//        String managerKey = Global.getCustomerManagerUserLoginKey(SystemTypeEnum.MANAGE.getCode(), LoginUserHolder.getUserId());
+//        RSet<Object> set = RedissonUtils.getSet(managerKey);
+//        if (CollectionUtils.isEmpty(set)){
+//            List authUserIdList = JSONObject.parseObject(set.toString(), List.class);
+//            if(CollectionUtils.isNotEmpty(authUserIdList)){
+//                authEntIdList.addAll(authUserIdList);
+//            }
+//        }
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                PageInfo<ManagementLogisticsOrderVO> pageInfo = new PageInfo<>();
+                return PageRes.build(pageInfo, new ArrayList<>());
+            }
+            authEntIdList.addAll(ids);
+        }
+
         if (StringUtils.isNotBlank(query.getStatus())) {
             if (String.valueOf(NumberConstant.SEVEN).equals(query.getStatus())) {
                 orderList.add(LogisticsOrderEnum.REJECT_ORDER.getCode());
@@ -139,16 +164,16 @@ public class KwtManagementLogisticsOrderService {
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
 //        LoginUserHolder.getIsMain()
-        List<ManagementLogisticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList, idsList);
+        List<ManagementLogisticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList, idsList,authEntIdList);
         PageInfo<ManagementLogisticsOrderVO> pageInfo = new PageInfo<>(list);
         if (CollectionUtils.isEmpty(list)) {
             return PageRes.build(pageInfo, list);
         }
 //        List<AcceptCarriageOrderVO> detailRes = new ArrayList<>();
         /**计量单位*/
-        Map<String, String> unitTypeDictData = commonService.getDictData(DictTypeEnum.UNIT_TYPE.getType());
+//        Map<String, String> unitTypeDictData = commonService.getDictData(DictTypeEnum.UNIT_TYPE.getType());
         /**运价方式*/
-        Map<String, String> priceDictData = commonService.getDictData(DictTypeEnum.PRICE_TYPE.getType());
+//        Map<String, String> priceDictData = commonService.getDictData(DictTypeEnum.PRICE_TYPE.getType());
         /**计费方式*/
         Map<String, String> chargingDictData = commonService.getDictData(DictTypeEnum.CHARGING_TYPE.getType());
         /**结算周期*/
@@ -205,6 +230,26 @@ public class KwtManagementLogisticsOrderService {
     }
 
     public HttpResult statisticsLogisticsOrder(ManagementLogisticsOrderQuery query) {
+
+        //客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                /**补全数据状态不齐的情况*/
+                List<TableTops> arrayList = new ArrayList<>();
+                List<TableTops> list =new ArrayList<>();
+                arrayList.addAll(list);
+                arrayList = commonService.packageReturnStatistics(list, arrayList);
+                // 查询结果
+                Map<String, Object> map = new HashMap<>(NumberConstant.SIXTEEN);
+                map.put("tableTop", arrayList);
+                // 查询结果
+                return HttpResult.ok(map);
+            }
+            authEntIdList.addAll(ids);
+        }
+
         Long entId = LoginUserHolder.getEntId();
         List<Integer> orderList = new ArrayList<>();
         if (StringUtils.isNotBlank(query.getStatus())) {
@@ -239,7 +284,7 @@ public class KwtManagementLogisticsOrderService {
         List<Long> longs = LoginUserHolder.getAuthUserIdList();
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
-        List<TableTops> list = logisticsOrderMapper.countManagementLogisticsOrderListByStatus(query, orderList, entId, longList, longList);
+        List<TableTops> list = logisticsOrderMapper.countManagementLogisticsOrderListByStatus(query, orderList, entId, longList, longList,authEntIdList);
         List<TableTops> arrayList = new ArrayList<>();
         arrayList.addAll(list);
         /**补全数据状态不齐的情况*/
@@ -252,6 +297,17 @@ public class KwtManagementLogisticsOrderService {
     }
 
     public List<ManagementLogisticsOrderExcelVo> exportLogisticsOrder(ManagementLogisticsOrderQuery query) {
+
+        //客户经理权限过滤
+        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<Long> idsList = new ArrayList<>();
         if (StringUtils.isNotBlank(query.getIds())) {
             idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
@@ -291,7 +347,7 @@ public class KwtManagementLogisticsOrderService {
         List<Long> longs = LoginUserHolder.getAuthUserIdList();
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
-        List<ManagementLogisticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList, idsList);
+        List<ManagementLogisticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList, idsList,authEntIdList);
         /**计费方式*/
         Map<String, String> chargingDictData = commonService.getDictData(DictTypeEnum.CHARGING_TYPE.getType());
         /**结算周期*/
@@ -537,7 +593,7 @@ public class KwtManagementLogisticsOrderService {
                 orderDetailVO.setOrderAmount(unloadAmount.multiply(price).subtract(fineValue));
             } else if (DictEnum.CHARGING_TYPE_3.getValue().equals(logisticsOrder.getBillingMode())) {
                 // 物流订单运单趟次数量
-                Map<String, Object> map = new HashMap<>(NumberConstant.SIXTEEN){{
+                Map<String, Object> map = new HashMap<>(NumberConstant.SIXTEEN) {{
                     put("upperlOrderId", logisticsOrder.getId());
                     put("passStatus", Global.NUMERICAL_ONE);
                 }};

+ 85 - 9
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtManagementWaybillOrderService.java

@@ -1,21 +1,24 @@
 package com.sckw.transport.service;
 
-import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.enums.CarWaybillEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.DateUtil;
 import com.sckw.mongo.model.SckwWaybillOrder;
 import com.sckw.mongo.model.TableTops;
+import com.sckw.system.api.RemoteUserService;
 import com.sckw.transport.model.param.ManagementWaybillOrderQuery;
 import com.sckw.transport.model.vo.ManagementCarWaybillVo;
 import com.sckw.transport.model.vo.execlVo.ManagementWaybillOrderExcelVO;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Sort;
@@ -54,15 +57,17 @@ public class KwtManagementWaybillOrderService {
     /**
      * 构造运单关联查询条件
      *
-     * @param query
+     * @param query 查询参数
+     * @param query 权限过滤 相关联的企业
      * @return
      */
-    public Criteria newBuildWaybillOrdersQuery(ManagementWaybillOrderQuery query) {
+    public Criteria newBuildWaybillOrdersQuery(ManagementWaybillOrderQuery query,List<Long> authEntIdList) {
         // 模糊匹配
         // 根据条件查询所有并排序,且分页
         // 设置模糊查询匹配规则  忽略大小写
         // 创建条件对象
         Criteria criteria = new Criteria();
+        criteria.and("entId").in(authEntIdList);
         criteria.and("delFlag").is(NumberConstant.ZERO);
         // 运单状态
         if (StringUtils.isNotBlank(query.getStatus()) && (!"all".equals(query.getStatus()))) {
@@ -125,13 +130,30 @@ public class KwtManagementWaybillOrderService {
         return criteria;
     }
 
+    @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
+    RemoteUserService remoteUserService;
+
     /**
      * 运单列表
+     *
      * @param query
      * @return
      */
     public HttpResult selectWaybillOrder(ManagementWaybillOrderQuery query) {
-        Criteria criteria = newBuildWaybillOrdersQuery(query);
+        List<ManagementCarWaybillVo> returnList = new ArrayList<>();
+
+        //客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                PageResult build = PageResult.build(query.getPage(), query.getPageSize(), 0L, returnList);
+                return HttpResult.ok(build);
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        Criteria criteria = newBuildWaybillOrdersQuery(query,authEntIdList);
 
         Query queryFormat = new Query(criteria);
         // in查询
@@ -146,7 +168,6 @@ public class KwtManagementWaybillOrderService {
         // 执行查询
         List<SckwWaybillOrder> list = mongoTemplate.find(queryFormat, SckwWaybillOrder.class);
 
-        List<ManagementCarWaybillVo> returnList = new ArrayList<>();
         if (CollectionUtils.isNotEmpty(list)) {
             for (SckwWaybillOrder waybillOrder : list) {
                 ManagementCarWaybillVo vo = new ManagementCarWaybillVo();
@@ -173,7 +194,7 @@ public class KwtManagementWaybillOrderService {
                 vo.setStatusLabel(CarWaybillEnum.getName(waybillOrder.getStatus()));
                 // 托量单位
                 vo.setUnit(waybillOrder.getUnit() == null ? null : waybillOrder.getUnit());
-                if(waybillOrder.getUnit() != null) {
+                if (waybillOrder.getUnit() != null) {
                     Map<String, String> unitType = commonService.getDictData(DictTypeEnum.UNIT_TYPE.getType());
                     String sysDict = unitType.get(waybillOrder.getUnit());
                     vo.setUnitLabel(sysDict);
@@ -231,11 +252,12 @@ public class KwtManagementWaybillOrderService {
 
     /**
      * 运单分类统计
+     *
      * @param query
      * @return
      */
     public HttpResult statisticsWaybillOrder(ManagementWaybillOrderQuery query) {
-        Criteria criteria = newBuildWaybillOrdersQuery(query);
+        //需要查询的状态
         List<Integer> statuses = new ArrayList<>();
         statuses.add(CarWaybillEnum.PENDING_ORDER.getCode());
         statuses.add(CarWaybillEnum.PENDING_VEHICLE.getCode());
@@ -246,6 +268,20 @@ public class KwtManagementWaybillOrderService {
         statuses.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
         statuses.add(CarWaybillEnum.APPROVAL_PASS.getCode());
         statuses.add(CarWaybillEnum.REJECT_ORDER.getCode());
+
+
+        //客户经理权限过滤
+        List<Long> authEntIdList = LoginUserHolder.getAuthEntIdList();
+        if (CollectionUtils.isEmpty(authEntIdList)) {
+            List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
+            if (CollectionUtils.isEmpty(ids)){
+                //填充默认值
+               return getDefaultWaybillOrder(statuses);
+            }
+            authEntIdList.addAll(ids);
+        }
+
+        Criteria criteria = newBuildWaybillOrdersQuery(query,authEntIdList);
         Aggregation aggregation = Aggregation.newAggregation(
                 Aggregation.match(criteria),
                 Aggregation.group("status").count().as("total"),
@@ -278,13 +314,53 @@ public class KwtManagementWaybillOrderService {
         return HttpResult.ok(listMap.values().stream().toList());
     }
 
+    private HttpResult getDefaultWaybillOrder(List<Integer> statuses) {
+        List<TableTops> results = new ArrayList<>();
+        // 填充默认值
+        Map<String,TableTops> listMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
+        TableTops topTotal = new TableTops();
+        topTotal.setName("全部");
+        topTotal.setValue("all");
+        topTotal.setTotal(NumberConstant.ZERO);
+        listMap.put("all", topTotal);
+        for (Integer status : statuses) {
+            TableTops top = new TableTops();
+            top.setName(CarWaybillEnum.getName(status));
+            top.setValue(status.toString());
+            top.setTotal(NumberConstant.ZERO);
+            listMap.put(status.toString(), top);
+        }
+        Integer allTotal = 0;
+        for (TableTops result : results) {
+            if(listMap.containsKey(result.getValue())) {
+                listMap.get(result.getValue()).setTotal(result.getTotal());
+            }
+            allTotal += result.getTotal();
+        }
+        topTotal.setTotal(allTotal);
+        return HttpResult.ok(listMap.values().stream().toList());
+    }
+
     /**
      * 导出运单列表
+     *
      * @param query
      * @return
      */
     public List<ManagementWaybillOrderExcelVO> exportWaybillOrder(ManagementWaybillOrderQuery query) {
-        Criteria criteria = newBuildWaybillOrdersQuery(query);
+        List<ManagementWaybillOrderExcelVO> list = new ArrayList<>();
+
+        //客户经理权限过滤
+        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);
+        }
+
+        Criteria criteria = newBuildWaybillOrdersQuery(query,authEntIdList);
         Query queryFormat = new Query(criteria);
         // in查询
         List<Long> wOrderIds = StringUtils.splitStrToList(query.getIds(), ",", Long.class);
@@ -292,7 +368,6 @@ public class KwtManagementWaybillOrderService {
             queryFormat.addCriteria(Criteria.where("wOrderId").in(wOrderIds));
         }
         List<SckwWaybillOrder> wOrders = mongoTemplate.find(queryFormat, SckwWaybillOrder.class);
-        List<ManagementWaybillOrderExcelVO> list = new ArrayList<>();
         AtomicInteger i = new AtomicInteger(1);
         wOrders.forEach(e -> {
             ManagementWaybillOrderExcelVO export = BeanUtils.copyProperties(e, ManagementWaybillOrderExcelVO.class);
@@ -325,6 +400,7 @@ public class KwtManagementWaybillOrderService {
 
     /**
      * 运单详情
+     *
      * @param id
      * @return
      */

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 623 - 537
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä