2 Commits 94b172d797 ... 2dcdf65f4d

Auteur SHA1 Bericht Datum
  钱惠东 2dcdf65f4d Merge remote-tracking branch 'origin/dev_v2' into dev_v2 1 week geleden
  钱惠东 18216d1e90 bug修改 1 week geleden

+ 5 - 0
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/controller/TbAgentController.java

@@ -155,6 +155,11 @@ public class TbAgentController extends BaseController {
         return success(tbAgentService.selectForProject());
     }
 
+    @GetMapping("/countries")
+    public AjaxResult getCountriesByCurUser() {
+        return success(tbAgentService.selectCountriesByCurUser());
+    }
+
     /**
      * 获取项目全部代理商
      */

+ 1 - 0
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/mapper/TbAgentMapper.java

@@ -84,4 +84,5 @@ public interface TbAgentMapper extends BaseMapper<TbAgent>
 
     List<TbAgent> selectAgentDealLine(int configValue);
 
+    String selectCountriesByCurUser(String permissionCharIns);
 }

+ 3 - 0
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/service/ITbAgentService.java

@@ -5,6 +5,7 @@ import cn.hutool.core.lang.tree.Tree;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.project.business.domain.TbAgent;
 import com.ruoyi.project.system.domain.SysUser;
+import org.springframework.data.util.Pair;
 
 import java.util.List;
 
@@ -96,4 +97,6 @@ public interface ITbAgentService extends IService<TbAgent>
     List<TbAgent> selectAgentListByOwner(Long ownerId);
 
     TbAgent getInfo(Long agentId);
+
+    List<Pair<Long, String>>  selectCountriesByCurUser();
 }

+ 11 - 0
RuoYi-Vue-fast-master/src/main/java/com/ruoyi/project/business/service/impl/TbAgentServiceImpl.java

@@ -8,6 +8,7 @@ import cn.hutool.core.lang.tree.TreeNodeConfig;
 import cn.hutool.core.lang.tree.TreeUtil;
 import com.google.common.collect.Lists;
 import com.ruoyi.common.enums.ValueType;
+import com.ruoyi.common.utils.LocalUtils;
 import com.ruoyi.project.business.enums.JEPFuncEnum;
 import com.ruoyi.project.business.enums.JEPLogicEnum;
 import com.ruoyi.project.business.service.*;
@@ -36,6 +37,7 @@ import lombok.RequiredArgsConstructor;
 
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.Cacheable;
+import org.springframework.data.util.Pair;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -486,4 +488,13 @@ public class TbAgentServiceImpl extends ServiceImpl<TbAgentMapper, TbAgent> impl
         }
         return agent;
     }
+
+    @Override
+    public List<Pair<Long, String>> selectCountriesByCurUser() {
+        String countryIds = tbAgentMapper.selectCountriesByCurUser(SecurityUtils.getPermissionCharIns());
+        if (StringUtils.isBlank(countryIds)){
+            return Lists.newArrayList();
+        }
+        return LocalUtils.selectCountriesByCurUser(Arrays.stream(countryIds.split(",")).distinct().map(Long::valueOf).collect(Collectors.toList()));
+    }
 }

+ 9 - 0
RuoYi-Vue-fast-master/src/main/resources/mybatis/business/TbAgentMapper.xml

@@ -433,6 +433,15 @@
           AND protocol_end_date is not null
           AND DATEDIFF(protocol_end_date, CURRENT_DATE) = #{configValue}
     </select>
+    <select id="selectCountriesByCurUser" resultType="java.lang.String">
+        select group_concat(a.country_id)
+        from tb_agent a
+                 inner join (SELECT p.premession_char
+                             FROM (SELECT @premessionStr := #{permissionChar} p) param,
+                                  getpremessionview_chars p) permission
+                            on permission.premession_char = a.permission_char
+        where a.del_flag = '0' and a.country_id is not null
+    </select>
 
 
 </mapper>

+ 8 - 0
ruoyi-ui-vue2/src/api/user/agent.js

@@ -136,3 +136,11 @@ export function selectByOwner(ownerId) {
     method: 'get',
   })
 }
+
+// 查询当前用户可见国家下拉
+export function getCountryList() {
+  return request({
+    url: '/user/agent/countries',
+    method: 'get'
+  })
+}

+ 1 - 2
ruoyi-ui-vue2/src/views/board/agentAddAccount/index.vue

@@ -70,8 +70,7 @@ import ColorDictTag from "@/views/crmManagement/lead/ColorDictTag/index.vue";
 import Column from "@/components/element/table/Column.vue";
 import {getAllAreaList} from "@/api/user/area";
 import {curAgent} from "@/api/business/crm/lead";
-import {getCountryList} from "@/api/business/crm/follow";
-import {listAllAgent, selectForAccount} from "@/api/user/agent";
+import {listAllAgent, selectForAccount, getCountryList} from "@/api/user/agent";
 import {listAgentAddAccount} from "@/api/board/agent4ProjectAndAccount";
 import moment from "moment";