Commit f41a0755 by fudahua

企业微信同步

parent cc483551
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* 企业微信标签
*
* @author fdh
*/
public class QywxTagInfoDTO implements Serializable {
/**
*
*/
private String qywxTagId;
/**
* 企业微信id
*/
private String wxEnterpriseId;
/**
* 企业微信对应的标签组id
*/
private String qywxGroupKey;
/**
* 标签组名称
*/
private String qywxGroupName;
/**
* 排序
*/
private Long order;
/**
* 0删除 1正常
*/
private Integer statusFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
/**
* This method returns the value of the database column tab_haoban_qywx_tag.qywx_tag_id
*
* @return the value of tab_haoban_qywx_tag.qywx_tag_id
*/
public String getQywxTagId() {
return qywxTagId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag.qywx_tag_id
*
* @param qywxTagId the value for tab_haoban_qywx_tag.qywx_tag_id
*/
public void setQywxTagId(String qywxTagId) {
this.qywxTagId = qywxTagId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag.wx_enterprise_id
*
* @return the value of tab_haoban_qywx_tag.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_qywx_tag.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag.qywx_group_key
*
* @return the value of tab_haoban_qywx_tag.qywx_group_key
*/
public String getQywxGroupKey() {
return qywxGroupKey;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag.qywx_group_key
*
* @param qywxGroupKey the value for tab_haoban_qywx_tag.qywx_group_key
*/
public void setQywxGroupKey(String qywxGroupKey) {
this.qywxGroupKey = qywxGroupKey;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag.qywx_group_name
*
* @return the value of tab_haoban_qywx_tag.qywx_group_name
*/
public String getQywxGroupName() {
return qywxGroupName;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag.qywx_group_name
*
* @param qywxGroupName the value for tab_haoban_qywx_tag.qywx_group_name
*/
public void setQywxGroupName(String qywxGroupName) {
this.qywxGroupName = qywxGroupName;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag.order
*
* @return the value of tab_haoban_qywx_tag.order
*/
public Long getOrder() {
return order;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag.order
*
* @param order the value for tab_haoban_qywx_tag.order
*/
public void setOrder(Long order) {
this.order = order;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag.status_flag
*
* @return the value of tab_haoban_qywx_tag.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag.status_flag
*
* @param statusFlag the value for tab_haoban_qywx_tag.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag.create_time
*
* @return the value of tab_haoban_qywx_tag.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag.create_time
*
* @param createTime the value for tab_haoban_qywx_tag.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag.update_time
*
* @return the value of tab_haoban_qywx_tag.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag.update_time
*
* @param updateTime the value for tab_haoban_qywx_tag.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* 企业微信标签项
*
* @author fdh
*/
public class QywxTagItemDTO implements Serializable {
/**
*
*/
private String qywxTagItemId;
/**
*
*/
private String wxEnterpriseId;
/**
* 关联的企业微信标签id
*/
private String qywxTagId;
/**
* 企业微信标签组对应的id
*/
private String qywxGroupKey;
/**
* 企业微信标签项对应的id
*/
private String qywxTagKey;
/**
* 名称
*/
private String qywxTagName;
/**
* 排序
*/
private Long order;
/**
* 状态
*/
private Integer statusFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.qywx_tag_item_id
*
* @return the value of tab_haoban_qywx_tag_item.qywx_tag_item_id
*/
public String getQywxTagItemId() {
return qywxTagItemId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.qywx_tag_item_id
*
* @param qywxTagItemId the value for tab_haoban_qywx_tag_item.qywx_tag_item_id
*/
public void setQywxTagItemId(String qywxTagItemId) {
this.qywxTagItemId = qywxTagItemId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.wx_enterprise_id
*
* @return the value of tab_haoban_qywx_tag_item.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_qywx_tag_item.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.qywx_tag_id
*
* @return the value of tab_haoban_qywx_tag_item.qywx_tag_id
*/
public String getQywxTagId() {
return qywxTagId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.qywx_tag_id
*
* @param qywxTagId the value for tab_haoban_qywx_tag_item.qywx_tag_id
*/
public void setQywxTagId(String qywxTagId) {
this.qywxTagId = qywxTagId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.qywx_group_key
*
* @return the value of tab_haoban_qywx_tag_item.qywx_group_key
*/
public String getQywxGroupKey() {
return qywxGroupKey;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.qywx_group_key
*
* @param qywxGroupKey the value for tab_haoban_qywx_tag_item.qywx_group_key
*/
public void setQywxGroupKey(String qywxGroupKey) {
this.qywxGroupKey = qywxGroupKey;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.qywx_tag_key
*
* @return the value of tab_haoban_qywx_tag_item.qywx_tag_key
*/
public String getQywxTagKey() {
return qywxTagKey;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.qywx_tag_key
*
* @param qywxTagKey the value for tab_haoban_qywx_tag_item.qywx_tag_key
*/
public void setQywxTagKey(String qywxTagKey) {
this.qywxTagKey = qywxTagKey;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.qywx_tag_name
*
* @return the value of tab_haoban_qywx_tag_item.qywx_tag_name
*/
public String getQywxTagName() {
return qywxTagName;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.qywx_tag_name
*
* @param qywxTagName the value for tab_haoban_qywx_tag_item.qywx_tag_name
*/
public void setQywxTagName(String qywxTagName) {
this.qywxTagName = qywxTagName;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.order
*
* @return the value of tab_haoban_qywx_tag_item.order
*/
public Long getOrder() {
return order;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.order
*
* @param order the value for tab_haoban_qywx_tag_item.order
*/
public void setOrder(Long order) {
this.order = order;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.status_flag
*
* @return the value of tab_haoban_qywx_tag_item.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.status_flag
*
* @param statusFlag the value for tab_haoban_qywx_tag_item.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.create_time
*
* @return the value of tab_haoban_qywx_tag_item.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.create_time
*
* @param createTime the value for tab_haoban_qywx_tag_item.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.update_time
*
* @return the value of tab_haoban_qywx_tag_item.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.update_time
*
* @param updateTime the value for tab_haoban_qywx_tag_item.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
*
* @author fdh
*/
public class QywxTagRelationDTO implements Serializable {
/**
*
*/
private String qywxTagRelationId;
/**
*
*/
private String wxEnterpriseId;
/**
*
*/
private String enterpriseId;
/**
* 标签id
*/
private String memberTagId;
/**
* 导购标签项id
*/
private String tagItemId;
/**
* 0 标签 1标签项
*/
private Integer relationType;
/**
* 同步状态 0 不同步 1同步
*/
private Integer syncFlag;
/**
* 排序
*/
private Long order;
/**
* 企业微信标签id
*/
private String qywxTagId;
/**
* 企业微信标签项id
*/
private String qywxTagItemId;
/**
* 0删除 1正常
*/
private Integer statusFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.qywx_tag_relation_id
*
* @return the value of tab_haoban_qywx_tag_relation.qywx_tag_relation_id
*/
public String getQywxTagRelationId() {
return qywxTagRelationId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.qywx_tag_relation_id
*
* @param qywxTagRelationId the value for tab_haoban_qywx_tag_relation.qywx_tag_relation_id
*/
public void setQywxTagRelationId(String qywxTagRelationId) {
this.qywxTagRelationId = qywxTagRelationId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.wx_enterprise_id
*
* @return the value of tab_haoban_qywx_tag_relation.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_qywx_tag_relation.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.enterprise_id
*
* @return the value of tab_haoban_qywx_tag_relation.enterprise_id
*/
public String getEnterpriseId() {
return enterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.enterprise_id
*
* @param enterpriseId the value for tab_haoban_qywx_tag_relation.enterprise_id
*/
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.member_tag_id
*
* @return the value of tab_haoban_qywx_tag_relation.member_tag_id
*/
public String getMemberTagId() {
return memberTagId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.member_tag_id
*
* @param memberTagId the value for tab_haoban_qywx_tag_relation.member_tag_id
*/
public void setMemberTagId(String memberTagId) {
this.memberTagId = memberTagId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.tag_item_id
*
* @return the value of tab_haoban_qywx_tag_relation.tag_item_id
*/
public String getTagItemId() {
return tagItemId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.tag_item_id
*
* @param tagItemId the value for tab_haoban_qywx_tag_relation.tag_item_id
*/
public void setTagItemId(String tagItemId) {
this.tagItemId = tagItemId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.relation_type
*
* @return the value of tab_haoban_qywx_tag_relation.relation_type
*/
public Integer getRelationType() {
return relationType;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.relation_type
*
* @param relationType the value for tab_haoban_qywx_tag_relation.relation_type
*/
public void setRelationType(Integer relationType) {
this.relationType = relationType;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.sync_flag
*
* @return the value of tab_haoban_qywx_tag_relation.sync_flag
*/
public Integer getSyncFlag() {
return syncFlag;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.sync_flag
*
* @param syncFlag the value for tab_haoban_qywx_tag_relation.sync_flag
*/
public void setSyncFlag(Integer syncFlag) {
this.syncFlag = syncFlag;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.order
*
* @return the value of tab_haoban_qywx_tag_relation.order
*/
public Long getOrder() {
return order;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.order
*
* @param order the value for tab_haoban_qywx_tag_relation.order
*/
public void setOrder(Long order) {
this.order = order;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.qywx_tag_id
*
* @return the value of tab_haoban_qywx_tag_relation.qywx_tag_id
*/
public String getQywxTagId() {
return qywxTagId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.qywx_tag_id
*
* @param qywxTagId the value for tab_haoban_qywx_tag_relation.qywx_tag_id
*/
public void setQywxTagId(String qywxTagId) {
this.qywxTagId = qywxTagId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.qywx_tag_item_id
*
* @return the value of tab_haoban_qywx_tag_relation.qywx_tag_item_id
*/
public String getQywxTagItemId() {
return qywxTagItemId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.qywx_tag_item_id
*
* @param qywxTagItemId the value for tab_haoban_qywx_tag_relation.qywx_tag_item_id
*/
public void setQywxTagItemId(String qywxTagItemId) {
this.qywxTagItemId = qywxTagItemId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.status_flag
*
* @return the value of tab_haoban_qywx_tag_relation.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.status_flag
*
* @param statusFlag the value for tab_haoban_qywx_tag_relation.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.create_time
*
* @return the value of tab_haoban_qywx_tag_relation.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.create_time
*
* @param createTime the value for tab_haoban_qywx_tag_relation.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.update_time
*
* @return the value of tab_haoban_qywx_tag_relation.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.update_time
*
* @param updateTime the value for tab_haoban_qywx_tag_relation.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.enums;
/**
* Created by hua on 2021/6/21.
*/
public enum QywxTagRelationTypeEnum {
TAG_GROUP(0, "标签组"),
TAG_ITEM(1, "标签项");
private int type;
private String name;
QywxTagRelationTypeEnum(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;
}
}
package com.gic.haoban.manage.api.service;
import com.gic.haoban.manage.api.dto.QywxTagInfoDTO;
import com.gic.haoban.manage.api.dto.QywxTagItemDTO;
import com.gic.haoban.manage.api.dto.QywxTagRelationDTO;
import java.util.List;
/**
* Created 2021/6/21.
*
* @author hua
*/
public interface QywxTagApiService {
/**
* 拉取企业微信标签
*
* @param wxEnterpriseId
*/
public void pullQywxTag(String wxEnterpriseId);
/**
* 同步会员导购标签到qywx
*
* @param infoDTO 标签
* @param items 标签项
*/
public void syncTagToQywx(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items);
/**
* 关闭同步
*
* @param wxEnterpriseId
* @param tagRelationId
*/
public void closeSync(String wxEnterpriseId, String tagRelationId);
/**
* 查询所有同步的标签
*
* @param wxEnterpriseId
* @return
*/
public List<QywxTagRelationDTO> listAllByWxEnterpriseId(String wxEnterpriseId);
}
...@@ -2,6 +2,9 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -2,6 +2,9 @@ package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabQywxTagItem; import com.gic.haoban.manage.service.entity.TabQywxTagItem;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper @Mapper
public interface QywxTagItemMapper { public interface QywxTagItemMapper {
...@@ -28,4 +31,31 @@ public interface QywxTagItemMapper { ...@@ -28,4 +31,31 @@ public interface QywxTagItemMapper {
/** /**
*/ */
int updateByPrimaryKey(TabQywxTagItem record); int updateByPrimaryKey(TabQywxTagItem record);
/**
* 根据id 获取标签项信息
*
* @param wxEnterpriseId
* @param qywxTagId
* @return
*/
List<TabQywxTagItem> listByQywxTagId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("qywxTagId") String qywxTagId);
/**
* 根据企业微信标签组key 获取标签项信息
*
* @param wxEnterpriseId
* @param qywxTagGroupKey
* @return
*/
List<TabQywxTagItem> listByQywxTagGroupKey(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("qywxTagGroupKey") String qywxTagGroupKey);
/**
* 根据企业微信标签组key 获取标签项信息
*
* @param wxEnterpriseId
* @param qywxTagGroupKey
* @return
*/
int delByQywxTagGroupKey(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("qywxTagGroupKey") String qywxTagGroupKey);
} }
\ No newline at end of file
...@@ -2,6 +2,9 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -2,6 +2,9 @@ package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabQywxTag; import com.gic.haoban.manage.service.entity.TabQywxTag;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper @Mapper
public interface QywxTagMapper { public interface QywxTagMapper {
...@@ -28,4 +31,22 @@ public interface QywxTagMapper { ...@@ -28,4 +31,22 @@ public interface QywxTagMapper {
/** /**
*/ */
int updateByPrimaryKey(TabQywxTag record); int updateByPrimaryKey(TabQywxTag record);
/**
* 查询企业微信的标签组 根据key
*
* @param wxEnterpriseId
* @param qywxTagGroupKey
* @return
*/
TabQywxTag getByQywxGroupKey(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("qywxTagGroupKey") String qywxTagGroupKey);
/**
* 删除企业微信标签
*
* @param wxEnterpriseId
* @param qywxTagGroupKey
* @return
*/
int delByGroupKey(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("qywxTagGroupKey") String qywxTagGroupKey);
} }
\ No newline at end of file
...@@ -2,6 +2,9 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -2,6 +2,9 @@ package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabQywxTagRelation; import com.gic.haoban.manage.service.entity.TabQywxTagRelation;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper @Mapper
public interface QywxTagRelationMapper { public interface QywxTagRelationMapper {
...@@ -28,4 +31,30 @@ public interface QywxTagRelationMapper { ...@@ -28,4 +31,30 @@ public interface QywxTagRelationMapper {
/** /**
*/ */
int updateByPrimaryKey(TabQywxTagRelation record); int updateByPrimaryKey(TabQywxTagRelation record);
/**
* 查询企业下所有同步的
*
* @param wxEnterpriseId
* @return
*/
List<TabQywxTagRelation> listBySyncStatus(String wxEnterpriseId);
/**
* 查询企业下所有同步的
*
* @param wxEnterpriseId
* @param memberTagId
* @return
*/
List<TabQywxTagRelation> listByTagId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("memberTagId") String memberTagId);
/**
* 删除同步信息
*
* @param wxEnterpriseId
* @param memberTagId
* @return
*/
int delByMemberTagId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("memberTagId") String memberTagId);
} }
\ No newline at end of file
...@@ -7,7 +7,6 @@ import java.util.Date; ...@@ -7,7 +7,6 @@ import java.util.Date;
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension * Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description: * Description:
* 企业微信标签 * 企业微信标签
*
* @author fdh * @author fdh
*/ */
public class TabQywxTag implements Serializable { public class TabQywxTag implements Serializable {
...@@ -17,27 +16,32 @@ public class TabQywxTag implements Serializable { ...@@ -17,27 +16,32 @@ public class TabQywxTag implements Serializable {
private String qywxTagId; private String qywxTagId;
/** /**
* 企业微信id * 企业微信id
*
*/ */
private String wxEnterpriseId; private String wxEnterpriseId;
/** /**
* 企业微信对应的标签组id * 企业微信对应的标签组id
*
*/ */
private String qywxGroupKey; private String qywxGroupKey;
/** /**
* 标签组名称 * 标签组名称
*
*/ */
private String qywxGroupName; private String qywxGroupName;
/** /**
* 排序 * 排序
*
*/ */
private Long order; private Long order;
/** /**
* 0删除 1正常 * 0删除 1正常
*
*/ */
private Integer statusFlag; private Integer statusFlag;
......
...@@ -7,7 +7,6 @@ import java.util.Date; ...@@ -7,7 +7,6 @@ import java.util.Date;
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension * Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description: * Description:
* 企业微信标签项 * 企业微信标签项
*
* @author fdh * @author fdh
*/ */
public class TabQywxTagItem implements Serializable { public class TabQywxTagItem implements Serializable {
...@@ -22,27 +21,37 @@ public class TabQywxTagItem implements Serializable { ...@@ -22,27 +21,37 @@ public class TabQywxTagItem implements Serializable {
private String wxEnterpriseId; private String wxEnterpriseId;
/** /**
* 企业微信标签组对应的id * 关联的企业微信标签id
*/
private String qywxTagId;
/**
* 企业微信标签组对应的id
*
*/ */
private String qywxGroupKey; private String qywxGroupKey;
/** /**
* 企业微信标签项对应的id * 企业微信标签项对应的id
*
*/ */
private String qywxTagKey; private String qywxTagKey;
/** /**
* 名称 * 名称
*
*/ */
private String qywxTagName; private String qywxTagName;
/** /**
* 排序 * 排序
*
*/ */
private Long order; private Long order;
/** /**
* 状态 * 状态
*
*/ */
private Integer statusFlag; private Integer statusFlag;
...@@ -97,6 +106,24 @@ public class TabQywxTagItem implements Serializable { ...@@ -97,6 +106,24 @@ public class TabQywxTagItem implements Serializable {
} }
/** /**
* This method returns the value of the database column tab_haoban_qywx_tag_item.qywx_tag_id
*
* @return the value of tab_haoban_qywx_tag_item.qywx_tag_id
*/
public String getQywxTagId() {
return qywxTagId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_item.qywx_tag_id
*
* @param qywxTagId the value for tab_haoban_qywx_tag_item.qywx_tag_id
*/
public void setQywxTagId(String qywxTagId) {
this.qywxTagId = qywxTagId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_item.qywx_group_key * This method returns the value of the database column tab_haoban_qywx_tag_item.qywx_group_key
* *
* @return the value of tab_haoban_qywx_tag_item.qywx_group_key * @return the value of tab_haoban_qywx_tag_item.qywx_group_key
......
...@@ -6,7 +6,7 @@ import java.util.Date; ...@@ -6,7 +6,7 @@ import java.util.Date;
/** /**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension * Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description: * Description:
* *
* @author fdh * @author fdh
*/ */
public class TabQywxTagRelation implements Serializable { public class TabQywxTagRelation implements Serializable {
...@@ -26,27 +26,48 @@ public class TabQywxTagRelation implements Serializable { ...@@ -26,27 +26,48 @@ public class TabQywxTagRelation implements Serializable {
private String enterpriseId; private String enterpriseId;
/** /**
* 标签id * 标签id
*
*/ */
private String memberTagId; private String memberTagId;
/** /**
* 同步状态 0 不同步 1同步 * 导购标签项id
*/
private String tagItemId;
/**
* 0 标签 1标签项
*/
private Integer relationType;
/**
* 同步状态 0 不同步 1同步
*
*/ */
private Integer syncFlag; private Integer syncFlag;
/** /**
* 排序 * 排序
*
*/ */
private Long order; private Long order;
/** /**
* 企业微信标签id * 企业微信标签id
*
*/ */
private String qywxTagId; private String qywxTagId;
/** /**
* 0删除 1正常 * 企业微信标签项id
*
*/
private String qywxTagItemId;
/**
* 0删除 1正常
*
*/ */
private Integer statusFlag; private Integer statusFlag;
...@@ -137,6 +158,42 @@ public class TabQywxTagRelation implements Serializable { ...@@ -137,6 +158,42 @@ public class TabQywxTagRelation implements Serializable {
} }
/** /**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.tag_item_id
*
* @return the value of tab_haoban_qywx_tag_relation.tag_item_id
*/
public String getTagItemId() {
return tagItemId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.tag_item_id
*
* @param tagItemId the value for tab_haoban_qywx_tag_relation.tag_item_id
*/
public void setTagItemId(String tagItemId) {
this.tagItemId = tagItemId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.relation_type
*
* @return the value of tab_haoban_qywx_tag_relation.relation_type
*/
public Integer getRelationType() {
return relationType;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.relation_type
*
* @param relationType the value for tab_haoban_qywx_tag_relation.relation_type
*/
public void setRelationType(Integer relationType) {
this.relationType = relationType;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.sync_flag * This method returns the value of the database column tab_haoban_qywx_tag_relation.sync_flag
* *
* @return the value of tab_haoban_qywx_tag_relation.sync_flag * @return the value of tab_haoban_qywx_tag_relation.sync_flag
...@@ -191,6 +248,24 @@ public class TabQywxTagRelation implements Serializable { ...@@ -191,6 +248,24 @@ public class TabQywxTagRelation implements Serializable {
} }
/** /**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.qywx_tag_item_id
*
* @return the value of tab_haoban_qywx_tag_relation.qywx_tag_item_id
*/
public String getQywxTagItemId() {
return qywxTagItemId;
}
/**
* This method sets the value of the database column tab_haoban_qywx_tag_relation.qywx_tag_item_id
*
* @param qywxTagItemId the value for tab_haoban_qywx_tag_relation.qywx_tag_item_id
*/
public void setQywxTagItemId(String qywxTagItemId) {
this.qywxTagItemId = qywxTagItemId;
}
/**
* This method returns the value of the database column tab_haoban_qywx_tag_relation.status_flag * This method returns the value of the database column tab_haoban_qywx_tag_relation.status_flag
* *
* @return the value of tab_haoban_qywx_tag_relation.status_flag * @return the value of tab_haoban_qywx_tag_relation.status_flag
......
package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.api.dto.QywxTagInfoDTO;
import com.gic.haoban.manage.api.dto.QywxTagItemDTO;
import com.gic.haoban.manage.api.dto.QywxTagRelationDTO;
import com.gic.haoban.manage.service.entity.TabQywxTag;
import com.gic.haoban.manage.service.entity.TabQywxTagItem;
import com.gic.haoban.manage.service.entity.TabQywxTagRelation;
import com.gic.wechat.api.dto.qywx.QywxTagGroupDTO;
import java.util.List;
/**
* Created 2021/6/21.
*
* @author hua
*/
public interface QywxTagService {
/**
* 根据标签组key 查询详情
*
* @param wxEnterpriseId
* @param groupKey
* @return
*/
public TabQywxTag getQywxTagByQywxGroupKey(String wxEnterpriseId, String groupKey);
/**
* 根据id 查询列表
*
* @param wxEnterpriseId
* @param qywxTagId
* @return
*/
public List<TabQywxTagItem> listByQywxTagId(String wxEnterpriseId, String qywxTagId);
/**
* 查询所有同步的企业微信标签
*
* @param wxEnterpriseId
* @return
*/
public List<TabQywxTagRelation> listAllQywxRelation(String wxEnterpriseId);
/**
* 保存企业微信的标签
*
* @param wxEnterpriseId
* @param groupDTO
* @return
*/
public void saveQywxTagByQywxGroupKey(String wxEnterpriseId, QywxTagGroupDTO groupDTO);
/**
* 保存企业微信的标签
*
* @param wxEnterpriseId
* @return
*/
public void saveQywxTagByQywxGroupKey(String wxEnterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items);
/**
* @param wxEnterpriseId
* @param tagId
* @return
*/
public boolean sync(String wxEnterpriseId, String tagId);
/**
* 关闭同步
*
* @param wxEnterpriseId
* @param memberTagId
* @return
*/
public boolean closeSync(String wxEnterpriseId, String memberTagId);
/**
* 保存标签
*
* @param list
* @return
*/
public boolean saveQywxRelation(List<TabQywxTagRelation> list);
/**
* 根据id 查询
*
* @param relationId
* @return
*/
public TabQywxTagRelation getQywxTagRelationById(String relationId);
/**
* 根据id 查询
*
* @param memberTagId
* @return
*/
public TabQywxTagRelation getQywxTagRelationByMemberTagId(String memberTagId);
/**
* 删除企业微信的标签
*
* @param groupKey
* @param wxEnterpriseId
* @return
*/
public boolean delQywxTag(String groupKey, String wxEnterpriseId);
}
package com.gic.haoban.manage.service.service.impl;
import com.gic.commons.util.ToolUtil;
import com.gic.haoban.manage.api.dto.QywxTagInfoDTO;
import com.gic.haoban.manage.api.dto.QywxTagItemDTO;
import com.gic.haoban.manage.service.dao.mapper.QywxTagItemMapper;
import com.gic.haoban.manage.service.dao.mapper.QywxTagMapper;
import com.gic.haoban.manage.service.dao.mapper.QywxTagRelationMapper;
import com.gic.haoban.manage.service.entity.TabQywxTag;
import com.gic.haoban.manage.service.entity.TabQywxTagItem;
import com.gic.haoban.manage.service.entity.TabQywxTagRelation;
import com.gic.haoban.manage.service.service.QywxTagService;
import com.gic.wechat.api.dto.qywx.QywxTagDTO;
import com.gic.wechat.api.dto.qywx.QywxTagGroupDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* Created 2021/6/21.
*
* @author hua
*/
@Service
public class QywxTagServiceImpl implements QywxTagService {
@Autowired
private QywxTagMapper qywxTagMapper;
@Autowired
private QywxTagItemMapper qywxTagItemMapper;
@Autowired
private QywxTagRelationMapper qywxTagRelationMapper;
@Override
public TabQywxTag getQywxTagByQywxGroupKey(String wxEnterpriseId, String groupKey) {
return qywxTagMapper.getByQywxGroupKey(wxEnterpriseId, groupKey);
}
@Override
public List<TabQywxTagItem> listByQywxTagId(String wxEnterpriseId, String qywxTagId) {
return qywxTagItemMapper.listByQywxTagId(wxEnterpriseId, qywxTagId);
}
@Override
public List<TabQywxTagRelation> listAllQywxRelation(String wxEnterpriseId) {
return qywxTagRelationMapper.listBySyncStatus(wxEnterpriseId);
}
@Override
public void saveQywxTagByQywxGroupKey(String wxEnterpriseId, QywxTagGroupDTO groupDTO) {
//判断保存 分组
TabQywxTag qywxTag = this.getQywxTagByQywxGroupKey(wxEnterpriseId, groupDTO.getGroupId());
if (null == qywxTag) {
qywxTag = new TabQywxTag();
qywxTag.setOrder(groupDTO.getOrder());
qywxTag.setCreateTime(new Date());
qywxTag.setUpdateTime(new Date());
qywxTag.setQywxGroupKey(groupDTO.getGroupId());
qywxTag.setQywxGroupName(groupDTO.getGroupName());
qywxTag.setQywxTagId(ToolUtil.randomUUID());
qywxTag.setStatusFlag(1);
qywxTag.setWxEnterpriseId(wxEnterpriseId);
qywxTagMapper.insert(qywxTag);
} else {
qywxTag.setQywxGroupName(groupDTO.getGroupName());
qywxTag.setOrder(groupDTO.getOrder());
qywxTag.setUpdateTime(new Date());
qywxTagMapper.updateByPrimaryKeySelective(qywxTag);
}
List<QywxTagDTO> dtos = groupDTO.getTag();
if (CollectionUtils.isEmpty(dtos)) {
return;
}
Map<String, TabQywxTagItem> itemMap = new HashMap<>();
List<TabQywxTagItem> orgItems = this.listByQywxTagId(wxEnterpriseId, qywxTag.getQywxTagId());
if (!CollectionUtils.isEmpty(orgItems)) {
itemMap = orgItems.stream().collect(Collectors.toMap(tab -> tab.getQywxTagKey(), dto -> dto));
}
List<TabQywxTagItem> items = new ArrayList<>();
//判断保存标签项
for (QywxTagDTO tagItem : dtos) {
TabQywxTagItem qywxTagItem = itemMap.get(tagItem.getId());
if (qywxTagItem == null) {
qywxTagItem = new TabQywxTagItem();
qywxTagItem.setQywxGroupKey(qywxTag.getQywxGroupKey());
qywxTagItem.setCreateTime(new Date());
qywxTagItem.setOrder(tagItem.getOrder());
qywxTagItem.setQywxTagId(qywxTag.getQywxTagId());
qywxTagItem.setQywxTagItemId(ToolUtil.randomUUID());
qywxTagItem.setQywxTagKey(tagItem.getId());
qywxTagItem.setQywxTagName(tagItem.getName());
qywxTagItem.setStatusFlag(1);
qywxTagItem.setUpdateTime(new Date());
qywxTagItem.setWxEnterpriseId(wxEnterpriseId);
qywxTagItemMapper.insert(qywxTagItem);
} else {
qywxTagItem.setQywxTagName(tagItem.getName());
qywxTagItem.setOrder(tagItem.getOrder());
qywxTagItem.setUpdateTime(new Date());
qywxTagItemMapper.updateByPrimaryKeySelective(qywxTagItem);
}
items.add(qywxTagItem);
}
}
@Override
public void saveQywxTagByQywxGroupKey(String wxEnterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) {
infoDTO.setQywxTagId(ToolUtil.randomUUID());
infoDTO.setCreateTime(new Date());
infoDTO.setStatusFlag(1);
infoDTO.setWxEnterpriseId(wxEnterpriseId);
infoDTO.setUpdateTime(new Date());
infoDTO.setStatusFlag(1);
}
@Override
public boolean sync(String wxEnterpriseId, String tagId) {
return false;
}
@Override
public boolean closeSync(String wxEnterpriseId, String memberTagId) {
qywxTagRelationMapper.delByMemberTagId(wxEnterpriseId, memberTagId);
return true;
}
@Override
public boolean saveQywxRelation(List<TabQywxTagRelation> list) {
list.forEach(dto -> {
dto.setCreateTime(new Date());
dto.setUpdateTime(new Date());
qywxTagRelationMapper.insert(dto);
});
return true;
}
@Override
public TabQywxTagRelation getQywxTagRelationById(String relationId) {
return qywxTagRelationMapper.selectByPrimaryKey(relationId);
}
@Override
public boolean delQywxTag(String groupKey, String wxEnterpriseId) {
qywxTagMapper.delByGroupKey(wxEnterpriseId, groupKey);
qywxTagItemMapper.delByQywxTagGroupKey(wxEnterpriseId, groupKey);
return true;
}
@Override
public TabQywxTagRelation getQywxTagRelationByMemberTagId(String memberTagId) {
return null;
}
}
package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.ToolUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.QywxTagInfoDTO;
import com.gic.haoban.manage.api.dto.QywxTagItemDTO;
import com.gic.haoban.manage.api.dto.QywxTagRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.QywxTagRelationTypeEnum;
import com.gic.haoban.manage.api.service.QywxTagApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabQywxTag;
import com.gic.haoban.manage.service.entity.TabQywxTagItem;
import com.gic.haoban.manage.service.entity.TabQywxTagRelation;
import com.gic.haoban.manage.service.service.QywxTagService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.wechat.api.dto.qywx.QywxTagDTO;
import com.gic.wechat.api.dto.qywx.QywxTagGroupDTO;
import com.gic.wechat.api.dto.qywx.response.QywxGetCorpTagListDTO;
import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Created 2021/6/21.
*
* @author hua
*/
@Service
public class QywxTagApiServiceImpl implements QywxTagApiService {
private static final Logger logger = getLogger(QywxTagApiServiceImpl.class);
@Autowired
private QywxUserApiService qywxUserApiService;
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Autowired
private Config config;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private QywxTagService qywxTagService;
@Override
public void pullQywxTag(String wxEnterpriseId) {
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (null == wxEnterpriseDTO) {
logger.info("企业标签所在企业不存在");
return;
}
QywxGetCorpTagListDTO corpTagListResp = qywxSuiteApiService.getCorpTagList(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), null, -1);
if (corpTagListResp.getErrorcode() != 0) {
logger.info("企业微信标签有问题:{}", wxEnterpriseId);
return;
}
//拉取保存所有标签
List<QywxTagGroupDTO> tagGroup = corpTagListResp.getTagGroup();
for (QywxTagGroupDTO groupDTO : tagGroup) {
qywxTagService.saveQywxTagByQywxGroupKey(wxEnterpriseId, groupDTO);
}
}
@Override
public void syncTagToQywx(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) {
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
//调用企业微信接口保存
QywxGetCorpTagListDTO resp = this.saveQywxTag(wxEnterpriseDTO, infoDTO, items);
if (resp.getErrorcode() != 0) {
logger.info("同步失败:{}", JSONObject.toJSONString(resp));
return;
}
//拉取保存所有标签
List<QywxTagGroupDTO> tagGroup = resp.getTagGroup();
QywxTagGroupDTO groupDTO = tagGroup.get(0);
//保存企业微信标签信息
qywxTagService.saveQywxTagByQywxGroupKey(wxEnterpriseId, groupDTO);
//保存关联关系
saveRelation(wxEnterpriseId, enterpriseId, infoDTO);
//todo 后续处理 比如同步会员标签等
}
/**
* 保存标签的关联关系
*
* @param wxEnterpriseId
* @param enterpriseId
* @param infoDTO
*/
private void saveRelation(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO) {
//设置关联关系
TabQywxTag groupKey = qywxTagService.getQywxTagByQywxGroupKey(wxEnterpriseId, infoDTO.getQywxGroupKey());
List<TabQywxTagItem> tabQywxTagItems = qywxTagService.listByQywxTagId(wxEnterpriseId, groupKey.getQywxTagId());
List<TabQywxTagRelation> saveRelationList = new ArrayList<>();
TabQywxTagRelation groupRelation = new TabQywxTagRelation();
groupRelation.setEnterpriseId(enterpriseId);
groupRelation.setMemberTagId(infoDTO.getQywxGroupKey());
groupRelation.setQywxTagId(groupKey.getQywxTagId());
groupRelation.setRelationType(QywxTagRelationTypeEnum.TAG_GROUP.getType());
groupRelation.setStatusFlag(1);
groupRelation.setSyncFlag(1);
groupRelation.setQywxTagRelationId(ToolUtil.randomUUID());
groupRelation.setWxEnterpriseId(wxEnterpriseId);
saveRelationList.add(groupRelation);
List<TabQywxTagRelation> itemList = tabQywxTagItems.stream().map(tab -> {
TabQywxTagRelation itemRelation = new TabQywxTagRelation();
itemRelation.setWxEnterpriseId(wxEnterpriseId);
itemRelation.setQywxTagRelationId(ToolUtil.randomUUID());
itemRelation.setSyncFlag(1);
itemRelation.setStatusFlag(1);
itemRelation.setRelationType(QywxTagRelationTypeEnum.TAG_ITEM.getType());
itemRelation.setQywxTagId(groupKey.getQywxTagId());
itemRelation.setMemberTagId(groupKey.getQywxGroupKey());
itemRelation.setEnterpriseId(enterpriseId);
itemRelation.setQywxTagItemId(tab.getQywxTagItemId());
itemRelation.setTagItemId(tab.getQywxTagKey());
return itemRelation;
}).collect(Collectors.toList());
saveRelationList.addAll(itemList);
qywxTagService.saveQywxRelation(saveRelationList);
}
/**
* 调用企业微信接口 保存标签
*
* @param wxEnterpriseDTO
* @param infoDTO
* @param items
* @return
*/
private QywxGetCorpTagListDTO saveQywxTag(WxEnterpriseDTO wxEnterpriseDTO, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) {
QywxTagGroupDTO qywxTagGroupDTO = new QywxTagGroupDTO();
qywxTagGroupDTO.setGroupId(infoDTO.getQywxGroupKey());
qywxTagGroupDTO.setGroupName("GIC" + infoDTO.getQywxGroupName());
qywxTagGroupDTO.setOrder(infoDTO.getOrder());
List<QywxTagDTO> tagItems = items.stream().map(item -> {
QywxTagDTO qywxTagDTO = new QywxTagDTO();
qywxTagDTO.setId(item.getQywxTagKey());
qywxTagDTO.setName(item.getQywxTagName());
qywxTagDTO.setOrder(item.getOrder());
return qywxTagDTO;
}).collect(Collectors.toList());
qywxTagGroupDTO.setTag(tagItems);
return qywxSuiteApiService.saveCorpTag(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxTagGroupDTO);
}
@Override
public void closeSync(String wxEnterpriseId, String memberTagId) {
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
//关闭同步
qywxTagService.closeSync(wxEnterpriseId, memberTagId);
List<String> delIds = new ArrayList<>();
delIds.add(memberTagId);
QywxResponseDTO responseDTO = qywxSuiteApiService.delCorpTag(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), delIds, 0);
if (responseDTO.getErrorcode() == 0) {
qywxTagService.delQywxTag(memberTagId, wxEnterpriseId);
}
}
@Override
public List<QywxTagRelationDTO> listAllByWxEnterpriseId(String wxEnterpriseId) {
List<TabQywxTagRelation> ret = qywxTagService.listAllQywxRelation(wxEnterpriseId);
return EntityUtil.changeEntityListByJSON(QywxTagRelationDTO.class, ret);
}
}
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.HandoverOperationApiService" <dubbo:service interface="com.gic.haoban.manage.api.service.HandoverOperationApiService"
ref="handoverOperationApiServiceImpl" timeout="10000"/> ref="handoverOperationApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.QywxTagApiService" ref="qywxTagApiService"
timeout="10000"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/> <dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService" id="qywxDepartmentApiService"/> <dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService" id="qywxDepartmentApiService"/>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.QywxTagItemMapper"> <mapper namespace="com.gic.haoban.manage.service.dao.mapper.QywxTagItemMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabQywxTagItem"> <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabQywxTagItem">
<id column="qywx_tag_item_id" jdbcType="VARCHAR" property="qywxTagItemId"/> <id column="qywx_tag_item_id" jdbcType="VARCHAR" property="qywxTagItemId"/>
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/> <result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="qywx_group_key" jdbcType="VARCHAR" property="qywxGroupKey"/> <result column="qywx_tag_id" jdbcType="VARCHAR" property="qywxTagId"/>
<result column="qywx_tag_key" jdbcType="VARCHAR" property="qywxTagKey"/> <result column="qywx_group_key" jdbcType="VARCHAR" property="qywxGroupKey"/>
<result column="qywx_tag_name" jdbcType="VARCHAR" property="qywxTagName"/> <result column="qywx_tag_key" jdbcType="VARCHAR" property="qywxTagKey"/>
<result column="order" jdbcType="BIGINT" property="order"/> <result column="qywx_tag_name" jdbcType="VARCHAR" property="qywxTagName"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/> <result column="order" jdbcType="BIGINT" property="order"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<sql id="Base_Column_List"> </resultMap>
qywx_tag_item_id, wx_enterprise_id, qywx_group_key, qywx_tag_key, qywx_tag_name, <sql id="Base_Column_List">
order, status_flag, create_time, update_time qywx_tag_item_id, wx_enterprise_id, qywx_tag_id, qywx_group_key, qywx_tag_key, qywx_tag_name,
</sql> `order`, status_flag, create_time, update_time
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> </sql>
select <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
<include refid="Base_Column_List"/> select
from tab_haoban_qywx_tag_item <include refid="Base_Column_List"/>
where qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR} from tab_haoban_qywx_tag_item
</select> where qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR}
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> </select>
delete from tab_haoban_qywx_tag_item <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
where qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR} delete from tab_haoban_qywx_tag_item
</delete> where qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR}
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagItem"> </delete>
insert into tab_haoban_qywx_tag_item (qywx_tag_item_id, wx_enterprise_id, qywx_group_key, <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagItem">
qywx_tag_key, qywx_tag_name, order, insert into tab_haoban_qywx_tag_item (qywx_tag_item_id, wx_enterprise_id, qywx_tag_id,
status_flag, create_time, update_time qywx_group_key, qywx_tag_key, qywx_tag_name,
) `order`, status_flag, create_time,
values (#{qywxTagItemId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{qywxGroupKey,jdbcType=VARCHAR}, update_time)
#{qywxTagKey,jdbcType=VARCHAR}, #{qywxTagName,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, values (#{qywxTagItemId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{qywxTagId,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} #{qywxGroupKey,jdbcType=VARCHAR}, #{qywxTagKey,jdbcType=VARCHAR}, #{qywxTagName,jdbcType=VARCHAR},
) #{order,jdbcType=BIGINT}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
</insert> #{updateTime,jdbcType=TIMESTAMP})
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagItem"> </insert>
insert into tab_haoban_qywx_tag_item <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagItem">
<trim prefix="(" suffix=")" suffixOverrides=","> insert into tab_haoban_qywx_tag_item
<if test="qywxTagItemId != null"> <trim prefix="(" suffix=")" suffixOverrides=",">
qywx_tag_item_id, <if test="qywxTagItemId != null">
</if> qywx_tag_item_id,
<if test="wxEnterpriseId != null"> </if>
wx_enterprise_id, <if test="wxEnterpriseId != null">
</if> wx_enterprise_id,
<if test="qywxGroupKey != null"> </if>
qywx_group_key, <if test="qywxTagId != null">
</if> qywx_tag_id,
<if test="qywxTagKey != null"> </if>
qywx_tag_key, <if test="qywxGroupKey != null">
</if> qywx_group_key,
<if test="qywxTagName != null"> </if>
qywx_tag_name, <if test="qywxTagKey != null">
</if> qywx_tag_key,
<if test="order != null"> </if>
order, <if test="qywxTagName != null">
</if> qywx_tag_name,
<if test="statusFlag != null"> </if>
status_flag, <if test="order != null">
</if> `order`,
<if test="createTime != null"> </if>
create_time, <if test="statusFlag != null">
</if> status_flag,
<if test="updateTime != null"> </if>
update_time, <if test="createTime != null">
</if> create_time,
</trim> </if>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test="updateTime != null">
<if test="qywxTagItemId != null"> update_time,
#{qywxTagItemId,jdbcType=VARCHAR}, </if>
</if> </trim>
<if test="wxEnterpriseId != null"> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{wxEnterpriseId,jdbcType=VARCHAR}, <if test="qywxTagItemId != null">
</if> #{qywxTagItemId,jdbcType=VARCHAR},
<if test="qywxGroupKey != null"> </if>
#{qywxGroupKey,jdbcType=VARCHAR}, <if test="wxEnterpriseId != null">
</if> #{wxEnterpriseId,jdbcType=VARCHAR},
<if test="qywxTagKey != null"> </if>
#{qywxTagKey,jdbcType=VARCHAR}, <if test="qywxTagId != null">
</if> #{qywxTagId,jdbcType=VARCHAR},
<if test="qywxTagName != null"> </if>
#{qywxTagName,jdbcType=VARCHAR}, <if test="qywxGroupKey != null">
</if> #{qywxGroupKey,jdbcType=VARCHAR},
<if test="order != null"> </if>
#{order,jdbcType=BIGINT}, <if test="qywxTagKey != null">
</if> #{qywxTagKey,jdbcType=VARCHAR},
<if test="statusFlag != null"> </if>
#{statusFlag,jdbcType=INTEGER}, <if test="qywxTagName != null">
</if> #{qywxTagName,jdbcType=VARCHAR},
<if test="createTime != null"> </if>
#{createTime,jdbcType=TIMESTAMP}, <if test="order != null">
</if> #{order,jdbcType=BIGINT},
<if test="updateTime != null"> </if>
#{updateTime,jdbcType=TIMESTAMP}, <if test="statusFlag != null">
</if> #{statusFlag,jdbcType=INTEGER},
</trim> </if>
</insert> <if test="createTime != null">
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagItem"> #{createTime,jdbcType=TIMESTAMP},
update tab_haoban_qywx_tag_item </if>
<set> <if test="updateTime != null">
<if test="wxEnterpriseId != null"> #{updateTime,jdbcType=TIMESTAMP},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, </if>
</if> </trim>
<if test="qywxGroupKey != null"> </insert>
qywx_group_key = #{qywxGroupKey,jdbcType=VARCHAR}, <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagItem">
</if> update tab_haoban_qywx_tag_item
<if test="qywxTagKey != null"> <set>
qywx_tag_key = #{qywxTagKey,jdbcType=VARCHAR}, <if test="wxEnterpriseId != null">
</if> wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
<if test="qywxTagName != null"> </if>
qywx_tag_name = #{qywxTagName,jdbcType=VARCHAR}, <if test="qywxTagId != null">
</if> qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR},
<if test="order != null"> </if>
order = #{order,jdbcType=BIGINT}, <if test="qywxGroupKey != null">
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagItem">
update tab_haoban_qywx_tag_item
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
qywx_group_key = #{qywxGroupKey,jdbcType=VARCHAR}, qywx_group_key = #{qywxGroupKey,jdbcType=VARCHAR},
</if>
<if test="qywxTagKey != null">
qywx_tag_key = #{qywxTagKey,jdbcType=VARCHAR}, qywx_tag_key = #{qywxTagKey,jdbcType=VARCHAR},
</if>
<if test="qywxTagName != null">
qywx_tag_name = #{qywxTagName,jdbcType=VARCHAR}, qywx_tag_name = #{qywxTagName,jdbcType=VARCHAR},
order = #{order,jdbcType=BIGINT}, </if>
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} </if>
where qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR} <if test="updateTime != null">
</update> update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagItem">
update tab_haoban_qywx_tag_item
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR},
qywx_group_key = #{qywxGroupKey,jdbcType=VARCHAR},
qywx_tag_key = #{qywxTagKey,jdbcType=VARCHAR},
qywx_tag_name = #{qywxTagName,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR}
</update>
<select id="listByQywxTagId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_qywx_tag_item
where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
and status_flag=1
and wx_enterprise_id=#{wxEnterpriseId}
</select>
<select id="listByQywxTagGroupKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_qywx_tag_item
where qywx_group_key = #{qywxTagGroupKey}
and status_flag=1
and wx_enterprise_id=#{wxEnterpriseId}
</select>
<update id="delByQywxTagGroupKey">
update tab_haoban_qywx_tag_item
set
status_flag = 0,
update_time = now()
where qywx_group_key = #{qywxTagGroupKey}
and status_flag=1
and wx_enterprise_id=#{wxEnterpriseId}
</update>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.QywxTagMapper"> <mapper namespace="com.gic.haoban.manage.service.dao.mapper.QywxTagMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabQywxTag"> <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabQywxTag">
<id column="qywx_tag_id" jdbcType="VARCHAR" property="qywxTagId"/> <id column="qywx_tag_id" jdbcType="VARCHAR" property="qywxTagId"/>
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/> <result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="qywx_group_key" jdbcType="VARCHAR" property="qywxGroupKey"/> <result column="qywx_group_key" jdbcType="VARCHAR" property="qywxGroupKey"/>
<result column="qywx_group_name" jdbcType="VARCHAR" property="qywxGroupName"/> <result column="qywx_group_name" jdbcType="VARCHAR" property="qywxGroupName"/>
<result column="order" jdbcType="BIGINT" property="order"/> <result column="order" jdbcType="BIGINT" property="order"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/> <result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
qywx_tag_id, wx_enterprise_id, qywx_group_key, qywx_group_name, order, status_flag, qywx_tag_id, wx_enterprise_id, qywx_group_key, qywx_group_name, `order`, status_flag,
create_time, update_time create_time, update_time
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_qywx_tag from tab_haoban_qywx_tag
where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR} where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_qywx_tag delete from tab_haoban_qywx_tag
where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR} where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
</delete> </delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTag"> <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTag">
insert into tab_haoban_qywx_tag (qywx_tag_id, wx_enterprise_id, qywx_group_key, insert into tab_haoban_qywx_tag (qywx_tag_id, wx_enterprise_id, qywx_group_key,
qywx_group_name, order, status_flag, qywx_group_name, `order`, status_flag,
create_time, update_time) create_time, update_time)
values (#{qywxTagId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{qywxGroupKey,jdbcType=VARCHAR}, values (#{qywxTagId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{qywxGroupKey,jdbcType=VARCHAR},
#{qywxGroupName,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{statusFlag,jdbcType=INTEGER}, #{qywxGroupName,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{statusFlag,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTag"> <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTag">
insert into tab_haoban_qywx_tag insert into tab_haoban_qywx_tag
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="qywxTagId != null"> <if test="qywxTagId != null">
qywx_tag_id, qywx_tag_id,
</if> </if>
<if test="wxEnterpriseId != null"> <if test="wxEnterpriseId != null">
wx_enterprise_id, wx_enterprise_id,
</if> </if>
<if test="qywxGroupKey != null"> <if test="qywxGroupKey != null">
qywx_group_key, qywx_group_key,
</if> </if>
<if test="qywxGroupName != null"> <if test="qywxGroupName != null">
qywx_group_name, qywx_group_name,
</if> </if>
<if test="order != null"> <if test="order != null">
order, `order`,
</if> </if>
<if test="statusFlag != null"> <if test="statusFlag != null">
status_flag, status_flag,
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="qywxTagId != null"> <if test="qywxTagId != null">
#{qywxTagId,jdbcType=VARCHAR}, #{qywxTagId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseId != null"> <if test="wxEnterpriseId != null">
#{wxEnterpriseId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="qywxGroupKey != null"> <if test="qywxGroupKey != null">
#{qywxGroupKey,jdbcType=VARCHAR}, #{qywxGroupKey,jdbcType=VARCHAR},
</if> </if>
<if test="qywxGroupName != null"> <if test="qywxGroupName != null">
#{qywxGroupName,jdbcType=VARCHAR}, #{qywxGroupName,jdbcType=VARCHAR},
</if> </if>
<if test="order != null"> <if test="order != null">
#{order,jdbcType=BIGINT}, #{order,jdbcType=BIGINT},
</if> </if>
<if test="statusFlag != null"> <if test="statusFlag != null">
#{statusFlag,jdbcType=INTEGER}, #{statusFlag,jdbcType=INTEGER},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTag"> <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTag">
update tab_haoban_qywx_tag update tab_haoban_qywx_tag
<set> <set>
<if test="wxEnterpriseId != null"> <if test="wxEnterpriseId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if> </if>
<if test="qywxGroupKey != null"> <if test="qywxGroupKey != null">
qywx_group_key = #{qywxGroupKey,jdbcType=VARCHAR},
</if>
<if test="qywxGroupName != null">
qywx_group_name = #{qywxGroupName,jdbcType=VARCHAR},
</if>
<if test="order != null">
order = #{order,jdbcType=BIGINT},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabQywxTag">
update tab_haoban_qywx_tag
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
qywx_group_key = #{qywxGroupKey,jdbcType=VARCHAR}, qywx_group_key = #{qywxGroupKey,jdbcType=VARCHAR},
</if>
<if test="qywxGroupName != null">
qywx_group_name = #{qywxGroupName,jdbcType=VARCHAR}, qywx_group_name = #{qywxGroupName,jdbcType=VARCHAR},
order = #{order,jdbcType=BIGINT}, </if>
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} </if>
where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR} <if test="updateTime != null">
</update> update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabQywxTag">
update tab_haoban_qywx_tag
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
qywx_group_key = #{qywxGroupKey,jdbcType=VARCHAR},
qywx_group_name = #{qywxGroupName,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
</update>
<select id="getByQywxGroupKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_qywx_tag
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and qywx_group_key=#{qywxTagGroupKey}
and status_flag=1
</select>
<update id="delByGroupKey">
UPDATE
tab_haoban_qywx_tag
SET
status_flag=0,
update_time=now()
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and qywx_group_key=#{qywxTagGroupKey}
and status_flag=1
</update>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.QywxTagRelationMapper"> <mapper namespace="com.gic.haoban.manage.service.dao.mapper.QywxTagRelationMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabQywxTagRelation"> <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabQywxTagRelation">
<id column="qywx_tag_relation_id" jdbcType="VARCHAR" property="qywxTagRelationId"/> <id column="qywx_tag_relation_id" jdbcType="VARCHAR" property="qywxTagRelationId"/>
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/> <result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="enterprise_id" jdbcType="VARCHAR" property="enterpriseId"/> <result column="enterprise_id" jdbcType="VARCHAR" property="enterpriseId"/>
<result column="member_tag_id" jdbcType="VARCHAR" property="memberTagId"/> <result column="member_tag_id" jdbcType="VARCHAR" property="memberTagId"/>
<result column="sync_flag" jdbcType="INTEGER" property="syncFlag"/> <result column="tag_item_id" jdbcType="VARCHAR" property="tagItemId"/>
<result column="order" jdbcType="BIGINT" property="order"/> <result column="relation_type" jdbcType="INTEGER" property="relationType"/>
<result column="qywx_tag_id" jdbcType="VARCHAR" property="qywxTagId"/> <result column="sync_flag" jdbcType="INTEGER" property="syncFlag"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/> <result column="order" jdbcType="BIGINT" property="order"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="qywx_tag_id" jdbcType="VARCHAR" property="qywxTagId"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="qywx_tag_item_id" jdbcType="VARCHAR" property="qywxTagItemId"/>
</resultMap> <result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<sql id="Base_Column_List"> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
qywx_tag_relation_id, wx_enterprise_id, enterprise_id, member_tag_id, sync_flag, <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
order, qywx_tag_id, status_flag, create_time, update_time </resultMap>
<sql id="Base_Column_List">
qywx_tag_relation_id, wx_enterprise_id, enterprise_id, member_tag_id, tag_item_id,
relation_type, sync_flag, order, qywx_tag_id, qywx_tag_item_id, status_flag, create_time,
update_time
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_qywx_tag_relation from tab_haoban_qywx_tag_relation
where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR} where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_qywx_tag_relation delete from tab_haoban_qywx_tag_relation
where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR} where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}
</delete> </delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation"> <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation">
insert into tab_haoban_qywx_tag_relation (qywx_tag_relation_id, wx_enterprise_id, insert into tab_haoban_qywx_tag_relation (qywx_tag_relation_id, wx_enterprise_id,
enterprise_id, member_tag_id, sync_flag, enterprise_id, member_tag_id, tag_item_id,
order, qywx_tag_id, status_flag, relation_type, sync_flag, order,
create_time, update_time) qywx_tag_id, qywx_tag_item_id, status_flag,
values (#{qywxTagRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, create_time, update_time)
#{enterpriseId,jdbcType=VARCHAR}, #{memberTagId,jdbcType=VARCHAR}, #{syncFlag,jdbcType=INTEGER}, values (#{qywxTagRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{order,jdbcType=BIGINT}, #{qywxTagId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{enterpriseId,jdbcType=VARCHAR}, #{memberTagId,jdbcType=VARCHAR}, #{tagItemId,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) #{relationType,jdbcType=INTEGER}, #{syncFlag,jdbcType=INTEGER}, #{order,jdbcType=BIGINT},
</insert> #{qywxTagId,jdbcType=VARCHAR}, #{qywxTagItemId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER},
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation"> #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
insert into tab_haoban_qywx_tag_relation </insert>
<trim prefix="(" suffix=")" suffixOverrides=","> <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation">
<if test="qywxTagRelationId != null"> insert into tab_haoban_qywx_tag_relation
qywx_tag_relation_id, <trim prefix="(" suffix=")" suffixOverrides=",">
</if> <if test="qywxTagRelationId != null">
<if test="wxEnterpriseId != null"> qywx_tag_relation_id,
wx_enterprise_id, </if>
</if> <if test="wxEnterpriseId != null">
<if test="enterpriseId != null"> wx_enterprise_id,
enterprise_id, </if>
</if> <if test="enterpriseId != null">
<if test="memberTagId != null"> enterprise_id,
member_tag_id, </if>
</if> <if test="memberTagId != null">
<if test="syncFlag != null"> member_tag_id,
sync_flag, </if>
</if> <if test="tagItemId != null">
<if test="order != null"> tag_item_id,
order, </if>
</if> <if test="relationType != null">
<if test="qywxTagId != null"> relation_type,
qywx_tag_id, </if>
</if> <if test="syncFlag != null">
<if test="statusFlag != null"> sync_flag,
status_flag, </if>
</if> <if test="order != null">
<if test="createTime != null"> order,
create_time, </if>
</if> <if test="qywxTagId != null">
<if test="updateTime != null"> qywx_tag_id,
update_time, </if>
</if> <if test="qywxTagItemId != null">
</trim> qywx_tag_item_id,
<trim prefix="values (" suffix=")" suffixOverrides=","> </if>
<if test="qywxTagRelationId != null"> <if test="statusFlag != null">
#{qywxTagRelationId,jdbcType=VARCHAR}, status_flag,
</if> </if>
<if test="wxEnterpriseId != null"> <if test="createTime != null">
#{wxEnterpriseId,jdbcType=VARCHAR}, create_time,
</if> </if>
<if test="enterpriseId != null"> <if test="updateTime != null">
#{enterpriseId,jdbcType=VARCHAR}, update_time,
</if> </if>
<if test="memberTagId != null"> </trim>
#{memberTagId,jdbcType=VARCHAR}, <trim prefix="values (" suffix=")" suffixOverrides=",">
</if> <if test="qywxTagRelationId != null">
<if test="syncFlag != null"> #{qywxTagRelationId,jdbcType=VARCHAR},
#{syncFlag,jdbcType=INTEGER}, </if>
</if> <if test="wxEnterpriseId != null">
<if test="order != null"> #{wxEnterpriseId,jdbcType=VARCHAR},
#{order,jdbcType=BIGINT}, </if>
</if> <if test="enterpriseId != null">
<if test="qywxTagId != null"> #{enterpriseId,jdbcType=VARCHAR},
#{qywxTagId,jdbcType=VARCHAR}, </if>
</if> <if test="memberTagId != null">
<if test="statusFlag != null"> #{memberTagId,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, </if>
</if> <if test="tagItemId != null">
<if test="createTime != null"> #{tagItemId,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, </if>
</if> <if test="relationType != null">
<if test="updateTime != null"> #{relationType,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP}, </if>
</if> <if test="syncFlag != null">
</trim> #{syncFlag,jdbcType=INTEGER},
</insert> </if>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation"> <if test="order != null">
update tab_haoban_qywx_tag_relation #{order,jdbcType=BIGINT},
<set> </if>
<if test="wxEnterpriseId != null"> <if test="qywxTagId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, #{qywxTagId,jdbcType=VARCHAR},
</if> </if>
<if test="enterpriseId != null"> <if test="qywxTagItemId != null">
enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, #{qywxTagItemId,jdbcType=VARCHAR},
</if> </if>
<if test="memberTagId != null"> <if test="statusFlag != null">
member_tag_id = #{memberTagId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER},
</if> </if>
<if test="syncFlag != null"> <if test="createTime != null">
sync_flag = #{syncFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="order != null"> <if test="updateTime != null">
order = #{order,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="qywxTagId != null"> </trim>
qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}, </insert>
</if> <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation">
<if test="statusFlag != null"> update tab_haoban_qywx_tag_relation
status_flag = #{statusFlag,jdbcType=INTEGER}, <set>
</if> <if test="wxEnterpriseId != null">
<if test="createTime != null"> wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, </if>
</if> <if test="enterpriseId != null">
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation">
update tab_haoban_qywx_tag_relation
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="memberTagId != null">
member_tag_id = #{memberTagId,jdbcType=VARCHAR}, member_tag_id = #{memberTagId,jdbcType=VARCHAR},
</if>
<if test="tagItemId != null">
tag_item_id = #{tagItemId,jdbcType=VARCHAR},
</if>
<if test="relationType != null">
relation_type = #{relationType,jdbcType=INTEGER},
</if>
<if test="syncFlag != null">
sync_flag = #{syncFlag,jdbcType=INTEGER}, sync_flag = #{syncFlag,jdbcType=INTEGER},
</if>
<if test="order != null">
order = #{order,jdbcType=BIGINT}, order = #{order,jdbcType=BIGINT},
</if>
<if test="qywxTagId != null">
qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}, qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR},
</if>
<if test="qywxTagItemId != null">
qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER}, status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} </if>
where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR} <if test="updateTime != null">
</update> update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation">
update tab_haoban_qywx_tag_relation
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
member_tag_id = #{memberTagId,jdbcType=VARCHAR},
tag_item_id = #{tagItemId,jdbcType=VARCHAR},
relation_type = #{relationType,jdbcType=INTEGER},
sync_flag = #{syncFlag,jdbcType=INTEGER},
`order` = #{order,jdbcType=BIGINT},
qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR},
qywx_tag_item_id = #{qywxTagItemId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}
</update>
<select id="listBySyncStatus" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<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>
<select id="listByTagId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_qywx_tag_relation
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and member_tag_id = #{memberTagId,jdbcType=VARCHAR}
and status_flag=1
</select>
<update id="delByMemberTagId">
update tab_haoban_qywx_tag_relation
set
status_flag = 0,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and member_tag_id = #{memberTagId,jdbcType=VARCHAR}
and status_flag=1
</update>
</mapper> </mapper>
\ No newline at end of file
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.HandoverExternalDTO;
import com.gic.haoban.manage.api.service.HandoverOperationApiService;
import com.gic.haoban.manage.api.service.QywxTagApiService;
import com.gic.mq.sdk.GicMQClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class QywxTagTest {
private static Logger logger = LoggerFactory.getLogger(QywxTagTest.class);
@Autowired
private QywxTagApiService qywxTagApiService;
@Test
public void test() {
String wxEnterpriseId = "ca66a01b79474c40b3e7c7f93daf1a3b";
qywxTagApiService.pullQywxTag(wxEnterpriseId);
}
}
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