Commit d53cd7ea by 阮思源

1001733 1v1模式优化,缩短路径

parent 14343e0c
......@@ -276,6 +276,11 @@ public interface BookGroupBiz {
void deleteBookGroup(Long bookGroupId);
/**
* 根据社群码id获取个人二维码信息
*/
OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByBookGroupId(Long wechatUserId, Long bookGroupId);
/**
* 根据分类id获取个人二维码信息
*/
OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByClassifyId(Long wechatUserId, Long classifyId);
......
......@@ -30,6 +30,7 @@ import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.entity.BookGroup;
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;
......@@ -1203,6 +1204,64 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
@Transactional(rollbackFor = Exception.class)
@ParamLog("根据社群码id获取个人二维码信息")
@Override
public OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByBookGroupId(Long wechatUserId, Long bookGroupId) {
OwnAltQrcodeInfoDTO ownAltQrcodeInfoDTO = new OwnAltQrcodeInfoDTO();
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOById(bookGroupId);
if (bookGroupDTO == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "没有该社群码");
}
ownAltQrcodeInfoDTO.setCustomerServiceName(bookGroupDTO.getCustomerServiceName());
Long bookId = bookGroupDTO.getBookId();
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("bookId", bookId);
paramMap.put("adviserId", bookGroupDTO.getCreateUser());
paramMap.put("channelId", bookGroupDTO.getChannelId());
BookDto bookDto = bookDao.getById(paramMap);
Long templetId = bookDto.getTempletId();
//根据分类id获取大类
TempletRelevance templetRelevance = templetRelevanceDao.getByTempletId(templetId);
LOGGER.info("根据分类id获取大类templetRelevance" + templetRelevance.toString());
Integer largeTemplet = templetRelevance.getLargeTemplet();
//TODO 根据bookGroupId获取机器人
// SelfRobotDTO selfRobotDTO = wechatGroupConsr.getAvailableRobotByBookGroupId(wechatUserId, largeTemplet, bookGroupId);
SelfRobotDTO selfRobotDTO = null;
if (selfRobotDTO == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "未找到机器人!");
}
ownAltQrcodeInfoDTO.setAltHeadUrl(selfRobotDTO.getHeadPic());
ownAltQrcodeInfoDTO.setAltId(selfRobotDTO.getWxId());
ownAltQrcodeInfoDTO.setAltNickName(selfRobotDTO.getNickName());
ownAltQrcodeInfoDTO.setAltQrcodeUrl(selfRobotDTO.getQrcodeUrl());
ownAltQrcodeInfoDTO.setAltHeadUrl(selfRobotDTO.getHeadPic());
//获取之前是否有没有使用的暗号
JoinGroupCipher joinGroupCipher = joinGroupCipherDao.getByCondition(wechatUserId, bookGroupId, CipherTypeEnum.BOOK_GROUP_CIPHER.code);
String cipher;
if (joinGroupCipher != null) {
cipher = joinGroupCipher.getCipher();
} else {
//新增暗号
cipher = UUIDUitl.generateShort();
//查重,如果有重复,再次生成
JoinGroupCipher joinGroupCipherHas = joinGroupCipherDao.getByCipher(cipher);
if (joinGroupCipherHas != null) {
cipher = UUIDUitl.generateShort();
}
cipher = "RAYS_" + cipher;
JoinGroupCipher joinGroupCipherNew = new JoinGroupCipher();
joinGroupCipherNew.setCipher(cipher);
joinGroupCipherNew.setWechatUserId(wechatUserId);
joinGroupCipherNew.setBookGroupId(bookGroupId);
joinGroupCipherNew.setAltId(selfRobotDTO.getWxId());
joinGroupCipherNew.setType(CipherTypeEnum.BOOK_GROUP_CIPHER.code);
joinGroupCipherDao.insert(joinGroupCipherNew);
}
ownAltQrcodeInfoDTO.setCipher(cipher);
return ownAltQrcodeInfoDTO;
}
@Transactional(rollbackFor = Exception.class)
@ParamLog("根据分类id获取个人二维码信息")
@Override
public OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByClassifyId(Long wechatUserId, Long classifyId) {
......@@ -1251,6 +1310,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);
......
......@@ -27,4 +27,6 @@ public interface JoinGroupCipherDao extends BaseDao<JoinGroupCipher> {
* @return
*/
BigDecimal getPayPrice(String wxId, Long qrcodeId);
JoinGroupCipher getByCondition(Long wechatUserId, Long bookGroupId, Integer type);
}
......@@ -69,4 +69,13 @@ public class JoinGroupCipherDaoImpl extends BaseDaoImpl<JoinGroupCipher> impleme
map.put("qrcodeId", qrcodeId);
return getSessionTemplate().selectOne(getStatement("getPayPrice"), map);
}
@Override
public JoinGroupCipher getByCondition(Long wechatUserId, Long bookGroupId, Integer type) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
map.put("bookGroupId",bookGroupId);
map.put("type",type);
return this.getSqlSession().selectOne(this.getStatement("getByCondition"), map);
}
}
......@@ -152,6 +152,21 @@ public class BookGroupDTO extends BaseDto {
*/
private Integer joinGroupType;
/**
* 加好友欢迎语
*/
private String addFriendGuide;
/**
* 客服称谓
*/
private String customerServiceName;
/**
* 是否邀请入群
*/
private Boolean isInviteGroup;
public String getUrl() {
return url;
}
......@@ -386,6 +401,30 @@ public class BookGroupDTO extends BaseDto {
this.bookNumber = bookNumber;
}
public String getAddFriendGuide() {
return addFriendGuide;
}
public void setAddFriendGuide(String addFriendGuide) {
this.addFriendGuide = addFriendGuide;
}
public String getCustomerServiceName() {
return customerServiceName;
}
public void setCustomerServiceName(String customerServiceName) {
this.customerServiceName = customerServiceName;
}
public Boolean getIsInviteGroup() {
return isInviteGroup;
}
public void setIsInviteGroup(Boolean isInviteGroup) {
this.isInviteGroup = isInviteGroup;
}
@Override
public String toString() {
return "BookGroupDTO{" +
......@@ -418,8 +457,9 @@ public class BookGroupDTO extends BaseDto {
", bookClockInfoId=" + bookClockInfoId +
", isShowBookName=" + isShowBookName +
", joinGroupType=" + joinGroupType +
", addFriendGuide='" + addFriendGuide + '\'' +
", customerServiceName='" + customerServiceName + '\'' +
", isInviteGroup=" + isInviteGroup +
"} " + super.toString();
}
}
\ No newline at end of file
......@@ -28,6 +28,9 @@ public class OwnAltQrcodeInfoDTO implements Serializable {
@ApiModelProperty("暗号")
private String cipher;
@ApiModelProperty("客服称谓")
private String customerServiceName;
public String getAltId() {
return altId;
}
......@@ -68,6 +71,14 @@ public class OwnAltQrcodeInfoDTO implements Serializable {
this.cipher = cipher;
}
public String getCustomerServiceName() {
return customerServiceName;
}
public void setCustomerServiceName(String customerServiceName) {
this.customerServiceName = customerServiceName;
}
@Override
public String toString() {
return "OwnAltQrcodeInfoDTO{" +
......@@ -76,6 +87,7 @@ public class OwnAltQrcodeInfoDTO implements Serializable {
", altHeadUrl='" + altHeadUrl + '\'' +
", altQrcodeUrl='" + altQrcodeUrl + '\'' +
", cipher='" + cipher + '\'' +
", customerServiceName='" + customerServiceName + '\'' +
'}';
}
}
......@@ -107,6 +107,21 @@ public class BookGroup extends BaseEntity {
*/
private Integer joinGroupType;
/**
* 加好友欢迎语
*/
private String addFriendGuide;
/**
* 客服称谓
*/
private String customerServiceName;
/**
* 是否邀请入群
*/
private Boolean isInviteGroup;
public Long getId() {
return id;
}
......@@ -259,6 +274,30 @@ public class BookGroup extends BaseEntity {
this.joinGroupType = joinGroupType;
}
public String getAddFriendGuide() {
return addFriendGuide;
}
public void setAddFriendGuide(String addFriendGuide) {
this.addFriendGuide = addFriendGuide;
}
public String getCustomerServiceName() {
return customerServiceName;
}
public void setCustomerServiceName(String customerServiceName) {
this.customerServiceName = customerServiceName;
}
public Boolean getIsInviteGroup() {
return isInviteGroup;
}
public void setIsInviteGroup(Boolean isInviteGroup) {
this.isInviteGroup = isInviteGroup;
}
@Override
public String toString() {
return "BookGroup{" +
......@@ -281,6 +320,9 @@ public class BookGroup extends BaseEntity {
", isDelete=" + isDelete +
", isShowBookName=" + isShowBookName +
", joinGroupType=" + joinGroupType +
", addFriendGuide='" + addFriendGuide + '\'' +
", customerServiceName='" + customerServiceName + '\'' +
", isInviteGroup=" + isInviteGroup +
"} " + super.toString();
}
}
\ No newline at end of file
......@@ -14,6 +14,9 @@ public class JoinGroupCipher extends BaseEntity {
@ApiModelProperty("密码")
private String cipher;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("分类id")
private Long classifyId;
......@@ -32,6 +35,9 @@ public class JoinGroupCipher extends BaseEntity {
@ApiModelProperty("机器人id")
private String altId;
@ApiModelProperty("暗号类型:1群,2分类,3社群码")
private Integer type;
public String getCipher() {
return cipher;
}
......@@ -40,6 +46,14 @@ public class JoinGroupCipher extends BaseEntity {
this.cipher = cipher;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getClassifyId() {
return classifyId;
}
......@@ -88,16 +102,26 @@ 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{" +
"cipher='" + cipher + '\'' +
", bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", qrcodeId=" + qrcodeId +
", wechatUserId=" + wechatUserId +
", 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;
}
}
......@@ -289,6 +289,13 @@ public interface BookGroupFacade {
) throws BizException, PermissionException, JsonParseException;
@ApiOperation("根据分类id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByBookGroupId")
ResponseDto<?> getOwnAltQrcodeInfoDTOByBookGroupId(
@CookieValue("userInfo") String userInfo,
@RequestParam("bookGroupId") Long bookGroupId
) throws BizException, PermissionException, JsonParseException;
@ApiOperation("根据分类id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByClassifyId")
ResponseDto<?> getOwnAltQrcodeInfoDTOByClassifyId(
@CookieValue("userInfo") String userInfo,
......
......@@ -410,6 +410,20 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>();
}
@ApiOperation("根据社群书id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByBookGroupId")
@Override
public ResponseDto<?> getOwnAltQrcodeInfoDTOByBookGroupId(
@CookieValue("userInfo") String userInfo,
@RequestParam("bookGroupId") Long bookGroupId
) throws BizException, PermissionException, JsonParseException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if (bookGroupId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "社群码id不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getOwnAltQrcodeInfoDTOByBookGroupId(wechatUserId, bookGroupId));
}
@ApiOperation("根据分类id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByClassifyId")
@Override
......
......@@ -21,6 +21,9 @@
<result column="is_delete" property="isDelete" jdbcType="BIT"/>
<result column="is_show_book_name" property="isShowBookName" jdbcType="BOOLEAN"/>
<result column="join_group_type" property="joinGroupType" jdbcType="INTEGER"/>
<result column="add_friend_guide" property="addFriendGuide" jdbcType="VARCHAR"/>
<result column="customer_service_name" property="customerServiceName" jdbcType="VARCHAR"/>
<result column="is_invite_group" property="isInviteGroup" jdbcType="BOOLEAN"/>
</resultMap>
<resultMap id="BookGroupDTO" type="com.pcloud.book.group.dto.BookGroupDTO">
......@@ -47,13 +50,17 @@
<result column="book_clock_info_id" property="bookClockInfoId" jdbcType="BIGINT"/>
<result column="is_show_book_name" property="isShowBookName" jdbcType="BOOLEAN"/>
<result column="join_group_type" property="joinGroupType" jdbcType="INTEGER"/>
<result column="add_friend_guide" property="addFriendGuide" jdbcType="VARCHAR"/>
<result column="customer_service_name" property="customerServiceName" jdbcType="VARCHAR"/>
<result column="is_invite_group" property="isInviteGroup" jdbcType="BOOLEAN"/>
</resultMap>
<sql id="Base_Column_List">
id, book_id, channel_id, scene_id, group_qrcode_url, group_qrcode_name, pro_label_id, dep_label_id,
pur_label_id, join_title, join_slogan, personal_qrcode_url, product_id, create_user,
create_time,
update_time, is_delete, is_show_book_name,join_group_type
update_time, is_delete, is_show_book_name,join_group_type,add_friend_guide,customer_service_name,
is_invite_group
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
......@@ -163,6 +170,9 @@
create_time,
update_time,
is_show_book_name,
add_friend_guide,
customer_service_name,
is_invite_group,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookId,jdbcType=BIGINT},
......@@ -181,6 +191,9 @@
NOW(),
NOW(),
#{isShowBookName,jdbcType=BOOLEAN},
#{addFriendGuide,jdbcType=VARCHAR},
#{customerServiceName,jdbcType=VARCHAR},
#{isInviteGroup,jdbcType=BOOLEAN},
</trim>
</insert>
......@@ -229,6 +242,15 @@
<if test="joinGroupType != null">
join_group_type = #{joinGroupType},
</if>
<if test="addFriendGuide != null">
add_friend_guide = #{addFriendGuide},
</if>
<if test="customerServiceName != null">
customer_service_name = #{customerServiceName},
</if>
<if test="isInviteGroup != null">
is_invite_group = #{isInviteGroup},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
......
......@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.JoinGroupCipher">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="cipher" property="cipher" jdbcType="VARCHAR"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="qrcode_id" property="qrcodeId" jdbcType="BIGINT"/>
<result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT"/>
......@@ -12,10 +13,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, book_group_id, 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"
......@@ -23,21 +25,25 @@
insert into join_group_cipher
<trim prefix="(" suffix=")" suffixOverrides=",">
cipher,
book_group_id,
classify_id,
qrcode_id,
create_time,
wechat_user_id,
has_used,
alt_id
alt_id,
type
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{cipher,jdbcType=VARCHAR},
#{bookGroupId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
now(),
#{wechatUserId,jdbcType=BIGINT},
0,
#{altId,jdbcType=VARCHAR}
#{altId,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER}
</trim>
</insert>
......@@ -102,4 +108,13 @@
AND c.wx_id = #{wxId}
</select>
<!--根据条件获取-->
<select id="getByCondition" parameterType="map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from join_group_cipher
where wechat_user_id=#{wechatUserId} and
book_group_id=#{bookGroupId} and
type=#{type}
</select>
</mapper>
\ No newline at end of file
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