zhaoxian 3 éve
szülő
commit
56f860f1ee

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/SysUserMapper.java

@@ -186,4 +186,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
      * @return
      */
     Integer updUserDesignLeaderById(@Param("userId") String userId,@Param("designTeamLeaderName") String designTeamLeaderName);
+
+    List<String> getUserIdsByLeaderId(@Param("leaderId")String leaderId);
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml

@@ -348,4 +348,9 @@ SELECT
         UPDATE sys_user SET design_team_leader_name = #{designTeamLeaderName} WHERE id = #{userId}
     </update>
 
+    <select id="getUserIdsByLeaderId" resultType="java.lang.String">
+        select id from sys_user
+        where leader_id = #{leaderId}
+    </select>
+
 </mapper>

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java

@@ -294,4 +294,6 @@ public interface ISysUserService extends IService<SysUser> {
     List<String> userIdToUsername(Collection<String> userIdList);
 
     List<SysUser> queryAdminPageList(SysUser user);
+
+    void getItsPersonnelIds(List<String> rids,String userId);
 }

+ 12 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java

@@ -655,4 +655,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     public List<SysUser> queryAdminPageList(SysUser user) {
         return userMapper.queryPageList(user);
     }
+
+    @Override
+    public void getItsPersonnelIds( List<String> rids,String userId) {
+        List<String> ids =  userMapper.getUserIdsByLeaderId(userId);
+        if(Check.isNull(ids)){
+            rids.add(userId);
+        }else{
+            for (String id : ids) {
+                getItsPersonnelIds(rids,id);
+            }
+        }
+    }
 }

+ 15 - 11
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelController.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.channel.controller;
 
 import cn.com.ctop.common.module.service.ISysRoleExtService;
