Commit 2bfc044b by 阮思源

修改品牌方入群

parent 0174efcb
......@@ -31,6 +31,7 @@ import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.book.group.enums.CipherTypeEnum;
import com.pcloud.book.group.enums.LargTempletEnum;
import com.pcloud.book.group.vo.StatisticVO;
......@@ -1251,6 +1252,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
joinGroupCipherNew.setWechatUserId(wechatUserId);
joinGroupCipherNew.setClassifyId(classifyId);
joinGroupCipherNew.setAltId(selfRobotDTO.getWxId());
joinGroupCipherNew.setType(CipherTypeEnum.CLASSIFY_CIPHER.code);
joinGroupCipherDao.insert(joinGroupCipherNew);
}
ownAltQrcodeInfoDTO.setCipher(cipher);
......@@ -1296,7 +1298,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
if (joinGroupCipher != null) {
cipher = joinGroupCipher.getCipher();
//避免之前通过社群码入群
if (!cipher.contains("RAYS_PCLOUD_")){
if (!CipherTypeEnum.QRCODE_CIPHER.code.equals(joinGroupCipher.getType())){
cipher = UUIDUitl.generateShort();
//查重,如果有重复,再次生成
JoinGroupCipher joinGroupCipherHas = joinGroupCipherDao.getByCipher(cipher);
......@@ -1314,13 +1316,14 @@ public class BookGroupBizImpl implements BookGroupBiz {
if (joinGroupCipherHas != null) {
cipher = UUIDUitl.generateShort();
}
cipher = "RAYS_PCLOUD_" + cipher;
cipher = "RAYS_" + cipher;
JoinGroupCipher joinGroupCipherNew = new JoinGroupCipher();
joinGroupCipherNew.setCipher(cipher);
joinGroupCipherNew.setWechatUserId(wechatUserId);
joinGroupCipherNew.setClassifyId(classifyId);
joinGroupCipherNew.setAltId(selfRobotDTO.getWxId());
joinGroupCipherNew.setQrcodeId(qrcodeId);
joinGroupCipherNew.setType(CipherTypeEnum.QRCODE_CIPHER.code);
joinGroupCipherDao.insert(joinGroupCipherNew);
}
ownAltQrcodeInfoDTO.setCipher(cipher);
......
......@@ -32,6 +32,9 @@ public class JoinGroupCipher extends BaseEntity {
@ApiModelProperty("机器人id")
private String altId;
@ApiModelProperty("暗号类型:1群,2分类,3社群码")
private Integer type;
public String getCipher() {
return cipher;
}
......@@ -88,6 +91,14 @@ public class JoinGroupCipher extends BaseEntity {
this.altId = altId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override
public String toString() {
return "JoinGroupCipher{" +
......@@ -98,6 +109,7 @@ public class JoinGroupCipher extends BaseEntity {
", wxId='" + wxId + '\'' +
", hasUsed=" + hasUsed +
", altId='" + altId + '\'' +
", type=" + type +
"} " + super.toString();
}
}
package com.pcloud.book.group.enums;
public enum CipherTypeEnum {
/**
* 群暗号
*/
QRCODE_CIPHER(1, "群暗号"),
/**
* 分类暗号
*/
CLASSIFY_CIPHER(2, "分类暗号"),
/**
* 社群码暗号
*/
BOOK_GROUP_CIPHER(3, "社群码暗号");
public final Integer code;
public final String name;
CipherTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
}
......@@ -20,6 +20,7 @@ import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.book.group.enums.CipherTypeEnum;
import com.pcloud.book.group.enums.TouchTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
......@@ -123,9 +124,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
//获取群
GroupQrcodeBaseInfoVO wxGroup = bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId(dto.getClassifyId(), dto.getWechatUserId());
//判断是否是品牌方进具体群,如果是,从暗号表获取已经定好的群
if ((!StringUtil.isEmpty(agreeAddUserDTO.getCipher())) && agreeAddUserDTO.getCipher().contains("RAYS_PCLOUD_")) {
if ((!StringUtil.isEmpty(agreeAddUserDTO.getCipher())) && agreeAddUserDTO.getCipher().contains("RAYS_")) {
JoinGroupCipher joinGroupCipher = joinGroupCipherDao.getByCipher(agreeAddUserDTO.getCipher());
wxGroup = groupQrcodeDao.getBaseById(joinGroupCipher.getQrcodeId());
if (CipherTypeEnum.QRCODE_CIPHER.code.equals(joinGroupCipher.getType())) {
wxGroup = groupQrcodeDao.getBaseById(joinGroupCipher.getQrcodeId());
}
}
if (null == wxGroup) {
log.error("[同意加好友发送欢迎语] : bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId dto:{}");
......
......@@ -12,10 +12,11 @@
<result column="wx_id" property="wxId" jdbcType="VARCHAR"/>
<result column="has_used" property="hasUsed" jdbcType="BOOLEAN"/>
<result column="alt_id" property="altId" jdbcType="VARCHAR"/>
<result column="type" property="type" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, cipher, classify_id, qrcode_id, create_time, wechat_user_id, update_time, wx_id, has_used, alt_id
id, cipher, classify_id, qrcode_id, create_time, wechat_user_id, update_time, wx_id, has_used, alt_id, type
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.JoinGroupCipher" useGeneratedKeys="true"
......@@ -28,7 +29,8 @@
create_time,
wechat_user_id,
has_used,
alt_id
alt_id,
type
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{cipher,jdbcType=VARCHAR},
......@@ -37,7 +39,8 @@
now(),
#{wechatUserId,jdbcType=BIGINT},
0,
#{altId,jdbcType=VARCHAR}
#{altId,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER}
</trim>
</insert>
......
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