Commit 2bfc044b by 阮思源

修改品牌方入群

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