|
|
|
|
@ -118,39 +118,54 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
|
|
|
|
|
return wxUserMemberMapper.selectUserCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量添加小程序标签
|
|
|
|
|
*
|
|
|
|
|
* @param tagIdList
|
|
|
|
|
* @param userIdList
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void batchAddMiniProgramTag(List<Integer> tagIdList, List<Integer> userIds) {
|
|
|
|
|
if (tagIdList != null && tagIdList.size() > 0) {
|
|
|
|
|
// 对单个标签操作
|
|
|
|
|
for (Integer tagId : tagIdList) {
|
|
|
|
|
SysTag sysTag = sysTagMapper.selectDeptById(tagId.longValue());
|
|
|
|
|
if (sysTag != null) {
|
|
|
|
|
List<Integer> needAddIdList = new ArrayList<>();
|
|
|
|
|
// 1、查询该标签下,有那些用户关联
|
|
|
|
|
List<Integer> existedUserList = wxUserTagMapper.selectWxUserTagByTagId(tagId, TagTypeStatus.MINI_PROGRAM.getCode());
|
|
|
|
|
if (existedUserList != null && existedUserList.size() > 0) {
|
|
|
|
|
Iterator<Integer> iterator = userIds.iterator();
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
|
Integer element = iterator.next();
|
|
|
|
|
if (!existedUserList.contains(element)) {
|
|
|
|
|
needAddIdList.add(element);
|
|
|
|
|
}
|
|
|
|
|
public void batchAddMiniProgramTag(List<Integer> tagIdList, List<Integer> userIdList) {
|
|
|
|
|
// 对单个标签操作
|
|
|
|
|
for (Integer tagId : tagIdList) {
|
|
|
|
|
SysTag sysTag = sysTagMapper.selectDeptById(tagId.longValue());
|
|
|
|
|
if (sysTag != null) {
|
|
|
|
|
List<Integer> needAddIdList = new ArrayList<>();
|
|
|
|
|
// 1、查询该标签下,有那些用户关联
|
|
|
|
|
List<Integer> existedUserList = wxUserTagMapper.selectWxUserTagByTagId(tagId, TagTypeStatus.MINI_PROGRAM.getCode());
|
|
|
|
|
if (existedUserList != null && existedUserList.size() > 0) {
|
|
|
|
|
Iterator<Integer> iterator = userIdList.iterator();
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
|
Integer element = iterator.next();
|
|
|
|
|
if (!existedUserList.contains(element)) {
|
|
|
|
|
needAddIdList.add(element);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2、添加用户与标签的关联
|
|
|
|
|
List<WxUserTag> list = new ArrayList<>();
|
|
|
|
|
WxUserTag wxUserTag;
|
|
|
|
|
if (needAddIdList != null && needAddIdList.size() > 0) {
|
|
|
|
|
for (Integer userId : needAddIdList) {
|
|
|
|
|
wxUserTag = new WxUserTag(null, userId.longValue(), sysTag.getTagName(), tagId.longValue(), TagTypeStatus.MINI_PROGRAM.getCode(), null);
|
|
|
|
|
wxUserTag.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
list.add(wxUserTag);
|
|
|
|
|
}
|
|
|
|
|
wxUserTagMapper.insertBatch(list);
|
|
|
|
|
// 2、添加用户与标签的关联
|
|
|
|
|
List<WxUserTag> list = new ArrayList<>();
|
|
|
|
|
WxUserTag wxUserTag;
|
|
|
|
|
if (needAddIdList != null && needAddIdList.size() > 0) {
|
|
|
|
|
for (Integer userId : needAddIdList) {
|
|
|
|
|
wxUserTag = new WxUserTag(null, userId.longValue(), sysTag.getTagName(), tagId.longValue(), TagTypeStatus.MINI_PROGRAM.getCode(), null);
|
|
|
|
|
wxUserTag.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
list.add(wxUserTag);
|
|
|
|
|
}
|
|
|
|
|
wxUserTagMapper.insertBatch(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量删除小程序标签
|
|
|
|
|
*
|
|
|
|
|
* @param tagIdList
|
|
|
|
|
* @param userIdList
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void batchDelMiniProgramTag(List<Integer> tagIdList, List<Integer> userIdList) {
|
|
|
|
|
wxUserTagMapper.deleteBatch(tagIdList, userIdList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|