Commit 6a1a3616 by 孙喜旺

标签回调通知修改

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