Commit 824e5770 by fudahua

会员标签同步-更新状态

parent 3d750c2a
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2021/7/27.
*/
public enum QywxTagRelationSyncFlagEnum {
DEL(0, "删除"),
PRE(1, "预处理"),
SUCCESS(2, "成功"),
FAIL(3, "失败");
private int type;
private String name;
QywxTagRelationSyncFlagEnum(int type, String name) {
this.type = type;
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -95,4 +95,13 @@ public interface QywxTagRelationMapper {
* @return
*/
TabQywxTagRelation getQywxTagByQywxTagItemId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("qywxTagItemId") String qywxTagItemId);
/**
* 更新标签同步状态
*
* @param wxEnterpriseId
* @param memberTagId
* @return
*/
int changeRelationSyncFlag(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("memberTagId") String memberTagId, @Param("syncFlag") Integer syncFlag);
}
\ No newline at end of file
......@@ -198,4 +198,12 @@ public interface QywxTagService {
public boolean saveQywxTagOrTagItemName(String id, String name, Integer relationType);
/**
* 更新名称
*
* @return
*/
public boolean changeRelationSyncFlagByMemberTagId(String wxEnterpriseId, String memberTagId, Integer syncFlag);
}
......@@ -247,4 +247,10 @@ public class QywxTagServiceImpl implements QywxTagService {
}
return true;
}
@Override
public boolean changeRelationSyncFlagByMemberTagId(String wxEnterpriseId, String memberTagId, Integer syncFlag) {
qywxTagRelationMapper.changeRelationSyncFlag(wxEnterpriseId, memberTagId, syncFlag);
return true;
}
}
......@@ -8,6 +8,7 @@ import com.gic.haoban.app.customer.dto.SearchDataDTO;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.QywxTagRelationSyncFlagEnum;
import com.gic.haoban.manage.api.enums.QywxTagRelationTypeEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.QywxTagApiService;
......@@ -127,14 +128,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
//保存关联关系
saveRelation(wxEnterpriseId, enterpriseId, infoDTO, items, savePair);
return ret;
// String taskId = dealSyncOperationApiService.createTagTask(wxEnterpriseId, "-1", infoDTO.getMemberTagId());
// if (null == taskId) {
// logger.info("标签不能重复执行");
// throw new RuntimeException("标签不能重复执行:" + infoDTO.getQywxGroupName());
// }
// List<String> tagItemIds = items.stream().map(dto -> dto.getQywxTagItemId()).collect(Collectors.toList());
// dealSyncOperationApiService.dealTagTask(wxEnterpriseId, enterpriseId, tagItemIds, taskId);
}
/**
......@@ -159,7 +152,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
groupRelation.setQywxTagId(groupKey.getQywxTagId());
groupRelation.setRelationType(QywxTagRelationTypeEnum.TAG_GROUP.getType());
groupRelation.setStatusFlag(1);
groupRelation.setSyncFlag(1);
groupRelation.setSyncFlag(QywxTagRelationSyncFlagEnum.PRE.getType());
groupRelation.setQywxTagRelationId(ToolUtil.randomUUID());
groupRelation.setWxEnterpriseId(wxEnterpriseId);
saveRelationList.add(groupRelation);
......@@ -169,7 +162,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
TabQywxTagRelation itemRelation = new TabQywxTagRelation();
itemRelation.setWxEnterpriseId(wxEnterpriseId);
itemRelation.setQywxTagRelationId(ToolUtil.randomUUID());
itemRelation.setSyncFlag(1);
itemRelation.setSyncFlag(QywxTagRelationSyncFlagEnum.PRE.getType());
itemRelation.setStatusFlag(1);
itemRelation.setRelationType(QywxTagRelationTypeEnum.TAG_ITEM.getType());
itemRelation.setQywxTagId(groupKey.getQywxTagId());
......@@ -800,16 +793,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Override
public void changeQywxTagStatus(String memberTagId, String wxEnterpriseId, int status) {
List<TabQywxTagRelation> tagRelations = qywxTagService.listQywxTagRelationByMemberTagId(wxEnterpriseId, memberTagId);
if (CollectionUtils.isEmpty(tagRelations)) {
return;
}
TabQywxTagRelation tagRelation = tagRelations.stream().filter(dto -> dto.getRelationType() == QywxTagRelationTypeEnum.TAG_GROUP.getType()).findFirst().orElse(null);
if (null == tagRelation) {
return;
}
qywxTagService.changeTagRelationStatus(tagRelation.getQywxTagRelationId(), status);
return;
qywxTagService.changeRelationSyncFlagByMemberTagId(wxEnterpriseId, memberTagId, status);
}
@Override
......
......@@ -192,7 +192,6 @@
<include refid="Base_Column_List"/>
from tab_haoban_qywx_tag_relation
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and sync_flag=1
and status_flag=1
</select>
......@@ -206,7 +205,6 @@
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</if>
and status_flag=1
and sync_flag=1
</select>
<select id="getQywxTagRelationByTagItemId" parameterType="java.lang.String" resultMap="BaseResultMap">
......@@ -216,7 +214,6 @@
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and tag_item_id = #{tagItemId,jdbcType=VARCHAR}
and status_flag=1
and sync_flag=1
</select>
<update id="delByMemberTagId">
......@@ -236,7 +233,6 @@
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
and status_flag=1
and sync_flag=1
</select>
<select id="getQywxGroupByQywxTagId" resultMap="BaseResultMap">
......@@ -247,7 +243,6 @@
and qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
and relation_type=0
and status_flag=1
and sync_flag=1
</select>
<select id="getQywxTagByQywxTagItemId" resultMap="BaseResultMap">
......@@ -258,6 +253,16 @@
and qywx_tag_item_id = #{qywxTagId,jdbcType=VARCHAR}
and relation_type=1
and status_flag=1
and sync_flag=1
</select>
<update id="changeRelationSyncFlag">
UPDATE tab_haoban_qywx_tag_relation
SET
sync_flag=#{syncFlag},
update_time=now()
where
wx_enterprise_id = #{wxEnterpriseId}
and member_tag_id = #{memberTagId,jdbcType=VARCHAR}
and status_flag=1
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment