Commit e1c705fa by 阮思源

个人二维码

parent 0e6fe017
......@@ -14,6 +14,8 @@ import com.pcloud.wechatgroup.message.dto.GroupChatCountDTO;
import com.pcloud.wechatgroup.message.service.MessageService;
import com.pcloud.wechatgroup.monitor.service.MonitorService;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
import com.pcloud.wechatgroup.selfrobot.service.SelfRobotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -35,6 +37,8 @@ public class WechatGroupConsr {
private MessageService messageService;
@Autowired
private MonitorService monitorService;
@Autowired
private SelfRobotService selfRobotService;
/**
* 是否黑名单
......@@ -267,4 +271,15 @@ public class WechatGroupConsr {
}
return map;
}
@ParamLog(value = "获取可用机器人")
public SelfRobotDTO getAvailableRobot(Long wechatUserId, Integer largeTemplet, Long classifyId) {
SelfRobotDTO selfRobotDTO = null;
try {
selfRobotDTO = ResponseHandleUtil.parseResponse(selfRobotService.getAvailableRobot(wechatUserId, largeTemplet, classifyId), SelfRobotDTO.class);
} catch (Exception e) {
log.error("获取可用机器人.[getAvailableRobot]:" + e.getMessage(), e);
}
return selfRobotDTO;
}
}
......@@ -18,6 +18,7 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.settlement.SettlementConsr;
import com.pcloud.book.consumer.trade.TradeConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dao.*;
......@@ -67,6 +68,7 @@ import com.pcloud.settlementcenter.record.service.SettlementService;
import com.pcloud.videolesson.schedule.service.ScheduleService;
import com.pcloud.wechatgroup.group.service.GroupMemberService;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -154,6 +156,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
private TempletRelevanceDao templetRelevanceDao;
@Autowired
private JoinGroupCipherDao joinGroupCipherDao;
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Override
......@@ -1058,9 +1062,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
return bookGroupDao.getIsShowBookName(partyId);
}
@Transactional(rollbackFor = Exception.class)
@ParamLog("根据分类id获取个人二维码信息")
@Override
public OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByClassifyId(Long wechatUserId, Long classifyId) {
OwnAltQrcodeInfoDTO ownAltQrcodeInfoDTO = new OwnAltQrcodeInfoDTO();
//根据分类id查询社群码信息
ClassifyDTO classifyDTO = bookGroupClassifyDao.getById(classifyId);
if (classifyDTO == null) {
......@@ -1077,10 +1083,18 @@ public class BookGroupBizImpl implements BookGroupBiz {
TempletRelevance templetRelevance = templetRelevanceDao.getByTempletId(templetId);
LOGGER.info("根据分类id获取大类templetRelevance" + templetRelevance.toString());
Integer largeTemplet = templetRelevance.getLargeTemplet();
//TODO 调内部接口获取分配的小号信息
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.getByCreateUser(wechatUserId, classifyId);
String cipher = "";
String cipher;
if (joinGroupCipher != null) {
cipher = joinGroupCipher.getCipher();
} else {
......@@ -1092,11 +1106,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
joinGroupCipherNew.setClassifyId(classifyId);
joinGroupCipherDao.insert(joinGroupCipherNew);
}
OwnAltQrcodeInfoDTO ownAltQrcodeInfoDTO=new OwnAltQrcodeInfoDTO();
ownAltQrcodeInfoDTO.setCipher(cipher);
//TODO 填充小号信息等
return ownAltQrcodeInfoDTO;
}
......@@ -1121,6 +1131,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
return state;
}
@Transactional(rollbackFor = Exception.class)
@ParamLog("获取暗号状态为已使用")
@Override
public void updateCipherStateToUsed(String cipher, String wxId) {
......
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