新增邀请码来源标识
This commit is contained in:
@@ -50,4 +50,11 @@ public class FlowTeamConstant {
|
||||
public final static Byte UPDATE = 1;
|
||||
public final static Byte DEL = 2;
|
||||
}
|
||||
|
||||
public interface UserSourceType {
|
||||
//自填
|
||||
int SELF = 0;
|
||||
//补填
|
||||
int REPAIR = 1;
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -50,4 +51,10 @@ public class FlowTeamMemberInviteUser {
|
||||
private Date createTime;
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 来源类型 0 自填 1 补填
|
||||
*/
|
||||
@ApiModelProperty("来源类型 0 自填 1 补填")
|
||||
@TableField("source")
|
||||
private Integer source;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package com.xuanyin.flowteam.service;
|
||||
|
||||
import com.accompany.common.exception.ApiException;
|
||||
import com.accompany.common.utils.StringUtils;
|
||||
import com.xuanyin.flowteam.constant.FlowTeamConstant;
|
||||
import com.xuanyin.flowteam.model.FlowTeamInfo;
|
||||
@@ -46,19 +47,19 @@ public class FlowTeamMemberInviteUserBizService {
|
||||
|
||||
/**
|
||||
* 保存引流小组成员与用户之间的邀请关系
|
||||
*
|
||||
* @param inviteCode 邀请码
|
||||
* @param uid 被邀请用户uid
|
||||
* @param uid 被邀请用户uid
|
||||
*/
|
||||
@Async
|
||||
@Transactional(rollbackFor = Exception.class, transactionManager = "mybatisplusTransactionManager")
|
||||
public void saveFlowTeamMemberInviteUserAsync(String inviteCode, Long uid) {
|
||||
public void saveFlowTeamMemberInviteUser(String inviteCode, Long uid, Integer source) {
|
||||
if (uid == null || StringUtils.isBlank(inviteCode)) {
|
||||
return;
|
||||
}
|
||||
// 根据邀请码查询对用的引流小组成员与当前所处小组信息
|
||||
FlowTeamMemberInviteCode flowTeamMemberInviteCode = flowTeamMemberInviteCodeService.getByInviteCode(inviteCode);
|
||||
if (flowTeamMemberInviteCode == null) {
|
||||
return;
|
||||
throw new ApiException("請輸入正確的邀請碼");
|
||||
}
|
||||
Long memberId = flowTeamMemberInviteCode.getMemberId();
|
||||
FlowTeamMember flowTeamMember = flowTeamMemberService.getById(memberId);
|
||||
@@ -72,16 +73,18 @@ public class FlowTeamMemberInviteUserBizService {
|
||||
if (null == flowTeamInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
FlowTeamMemberInviteUser flowTeamMemberInviteUser = buildFlowTeamMemberInviteUser(flowTeamMember, inviteCode, uid, flowTeamInfo.getGroupId());
|
||||
Date now = new Date();
|
||||
FlowTeamMemberInviteUser flowTeamMemberInviteUser = FlowTeamMemberInviteUser.builder()
|
||||
.groupId(flowTeamInfo.getGroupId())
|
||||
.teamId(flowTeamMember.getTeamId())
|
||||
.memberId(flowTeamMember.getMemberId())
|
||||
.inviteCode(inviteCode)
|
||||
.uid(uid)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.source(source)
|
||||
.build();
|
||||
flowTeamMemberInviteUserService.save(flowTeamMemberInviteUser);
|
||||
}
|
||||
|
||||
private FlowTeamMemberInviteUser buildFlowTeamMemberInviteUser(FlowTeamMember flowTeamMember, String inviteCode, Long uid, Long groupId) {
|
||||
return FlowTeamMemberInviteUser.builder().groupId(groupId).teamId(flowTeamMember.getTeamId())
|
||||
.memberId(flowTeamMember.getMemberId()).inviteCode(inviteCode).uid(uid)
|
||||
.createTime(new Date()).updateTime(new Date()).build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user