Commit d460b281 by danmo

标签回调通知修改

1 parent 9aa93820
...@@ -39,7 +39,7 @@ public class WxCpXmlMessageVO extends WxCpXmlMessage { ...@@ -39,7 +39,7 @@ public class WxCpXmlMessageVO extends WxCpXmlMessage {
@XStreamAlias("Id") @XStreamAlias("Id")
@XStreamConverter(value = XStreamCDataConverter.class) @XStreamConverter(value = XStreamCDataConverter.class)
private String id; private String tagId;
@Data @Data
public static class BatchJob implements Serializable { public static class BatchJob implements Serializable {
......
...@@ -50,7 +50,7 @@ public abstract class WeEventStrategy { ...@@ -50,7 +50,7 @@ public abstract class WeEventStrategy {
public WeDepartment setWeDepartMent(WxCpXmlMessageVO message){ public WeDepartment setWeDepartMent(WxCpXmlMessageVO message){
WeDepartment weDepartment = new WeDepartment(); WeDepartment weDepartment = new WeDepartment();
if (message.getId() != null) { if (message.getId() != null) {
weDepartment.setId(Long.valueOf(message.getId())); weDepartment.setId(message.getId());
} }
if (message.getName() != null) { if (message.getName() != null) {
weDepartment.setName(message.getName()); weDepartment.setName(message.getName());
......
...@@ -26,7 +26,7 @@ public class WeCallBackCreateCustomerTagImpl extends WeEventStrategy { ...@@ -26,7 +26,7 @@ public class WeCallBackCreateCustomerTagImpl extends WeEventStrategy {
try { try {
switch (message.getTagType()){ switch (message.getTagType()){
case tagGroup: case tagGroup:
weTagGroupService.createTagGroup(message.getId()); weTagGroupService.createTagGroup(message.getTagId());
break; break;
case tag: case tag:
weTagService.creatTag(message.getTagId()); weTagService.creatTag(message.getTagId());
......
...@@ -25,7 +25,7 @@ public class WeCallBackDeleteCustomerTagImpl extends WeEventStrategy { ...@@ -25,7 +25,7 @@ public class WeCallBackDeleteCustomerTagImpl extends WeEventStrategy {
try { try {
switch (message.getTagType()){ switch (message.getTagType()){
case tagGroup: case tagGroup:
weTagGroupService.deleteTagGroup(message.getId()); weTagGroupService.deleteTagGroup(message.getTagId());
break; break;
case tag: case tag:
weTagService.deleteTag(message.getTagId()); weTagService.deleteTag(message.getTagId());
......
...@@ -25,7 +25,7 @@ public class WeCallBackUpdateCustomerTagImpl extends WeEventStrategy { ...@@ -25,7 +25,7 @@ public class WeCallBackUpdateCustomerTagImpl extends WeEventStrategy {
try { try {
switch (message.getTagType()){ switch (message.getTagType()){
case tagGroup: case tagGroup:
weTagGroupService.updateTagGroup(message.getId()); weTagGroupService.updateTagGroup(message.getTagId());
break; break;
case tag: case tag:
weTagService.updateTag(message.getTagId()); weTagService.updateTag(message.getTagId());
......
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeTag; import com.linkwechat.wecom.domain.WeTag;
import org.apache.ibatis.annotations.Param;
/** /**
* 企业微信标签Mapper接口 * 企业微信标签Mapper接口
...@@ -51,7 +52,7 @@ public interface WeTagMapper extends BaseMapper<WeTag> ...@@ -51,7 +52,7 @@ public interface WeTagMapper extends BaseMapper<WeTag>
* @param id 企业微信标签ID * @param id 企业微信标签ID
* @return 结果 * @return 结果
*/ */
public int deleteWeTagById(String id); public int deleteWeTagById(@Param("id") String id);
/** /**
* 批量删除企业微信标签 * 批量删除企业微信标签
...@@ -59,7 +60,7 @@ public interface WeTagMapper extends BaseMapper<WeTag> ...@@ -59,7 +60,7 @@ public interface WeTagMapper extends BaseMapper<WeTag>
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteWeTagByIds(String[] ids); public int deleteWeTagByIds(@Param("ids") String[] ids);
/** /**
......
...@@ -299,33 +299,15 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr ...@@ -299,33 +299,15 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
List<WeTagGroup> tagGroupsList = new ArrayList<>(); List<WeTagGroup> tagGroupsList = new ArrayList<>();
tag_group.stream().forEach(k -> { tag_group.stream().forEach(k -> {
WeTagGroup tagGroupInfo = this.baseMapper.selectOne(new LambdaQueryWrapper<WeTagGroup>() WeTagGroup tagGroupInfo = this.baseMapper.selectOne(new LambdaQueryWrapper<WeTagGroup>()
.eq(WeTagGroup::getGroupId, k.getGroup_id())); .eq(WeTagGroup::getGroupId, k.getGroup_id())
if (tagGroupInfo != null) { .eq(WeTagGroup::getStatus,0));
if (tagGroupInfo == null) {
WeTagGroup weTagGroup = new WeTagGroup(); WeTagGroup weTagGroup = new WeTagGroup();
weTagGroup.setCreateBy(SecurityUtils.getUsername()); weTagGroup.setCreateBy("sys");
weTagGroup.setGourpName(k.getGroup_name()); weTagGroup.setGourpName(k.getGroup_name());
weTagGroup.setGroupId(k.getGroup_id()); weTagGroup.setGroupId(k.getGroup_id());
weTagGroup.setStatus(k.getDeleted()==true?"0":"2");
tagGroupsList.add(weTagGroup); tagGroupsList.add(weTagGroup);
} }
List<WeCropTagDto> tag = k.getTag();
if (CollectionUtil.isNotEmpty(tag)) {
List<WeTag> weTags = new ArrayList<>();
tag.stream().forEach(v -> {
WeTag tagInfo = iWeTagService.getOne(new LambdaQueryWrapper<WeTag>()
.eq(WeTag::getGroupId, k.getGroup_id())
.eq(WeTag::getTagId, v.getId()));
if (tagInfo != null) {
WeTag weTag = new WeTag();
weTag.setTagId(v.getId());
weTag.setGroupId(k.getGroup_id());
weTag.setName(v.getName());
weTag.setStatus(v.getDeleted()==true?"0":"2");
weTags.add(weTag);
}
});
iWeTagService.saveBatch(weTags);
}
}); });
this.saveBatch(tagGroupsList); this.saveBatch(tagGroupsList);
} }
...@@ -333,7 +315,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr ...@@ -333,7 +315,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
@Override @Override
public void deleteTagGroup(String id) { public void deleteTagGroup(String id) {
this.deleteWeTagGroupByIds(id.split(",")); this.baseMapper.deleteWeTagGroupByIds(id.split(","));
} }
@Override @Override
...@@ -347,24 +329,10 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr ...@@ -347,24 +329,10 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
List<WeTagGroup> tagGroupsList = new ArrayList<>(); List<WeTagGroup> tagGroupsList = new ArrayList<>();
WeTagGroup weTagGroup = new WeTagGroup(); WeTagGroup weTagGroup = new WeTagGroup();
tag_group.stream().forEach(k -> { tag_group.stream().forEach(k -> {
weTagGroup.setCreateBy(SecurityUtils.getUsername()); weTagGroup.setCreateBy("sys");
weTagGroup.setGourpName(k.getGroup_name()); weTagGroup.setGourpName(k.getGroup_name());
weTagGroup.setGroupId(k.getGroup_id()); weTagGroup.setGroupId(k.getGroup_id());
weTagGroup.setStatus(k.getDeleted()==true?"0":"2");
tagGroupsList.add(weTagGroup); tagGroupsList.add(weTagGroup);
List<WeCropTagDto> tag = k.getTag();
if (CollectionUtil.isNotEmpty(tag)) {
List<WeTag> weTags = new ArrayList<>();
WeTag weTag = new WeTag();
tag.stream().forEach(v -> {
weTag.setTagId(v.getId());
weTag.setGroupId(k.getGroup_id());
weTag.setName(v.getName());
weTag.setStatus(v.getDeleted()==true?"0":"2");
weTags.add(weTag);
});
iWeTagService.saveOrUpdateBatch(weTags);
}
}); });
this.saveOrUpdateBatch(tagGroupsList); this.saveOrUpdateBatch(tagGroupsList);
} }
......
...@@ -138,17 +138,7 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements ...@@ -138,17 +138,7 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements
WeCropGroupTagListDto weCropGroupTagListDto = weCropTagClient.getCorpTagListByTagIds(WeFindCropTagParam.builder().tag_id(tagId.split(",")).build()); WeCropGroupTagListDto weCropGroupTagListDto = weCropTagClient.getCorpTagListByTagIds(WeFindCropTagParam.builder().tag_id(tagId.split(",")).build());
List<WeCropGroupTagDto> tag_group = weCropGroupTagListDto.getTag_group(); List<WeCropGroupTagDto> tag_group = weCropGroupTagListDto.getTag_group();
if (CollectionUtil.isNotEmpty(tag_group)) { if (CollectionUtil.isNotEmpty(tag_group)) {
List<WeTagGroup> tagGroupsList = new ArrayList<>();
tag_group.stream().forEach(k -> { tag_group.stream().forEach(k -> {
WeTagGroup tagGroupInfo = this.weTagGroupService.getOne(new LambdaQueryWrapper<WeTagGroup>()
.eq(WeTagGroup::getGroupId, k.getGroup_id()));
if (tagGroupInfo != null) {
WeTagGroup weTagGroup = new WeTagGroup();
weTagGroup.setCreateBy(SecurityUtils.getUsername());
weTagGroup.setGourpName(k.getGroup_name());
weTagGroup.setGroupId(k.getGroup_id());
tagGroupsList.add(weTagGroup);
}
List<WeCropTagDto> tag = k.getTag(); List<WeCropTagDto> tag = k.getTag();
if (CollectionUtil.isNotEmpty(tag)) { if (CollectionUtil.isNotEmpty(tag)) {
List<WeTag> weTags = new ArrayList<>(); List<WeTag> weTags = new ArrayList<>();
...@@ -156,7 +146,7 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements ...@@ -156,7 +146,7 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements
WeTag tagInfo = this.getOne(new LambdaQueryWrapper<WeTag>() WeTag tagInfo = this.getOne(new LambdaQueryWrapper<WeTag>()
.eq(WeTag::getGroupId, k.getGroup_id()) .eq(WeTag::getGroupId, k.getGroup_id())
.eq(WeTag::getTagId, v.getId())); .eq(WeTag::getTagId, v.getId()));
if (tagInfo != null) { if (tagInfo == null) {
WeTag weTag = new WeTag(); WeTag weTag = new WeTag();
weTag.setTagId(v.getId()); weTag.setTagId(v.getId());
weTag.setGroupId(k.getGroup_id()); weTag.setGroupId(k.getGroup_id());
...@@ -167,7 +157,6 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements ...@@ -167,7 +157,6 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements
this.saveBatch(weTags); this.saveBatch(weTags);
} }
}); });
weTagGroupService.saveBatch(tagGroupsList);
} }
} }
} }
...@@ -183,13 +172,7 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements ...@@ -183,13 +172,7 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements
WeCropGroupTagListDto weCropGroupTagListDto = weCropTagClient.getCorpTagListByTagIds(WeFindCropTagParam.builder().tag_id(tagId.split(",")).build()); WeCropGroupTagListDto weCropGroupTagListDto = weCropTagClient.getCorpTagListByTagIds(WeFindCropTagParam.builder().tag_id(tagId.split(",")).build());
List<WeCropGroupTagDto> tag_group = weCropGroupTagListDto.getTag_group(); List<WeCropGroupTagDto> tag_group = weCropGroupTagListDto.getTag_group();
if (CollectionUtil.isNotEmpty(tag_group)) { if (CollectionUtil.isNotEmpty(tag_group)) {
List<WeTagGroup> tagGroupsList = new ArrayList<>();
tag_group.stream().forEach(k -> { tag_group.stream().forEach(k -> {
WeTagGroup weTagGroup = new WeTagGroup();
weTagGroup.setCreateBy(SecurityUtils.getUsername());
weTagGroup.setGourpName(k.getGroup_name());
weTagGroup.setGroupId(k.getGroup_id());
tagGroupsList.add(weTagGroup);
List<WeCropTagDto> tag = k.getTag(); List<WeCropTagDto> tag = k.getTag();
if (CollectionUtil.isNotEmpty(tag)) { if (CollectionUtil.isNotEmpty(tag)) {
List<WeTag> weTags = new ArrayList<>(); List<WeTag> weTags = new ArrayList<>();
...@@ -203,7 +186,6 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements ...@@ -203,7 +186,6 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements
this.saveOrUpdateBatch(weTags); this.saveOrUpdateBatch(weTags);
} }
}); });
weTagGroupService.saveOrUpdateBatch(tagGroupsList);
} }
} }
} }
......
...@@ -54,12 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -54,12 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteWeTagById" parameterType="String"> <delete id="deleteWeTagById">
uddate we_tag set status=2 where tag_id = #{id} update we_tag set status=2 where tag_id = #{id}
</delete> </delete>
<delete id="deleteWeTagByIds"> <delete id="deleteWeTagByIds">
uddate we_tag set status=2 where tag_id in update we_tag set status=2 where tag_id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!