Commit 3753e927 by 阮思源

1001684平台端社群统计新增统计数据

parent 6f4944e5
...@@ -281,6 +281,11 @@ public interface BookGroupBiz { ...@@ -281,6 +281,11 @@ public interface BookGroupBiz {
OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByClassifyId(Long wechatUserId, Long classifyId); OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByClassifyId(Long wechatUserId, Long classifyId);
/** /**
* 根据群二维码id获取个人二维码信息
*/
OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByQrcodeId(Long wechatUserId, Long qrcodeId);
/**
* 获取暗号状态 * 获取暗号状态
*/ */
Integer getCipherState(String cipher); Integer getCipherState(String cipher);
......
...@@ -28,6 +28,7 @@ import com.pcloud.book.group.biz.BookGroupClassifyBiz; ...@@ -28,6 +28,7 @@ import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dao.*; import com.pcloud.book.group.dao.*;
import com.pcloud.book.group.dto.*; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.entity.BookGroup; 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.JoinGroupCipher;
import com.pcloud.book.group.entity.TempletRelevance; import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.book.group.enums.LargTempletEnum; import com.pcloud.book.group.enums.LargTempletEnum;
...@@ -192,6 +193,8 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -192,6 +193,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
private BookConsr bookConsr; private BookConsr bookConsr;
@Autowired @Autowired
private GroupQrcodeBiz groupQrcodeBiz; private GroupQrcodeBiz groupQrcodeBiz;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
...@@ -1254,6 +1257,76 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -1254,6 +1257,76 @@ public class BookGroupBizImpl implements BookGroupBiz {
return ownAltQrcodeInfoDTO; return ownAltQrcodeInfoDTO;
} }
@Transactional(rollbackFor = Exception.class)
@ParamLog("根据分类id获取个人二维码信息")
@Override
public OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByQrcodeId(Long wechatUserId, Long qrcodeId) {
OwnAltQrcodeInfoDTO ownAltQrcodeInfoDTO = new OwnAltQrcodeInfoDTO();
GroupQrcode groupQrcode = groupQrcodeDao.getById(qrcodeId);
Long classifyId = groupQrcode.getClassifyId();
//根据分类id查询社群码信息
ClassifyDTO classifyDTO = bookGroupClassifyDao.getById(classifyId);
if (classifyDTO == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "没有该分类");
}
Long bookId = classifyDTO.getBookId();
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("bookId", bookId);
paramMap.put("adviserId", classifyDTO.getCreateUser());
paramMap.put("channelId", classifyDTO.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();
SelfRobotDTO selfRobotDTO = wechatGroupConsr.getAvailableRobot(wechatUserId, largeTemplet, classifyId);
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.getByWechatUserIdAndQrcodeId(wechatUserId, qrcodeId);
String cipher;
if (joinGroupCipher != null) {
cipher = joinGroupCipher.getCipher();
//避免之前通过社群码入群
if (!cipher.contains("RAYS_PCLOUD_")){
cipher = UUIDUitl.generateShort();
//查重,如果有重复,再次生成
JoinGroupCipher joinGroupCipherHas = joinGroupCipherDao.getByCipher(cipher);
if (joinGroupCipherHas != null) {
cipher = UUIDUitl.generateShort();
}
//更新
joinGroupCipherDao.updateCipher(joinGroupCipher.getId(), cipher);
}
} else {
//新增暗号
cipher = UUIDUitl.generateShort();
//查重,如果有重复,再次生成
JoinGroupCipher joinGroupCipherHas = joinGroupCipherDao.getByCipher(cipher);
if (joinGroupCipherHas != null) {
cipher = UUIDUitl.generateShort();
}
cipher = "RAYS_PCLOUD_" + cipher;
JoinGroupCipher joinGroupCipherNew = new JoinGroupCipher();
joinGroupCipherNew.setCipher(cipher);
joinGroupCipherNew.setWechatUserId(wechatUserId);
joinGroupCipherNew.setClassifyId(classifyId);
joinGroupCipherNew.setAltId(selfRobotDTO.getWxId());
joinGroupCipherNew.setQrcodeId(qrcodeId);
joinGroupCipherDao.insert(joinGroupCipherNew);
}
ownAltQrcodeInfoDTO.setCipher(cipher);
return ownAltQrcodeInfoDTO;
}
@ParamLog("获取暗号状态") @ParamLog("获取暗号状态")
@Override @Override
public Integer getCipherState(String cipher) { public Integer getCipherState(String cipher) {
......
...@@ -27,4 +27,8 @@ public interface JoinGroupCipherDao extends BaseDao<JoinGroupCipher> { ...@@ -27,4 +27,8 @@ public interface JoinGroupCipherDao extends BaseDao<JoinGroupCipher> {
* @return * @return
*/ */
BigDecimal getPayPrice(String wxId, Long qrcodeId); BigDecimal getPayPrice(String wxId, Long qrcodeId);
JoinGroupCipher getByWechatUserIdAndQrcodeId(Long wechatUserId, Long qrcodeId);
void updateCipher(Long id, String cipher);
} }
...@@ -69,4 +69,20 @@ public class JoinGroupCipherDaoImpl extends BaseDaoImpl<JoinGroupCipher> impleme ...@@ -69,4 +69,20 @@ public class JoinGroupCipherDaoImpl extends BaseDaoImpl<JoinGroupCipher> impleme
map.put("qrcodeId", qrcodeId); map.put("qrcodeId", qrcodeId);
return getSessionTemplate().selectOne(getStatement("getPayPrice"), map); return getSessionTemplate().selectOne(getStatement("getPayPrice"), map);
} }
@Override
public JoinGroupCipher getByWechatUserIdAndQrcodeId(Long wechatUserId, Long qrcodeId) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
map.put("qrcodeId",qrcodeId);
return this.getSqlSession().selectOne(this.getStatement("getByWechatUserIdAndQrcodeId"), map);
}
@Override
public void updateCipher(Long id, String cipher) {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("cipher", cipher);
getSessionTemplate().update(getStatement("updateCipher"), map);
}
} }
...@@ -295,6 +295,13 @@ public interface BookGroupFacade { ...@@ -295,6 +295,13 @@ public interface BookGroupFacade {
@RequestParam("classifyId") Long classifyId @RequestParam("classifyId") Long classifyId
) throws BizException, PermissionException, JsonParseException; ) throws BizException, PermissionException, JsonParseException;
@ApiOperation("根据分类id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByQrcodeId")
ResponseDto<?> getOwnAltQrcodeInfoDTOByQrcodeId(
@CookieValue("userInfo") String userInfo,
@RequestParam("qrcodeId") Long qrcodeId
) throws BizException, PermissionException, JsonParseException;
@ApiOperation("获取所有的大类") @ApiOperation("获取所有的大类")
@GetMapping("getAllLargeTemplet") @GetMapping("getAllLargeTemplet")
ResponseDto<?> getAllLargeTemplet( ResponseDto<?> getAllLargeTemplet(
......
...@@ -424,6 +424,20 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -424,6 +424,20 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(bookGroupBiz.getOwnAltQrcodeInfoDTOByClassifyId(wechatUserId, classifyId)); return new ResponseDto<>(bookGroupBiz.getOwnAltQrcodeInfoDTOByClassifyId(wechatUserId, classifyId));
} }
@ApiOperation("根据群二维码id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByQrcodeId")
@Override
public ResponseDto<?> getOwnAltQrcodeInfoDTOByQrcodeId(
@CookieValue("userInfo") String userInfo,
@RequestParam("qrcodeId") Long qrcodeId
) throws BizException, PermissionException, JsonParseException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if (qrcodeId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "分类不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getOwnAltQrcodeInfoDTOByQrcodeId(wechatUserId, qrcodeId));
}
@ApiOperation("获取所有的大类") @ApiOperation("获取所有的大类")
@GetMapping("getAllLargeTemplet") @GetMapping("getAllLargeTemplet")
@Override @Override
......
...@@ -102,4 +102,18 @@ ...@@ -102,4 +102,18 @@
AND c.wx_id = #{wxId} AND c.wx_id = #{wxId}
</select> </select>
<!--根据用户id和群id获取基本信息-->
<select id="getByWechatUserIdAndQrcodeId" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from join_group_cipher
where wechat_user_id=#{wechatUserId} and
qrcode_id=#{qrcode_id}
</select>
<!--更新暗号-->
<update id="updateCipher" parameterType="map" >
update join_group_cipher set
cipher=#{cipher}
where id=#{id}
</update>
</mapper> </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