+import cn.com.ctop.common.module.service.ISysUserService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel;
@@ -63,6 +64,8 @@ public class KuaishouChannelController {
     private IKuaishouChannelService kuaishouChannelService;
     @Autowired
     private ISysRoleExtService sysRoleService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询渠道号管理首页数据
@@ -70,12 +73,15 @@ public class KuaishouChannelController {
     @GetMapping(value = "/channelManagementHome")
     public Result<Object> channelManagementHome(KuaishouChannel kuaishouChannel, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         try {
+
             String roleCode = sysRoleService.getRoleCodeByUserId(kuaishouChannel.getUserId());
-            if (Check.isNull(roleCode)) {
-                return Result.error("缺失 人员信息");
-            }
-            if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
-                kuaishouChannel.setUserId(null);
+
+            if (!Check.isNull(roleCode) && ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode))) {
+                kuaishouChannel.setRids(null);
+            } else {
+                List<String> rids = new ArrayList<>();
+                sysUserService.getItsPersonnelIds(rids, kuaishouChannel.getUserId());
+                kuaishouChannel.setRids(rids);
             }
             PageHelper.startPage(pageNo, pageSize);
             return kuaishouChannelService.channelManagementHome(kuaishouChannel);
@@ -98,8 +104,6 @@ public class KuaishouChannelController {
             return kuaishouChannelService.channelNumberDetails(kuaishouChannel, pageNo, pageSize);
 
 
-
-
         } catch (Exception e) {
             e.printStackTrace();
             return Result.error("查询渠道号详情异常");
@@ -189,7 +193,7 @@ public class KuaishouChannelController {
     @GetMapping(value = "/updateChannels")
     public Result<Object> updateChannels(KuaishouChannel channel) {
         try {
-            if (Check.isNull(channel.getAccountId())||Check.isNull(channel.getUserId())) {
+            if (Check.isNull(channel.getAccountId()) || Check.isNull(channel.getUserId())) {
                 return Result.error("缺失参数");
             }
             return kuaishouChannelService.updateChannels(channel);
@@ -247,9 +251,9 @@ public class KuaishouChannelController {
             ids.add("hcst");//应用标记
             ids.add("http://test123.com.cn");//隐私政策链接
             ids.add("http://test123456.com.cn");//第三方点击监测链接
-            ids.add(1);//是否关联单品(0否,1是)
-            ids.add("剑来");//关联单品名称
-            ids.add("account");//使用层级(账户:account,计划:plan,组:group)
+            ids.add(0);//是否关联单品(0否,1是)
+            ids.add("");//关联单品名称
+            ids.add("plan");//使用层级(账户:account,计划:plan,组:group)
             ids.add(1);//是否循环(0否,1是)
             list.add(ids);
             eeu.exportExcelForAttendance(workbook, 0, "Sheet1", titles, list);

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannel.java

@@ -205,4 +205,7 @@ public class KuaishouChannel {
     @TableField(exist = false)
     private Long unitId;
 
+    @TableField(exist = false)
+    private  List<String> rids;
+
 }

+ 6 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelMapper.xml

@@ -19,8 +19,12 @@
         FROM ctop_kuaishou_channel t1
         LEFT JOIN sys_user t2 ON t1.user_id = t2.id
         <where>
-            <if test="userId != null">
-                and t1.user_id = #{userId}
+            <if test="rids != null">
+                and t1.user_id  IN
+                <foreach collection="rids" item="id" separator=","
+                         open="(" close=")">
+                    #{id}
+                </foreach>
             </if>
             <if test="projectId != null">
                 and project_id = #{projectId}

+ 8 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java

@@ -711,17 +711,17 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
             channelStrategy.setChannelName(channelName);
         }
         String schemaUri = strategy.getSchemaUri();
-        if (!Check.isNull(schemaUri) && schemaUri.contains(CHANNEL_STR)) {
-            channelStrategy.setSchemaUri(schemaUri.replace(CHANNEL_STR, channelCode).trim());
+        if (!Check.isNull(schemaUri) && schemaUri.contains(CHANNEL_STR) || channelName.contains(NUMBER_STR)) {
+            channelStrategy.setSchemaUri(schemaUri.replace(CHANNEL_STR, channelCode).replace(NUMBER_STR, numberStr).trim());
         }
-        if (!Check.isNull(strategy.getUrl()) && strategy.getUrl().contains(CHANNEL_STR)) {
-            channelStrategy.setUrl(strategy.getUrl().replace(CHANNEL_STR, channelCode).trim());
+        if (!Check.isNull(strategy.getUrl()) && strategy.getUrl().contains(CHANNEL_STR) || channelName.contains(NUMBER_STR)) {
+            channelStrategy.setUrl(strategy.getUrl().replace(CHANNEL_STR, channelCode).replace(NUMBER_STR, numberStr).trim());
         }
-        if (!Check.isNull(strategy.getActionbarClickUrl()) && strategy.getActionbarClickUrl().contains(CHANNEL_STR)) {
-            channelStrategy.setActionbarClickUrl(strategy.getActionbarClickUrl().replace(CHANNEL_STR, channelCode).trim());
+        if (!Check.isNull(strategy.getActionbarClickUrl()) && strategy.getActionbarClickUrl().contains(CHANNEL_STR) || channelName.contains(NUMBER_STR)) {
+            channelStrategy.setActionbarClickUrl(strategy.getActionbarClickUrl().replace(CHANNEL_STR, channelCode).replace(NUMBER_STR, numberStr).trim());
         }
-        if (strategy.getClickTrackUrl().contains(CHANNEL_STR)) {
-            channelStrategy.setClickTrackUrl(strategy.getClickTrackUrl().replace(CHANNEL_STR, channelCode).trim());
+        if (strategy.getClickTrackUrl().contains(CHANNEL_STR) || channelName.contains(NUMBER_STR)) {
+            channelStrategy.setClickTrackUrl(strategy.getClickTrackUrl().replace(CHANNEL_STR, channelCode).replace(NUMBER_STR, numberStr).trim());
         }
         String appVersion = strategy.getAppVersion();
         if (appVersion.contains(CHANNEL_STR)) {