浏览代码

供应链调整

yumeng 1 年之前
父节点
当前提交
be0d58679e

+ 23 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java

@@ -10,6 +10,7 @@ import com.ruixuan.isc.entity.JYKuaishouPromoter;
 import com.ruixuan.isc.entity.KuaishouPromoter;
 import com.ruixuan.isc.service.IKuaishouPromoterService;
 import com.ruixuan.isc.utils.Tess4jClient;
+import com.ruixuan.system.service.ISysUserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -89,14 +91,15 @@ public class KuaishouPromoterController extends BaseController {
                               @ApiParam("达人名称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName,
                               @ApiParam("媒体") @RequestParam(value = "mediaId", required = false) String mediaId,
                               @ApiParam("排序参数") @RequestParam(value = "parameter", required = false) String parameter,
-                              @ApiParam("正序倒叙") @RequestParam(value = "orderBy", required = false) String orderBy
+                              @ApiParam("正序倒叙") @RequestParam(value = "orderBy", required = false) String orderBy,
+                              @ApiParam("绑定人") @RequestParam(value = "bdUserId", required = false) Long bdUserId
 
     ) {
 
         if (Check.isNotNull(promoterId)) {
             promoterId = promoterId.trim();
         }
-        List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList(userId, promoterId, promoterNickName, mediaId, parameter, orderBy);
+        List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList(userId, promoterId, promoterNickName, mediaId, parameter, orderBy, bdUserId);
         return getDataTable(list);
     }
 
@@ -272,6 +275,24 @@ public class KuaishouPromoterController extends BaseController {
         return toAjax(kuaishouPromoterService.updateKuaishouPromoter(kuaishouPromoter));
     }
 
+    @Autowired
+    ISysUserService sysUserService;
+
+    @PostMapping(value = "/editBindUser")
+    @ApiOperation(value = "修改快手达人")
+    public AjaxResult editBindUser(@RequestBody JSONObject userJson) {
+        Long id = userJson.getLong("id");
+        Long bdUserId = userJson.getLong("bdUserId");
+        String userName = sysUserService.getUserNameById(bdUserId);
+        KuaishouPromoter kuaishouPromoter = new KuaishouPromoter();
+        kuaishouPromoter.setId(id);
+        kuaishouPromoter.setUserId(bdUserId);
+        kuaishouPromoter.setUserName(userName);
+        kuaishouPromoter.setCreateTime(new Date());
+        return toAjax(kuaishouPromoterService.updateKuaishouPromoter(kuaishouPromoter));
+    }
+
+
     /**
      * 修改骄阳达人 信息
      */

+ 2 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java

@@ -25,7 +25,8 @@ public interface KuaishouPromoterMapper {
     public List<KuaishouPromoter> selectKuaishouPromoterList(@Param("userList") List<Long> userList, @Param("promoterId") String promoterId,
                                                              @Param("promoterNickName") String promoterNickName,
                                                              @Param("mediaId") String mediaId,
-                                                             @Param("parameter") String parameter, @Param("orderBy") String orderBy);
+                                                             @Param("parameter") String parameter, @Param("orderBy") String orderBy,
+                                                             @Param("bdUserId") Long bdUserId);
 
     public List<JYKuaishouPromoter> selectKuaishouPromoterList3(@Param("userList") List<Long> userList, @Param("promoterId") String promoterId,
                                                                 @Param("promoterNickName") String promoterNickName,

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java

@@ -29,7 +29,7 @@ public interface IKuaishouPromoterService {
      * @param kuaishouPromoter 快手达人 信息
      * @return 快手达人 信息集合
      */
-    public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, String promoterId, String promoterNickName, String mediaId, String parameter, String orderBy);
+    public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, String promoterId, String promoterNickName, String mediaId, String parameter, String orderBy, Long bdUserId);
 
     public List<JYKuaishouPromoter> selectKuaishouPromoterList3(Long userId, String promoterId, String promoterNickName, String mediaId, String type, String parameter, String orderBy);
 

+ 25 - 19
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -73,16 +73,22 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
      * @return 快手达人 信息
      */
     @Override
-    public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, String promoterId, String promoterNickName, String mediaId, String parameter, String orderBy) {
+    public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, String promoterId, String promoterNickName, String mediaId, String parameter, String orderBy, Long bdUserId) {
         String roleKey = sysUserService.getRoleKeyByUserId(userId);
-        List<Long> userList = null;
+        List<Long> userList = new ArrayList<>();
         //角色:供应链管理员、招商、招商经理可以看到所有的达人信息
         if (roleKey.contains("courtship") || "supplyChainAdmin".equals(roleKey) || "admin".equals(roleKey)) {
-
-        } else if ("bdManager".equals(roleKey) || "associationManager".equals(roleKey)) {
+            if (!Check.isNull(bdUserId)) {
+                userList.add(bdUserId);
+            }
+        } else if ("bdManager".equals(roleKey) || "z".equals(roleKey)) {
             // 渠道经理、社群经理 可以看到自己创建的以及自己部门人员的达人信息
-            Long deptId = deptService.getDeptIdByUserId(userId);
-            userList = deptService.getDeptUserListByDeptId(deptId);
+            if (!Check.isNull(bdUserId)) {
+                userList.add(bdUserId);
+            } else {
+                Long deptId = deptService.getDeptIdByUserId(userId);
+                userList = deptService.getDeptUserListByDeptId(deptId);
+            }
         } else if ("bd".equals(roleKey)) {
             // 渠道可以看到自己创建的达人信息
             userList = Arrays.asList(userId);
@@ -111,7 +117,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             orderBy = "desc";
         }
         PageUtils.startPage();
-        List<KuaishouPromoter> list = kuaishouPromoterMapper.selectKuaishouPromoterList(userList, promoterId, promoterNickName, mediaId, parameter, orderBy);
+        List<KuaishouPromoter> list = kuaishouPromoterMapper.selectKuaishouPromoterList(userList, promoterId, promoterNickName, mediaId, parameter, orderBy, bdUserId);
         list.forEach(ent -> {
             JSONObject follow = kuaishouPromoterMapper.getFollowUpRecordsByUserId(ent.getPromoterId(), ent.getUserId());
             ent.setFollowUpRecord(Check.isNull(follow) ? "-" : follow.getString("txt"));
@@ -257,21 +263,21 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         }
 
 //        if ("2".equals(promoter.getMediaId())) {
-            // 快手、抖音 同一达人ID 不能绑定到多个渠道角色用户上
-            String roleKey = sysUserService.getRoleKeyByUserId(promoter.getUserId());
-            if (roleKey.contains("bd")) {
-                List<JSONObject> keys = kuaishouPromoterMapper.getBoundPromoterRoleKey(promoter.getPromoterId());
-                if (Check.isNotNull(keys)) {
-                    for (JSONObject key : keys) {
-                        String rKey = key.getString("role_key");
-                        if ("bd".equals(rKey) || "bdManager".equals(rKey)) {
-                            result.put("code", 500);
-                            result.put("msg", "该达人已被其他渠道人员绑定,绑定人:" + key.getString("user_name"));
-                            return result;
-                        }
+        // 快手、抖音 同一达人ID 不能绑定到多个渠道角色用户上
+        String roleKey = sysUserService.getRoleKeyByUserId(promoter.getUserId());
+        if (roleKey.contains("bd")) {
+            List<JSONObject> keys = kuaishouPromoterMapper.getBoundPromoterRoleKey(promoter.getPromoterId());
+            if (Check.isNotNull(keys)) {
+                for (JSONObject key : keys) {
+                    String rKey = key.getString("role_key");
+                    if ("bd".equals(rKey) || "bdManager".equals(rKey)) {
+                        result.put("code", 500);
+                        result.put("msg", "该达人已被其他渠道人员绑定,绑定人:" + key.getString("user_name"));
+                        return result;
                     }
                 }
             }
+        }
 //        }
         //查询 设置可绑定达人数
         Integer count = kuaishouPromoterMapper.getUserPromotersCount(promoter.getUserId(), promoter.getMediaId());

+ 2 - 0
ruixuan-system/src/main/java/com/ruixuan/system/mapper/SysUserMapper.java

@@ -166,4 +166,6 @@ public interface SysUserMapper {
     List<Long> getUserIdByRoleKey(@Param("roleKey") String roleKey);
 
     String getDepName(@Param("userId") Long userId);
+
+    String getUserNameById(@Param("userId") Long userId);
 }

+ 2 - 0
ruixuan-system/src/main/java/com/ruixuan/system/service/ISysUserService.java

@@ -233,4 +233,6 @@ public interface ISysUserService {
     List<Long> getUserIdByRoleKey(String roleKey);
 
     String getDepName( Long userId);
+
+    String getUserNameById(Long bdUserId);
 }

+ 5 - 0
ruixuan-system/src/main/java/com/ruixuan/system/service/impl/SysUserServiceImpl.java

@@ -555,4 +555,9 @@ public class SysUserServiceImpl implements ISysUserService {
         return userMapper.getDepName(userId);
     }
 
+    @Override
+    public String getUserNameById(Long bdUserId) {
+        return userMapper.getUserNameById(bdUserId);
+    }
+
 }

+ 4 - 0
ruixuan-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -386,5 +386,9 @@
 on t1.dept_id = t2.dept_id
 where t1.user_id = #{userId}
     </select>
+    <select id="getUserNameById" resultType="java.lang.String" parameterType="java.lang.Long">
+        select nick_name  from ruixuan.sys_user where user_id
+                                                  = #{userId};
+    </select>
 
 </mapper>