|
|
|
|
@ -6,10 +6,7 @@ import com.flossom.common.core.enums.SitePushTypeEnum;
|
|
|
|
|
import com.flossom.common.core.enums.SiteTypeEnum;
|
|
|
|
|
import com.flossom.common.core.enums.TagTypeStatus;
|
|
|
|
|
import com.flossom.common.core.exception.ServiceException;
|
|
|
|
|
import com.flossom.common.core.mapper.SiteInfoMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.SiteInfoTagMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.SiteLogMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.WxUserTagMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.*;
|
|
|
|
|
import com.flossom.common.core.utils.DateUtils;
|
|
|
|
|
import com.flossom.common.core.utils.StringUtils;
|
|
|
|
|
import com.flossom.common.security.utils.SecurityUtils;
|
|
|
|
|
@ -42,6 +39,9 @@ public class SiteInfoServiceImpl implements ISiteInfoService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private SiteInfoTagMapper siteInfoTagMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysTagMapper sysTagMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SiteInfo> popupList(Integer openType) {
|
|
|
|
|
@ -79,6 +79,70 @@ public class SiteInfoServiceImpl implements ISiteInfoService {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addTag(Long siteInfoId) {
|
|
|
|
|
SiteInfoTag siteInfoTag = new SiteInfoTag();
|
|
|
|
|
siteInfoTag.setSiteId(siteInfoId);
|
|
|
|
|
// 小程序标签
|
|
|
|
|
siteInfoTag.setTagType(TagTypeStatus.MINI_PROGRAM.getCode());
|
|
|
|
|
siteInfoTag.setStatus(2L);
|
|
|
|
|
List<SiteInfoTag> addMiniTagList = siteInfoTagMapper.selectSiteInfoTagList(siteInfoTag);
|
|
|
|
|
if (addMiniTagList != null && addMiniTagList.size() > 0) {
|
|
|
|
|
List<Integer> tagIdList = addMiniTagList.stream().map(SiteInfoTag::getTagId).map(Long::intValue).collect(Collectors.toList());
|
|
|
|
|
List<Integer> userIdList = Arrays.asList(SecurityUtils.getLoginUser().getWxUserMember().getId()).stream().map(Long::intValue).collect(Collectors.toList());
|
|
|
|
|
batchAddTag(tagIdList, userIdList, TagTypeStatus.MINI_PROGRAM.getCode());
|
|
|
|
|
}
|
|
|
|
|
// 企微标签
|
|
|
|
|
siteInfoTag.setTagType(TagTypeStatus.ENTERPRISE_WECHAT.getCode());
|
|
|
|
|
siteInfoTag.setStatus(2L);
|
|
|
|
|
List<SiteInfoTag> addWecomTagList = siteInfoTagMapper.selectSiteInfoTagList(siteInfoTag);
|
|
|
|
|
if (addWecomTagList != null && addWecomTagList.size() > 0) {
|
|
|
|
|
List<Integer> tagIdList = addWecomTagList.stream().map(SiteInfoTag::getTagId).map(Long::intValue).collect(Collectors.toList());
|
|
|
|
|
List<Integer> userIdList = Arrays.asList(SecurityUtils.getLoginUser().getWxUserMember().getId()).stream().map(Long::intValue).collect(Collectors.toList());
|
|
|
|
|
batchAddTag(tagIdList, userIdList, TagTypeStatus.ENTERPRISE_WECHAT.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量添加标签
|
|
|
|
|
* code 标签类型 {@link com.flossom.common.core.enums.TagTypeStatus}
|
|
|
|
|
*
|
|
|
|
|
* @param tagIdList
|
|
|
|
|
* @param userIdList
|
|
|
|
|
*/
|
|
|
|
|
public void batchAddTag(List<Integer> tagIdList, List<Integer> userIdList, Integer code) {
|
|
|
|
|
// 对单个标签操作
|
|
|
|
|
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, code);
|
|
|
|
|
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(), code, null);
|
|
|
|
|
wxUserTag.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
list.add(wxUserTag);
|
|
|
|
|
}
|
|
|
|
|
wxUserTagMapper.insertBatch(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// TODO: 对接数赢:批量添加小程序标签
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据 条件做过滤
|
|
|
|
|
*
|
|
|
|
|
@ -174,7 +238,7 @@ public class SiteInfoServiceImpl implements ISiteInfoService {
|
|
|
|
|
|
|
|
|
|
// 4.4、可见小程序标签
|
|
|
|
|
siteInfoTag.setSiteId(info.getId());
|
|
|
|
|
siteInfoTag.setTagType(1);
|
|
|
|
|
siteInfoTag.setTagType(TagTypeStatus.MINI_PROGRAM.getCode());
|
|
|
|
|
siteInfoTag.setStatus(0L);
|
|
|
|
|
List<SiteInfoTag> showWechatSiteInfoTags = siteInfoTagMapper.selectSiteInfoTagList(siteInfoTag);
|
|
|
|
|
if (showWechatSiteInfoTags != null && showWechatSiteInfoTags.size() > 0) {
|
|
|
|
|
@ -185,7 +249,7 @@ public class SiteInfoServiceImpl implements ISiteInfoService {
|
|
|
|
|
}
|
|
|
|
|
// 4.5、可见企微标签
|
|
|
|
|
siteInfoTag.setSiteId(info.getId());
|
|
|
|
|
siteInfoTag.setTagType(2);
|
|
|
|
|
siteInfoTag.setTagType(TagTypeStatus.ENTERPRISE_WECHAT.getCode());
|
|
|
|
|
siteInfoTag.setStatus(0L);
|
|
|
|
|
List<SiteInfoTag> showCompanySiteInfoTags = siteInfoTagMapper.selectSiteInfoTagList(siteInfoTag);
|
|
|
|
|
if (showCompanySiteInfoTags != null && showCompanySiteInfoTags.size() > 0) {
|
|
|
|
|
|