数云接口对接
parent
5936caef59
commit
8b37d4a8d0
@ -0,0 +1,59 @@
|
|||||||
|
package com.flossom.common.core.domain.shuyun;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数云传输外部标签实体
|
||||||
|
*/
|
||||||
|
public class ShuYunTagCreate {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部标签ID
|
||||||
|
*/
|
||||||
|
private String tagId;
|
||||||
|
/**
|
||||||
|
* 外部标签名称
|
||||||
|
*/
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date addTime;
|
||||||
|
|
||||||
|
public ShuYunTagCreate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShuYunTagCreate(String tagId, String tagName, Date addTime) {
|
||||||
|
this.tagId = tagId;
|
||||||
|
this.tagName = tagName;
|
||||||
|
this.addTime = addTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTagId() {
|
||||||
|
return tagId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTagId(String tagId) {
|
||||||
|
this.tagId = tagId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTagName() {
|
||||||
|
return tagName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTagName(String tagName) {
|
||||||
|
this.tagName = tagName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getAddTime() {
|
||||||
|
return addTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddTime(Date addTime) {
|
||||||
|
this.addTime = addTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.flossom.common.core.domain.shuyun;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数云标记用户标签
|
||||||
|
*/
|
||||||
|
public class ShuYunUserTag {
|
||||||
|
|
||||||
|
@NotBlank(message = "外部标签ID不能为空")
|
||||||
|
private String tagId;
|
||||||
|
|
||||||
|
@NotBlank(message = "会员信息不能为空")
|
||||||
|
private String platAccount;
|
||||||
|
|
||||||
|
private Date addTime;
|
||||||
|
|
||||||
|
public ShuYunUserTag() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShuYunUserTag(String tagId, String platAccount, Date addTime) {
|
||||||
|
this.tagId = tagId;
|
||||||
|
this.platAccount = platAccount;
|
||||||
|
this.addTime = addTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTagId() {
|
||||||
|
return tagId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTagId(String tagId) {
|
||||||
|
this.tagId = tagId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlatAccount() {
|
||||||
|
return platAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatAccount(String platAccount) {
|
||||||
|
this.platAccount = platAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getAddTime() {
|
||||||
|
return addTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddTime(Date addTime) {
|
||||||
|
this.addTime = addTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.flossom.system.service;
|
||||||
|
|
||||||
|
import com.flossom.common.core.domain.shuyun.ShuYunTagCreate;
|
||||||
|
import com.flossom.common.core.domain.shuyun.ShuYunUserTag;
|
||||||
|
|
||||||
|
public interface IShuYunService {
|
||||||
|
void tagCreate(ShuYunTagCreate shuYunTagCreate);
|
||||||
|
|
||||||
|
void markUserTag(ShuYunUserTag shuYunUserTag);
|
||||||
|
|
||||||
|
void delUserTag(ShuYunUserTag shuYunUserTag);
|
||||||
|
}
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
package com.flossom.system.service.impl;
|
||||||
|
|
||||||
|
import com.flossom.common.core.domain.entity.SysTag;
|
||||||
|
import com.flossom.common.core.domain.entity.WxUserMember;
|
||||||
|
import com.flossom.common.core.domain.shuyun.ShuYunTagCreate;
|
||||||
|
import com.flossom.common.core.domain.shuyun.ShuYunUserTag;
|
||||||
|
import com.flossom.common.core.enums.Status;
|
||||||
|
import com.flossom.common.core.exception.ServiceException;
|
||||||
|
import com.flossom.common.core.mapper.SysTagMapper;
|
||||||
|
import com.flossom.common.core.mapper.WxUserMemberMapper;
|
||||||
|
import com.flossom.common.security.utils.SecurityUtils;
|
||||||
|
import com.flossom.system.service.IShuYunService;
|
||||||
|
import com.flossom.system.service.IWxUserMemberService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ShuYunServiceImpl implements IShuYunService {
|
||||||
|
|
||||||
|
protected final static Logger logger = LoggerFactory.getLogger(ShuYunServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysTagMapper sysTagMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WxUserMemberMapper wxUserMemberMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWxUserMemberService wxUserMemberService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tagCreate(ShuYunTagCreate shuYunTagCreate) {
|
||||||
|
SysTag sysTag = new SysTag();
|
||||||
|
sysTag.setTagName(shuYunTagCreate.getTagName());
|
||||||
|
SysTag parentTag = sysTagMapper.selectDeptById(1L);
|
||||||
|
if (parentTag != null) {
|
||||||
|
sysTag.setParentId(parentTag.getId());
|
||||||
|
sysTag.setParentName(parentTag.getParentName());
|
||||||
|
}
|
||||||
|
// 默认排序
|
||||||
|
sysTag.setOrderNum(1);
|
||||||
|
// 外部标签
|
||||||
|
sysTag.setType("2");
|
||||||
|
sysTag.setStatus(Status.OK.getCode().toString());
|
||||||
|
sysTag.setDelFlag(Status.OK.getCode().toString());
|
||||||
|
sysTag.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||||
|
sysTag.setCreateTime(shuYunTagCreate.getAddTime());
|
||||||
|
sysTag.setShuyunTagId(shuYunTagCreate.getTagId());
|
||||||
|
sysTagMapper.insertDept(sysTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void markUserTag(ShuYunUserTag shuYunUserTag) {
|
||||||
|
// 查询会员信息
|
||||||
|
WxUserMember wxUserMember = wxUserMemberMapper.selectUserMemberByUnionId(shuYunUserTag.getPlatAccount());
|
||||||
|
if (wxUserMember == null) {
|
||||||
|
logger.info("会员不存在");
|
||||||
|
throw new ServiceException("会员不存在");
|
||||||
|
}
|
||||||
|
// 查询标签信息
|
||||||
|
SysTag sysTag = sysTagMapper.selectTagByShuyunTagId(shuYunUserTag.getTagId());
|
||||||
|
if (sysTag == null) {
|
||||||
|
logger.info("外部标签不存在");
|
||||||
|
throw new ServiceException("外部标签不存在");
|
||||||
|
}
|
||||||
|
wxUserMemberService.batchAddWecomTag(Arrays.asList(sysTag.getId().intValue()), Arrays.asList(wxUserMember.getId().intValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delUserTag(ShuYunUserTag shuYunUserTag) {
|
||||||
|
// 查询会员信息
|
||||||
|
WxUserMember wxUserMember = wxUserMemberMapper.selectUserMemberByUnionId(shuYunUserTag.getPlatAccount());
|
||||||
|
if (wxUserMember == null) {
|
||||||
|
logger.info("会员不存在");
|
||||||
|
throw new ServiceException("会员不存在");
|
||||||
|
}
|
||||||
|
// 查询标签信息
|
||||||
|
SysTag sysTag = sysTagMapper.selectTagByShuyunTagId(shuYunUserTag.getTagId());
|
||||||
|
if (sysTag == null) {
|
||||||
|
logger.info("外部标签不存在");
|
||||||
|
throw new ServiceException("外部标签不存在");
|
||||||
|
}
|
||||||
|
wxUserMemberService.batchDelMiniProgramTag(Arrays.asList(sysTag.getId().intValue()), Arrays.asList(wxUserMember.getId().intValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue