Commit db42952e by 阮思源

个人号特殊出版社获取小号逻辑修改

parent 41342533
......@@ -22,6 +22,7 @@ import com.pcloud.wechatgroup.message.service.MessageService;
import com.pcloud.wechatgroup.monitor.service.MonitorService;
import com.pcloud.wechatgroup.selfrobot.dto.AltAndUserDTO;
import com.pcloud.wechatgroup.selfrobot.dto.AltAndUserResultDTO;
import com.pcloud.wechatgroup.selfrobot.dto.AvailableRobotParamDTO;
import com.pcloud.wechatgroup.selfrobot.dto.RobotBaseInfoDTO;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
import com.pcloud.wechatgroup.selfrobot.dto.UserRobotDTO;
......@@ -361,10 +362,10 @@ public class WechatGroupConsr {
}
@ParamLog(value = "获取可用机器人")
public SelfRobotDTO getAvailableRobotByBookGroup(Long wechatUserId, Integer largeTemplet, Long bookGroupId) {
public SelfRobotDTO getAvailableRobotByBookGroup(AvailableRobotParamDTO availableRobotParamDTO) {
SelfRobotDTO selfRobotDTO = null;
try {
selfRobotDTO = ResponseHandleUtil.parseResponse(selfRobotService.getAvailableRobotByBookGroup(wechatUserId, largeTemplet, bookGroupId), SelfRobotDTO.class);
selfRobotDTO = ResponseHandleUtil.parseResponse(selfRobotService.getAvailableRobotByBookGroup(availableRobotParamDTO), SelfRobotDTO.class);
} catch (Exception e) {
log.error("获取可用机器人.[getAvailableRobotByBookGroup]:" + e.getMessage(), e);
}
......
......@@ -174,6 +174,7 @@ import com.pcloud.wechatgroup.message.dto.SendTextDTO;
import com.pcloud.wechatgroup.message.dto.UserChatCountDTO;
import com.pcloud.wechatgroup.selfrobot.dto.AltAndUserDTO;
import com.pcloud.wechatgroup.selfrobot.dto.AltAndUserResultDTO;
import com.pcloud.wechatgroup.selfrobot.dto.AvailableRobotParamDTO;
import com.pcloud.wechatgroup.selfrobot.dto.RobotBaseInfoDTO;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
import com.pcloud.wechatgroup.selfrobot.dto.UserRobotDTO;
......@@ -1427,26 +1428,40 @@ public class BookGroupBizImpl implements BookGroupBiz {
paramMap.put("bookId", bookId);
paramMap.put("adviserId", bookGroupDTO.getCreateUser());
paramMap.put("channelId", bookGroupDTO.getChannelId());
Integer largeTemplet;
//判断是否为定制出版社
Boolean specail=false;
Long agentId = bookGroupDTO.getAgentId();
List<String> specialAgentIds = wechatGroupConsr.getRobotListByLargeTemplet(LargeTempletEnum.SPECIAL_AGENT.code);
if (specialAgentIds.contains(agentId)) {
specail = true;
}
if (specail) {
largeTemplet = LargeTempletEnum.SPECIAL_AGENT.code;
} else {
BookDto bookDto = bookDao.getById(paramMap);
Long templetId = bookDto.getTempletId();
//根据分类id获取大类
TempletRelevance templetRelevance = templetRelevanceDao.getByTempletId(templetId);
LOGGER.info("根据分类id获取大类templetRelevance" + templetRelevance.toString());
largeTemplet = templetRelevance.getLargeTemplet();
Integer largeTemplet = templetRelevance.getLargeTemplet();
List<Long> labelIds = new ArrayList<>();
if (null != bookGroupDTO.getProLabelId()) {
labelIds.add(bookGroupDTO.getProLabelId());
}
if (null != bookGroupDTO.getDepLabelId()) {
labelIds.add(bookGroupDTO.getDepLabelId());
}
if (!ListUtils.isEmpty(labelIds)) {
Map<Long, String> labelMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
if (!MapUtils.isEmpty(labelMap)) {
if (null != bookGroupDTO.getProLabelId() && labelMap.containsKey(bookGroupDTO.getProLabelId())) {
bookGroupDTO.setProLabelName(labelMap.get(bookGroupDTO.getProLabelId()));
}
if (null != bookGroupDTO.getDepLabelId() && labelMap.containsKey(bookGroupDTO.getDepLabelId())) {
bookGroupDTO.setDepLabelName(labelMap.get(bookGroupDTO.getDepLabelId()));
}
}
}
Long agentId=bookGroupDTO.getAgentId();
//根据bookGroupId获取机器人
SelfRobotDTO selfRobotDTO = wechatGroupConsr.getAvailableRobotByBookGroup(wechatUserId, largeTemplet, bookGroupId);
AvailableRobotParamDTO availableRobotParamDTO=new AvailableRobotParamDTO();
availableRobotParamDTO.setAgentId(agentId);
availableRobotParamDTO.setBookGroupId(bookGroupId);
availableRobotParamDTO.setWechatUserId(wechatUserId);
availableRobotParamDTO.setLargeTemplet(largeTemplet);
availableRobotParamDTO.setGrade(bookGroupDTO.getDepLabelName());
availableRobotParamDTO.setSubject(bookGroupDTO.getProLabelName());
SelfRobotDTO selfRobotDTO = wechatGroupConsr.getAvailableRobotByBookGroup(availableRobotParamDTO);
if (selfRobotDTO == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "未找到机器人!");
}
......@@ -1455,7 +1470,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
ownAltQrcodeInfoDTO.setAltNickName(selfRobotDTO.getNickName());
ownAltQrcodeInfoDTO.setAltQrcodeUrl(selfRobotDTO.getQrcodeUrl());
ownAltQrcodeInfoDTO.setAltHeadUrl(selfRobotDTO.getHeadPic());
if (specail) {
if (selfRobotDTO.getAgentRobot()!=null&&selfRobotDTO.getAgentRobot()) {
//先查询有没有重复的
String altId = "";
BookGroupAgentRecord old = bookGroupAgentRecordDao.getByAltIdAndBookGroupId(altId, bookGroupId);
......
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