|
|
@@ -83,11 +83,11 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
|
|
|
PageUtils.startPage();
|
|
|
list = kuaishouLiveUserAccountMapper.selectKuaishouLiveUserAccountList(kuaishouLiveUserAccount);
|
|
|
} else {
|
|
|
- List<String> accountNames = kuaishouLiveUserAccountMapper.queryAccountNamesByUserId(kuaishouLiveUserAccount.getUserId());
|
|
|
- if (Check.isNotNull(accountNames) && accountNames.size() > 0) {
|
|
|
- kuaishouLiveUserAccount.setAccountNames(accountNames);
|
|
|
+ List<Long> accountIds = kuaishouLiveUserAccountMapper.queryAccountIdsByUserId(kuaishouLiveUserAccount.getUserId());
|
|
|
+ if (Check.isNotNull(accountIds) && accountIds.size() > 0) {
|
|
|
+ kuaishouLiveUserAccount.setAccountIds(accountIds);
|
|
|
PageUtils.startPage();
|
|
|
- list = kuaishouLiveUserAccountMapper.selectAllListByAccountNames(kuaishouLiveUserAccount);
|
|
|
+ list = kuaishouLiveUserAccountMapper.selectAllListByAccountIds(kuaishouLiveUserAccount);
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
|
@@ -101,11 +101,11 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
|
|
|
PageUtils.startPage();
|
|
|
list = kuaishouLiveUserAccountMapper.queryAllList(userAccount);
|
|
|
} else {
|
|
|
- List<String> accountNames = kuaishouLiveUserAccountMapper.queryAccountNamesByUserId(userAccount.getUserId());
|
|
|
- if (Check.isNotNull(accountNames) && accountNames.size() > 0) {
|
|
|
- userAccount.setAccountNames(accountNames);
|
|
|
+ List<Long> accountIds = kuaishouLiveUserAccountMapper.queryAccountIdsByUserId(userAccount.getUserId());
|
|
|
+ if (Check.isNotNull(accountIds) && accountIds.size() > 0) {
|
|
|
+ userAccount.setAccountIds(accountIds);
|
|
|
PageUtils.startPage();
|
|
|
- list = kuaishouLiveUserAccountMapper.queryAllListByAccountNames(userAccount);
|
|
|
+ list = kuaishouLiveUserAccountMapper.queryAllListByAccountIds(userAccount);
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
|
@@ -118,10 +118,13 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
|
|
|
*/
|
|
|
@Override
|
|
|
public ResultResponse insertKuaishouLiveUserAccount(KuaishouLiveUserAccount account) {
|
|
|
- KuaishouLiveUserAccount one = kuaishouLiveUserAccountMapper.getOne(account.getKsId(), account.getAccountName());
|
|
|
+ KuaishouLiveUserAccount one = kuaishouLiveUserAccountMapper.getOne(account);
|
|
|
if (one != null) {
|
|
|
return ResultResponse.error("快手ID:" + account.getKsId() + "下已存在该账户名,请重新命名!");
|
|
|
}
|
|
|
+ if (Check.isNull(account.getAccountId())) {
|
|
|
+ account.setAccountId(System.currentTimeMillis());
|
|
|
+ }
|
|
|
String collaboratorList = account.getCollaboratorList();
|
|
|
if (collaboratorList != null) {
|
|
|
List<JSONObject> collaborators = JSONArray.parseArray(collaboratorList, JSONObject.class);
|
|
|
@@ -207,13 +210,13 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
|
|
|
}
|
|
|
|
|
|
// 通过人员名字查询人员ID
|
|
|
- private Long getUserIdByName(String name) {
|
|
|
+ private String getUserIdByName(String name) {
|
|
|
if (Check.isNull(name)) {
|
|
|
return null;
|
|
|
}
|
|
|
SysUser user = sysUserService.selectUserByNickName(name);
|
|
|
if (Check.isNotNull(user)) {
|
|
|
- return user.getUserId();
|
|
|
+ return user.getUserId().toString();
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
@@ -223,7 +226,7 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
|
|
|
*/
|
|
|
@Override
|
|
|
public ResultResponse updateKuaishouLiveUserAccount(KuaishouLiveUserAccount account) {
|
|
|
- KuaishouLiveUserAccount one = kuaishouLiveUserAccountMapper.getOne(account.getKsId(), account.getAccountName());
|
|
|
+ KuaishouLiveUserAccount one = kuaishouLiveUserAccountMapper.getOne(account);
|
|
|
if (one == null) {
|
|
|
return ResultResponse.error("未查询到账户");
|
|
|
}
|
|
|
@@ -273,7 +276,6 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
|
|
|
|
|
|
@Override
|
|
|
public List<JSONObject> queryNicknameList() {
|
|
|
-
|
|
|
return kuaishouLiveUserAccountMapper.queryNicknameList();
|
|
|
}
|
|
|
|
|
|
@@ -288,4 +290,66 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
|
|
|
return ResultResponse.success(list);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResultResponse queryAccountAllUsers(Long ksId, Long accountId) {
|
|
|
+ List<JSONObject> collaborators = accountPartMapper.queryAccountCollaborators(ksId, accountId);
|
|
|
+ KuaishouLiveUserAccount account = new KuaishouLiveUserAccount();
|
|
|
+ account.setAccountId(accountId);
|
|
|
+ account.setKsId(ksId);
|
|
|
+ KuaishouLiveUserAccount one = kuaishouLiveUserAccountMapper.getOne(account);
|
|
|
+ if (Check.isNotNull(one)) {
|
|
|
+ if (Check.isNotNull(one.getSaleLeaderId())) {
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("role", "saleLeader");
|
|
|
+ obj.put("roleName", "销售负责人");
|
|
|
+ obj.put("userId", one.getSaleLeaderId());
|
|
|
+ obj.put("name", one.getSaleLeader());
|
|
|
+ collaborators.add(obj);
|
|
|
+ }
|
|
|
+ if (Check.isNotNull(one.getOperatorLeaderId())) {
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("role", "operatorLeader");
|
|
|
+ obj.put("roleName", "运营负责人");
|
|
|
+ obj.put("userId", one.getOperatorLeaderId());
|
|
|
+ obj.put("name", one.getOperatorLeader());
|
|
|
+ collaborators.add(obj);
|
|
|
+ }
|
|
|
+ if (Check.isNotNull(one.getDesignerLeaderId())) {
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("role", "designerLeader");
|
|
|
+ obj.put("roleName", "设计负责人");
|
|
|
+ obj.put("userId", one.getDesignerLeaderId());
|
|
|
+ obj.put("name", one.getDesignerLeader());
|
|
|
+ collaborators.add(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultResponse.success(collaborators);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultResponse deleteAccountAllUser(Long ksId, Long accountId, String role, String userId) {
|
|
|
+ if ("collaborator".equals(role)) {
|
|
|
+ accountPartMapper.deleteByAccountId(ksId, accountId);
|
|
|
+ } else {
|
|
|
+ KuaishouLiveUserAccount account = new KuaishouLiveUserAccount();
|
|
|
+ account.setAccountId(accountId);
|
|
|
+ account.setKsId(ksId);
|
|
|
+ KuaishouLiveUserAccount one = kuaishouLiveUserAccountMapper.getOne(account);
|
|
|
+ if ("saleLeader".equals(role)) {
|
|
|
+ one.setSaleLeader("");
|
|
|
+ one.setSaleLeaderId("");
|
|
|
+ }
|
|
|
+ if ("operatorLeader".equals(role)) {
|
|
|
+ one.setOperatorLeader("");
|
|
|
+ one.setOperatorLeaderId("");
|
|
|
+ }
|
|
|
+ if ("designerLeader".equals(role)) {
|
|
|
+ one.setDesignerLeader("");
|
|
|
+ one.setDesignerLeaderId("");
|
|
|
+ }
|
|
|
+ kuaishouLiveUserAccountMapper.updateKuaishouLiveUserAccount(one);
|
|
|
+ }
|
|
|
+ return ResultResponse.success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|