Commit aec0b13e by 郑勇

bug: [1029330] erp多个码对应rays一个码

parent d6a130d5
...@@ -184,6 +184,10 @@ public interface BookAdviserService { ...@@ -184,6 +184,10 @@ public interface BookAdviserService {
@ApiOperation("erp获取二维码下面配置了企业微信的二维码") @ApiOperation("erp获取二维码下面配置了企业微信的二维码")
ResponseEntity<ResponseDto<List<Long>>> getHasWxWorkCode(@RequestBody List<Long> sceneIds); ResponseEntity<ResponseDto<List<Long>>> getHasWxWorkCode(@RequestBody List<Long> sceneIds);
@PostMapping("getHasResourceCode")
@ApiOperation("erp获取配置了资源的Rays码")
ResponseEntity<ResponseDto<List<Long>>> getHasResourceCode(@RequestBody List<Long> sceneIds);
@GetMapping("getBookIdsByAgentId") @GetMapping("getBookIdsByAgentId")
@ApiOperation("根据agentId获取书籍id") @ApiOperation("根据agentId获取书籍id")
void getBookIdsByAgentId(@RequestParam("agentId") Long agentId); void getBookIdsByAgentId(@RequestParam("agentId") Long agentId);
......
...@@ -44,6 +44,10 @@ public class BookGroupServeCountDTO extends BaseDto { ...@@ -44,6 +44,10 @@ public class BookGroupServeCountDTO extends BaseDto {
@ApiModelProperty("公众号sceneid/RAYS码bookgroupid") @ApiModelProperty("公众号sceneid/RAYS码bookgroupid")
private Long bookQrcodeId; private Long bookQrcodeId;
@ApiModelProperty("sceneId")
private Long sceneId;
@ApiModelProperty("sceneId数组") @ApiModelProperty("sceneId数组")
private String sceneIdStr; private String sceneIdStr;
......
...@@ -379,6 +379,15 @@ public interface BookAdviserBiz { ...@@ -379,6 +379,15 @@ public interface BookAdviserBiz {
List<Long> getHasWxWorkCode(List<Long> sceneIds); List<Long> getHasWxWorkCode(List<Long> sceneIds);
/** /**
* erp获取rays自有码下面是否配置了资源
* @param sceneIds
* @return
*/
List<Long> getHasResourceCode4Erp(List<Long> sceneIds);
/**
* 根据agentId获取书籍id * 根据agentId获取书籍id
* @param agentId * @param agentId
*/ */
......
...@@ -75,6 +75,7 @@ import com.pcloud.book.group.biz.ResourcePageBiz; ...@@ -75,6 +75,7 @@ import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.book.group.dao.BookAppletSceneDao; import com.pcloud.book.group.dao.BookAppletSceneDao;
import com.pcloud.book.group.dao.BookGroupDao; import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.BookGroupServeDao; import com.pcloud.book.group.dao.BookGroupServeDao;
import com.pcloud.book.group.dao.ResourcePageItemDao;
import com.pcloud.book.group.dto.BookAppletSceneDTO; import com.pcloud.book.group.dto.BookAppletSceneDTO;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupServeCountDTO; import com.pcloud.book.group.dto.BookGroupServeCountDTO;
...@@ -149,8 +150,10 @@ import java.util.Collections; ...@@ -149,8 +150,10 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
...@@ -256,6 +259,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -256,6 +259,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
private ResourcePageBiz resourcePageBiz; private ResourcePageBiz resourcePageBiz;
@Autowired @Autowired
private UpdateSuperSearchProducer searchProducer; private UpdateSuperSearchProducer searchProducer;
@Autowired
private ResourcePageItemDao resourcePageItemDao;
@Override @Override
public List<BookDto> listByAdviserId(Long adviserId) { public List<BookDto> listByAdviserId(Long adviserId) {
...@@ -1154,31 +1159,42 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1154,31 +1159,42 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
throw new BookBizException(BookBizException.ERROR, "参数为空"); throw new BookBizException(BookBizException.ERROR, "参数为空");
} }
//type 代表的是过滤二维码。如果是0,展示所有的二维码。如果是1(展示没有资源的码。但是要过滤小睿教育的书的非公众号二维码) //type 代表的是过滤二维码。如果是0,展示所有的二维码。如果是1(展示没有资源的码。但是要过滤小睿教育的书的非公众号二维码)
//获取rays码的权益书。一本书的权益书都一样
Integer rightsettingCounts = getRightsettingCounts(bookId, adviserId, channelId);
List<Long> xiaoRuiEducation = channelConsr.isXiaoRuiEducation(Lists.newArrayList(bookId)); List<Long> xiaoRuiEducation = channelConsr.isXiaoRuiEducation(Lists.newArrayList(bookId));
//BookAdviserDto bookAdviserDto = bookAdviserDao.getBase(bookId, channelId, adviserId); //JoinGroupTypeEnum.XIAORUI的码迁到渠道了。不走这里查)
//现在一本书下面可以配多个跳小睿的码
List<BookGroupDTO> bookGroupDTOList=bookGroupDao.getDTOByBookIdList(bookId, channelId, adviserId); List<BookGroupDTO> bookGroupDTOList=bookGroupDao.getDTOByBookIdList(bookId, channelId, adviserId);
//群二维码 Set<Long> groupQrcodeSet=new HashSet<>();
List<Long> groupQrcodeList =CollUtil.isEmpty(bookGroupDTOList) ? new ArrayList<>() : bookGroupDTOList.stream().filter(a -> null != a.getJoinGroupType() && JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(a.getJoinGroupType())).map(a -> a.getId()).distinct().collect(Collectors.toList()); Set<Long> xiaoruiSet=new HashSet<>();
//客服机器人 List<QrCodeVO> qrCodeVOS = new ArrayList<>();
List<Long> robotList =CollUtil.isEmpty(bookGroupDTOList) ? new ArrayList<>() : bookGroupDTOList.stream().filter(a -> null != a.getJoinGroupType() && JoinGroupTypeEnum.ROBOT.getCode().equals(a.getJoinGroupType())).map(a -> a.getId()).distinct().collect(Collectors.toList()); if(CollUtil.isNotEmpty(bookGroupDTOList)){
//(**不包括群二维码)小睿二维码下资源数量 for (BookGroupDTO bookGroupDTO : bookGroupDTOList) {
List<Long> xiaoruiList =CollUtil.isEmpty(bookGroupDTOList) ? new ArrayList<>() : bookGroupDTOList.stream().filter(a -> null != a.getJoinGroupType() && !JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(a.getJoinGroupType())).map(a -> a.getId()).distinct().collect(Collectors.toList()); Integer joinGroupType = bookGroupDTO.getJoinGroupType();
if(null!=joinGroupType){
//群二维码和客服机器人
if(JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(joinGroupType) || JoinGroupTypeEnum.ROBOT.getCode().equals(joinGroupType)){
groupQrcodeSet.add(bookGroupDTO.getId());
}
//(**不包括群二维码,小睿)资源数量
if(!JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(joinGroupType)){
xiaoruiSet.add(bookGroupDTO.getId());
}
}
}
List<Long> groupQrcodeList = new ArrayList<>(groupQrcodeSet);
List<Long> xiaoruiList = new ArrayList<>(xiaoruiSet);
//分开查3种类型的资源数量 //分开查3种类型的资源数量
//群二维码下资源数量 //群二维码和客服机器人
Map<Long, BookGroupServeCountDTO> groupQrCodeMap =CollUtil.isEmpty(groupQrcodeList) ? new HashMap<>() : bookGroupServeDao.mapGroupQrcodeServeCount(groupQrcodeList); Map<Long, BookGroupServeCountDTO> groupQrCodeMap =CollUtil.isEmpty(groupQrcodeList) ? new HashMap<>() : bookGroupServeDao.mapGroupQrcodeServeCount(groupQrcodeList);
//客服机器人码下资源数量 //(**不包括群二维码,小睿)资源数量
Map<Long, BookGroupServeCountDTO> robotMap =CollUtil.isEmpty(robotList) ? new HashMap<>() : bookGroupServeDao.mapGroupQrcodeServeCount(robotList);
//(**不包括群二维码)小睿二维码下资源数量
Map<Long, BookGroupServeCountDTO> xiaoruiMap =CollUtil.isEmpty(xiaoruiList) ? new HashMap<>() : bookGroupServeDao.mapXiaoRuiGroupQrcodeServeCount(xiaoruiList); Map<Long, BookGroupServeCountDTO> xiaoruiMap =CollUtil.isEmpty(xiaoruiList) ? new HashMap<>() : bookGroupServeDao.mapXiaoRuiGroupQrcodeServeCount(xiaoruiList);
//计算码的销售额 //计算码的销售额
List<Long> bookGroupIds =CollUtil.isEmpty(bookGroupDTOList) ? new ArrayList<>() : bookGroupDTOList.stream().filter(a -> null != a.getId()).map(a -> a.getId()).distinct().collect(Collectors.toList()); List<Long> bookGroupIds =CollUtil.isEmpty(bookGroupDTOList) ? new ArrayList<>() : bookGroupDTOList.stream().filter(a -> null != a.getId() && null!=a.getJoinGroupType()
&& !JoinGroupTypeEnum.XIAORUI.getCode().equals(a.getJoinGroupType())).map(a -> a.getId()).distinct().collect(Collectors.toList());
Map<Long, BigDecimal> groupListSaleInfoMap = tradeConsr.getGroupListSaleInfo(bookGroupIds); Map<Long, BigDecimal> groupListSaleInfoMap = tradeConsr.getGroupListSaleInfo(bookGroupIds);
//小睿的销售额 要用sceneId查
List<QrCodeVO> qrCodeVOS = new ArrayList<>();
QrCodeVO qrCodeVO; QrCodeVO qrCodeVO;
for (BookGroupDTO bookGroupDTO : bookGroupDTOList) { for (BookGroupDTO bookGroupDTO : bookGroupDTOList) {
qrCodeVO = new QrCodeVO(); qrCodeVO = new QrCodeVO();
...@@ -1201,18 +1217,14 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1201,18 +1217,14 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
qrCodeVO.setServeCount(bookGroupServeCountDTO.getServeCount()); qrCodeVO.setServeCount(bookGroupServeCountDTO.getServeCount());
} }
if(JoinGroupTypeEnum.ROBOT.getCode().equals(bookGroupDTO.getJoinGroupType())){ if(JoinGroupTypeEnum.ROBOT.getCode().equals(bookGroupDTO.getJoinGroupType())){
if(CollUtil.isNotEmpty(robotMap) && robotMap.containsKey(bookGroupDTO.getId())){ if(CollUtil.isNotEmpty(groupQrCodeMap) && groupQrCodeMap.containsKey(bookGroupDTO.getId())){
BookGroupServeCountDTO bookGroupServeCountDTO = robotMap.get(bookGroupDTO.getId()); BookGroupServeCountDTO bookGroupServeCountDTO = groupQrCodeMap.get(bookGroupDTO.getId());
if(null!=bookGroupServeCountDTO && null!=bookGroupServeCountDTO.getServeCount()) { if(null!=bookGroupServeCountDTO && null!=bookGroupServeCountDTO.getServeCount()) {
qrCodeVO.setServeCount((null == qrCodeVO.getServeCount() ? 0 : qrCodeVO.getServeCount()) + bookGroupServeCountDTO.getServeCount()); qrCodeVO.setServeCount((null == qrCodeVO.getServeCount() ? 0 : qrCodeVO.getServeCount()) + bookGroupServeCountDTO.getServeCount());
} }
} }
} }
} }
//小睿的码才有权益
if(JoinGroupTypeEnum.XIAORUI.getCode().equals(bookGroupDTO.getJoinGroupType())){
qrCodeVO.setRightsCount(rightsettingCounts);
}
//设置销售额 //设置销售额
if(CollUtil.isNotEmpty(groupListSaleInfoMap) && groupListSaleInfoMap.containsKey(bookGroupDTO.getId())){ if(CollUtil.isNotEmpty(groupListSaleInfoMap) && groupListSaleInfoMap.containsKey(bookGroupDTO.getId())){
qrCodeVO.setSaleMoney(groupListSaleInfoMap.get(bookGroupDTO.getId())); qrCodeVO.setSaleMoney(groupListSaleInfoMap.get(bookGroupDTO.getId()));
...@@ -1224,57 +1236,15 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1224,57 +1236,15 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
} }
qrCodeVOS.add(qrCodeVO); qrCodeVOS.add(qrCodeVO);
} }
/*BookGroupDTO bookGroupDTO = bookGroupDao.getDTOByBookId(bookId, channelId, adviserId);
if (null != bookGroupDTO) {
Map<String, BookGroupServeCountDTO> mapBookGroupServeCount;
Map<String, BookGroupServeCountDTO> mapBookGroupRobotServeCount = null;
if(JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(bookGroupDTO.getJoinGroupType())){
mapBookGroupServeCount = bookGroupBiz.mapBookGroupQrcodeServeCount(Lists.newArrayList(adviserId),Lists.newArrayList(bookId),Lists.newArrayList(channelId), JoinGroupTypeEnum.GROUP_QRCODE.getCode());
} else {
mapBookGroupServeCount = bookGroupBiz.mapBookGroupServeCount(Lists.newArrayList(adviserId),Lists.newArrayList(bookId),Lists.newArrayList(channelId));
// 获取 1V1 关键词回复数量
if(JoinGroupTypeEnum.ROBOT.getCode().equals(bookGroupDTO.getJoinGroupType())){
mapBookGroupRobotServeCount = bookGroupBiz.mapBookGroupQrcodeServeCount(Lists.newArrayList(adviserId),Lists.newArrayList(bookId),Lists.newArrayList(channelId), JoinGroupTypeEnum.ROBOT.getCode());
}
if(JoinGroupTypeEnum.XIAORUI.getCode().equals(bookGroupDTO.getJoinGroupType())){
// 小睿权益数量
List<RightsSettingDto> rightsSettingDtos = rightsSettingDAO.listByBookId(bookId);
if(!CollectionUtils.isEmpty(rightsSettingDtos) && mapBookGroupServeCount != null && !mapBookGroupServeCount.isEmpty()){
BookGroupServeCountDTO bookGroupServeCountDTO = mapBookGroupServeCount.values().stream().findFirst().get();
if(bookGroupServeCountDTO!=null){
bookGroupServeCountDTO.setRightsCount(rightsSettingDtos.get(0).getCount());
} }
}
}
}
QrCodeVO qrCodeVO = new QrCodeVO();
qrCodeVO.setQrCodeName(bookGroupDTO.getGroupQrcodeName());
qrCodeVO.setQrCodeUrl(bookGroupDTO.getGroupQrcodeUrl());
qrCodeVO.setServeCount(0);
qrCodeVO.setRightsCount(0);
qrCodeVO.setJoinGroupType(bookGroupDTO.getJoinGroupType());
if(mapBookGroupServeCount!=null && !mapBookGroupServeCount.isEmpty()) {
BookGroupServeCountDTO bookGroupServeCountDTO = mapBookGroupServeCount.get("" + bookId + "_" + channelId + "_" + adviserId);
qrCodeVO.setServeCount(bookGroupServeCountDTO.getServeCount());
// 如果是小睿码
if(JoinGroupTypeEnum.XIAORUI.getCode().equals(bookGroupServeCountDTO.getJoinGroupType())){
qrCodeVO.setRightsCount(null == bookGroupServeCountDTO.getRightsCount() ? 0 : bookGroupServeCountDTO.getRightsCount());
}
}
if(mapBookGroupRobotServeCount!=null && !mapBookGroupRobotServeCount.isEmpty()){
BookGroupServeCountDTO bookGroupServeCountDTO = mapBookGroupRobotServeCount.get("" + bookId + "_" + channelId + "_" + adviserId);
qrCodeVO.setServeCount(qrCodeVO.getServeCount() + bookGroupServeCountDTO.getServeCount());
}
qrCodeVO.setCodeType("group");
qrCodeVO.setXiaoRuiEducation(false);
if(CollUtil.isNotEmpty(xiaoRuiEducation) && xiaoRuiEducation.contains(bookId)){
qrCodeVO.setXiaoRuiEducation(true);
}
qrCodeVOS.add(qrCodeVO);
}*/
List<QrcodeSceneDto> qrcodeSceneDtos = qrcodeSceneConsr.getQrCodeList(bookId, adviserId, channelId); List<QrcodeSceneDto> qrcodeSceneDtos = qrcodeSceneConsr.getQrCodeList(bookId, adviserId, channelId);
if (!ListUtils.isEmpty(qrcodeSceneDtos)) { if (!ListUtils.isEmpty(qrcodeSceneDtos)) {
List<Long> sceneIds = qrcodeSceneDtos.stream().map(x -> x.getSceneId()).collect(Collectors.toList()); List<Long> sceneIds = qrcodeSceneDtos.stream().map(x -> x.getSceneId()).collect(Collectors.toList());
List<Long> qrcodeSceneIds = qrcodeSceneDtos.stream().filter(a->null!=a.getQrcodeType() && "wechat".equalsIgnoreCase(a.getQrcodeType())).map(x -> x.getSceneId()).collect(Collectors.toList());
//之前小睿的码。现在叫rays码
List<Long> ruiList = qrcodeSceneDtos.stream().filter(a->null!=a.getQrcodeType() && ("ali".equalsIgnoreCase(a.getQrcodeType()) || "own".equalsIgnoreCase(a.getQrcodeType()))).map(x -> x.getSceneId()).collect(Collectors.toList());
//小睿的资源数量。要在resource_page_item查
Map<Long, BookGroupServeCountDTO> ruiMap=resourcePageItemDao.mapQrServeCount(ruiList);
// 企业微信群资源数 // 企业微信群资源数
Map<Long, BookGroupServeCountDTO> bookQrcodeWxworkMap = bookQrcodeWxworkBiz.mapWxWorkServeCount4SceneIds(sceneIds, BookQrcodeType.OFFICIAL_ACCOUNTS.getCode()); Map<Long, BookGroupServeCountDTO> bookQrcodeWxworkMap = bookQrcodeWxworkBiz.mapWxWorkServeCount4SceneIds(sceneIds, BookQrcodeType.OFFICIAL_ACCOUNTS.getCode());
//计算码的销售额 //计算码的销售额
...@@ -1284,7 +1254,17 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1284,7 +1254,17 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
qrCodeVO1.setQrCodeName(e.getSceneName()); qrCodeVO1.setQrCodeName(e.getSceneName());
qrCodeVO1.setQrCodeUrl(e.getQrcodeUrl()); qrCodeVO1.setQrCodeUrl(e.getQrcodeUrl());
BookGroupServeCountDTO serveCountDTO = bookQrcodeWxworkMap.get(e.getSceneId()); BookGroupServeCountDTO serveCountDTO = bookQrcodeWxworkMap.get(e.getSceneId());
qrCodeVO1.setServeCount(0);
//公众号二维码才算渠道原来的资源
if(CollUtil.isNotEmpty(qrcodeSceneIds) && qrcodeSceneIds.contains(e.getSceneId())){
qrCodeVO1.setServeCount((ListUtils.isEmpty(e.getMessages()) ? 0 : e.getMessages().size()) + ((serveCountDTO == null || null==serveCountDTO.getServeCount()) ? 0 : serveCountDTO.getServeCount())); qrCodeVO1.setServeCount((ListUtils.isEmpty(e.getMessages()) ? 0 : e.getMessages().size()) + ((serveCountDTO == null || null==serveCountDTO.getServeCount()) ? 0 : serveCountDTO.getServeCount()));
}
if(CollUtil.isNotEmpty(ruiMap) && ruiMap.containsKey(e.getSceneId())){
BookGroupServeCountDTO bookGroupServeCountDTO = ruiMap.get(e.getSceneId());
if(null!=bookGroupServeCountDTO && null!=bookGroupServeCountDTO.getServeCount()){
qrCodeVO1.setServeCount(bookGroupServeCountDTO.getServeCount());
}
}
//设置二维码类型和书刊是否是小睿教育的书 //设置二维码类型和书刊是否是小睿教育的书
qrCodeVO1.setCodeType(e.getQrcodeType()); qrCodeVO1.setCodeType(e.getQrcodeType());
qrCodeVO1.setXiaoRuiEducation(false); qrCodeVO1.setXiaoRuiEducation(false);
...@@ -1348,22 +1328,35 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1348,22 +1328,35 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
if(CollectionUtils.isEmpty(adviserIds) || CollectionUtils.isEmpty(bookIds) || CollectionUtils.isEmpty(channelIds)){ if(CollectionUtils.isEmpty(adviserIds) || CollectionUtils.isEmpty(bookIds) || CollectionUtils.isEmpty(channelIds)){
throw new ChannelBizException(ChannelBizException.FILED_NULL, "adviserIds、bookIds、channelIds 参数为空!"); throw new ChannelBizException(ChannelBizException.FILED_NULL, "adviserIds、bookIds、channelIds 参数为空!");
} }
Future<Map<String, QrcodeMessageDTO>> mapQrcodeMessageSubmit = ThreadPoolUtils.OTHER_POOL.submit(() -> channelConsr.mapResourceCount(adviserIds, bookIds, channelIds)); //公众号二维码
Future<Map<String, QrcodeMessageDTO>> mapQrcodeMessageSubmit = ThreadPoolUtils.OTHER_POOL.submit(() -> channelConsr.mapResourceCount(adviserIds, bookIds, channelIds,1));
//Rays二维码
Future<Map<String, QrcodeMessageDTO>> mapRaysCodeMessageSubmit = ThreadPoolUtils.OTHER_POOL.submit(() -> channelConsr.mapResourceCount(adviserIds, bookIds, channelIds,2));
Future<Map<String, BookGroupServeCountDTO>> mapBookGroupServeCountSubmit = ThreadPoolUtils.OTHER_POOL.submit(() -> bookGroupBiz.mapBookGroupServeCount(adviserIds, bookIds, channelIds)); Future<Map<String, BookGroupServeCountDTO>> mapBookGroupServeCountSubmit = ThreadPoolUtils.OTHER_POOL.submit(() -> bookGroupBiz.mapBookGroupServeCount(adviserIds, bookIds, channelIds));
Future<Map<String, BookGroupServeCountDTO>> mapBookGroupQrcodeSubmit = ThreadPoolUtils.OTHER_POOL.submit(() -> bookGroupBiz.mapBookGroupQrcodeServeCount(adviserIds, bookIds, channelIds, JoinGroupTypeEnum.GROUP_QRCODE.getCode())); Future<Map<String, BookGroupServeCountDTO>> mapBookGroupQrcodeSubmit = ThreadPoolUtils.OTHER_POOL.submit(() -> bookGroupBiz.mapBookGroupQrcodeServeCount(adviserIds, bookIds, channelIds, JoinGroupTypeEnum.GROUP_QRCODE.getCode()));
Future<Map<String, BookGroupServeCountDTO>> mapBookGroupRobotServeCountSubmit = ThreadPoolUtils.OTHER_POOL.submit(()-> bookGroupBiz.mapBookGroupQrcodeServeCount(adviserIds, bookIds, channelIds, JoinGroupTypeEnum.ROBOT.getCode())); Future<Map<String, BookGroupServeCountDTO>> mapBookGroupRobotServeCountSubmit = ThreadPoolUtils.OTHER_POOL.submit(()-> bookGroupBiz.mapBookGroupQrcodeServeCount(adviserIds, bookIds, channelIds, JoinGroupTypeEnum.ROBOT.getCode()));
// Future<Map<Long, Integer>> rightsMapSubmit = ThreadPoolUtils.OTHER_POOL.submit(()-> bookAdviserBiz.rightsCountByBookIds(bookIds));
//rays码的资源数量
Future<Map<String, BookGroupServeCountDTO>> raysCodeServeCountSubmit = ThreadPoolUtils.OTHER_POOL.submit(()-> resourcePageBiz.mapRaysCodeServeCount(adviserIds, bookIds, channelIds));
Future<Map<Long, Integer>> rightsMapSubmit = ThreadPoolUtils.OTHER_POOL.submit(()-> bookAdviserBiz.rightsCountByBookIds(bookIds)); Future<Map<Long, Integer>> rightsMapSubmit = ThreadPoolUtils.OTHER_POOL.submit(()-> bookAdviserBiz.rightsCountByBookIds(bookIds));
Map<String, QrcodeMessageDTO> mapQrcodeMessage =new HashMap<>(); Map<String, QrcodeMessageDTO> mapQrcodeMessage =new HashMap<>();
Map<String, QrcodeMessageDTO> mapRaysCodeMessage =new HashMap<>();
Map<String, BookGroupServeCountDTO> mapWxworkServeCount =new HashMap<>(); Map<String, BookGroupServeCountDTO> mapWxworkServeCount =new HashMap<>();
Map<String, BookGroupServeCountDTO> mapBookGroupServeCount = new HashMap<>(); Map<String, BookGroupServeCountDTO> mapBookGroupServeCount = new HashMap<>();
Map<String, BookGroupServeCountDTO> mapBookGroupQrcodeServeCount = new HashMap<>(); Map<String, BookGroupServeCountDTO> mapBookGroupQrcodeServeCount = new HashMap<>();
Map<String, BookGroupServeCountDTO> mapBookGroupRobotServeCount =new HashMap<>(); Map<String, BookGroupServeCountDTO> mapBookGroupRobotServeCount =new HashMap<>();
Map<Long, Integer> rightsMap=new HashMap<>(); Map<String, BookGroupServeCountDTO> raysCodeServeCount =new HashMap<>();
/* Map<Long, Integer> rightsMap=new HashMap<>();*/
try { try {
mapQrcodeMessage = mapQrcodeMessageSubmit.get(ThreadPoolUtils.REMOTE_TIME_OUT, TimeUnit.SECONDS); mapQrcodeMessage = mapQrcodeMessageSubmit.get(ThreadPoolUtils.REMOTE_TIME_OUT, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) { } catch (InterruptedException | ExecutionException | TimeoutException e) {
LOGGER.error("获取二维码信息错误: {}==", e); LOGGER.error("获取二维码信息错误: {}==", e);
} }
try {
mapRaysCodeMessage = mapRaysCodeMessageSubmit.get(ThreadPoolUtils.REMOTE_TIME_OUT, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
LOGGER.error("获取Rays二维码信息错误: {}==", e);
}
if(CollUtil.isNotEmpty(mapQrcodeMessage)){ if(CollUtil.isNotEmpty(mapQrcodeMessage)){
// 只查询公众号二维码中未被删除的sceneId对应的企业微信资源数 // 只查询公众号二维码中未被删除的sceneId对应的企业微信资源数
String strSceneIds = mapQrcodeMessage.values().stream().map(x -> x.getSceneIdStr()).collect(Collectors.joining(",")); String strSceneIds = mapQrcodeMessage.values().stream().map(x -> x.getSceneIdStr()).collect(Collectors.joining(","));
...@@ -1385,10 +1378,15 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1385,10 +1378,15 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
LOGGER.error("批量获取书下的资源数小睿错误: {}==", e); LOGGER.error("批量获取书下的资源数小睿错误: {}==", e);
} }
try { try {
raysCodeServeCount = raysCodeServeCountSubmit.get();
} catch (InterruptedException | ExecutionException e) {
LOGGER.error("批量获取rays码下的资源数量错误: {}==", e);
}
/*try {
rightsMap = rightsMapSubmit.get(); rightsMap = rightsMapSubmit.get();
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
LOGGER.error("获取权益数量错误: {}==", e); LOGGER.error("获取权益数量错误: {}==", e);
} }*/
if(mapQrcodeMessage == null || mapQrcodeMessage.isEmpty()){ if(mapQrcodeMessage == null || mapQrcodeMessage.isEmpty()){
mapQrcodeMessage = new HashMap<>(); mapQrcodeMessage = new HashMap<>();
} }
...@@ -1402,14 +1400,27 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1402,14 +1400,27 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
mapBookGroupRobotServeCount = new HashMap<>(); mapBookGroupRobotServeCount = new HashMap<>();
} }
List<String> bookChannelAdviserIds = mapQrcodeMessage.keySet().stream().collect(Collectors.toList()); List<String> bookChannelAdviserIds = mapQrcodeMessage.keySet().stream().collect(Collectors.toList());
bookChannelAdviserIds.addAll(mapRaysCodeMessage.keySet().stream().collect(Collectors.toList()));
bookChannelAdviserIds.addAll(mapBookGroupServeCount.keySet().stream().collect(Collectors.toList())); bookChannelAdviserIds.addAll(mapBookGroupServeCount.keySet().stream().collect(Collectors.toList()));
bookChannelAdviserIds.addAll(mapBookGroupQrcodeServeCount.keySet().stream().collect(Collectors.toList())); bookChannelAdviserIds.addAll(mapBookGroupQrcodeServeCount.keySet().stream().collect(Collectors.toList()));
bookChannelAdviserIds.addAll(mapBookGroupRobotServeCount.keySet().stream().collect(Collectors.toList())); bookChannelAdviserIds.addAll(mapBookGroupRobotServeCount.keySet().stream().collect(Collectors.toList()));
bookChannelAdviserIds = bookChannelAdviserIds.stream().distinct().collect(Collectors.toList()); bookChannelAdviserIds = bookChannelAdviserIds.stream().distinct().collect(Collectors.toList());
//处理渠道查询二维码rays码的资源数量,从book出数量
if(CollUtil.isNotEmpty(mapRaysCodeMessage)){
for (Entry<String, QrcodeMessageDTO> entry : mapRaysCodeMessage.entrySet()) {
if(CollUtil.isNotEmpty(raysCodeServeCount) && raysCodeServeCount.containsKey(entry.getKey())){
//book这边rays码的资源
BookGroupServeCountDTO bookGroupServeCountDTO = raysCodeServeCount.get(entry.getKey());
if (null != bookGroupServeCountDTO) {
entry.getValue().setServeCount(null!=bookGroupServeCountDTO.getServeCount() ? bookGroupServeCountDTO.getServeCount() : 0);
}
}
}
}
// 处理权益数 // 处理权益数
if(rightsMap!=null && !rightsMap.isEmpty()){ /* if(rightsMap!=null && !rightsMap.isEmpty()){
for (BookGroupServeCountDTO bookGroupServeCountDTO : mapBookGroupServeCount.values()) { for (BookGroupServeCountDTO bookGroupServeCountDTO : mapBookGroupServeCount.values()) {
if(!JoinGroupTypeEnum.XIAORUI.getCode().equals(bookGroupServeCountDTO.getJoinGroupType())){ if(!JoinGroupTypeEnum.XIAORUI.getCode().equals(bookGroupServeCountDTO.getJoinGroupType())){
continue; continue;
...@@ -1418,7 +1429,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1418,7 +1429,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
Integer count = rightsMap.get(bookGroupServeCountDTO.getBookId()); Integer count = rightsMap.get(bookGroupServeCountDTO.getBookId());
bookGroupServeCountDTO.setRightsCount(count); bookGroupServeCountDTO.setRightsCount(count);
} }
} }*/
BookResourceStatisticsDTO bookResourceStatisticsDTO; BookResourceStatisticsDTO bookResourceStatisticsDTO;
for (String bookChannelAdviserId : bookChannelAdviserIds) { for (String bookChannelAdviserId : bookChannelAdviserIds) {
...@@ -1429,6 +1440,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1429,6 +1440,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
bookResourceStatisticsDTO = new BookResourceStatisticsDTO(); bookResourceStatisticsDTO = new BookResourceStatisticsDTO();
QrcodeMessageDTO qrcodeMessageDTO = mapQrcodeMessage.get(bookChannelAdviserId); QrcodeMessageDTO qrcodeMessageDTO = mapQrcodeMessage.get(bookChannelAdviserId);
QrcodeMessageDTO raysCodeMessageDTO = mapRaysCodeMessage.get(bookChannelAdviserId);
BookGroupServeCountDTO bookQrcodeWxwork = mapWxworkServeCount.get(bookChannelAdviserId); BookGroupServeCountDTO bookQrcodeWxwork = mapWxworkServeCount.get(bookChannelAdviserId);
BookGroupServeCountDTO bookGroupServeCountDTO = mapBookGroupServeCount.get(bookChannelAdviserId); BookGroupServeCountDTO bookGroupServeCountDTO = mapBookGroupServeCount.get(bookChannelAdviserId);
BookGroupServeCountDTO bookGroupQrcodeServeCountDTO = mapBookGroupQrcodeServeCount.get(bookChannelAdviserId); BookGroupServeCountDTO bookGroupQrcodeServeCountDTO = mapBookGroupQrcodeServeCount.get(bookChannelAdviserId);
...@@ -1446,6 +1458,15 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1446,6 +1458,15 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
bookResourceStatisticsDTO.setServeCount(bookResourceStatisticsDTO.getServeCount() + qrcodeMessageDTO.getServeCount()); bookResourceStatisticsDTO.setServeCount(bookResourceStatisticsDTO.getServeCount() + qrcodeMessageDTO.getServeCount());
bookResourceStatisticsDTO.setQrcodeCount(bookResourceStatisticsDTO.getQrcodeCount() + qrcodeMessageDTO.getQrcodeCount()); bookResourceStatisticsDTO.setQrcodeCount(bookResourceStatisticsDTO.getQrcodeCount() + qrcodeMessageDTO.getQrcodeCount());
} }
if(raysCodeMessageDTO != null){
if(StringUtil.isEmpty(bookResourceStatisticsDTO.getBookChannelAdviserId())){
BeanUtils.copyProperties(raysCodeMessageDTO, bookResourceStatisticsDTO);
bookResourceStatisticsDTO.setQrcodeCount(0);
bookResourceStatisticsDTO.setServeCount(0);
}
bookResourceStatisticsDTO.setServeCount(bookResourceStatisticsDTO.getServeCount() + raysCodeMessageDTO.getServeCount());
bookResourceStatisticsDTO.setQrcodeCount(bookResourceStatisticsDTO.getQrcodeCount() + raysCodeMessageDTO.getQrcodeCount());
}
if(bookGroupServeCountDTO != null){ if(bookGroupServeCountDTO != null){
if(StringUtil.isEmpty(bookResourceStatisticsDTO.getBookChannelAdviserId())){ if(StringUtil.isEmpty(bookResourceStatisticsDTO.getBookChannelAdviserId())){
BeanUtils.copyProperties(bookGroupServeCountDTO, bookResourceStatisticsDTO); BeanUtils.copyProperties(bookGroupServeCountDTO, bookResourceStatisticsDTO);
...@@ -1481,12 +1502,13 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1481,12 +1502,13 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
} }
// 设置默认值 // 设置默认值
int rightsCount = 0; int rightsCount = 0;
if(bookGroupServeCountDTO != null && JoinGroupTypeEnum.XIAORUI.getCode().equals(bookGroupServeCountDTO.getJoinGroupType())) { if(bookGroupServeCountDTO != null && null!=bookGroupServeCountDTO.getJoinGroupType() && JoinGroupTypeEnum.XIAORUI.getCode().equals(bookGroupServeCountDTO.getJoinGroupType())) {
// 如果是小睿码,则设置权益数 // 如果是小睿码,则设置权益数
rightsCount = null == bookGroupServeCountDTO.getRightsCount() ? 0 : bookGroupServeCountDTO.getRightsCount(); // rightsCount = null == bookGroupServeCountDTO.getRightsCount() ? 0 : bookGroupServeCountDTO.getRightsCount();
} }
bookResourceStatisticsDTO.setRightsCount(rightsCount); bookResourceStatisticsDTO.setRightsCount(rightsCount);
bookResourceStatisticsDTO.setServeTotalCount(bookResourceStatisticsDTO.getServeCount() + rightsCount); bookResourceStatisticsDTO.setServeTotalCount(bookResourceStatisticsDTO.getServeCount() + rightsCount);
bookResourceStatisticsDTO.setServeTotalCount(bookResourceStatisticsDTO.getServeCount());
mapBookResourceStatistics.put(bookChannelAdviserId, bookResourceStatisticsDTO); mapBookResourceStatistics.put(bookChannelAdviserId, bookResourceStatisticsDTO);
} }
return mapBookResourceStatistics; return mapBookResourceStatistics;
...@@ -1630,21 +1652,39 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1630,21 +1652,39 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
//是否小睿教育的书 //是否小睿教育的书
List<Long> xiaoRuiEducation =CollUtil.isEmpty(bookIds) ? new ArrayList<>() : channelConsr.isXiaoRuiEducation(bookIds); List<Long> xiaoRuiEducation =CollUtil.isEmpty(bookIds) ? new ArrayList<>() : channelConsr.isXiaoRuiEducation(bookIds);
// 社群书统计 // 社群书统计
//JoinGroupTypeEnum.XIAORUI的码迁到渠道了。不走这里查)
List<BookGroupDTO> bookGroupList = bookGroupDao.getDTOByBookIdsAdviserIdsChannelIds(bookIds, adviserIds, channelIds); List<BookGroupDTO> bookGroupList = bookGroupDao.getDTOByBookIdsAdviserIdsChannelIds(bookIds, adviserIds, channelIds);
//计算每个二维码下面的资源数量 //计算每个二维码下面的资源数量
//群二维码 Map<Long, BookGroupServeCountDTO> groupQrCodeMap=new HashMap<>();
List<Long> groupQrcodeList =CollUtil.isEmpty(bookGroupList) ? new ArrayList<>() : bookGroupList.stream().filter(a -> null != a.getJoinGroupType() && JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(a.getJoinGroupType())).map(a -> a.getId()).distinct().collect(Collectors.toList()); Map<Long, BookGroupServeCountDTO> xiaoruiMap=new HashMap<>();
//客服机器人 Set<Long> groupQrcodeSet=new HashSet<>();
List<Long> robotList =CollUtil.isEmpty(bookGroupList) ? new ArrayList<>() : bookGroupList.stream().filter(a -> null != a.getJoinGroupType() && JoinGroupTypeEnum.ROBOT.getCode().equals(a.getJoinGroupType())).map(a -> a.getId()).distinct().collect(Collectors.toList()); Set<Long> xiaoruiSet=new HashSet<>();
//(**不包括群二维码)小睿二维码下资源数量 List<QrCodeVO> qrCodeVOS = new ArrayList<>();
List<Long> xiaoruiList =CollUtil.isEmpty(bookGroupList) ? new ArrayList<>() : bookGroupList.stream().filter(a -> null != a.getJoinGroupType() && !JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(a.getJoinGroupType())).map(a -> a.getId()).distinct().collect(Collectors.toList()); if(CollUtil.isNotEmpty(bookGroupList)){
for (BookGroupDTO bookGroupDTO : bookGroupList) {
Integer joinGroupType = bookGroupDTO.getJoinGroupType();
if(null!=joinGroupType){
//群二维码和客服机器人
if(JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(joinGroupType) || JoinGroupTypeEnum.ROBOT.getCode().equals(joinGroupType)){
groupQrcodeSet.add(bookGroupDTO.getId());
}
//(**不包括群二维码,小睿)资源数量
if(!JoinGroupTypeEnum.GROUP_QRCODE.getCode().equals(joinGroupType)){
xiaoruiSet.add(bookGroupDTO.getId());
}
}
}
List<Long> groupQrcodeList = new ArrayList<>(groupQrcodeSet);
List<Long> xiaoruiList = new ArrayList<>(xiaoruiSet);
//分开查3种类型的资源数量 //分开查3种类型的资源数量
//群二维码下资源数量 //群二维码和客服机器人
Map<Long, BookGroupServeCountDTO> groupQrCodeMap =CollUtil.isEmpty(groupQrcodeList) ? new HashMap<>() : bookGroupServeDao.mapGroupQrcodeServeCount(groupQrcodeList); groupQrCodeMap =CollUtil.isEmpty(groupQrcodeList) ? new HashMap<>() : bookGroupServeDao.mapGroupQrcodeServeCount(groupQrcodeList);
//客服机器人码下资源数量 //(**不包括群二维码,小睿)资源数量
Map<Long, BookGroupServeCountDTO> robotMap =CollUtil.isEmpty(robotList) ? new HashMap<>() : bookGroupServeDao.mapGroupQrcodeServeCount(robotList); xiaoruiMap =CollUtil.isEmpty(xiaoruiList) ? new HashMap<>() : bookGroupServeDao.mapXiaoRuiGroupQrcodeServeCount(xiaoruiList);
//(**不包括群二维码)小睿二维码下资源数量 }
Map<Long, BookGroupServeCountDTO> xiaoruiMap =CollUtil.isEmpty(xiaoruiList) ? new HashMap<>() : bookGroupServeDao.mapXiaoRuiGroupQrcodeServeCount(xiaoruiList); if(CollUtil.isNotEmpty(bookGroupList)){
bookGroupList = bookGroupList.stream().filter(a -> null != a.getJoinGroupType() && !JoinGroupTypeEnum.XIAORUI.getCode().equals(a.getJoinGroupType())).collect(Collectors.toList());
}
if(!CollectionUtils.isEmpty(bookGroupList)){ if(!CollectionUtils.isEmpty(bookGroupList)){
List<Long> bookGroupIds = bookGroupList.stream().map(x -> x.getId()).collect(Collectors.toList()); List<Long> bookGroupIds = bookGroupList.stream().map(x -> x.getId()).collect(Collectors.toList());
Map<Long, GroupUserCountDTO> scanCountByGroup = wechatGroupConsr.getScanCountByGroup(bookGroupIds, null); Map<Long, GroupUserCountDTO> scanCountByGroup = wechatGroupConsr.getScanCountByGroup(bookGroupIds, null);
...@@ -1685,8 +1725,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1685,8 +1725,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
qrcodeStatisticsDTO.setServeCount(bookGroupServeCountDTO.getServeCount()); qrcodeStatisticsDTO.setServeCount(bookGroupServeCountDTO.getServeCount());
} }
if(JoinGroupTypeEnum.ROBOT.getCode().equals(bookGroupDTO.getJoinGroupType())){ if(JoinGroupTypeEnum.ROBOT.getCode().equals(bookGroupDTO.getJoinGroupType())){
if(CollUtil.isNotEmpty(robotMap) && robotMap.containsKey(bookGroupDTO.getId())){ if(CollUtil.isNotEmpty(groupQrCodeMap) && groupQrCodeMap.containsKey(bookGroupDTO.getId())){
BookGroupServeCountDTO bookGroupServeCountDTO = robotMap.get(bookGroupDTO.getId()); BookGroupServeCountDTO bookGroupServeCountDTO = groupQrCodeMap.get(bookGroupDTO.getId());
if(null!=bookGroupServeCountDTO && null!=bookGroupServeCountDTO.getServeCount()) { if(null!=bookGroupServeCountDTO && null!=bookGroupServeCountDTO.getServeCount()) {
qrcodeStatisticsDTO.setServeCount((null == qrcodeStatisticsDTO.getServeCount() ? 0 : qrcodeStatisticsDTO.getServeCount()) + bookGroupServeCountDTO.getServeCount()); qrcodeStatisticsDTO.setServeCount((null == qrcodeStatisticsDTO.getServeCount() ? 0 : qrcodeStatisticsDTO.getServeCount()) + bookGroupServeCountDTO.getServeCount());
} }
...@@ -1714,6 +1754,15 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1714,6 +1754,15 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
qrcodeSceneDtos = Lists.newArrayList(); qrcodeSceneDtos = Lists.newArrayList();
} }
List<Long> sceneIds =CollUtil.isEmpty(qrcodeSceneDtos) ? new ArrayList<>() : qrcodeSceneDtos.stream().map(x -> x.getSceneId()).collect(Collectors.toList()); List<Long> sceneIds =CollUtil.isEmpty(qrcodeSceneDtos) ? new ArrayList<>() : qrcodeSceneDtos.stream().map(x -> x.getSceneId()).collect(Collectors.toList());
//公众号二维码
List<Long> qrCodeSceneIds =CollUtil.isEmpty(qrcodeSceneDtos) ? new ArrayList<>() : qrcodeSceneDtos.stream().filter(a->null!=a.getQrcodeType()
&& "wechat".equalsIgnoreCase(a.getQrcodeType())).map(x -> x.getSceneId()).collect(Collectors.toList());
//之前小睿的码。现在叫rays码
List<Long> ruiList =CollUtil.isEmpty(qrcodeSceneDtos) ? new ArrayList<>() : qrcodeSceneDtos.stream().filter(a->null!=a.getQrcodeType()
&& ("ali".equalsIgnoreCase(a.getQrcodeType()) || "own".equalsIgnoreCase(a.getQrcodeType()))
).map(x -> x.getSceneId()).collect(Collectors.toList());
//小睿的资源数量。要在resource_page_item查
Map<Long, BookGroupServeCountDTO> ruiMap=CollUtil.isNotEmpty(ruiList) ? resourcePageItemDao.mapQrServeCount(ruiList) : new HashMap<>();
// 企业微信群资源数 // 企业微信群资源数
Map<Long, BookGroupServeCountDTO> bookQrcodeWxworkMap =CollUtil.isEmpty(sceneIds) ? new HashMap<>() : bookQrcodeWxworkBiz.mapWxWorkServeCount4SceneIds(sceneIds, BookQrcodeType.OFFICIAL_ACCOUNTS.getCode()); Map<Long, BookGroupServeCountDTO> bookQrcodeWxworkMap =CollUtil.isEmpty(sceneIds) ? new HashMap<>() : bookQrcodeWxworkBiz.mapWxWorkServeCount4SceneIds(sceneIds, BookQrcodeType.OFFICIAL_ACCOUNTS.getCode());
// 查询图书是否开启小睿流程 // 查询图书是否开启小睿流程
...@@ -1744,18 +1793,27 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1744,18 +1793,27 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
//设置二维码类型和二维码下面配置的资源数量。一般资源和企业微信数量 //设置二维码类型和二维码下面配置的资源数量。一般资源和企业微信数量
qrcodeStatisticsDTO.setCodeType(qrcodeSceneDto.getQrcodeType()); qrcodeStatisticsDTO.setCodeType(qrcodeSceneDto.getQrcodeType());
qrcodeStatisticsDTO.setServeCount(qrcodeSceneDto.getServeCount()); qrcodeStatisticsDTO.setServeCount(qrcodeSceneDto.getServeCount());
qrcodeStatisticsDTO.setTotalCount(qrcodeSceneDto.getServeCount()); if(CollUtil.isNotEmpty(ruiMap) && ruiMap.containsKey(qrcodeSceneDto.getSceneId())){
//计算二维码下面的资源数(包括普通资源和配置的企业微信数量) BookGroupServeCountDTO bookGroupServeCountDTO = ruiMap.get(qrcodeSceneDto.getSceneId());
if(null!=bookGroupServeCountDTO && null!=bookGroupServeCountDTO.getServeCount()){
qrcodeStatisticsDTO.setServeCount(bookGroupServeCountDTO.getServeCount());
}
}
//计算公众号二维码下面的资源数(包括普通资源和配置的企业微信数量)
if(CollUtil.isNotEmpty(qrCodeSceneIds) && qrCodeSceneIds.contains(qrcodeSceneDto.getSceneId())){
if(CollUtil.isNotEmpty(bookQrcodeWxworkMap) && bookQrcodeWxworkMap.containsKey(qrcodeSceneDto.getSceneId())){ if(CollUtil.isNotEmpty(bookQrcodeWxworkMap) && bookQrcodeWxworkMap.containsKey(qrcodeSceneDto.getSceneId())){
BookGroupServeCountDTO bookGroupServeCountDTO = bookQrcodeWxworkMap.get(qrcodeSceneDto.getSceneId()); BookGroupServeCountDTO bookGroupServeCountDTO = bookQrcodeWxworkMap.get(qrcodeSceneDto.getSceneId());
if(null!=bookGroupServeCountDTO && null!=bookGroupServeCountDTO.getServeCount()){ if(null!=bookGroupServeCountDTO && null!=bookGroupServeCountDTO.getServeCount()){
qrcodeStatisticsDTO.setServeCount((null==qrcodeSceneDto.getServeCount() ? 0 : qrcodeSceneDto.getServeCount()) + bookGroupServeCountDTO.getServeCount()); qrcodeStatisticsDTO.setServeCount((null==qrcodeSceneDto.getServeCount() ? 0 : qrcodeSceneDto.getServeCount()) + bookGroupServeCountDTO.getServeCount());
} }
} }
}
qrcodeStatisticsDTO.setXiaoRuiEducation(false); qrcodeStatisticsDTO.setXiaoRuiEducation(false);
if(CollUtil.isNotEmpty(xiaoRuiEducation) && xiaoRuiEducation.contains(qrcodeSceneDto.getAdviserBookId())){ if(CollUtil.isNotEmpty(xiaoRuiEducation) && xiaoRuiEducation.contains(qrcodeSceneDto.getAdviserBookId())){
qrcodeStatisticsDTO.setXiaoRuiEducation(true); qrcodeStatisticsDTO.setXiaoRuiEducation(true);
} }
qrcodeStatisticsDTO.setTotalCount(qrcodeStatisticsDTO.getServeCount());
bookQrcodeStatisticsDTO.getQrcodeSceneDtoList().add(qrcodeStatisticsDTO); bookQrcodeStatisticsDTO.getQrcodeSceneDtoList().add(qrcodeStatisticsDTO);
} }
// 筛选出疑似未印刷的二维码(扫码人数<=20 || 扫码次数<=40) // 筛选出疑似未印刷的二维码(扫码人数<=20 || 扫码次数<=40)
...@@ -2531,6 +2589,20 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -2531,6 +2589,20 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
return bookQrcodeWxworkBiz.getHasWxWorkCode(sceneIds); return bookQrcodeWxworkBiz.getHasWxWorkCode(sceneIds);
} }
/**
* erp获取rays自有码下面是否配置了资源
* @param sceneIds
* @return
*/
@Override
public List<Long> getHasResourceCode4Erp(List<Long> sceneIds) {
if(CollUtil.isEmpty(sceneIds)){
return new ArrayList<>();
}
List<Long> result=resourcePageItemDao.getHasResourceCode4Erp(sceneIds);
return result;
}
@Override @Override
@ParamLog("根据agentId获取书籍id") @ParamLog("根据agentId获取书籍id")
public void getBookIdsByAgentId(Long agentId) { public void getBookIdsByAgentId(Long agentId) {
......
...@@ -3103,7 +3103,8 @@ public class BookBizImpl implements BookBiz { ...@@ -3103,7 +3103,8 @@ public class BookBizImpl implements BookBiz {
qrcodeSceneDtos = Lists.newArrayList(); qrcodeSceneDtos = Lists.newArrayList();
} }
// 获取所有的社群码 // 获取所有的社群码
List<BookGroupDTO> bookGroupList = bookGroupDao.getDTOByBookIdsAdviserIdsChannelIds(Lists.newArrayList(bookId), Lists.newArrayList(adviserId), Lists.newArrayList(channelId)); //List<BookGroupDTO> bookGroupList = bookGroupDao.getDTOByBookIdsAdviserIdsChannelIds(Lists.newArrayList(bookId), Lists.newArrayList(adviserId), Lists.newArrayList(channelId));
List<BookGroupDTO> bookGroupList = bookGroupDao.getNotXiaoRui(Lists.newArrayList(bookId), Lists.newArrayList(adviserId), Lists.newArrayList(channelId));
if(CollectionUtils.isEmpty(bookGroupList)){ if(CollectionUtils.isEmpty(bookGroupList)){
bookGroupList = Lists.newArrayList(); bookGroupList = Lists.newArrayList();
} }
......
...@@ -385,6 +385,12 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade { ...@@ -385,6 +385,12 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
return new ResponseDto<>(bookAdviserBiz.getHasWxWorkCode(sceneIds)); return new ResponseDto<>(bookAdviserBiz.getHasWxWorkCode(sceneIds));
} }
@ApiOperation("erp获取rays自有码下面是否配置了资源")
@PostMapping("getHasResourceCode4Erp")
public ResponseDto<?> getHasResourceCode4Erp(@RequestBody List<Long> sceneIds) {
return new ResponseDto<>(bookAdviserBiz.getHasResourceCode4Erp(sceneIds));
}
@PostMapping("getBooksByAgentToken") @PostMapping("getBooksByAgentToken")
public ResponseDto<List<Long>>getBooksByAgentToken(@RequestParam(value = "token") String token,@RequestParam(value = "index") int index,@RequestParam(value = "month" ,required = false) Integer month){ public ResponseDto<List<Long>>getBooksByAgentToken(@RequestParam(value = "token") String token,@RequestParam(value = "index") int index,@RequestParam(value = "month" ,required = false) Integer month){
Long agentId = (Long)SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); Long agentId = (Long)SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
......
...@@ -207,6 +207,12 @@ public class BookAdviserServiceImpl implements BookAdviserService { ...@@ -207,6 +207,12 @@ public class BookAdviserServiceImpl implements BookAdviserService {
} }
@Override @Override
@PostMapping("getHasResourceCode")
public ResponseEntity<ResponseDto<List<Long>>> getHasResourceCode(@RequestBody List<Long> sceneIds) {
return ResponseHandleUtil.toResponse(bookAdviserBiz.getHasResourceCode4Erp(sceneIds));
}
@Override
public void getBookIdsByAgentId(Long agentId) { public void getBookIdsByAgentId(Long agentId) {
bookAdviserBiz.getBookIdsByAgentId(agentId); bookAdviserBiz.getBookIdsByAgentId(agentId);
} }
......
...@@ -177,11 +177,12 @@ public class ChannelConsr { ...@@ -177,11 +177,12 @@ public class ChannelConsr {
} }
} }
public Map<String, QrcodeMessageDTO> mapResourceCount(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds) { public Map<String, QrcodeMessageDTO> mapResourceCount(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds,Integer codeType) {
MapResourceCountDTO mapResourceCountDTO = new MapResourceCountDTO(); MapResourceCountDTO mapResourceCountDTO = new MapResourceCountDTO();
mapResourceCountDTO.setAdviserIds(adviserIds); mapResourceCountDTO.setAdviserIds(adviserIds);
mapResourceCountDTO.setBookIds(bookIds); mapResourceCountDTO.setBookIds(bookIds);
mapResourceCountDTO.setChannelIds(channelIds); mapResourceCountDTO.setChannelIds(channelIds);
mapResourceCountDTO.setCodeType(codeType);
Map<String, QrcodeMessageDTO> mapQrcodeMessage = ResponseHandleUtil.parseMap(qrcodeSceneService.mapResourceCount(mapResourceCountDTO), String.class, QrcodeMessageDTO.class); Map<String, QrcodeMessageDTO> mapQrcodeMessage = ResponseHandleUtil.parseMap(qrcodeSceneService.mapResourceCount(mapResourceCountDTO), String.class, QrcodeMessageDTO.class);
return mapQrcodeMessage; return mapQrcodeMessage;
} }
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.group.biz; ...@@ -2,6 +2,7 @@ package com.pcloud.book.group.biz;
import com.pcloud.book.book.dto.RaysSceneCatalogDto; import com.pcloud.book.book.dto.RaysSceneCatalogDto;
import com.pcloud.book.group.dto.AddBookGroupServeDTO; import com.pcloud.book.group.dto.AddBookGroupServeDTO;
import com.pcloud.book.group.dto.BookGroupServeCountDTO;
import com.pcloud.book.group.dto.BookGroupServeDTO; import com.pcloud.book.group.dto.BookGroupServeDTO;
import com.pcloud.book.group.dto.BookServeDTO; import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.ResourcePageCourseDTO; import com.pcloud.book.group.dto.ResourcePageCourseDTO;
...@@ -329,4 +330,12 @@ public interface ResourcePageBiz { ...@@ -329,4 +330,12 @@ public interface ResourcePageBiz {
List<String> mapCatalogBook(List<Long> bookIds, Long adviserId); List<String> mapCatalogBook(List<Long> bookIds, Long adviserId);
List<RaysSceneCatalogDto> listRaysSceneCatalogDto(List<Long> sceneIds); List<RaysSceneCatalogDto> listRaysSceneCatalogDto(List<Long> sceneIds);
/**
* rays码下面资源数量
* @param adviserIds
* @param bookIds
* @param channelIds
*/
Map<String, BookGroupServeCountDTO> mapRaysCodeServeCount(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds);
} }
...@@ -46,6 +46,7 @@ import com.pcloud.book.group.dao.ResourcePageItemDao; ...@@ -46,6 +46,7 @@ import com.pcloud.book.group.dao.ResourcePageItemDao;
import com.pcloud.book.group.dao.ResourcePageToolDao; import com.pcloud.book.group.dao.ResourcePageToolDao;
import com.pcloud.book.group.dto.AddBookGroupServeDTO; import com.pcloud.book.group.dto.AddBookGroupServeDTO;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupServeCountDTO;
import com.pcloud.book.group.dto.BookGroupServeDTO; import com.pcloud.book.group.dto.BookGroupServeDTO;
import com.pcloud.book.group.dto.BookServeDTO; import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.ResourcePageCourseDTO; import com.pcloud.book.group.dto.ResourcePageCourseDTO;
...@@ -97,6 +98,7 @@ import com.pcloud.message.common.enums.YesNoEnums; ...@@ -97,6 +98,7 @@ import com.pcloud.message.common.enums.YesNoEnums;
import com.pcloud.resourcecenter.product.dto.ProductDto; import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto; import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -1694,4 +1696,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1694,4 +1696,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
return Optional.ofNullable(bookGroupDao.listRaysSceneCatalogDto(sceneIds)).orElse(new ArrayList<>()); return Optional.ofNullable(bookGroupDao.listRaysSceneCatalogDto(sceneIds)).orElse(new ArrayList<>());
} }
@Override
public Map<String, BookGroupServeCountDTO> mapRaysCodeServeCount(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds) {
if(CollectionUtils.isEmpty(adviserIds) || CollectionUtils.isEmpty(bookIds) || CollectionUtils.isEmpty(channelIds)){
return new HashMap<>();
}
return resourcePageDao.mapRaysCodeServeCount(adviserIds, bookIds, channelIds);
}
} }
...@@ -15,6 +15,7 @@ import com.pcloud.channelcenter.qrcode.vo.BookQrcodeVO; ...@@ -15,6 +15,7 @@ import com.pcloud.channelcenter.qrcode.vo.BookQrcodeVO;
import com.pcloud.book.rightsSetting.dto.ServeIdTypeDTO; import com.pcloud.book.rightsSetting.dto.ServeIdTypeDTO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -401,4 +402,6 @@ public interface BookGroupDao extends BaseDao<BookGroup> { ...@@ -401,4 +402,6 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
List<Long> mapCatalogBook(List<Long> bookIds, Long adviserId); List<Long> mapCatalogBook(List<Long> bookIds, Long adviserId);
List<RaysSceneCatalogDto> listRaysSceneCatalogDto(List<Long> sceneIds); List<RaysSceneCatalogDto> listRaysSceneCatalogDto(List<Long> sceneIds);
List<BookGroupDTO> getNotXiaoRui(List<Long> bookIds, List<Long> adviserIds, List<Long> channelIds);
} }
package com.pcloud.book.group.dao; package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.AddBookGroupServeDTO; import com.pcloud.book.group.dto.AddBookGroupServeDTO;
import com.pcloud.book.group.dto.BookGroupServeCountDTO;
import com.pcloud.book.group.entity.ResourcePage; import com.pcloud.book.group.entity.ResourcePage;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -105,4 +106,6 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{ ...@@ -105,4 +106,6 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
* * @param null * * @param null
*/ */
Boolean isOpenRaysBook(Long bookId, Long channelId, Long adviserId); Boolean isOpenRaysBook(Long bookId, Long channelId, Long adviserId);
Map<String, BookGroupServeCountDTO> mapRaysCodeServeCount(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds);
} }
\ No newline at end of file
package com.pcloud.book.group.dao; package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.BookGroupServeCountDTO;
import com.pcloud.book.group.dto.BookGroupServeDTO; import com.pcloud.book.group.dto.BookGroupServeDTO;
import com.pcloud.book.group.dto.BookServeDTO; import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.ResourcePageUrlDTO; import com.pcloud.book.group.dto.ResourcePageUrlDTO;
...@@ -9,6 +10,7 @@ import com.pcloud.book.group.vo.ResourcePageItemVO; ...@@ -9,6 +10,7 @@ import com.pcloud.book.group.vo.ResourcePageItemVO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 自有码H5页面栏目资源详情(ResourcePageItem)表数据库访问层 * 自有码H5页面栏目资源详情(ResourcePageItem)表数据库访问层
...@@ -90,4 +92,18 @@ public interface ResourcePageItemDao extends BaseDao<ResourcePageItem>{ ...@@ -90,4 +92,18 @@ public interface ResourcePageItemDao extends BaseDao<ResourcePageItem>{
List<ResourcePageUrlDTO> getServeUrl4Update(List<Long> sceneIdList); List<ResourcePageUrlDTO> getServeUrl4Update(List<Long> sceneIdList);
void batchUpdateServeUrlById(List<ResourcePageUrlDTO> list); void batchUpdateServeUrlById(List<ResourcePageUrlDTO> list);
/**
* 算码下面的资源
* @param ruiList
* @return
*/
Map<Long, BookGroupServeCountDTO> mapQrServeCount(List<Long> ruiList);
/**
* 过滤有资源的rays码
* @param sceneIds
* @return
*/
List<Long> getHasResourceCode4Erp(List<Long> sceneIds);
} }
\ No newline at end of file
...@@ -20,6 +20,7 @@ import com.pcloud.common.utils.ListForInSQL; ...@@ -20,6 +20,7 @@ import com.pcloud.common.utils.ListForInSQL;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -569,4 +570,13 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou ...@@ -569,4 +570,13 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
public List<RaysSceneCatalogDto> listRaysSceneCatalogDto(List<Long> sceneIds) { public List<RaysSceneCatalogDto> listRaysSceneCatalogDto(List<Long> sceneIds) {
return getSessionTemplate().selectList(getStatement("listRaysSceneCatalogDto"), MapUtil.of("sceneIds", sceneIds)); return getSessionTemplate().selectList(getStatement("listRaysSceneCatalogDto"), MapUtil.of("sceneIds", sceneIds));
} }
@Override
public List<BookGroupDTO> getNotXiaoRui(List<Long> bookIds, List<Long> adviserIds, List<Long> channelIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookIds",bookIds);
paramMap.put("adviserIds",adviserIds);
paramMap.put("channelIds",channelIds);
return super.getSqlSession().selectList(getStatement("getNotXiaoRui"),paramMap);
}
} }
...@@ -2,8 +2,10 @@ package com.pcloud.book.group.dao.impl; ...@@ -2,8 +2,10 @@ package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.ResourcePageDao; import com.pcloud.book.group.dao.ResourcePageDao;
import com.pcloud.book.group.dto.AddBookGroupServeDTO; import com.pcloud.book.group.dto.AddBookGroupServeDTO;
import com.pcloud.book.group.dto.BookGroupServeCountDTO;
import com.pcloud.book.group.entity.ResourcePage; import com.pcloud.book.group.entity.ResourcePage;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import com.pcloud.common.utils.ListUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -97,4 +99,29 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re ...@@ -97,4 +99,29 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
map.put("adviserId", adviserId); map.put("adviserId", adviserId);
return getSessionTemplate().selectOne(getStatement("isOpenRaysBook"), map); return getSessionTemplate().selectOne(getStatement("isOpenRaysBook"), map);
} }
@Override
public Map<String, BookGroupServeCountDTO> mapRaysCodeServeCount(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds) {
if (bookIds != null && bookIds.size() > 500) {
Map<String, BookGroupServeCountDTO>resultMap = new HashMap<>();
List<List<Long>> lists = ListUtils.groupList(bookIds);
for (List<Long> list : lists) {
Map<String, Object> map = new HashMap<>();
map.put("adviserIds", adviserIds);
map.put("bookIds", list);
map.put("channelIds", channelIds);
Map<String, BookGroupServeCountDTO> objectObjectMap = getSessionTemplate().selectMap(getStatement("mapRaysCodeServeCount"), map, "bookChannelAdviserId");
if(objectObjectMap!=null){
resultMap.putAll(objectObjectMap);
}
}
return resultMap;
} else {
Map<String, Object> map = new HashMap<>();
map.put("adviserIds", adviserIds);
map.put("bookIds", bookIds);
map.put("channelIds", channelIds);
return getSessionTemplate().selectMap(getStatement("mapRaysCodeServeCount"), map, "bookChannelAdviserId");
}
}
} }
...@@ -3,6 +3,7 @@ package com.pcloud.book.group.dao.impl; ...@@ -3,6 +3,7 @@ package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.ResourcePageItemDao; import com.pcloud.book.group.dao.ResourcePageItemDao;
import com.pcloud.book.group.dto.BookServeDTO; import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.ResourcePageUrlDTO; import com.pcloud.book.group.dto.ResourcePageUrlDTO;
import com.pcloud.book.group.dto.BookGroupServeCountDTO;
import com.pcloud.book.group.entity.BookGroupServe; import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.ResourcePageItem; import com.pcloud.book.group.entity.ResourcePageItem;
import com.pcloud.book.group.vo.ResourcePageItemVO; import com.pcloud.book.group.vo.ResourcePageItemVO;
...@@ -93,4 +94,18 @@ public class ResourcePageItemDaoImpl extends BaseDaoImpl<ResourcePageItem> imple ...@@ -93,4 +94,18 @@ public class ResourcePageItemDaoImpl extends BaseDaoImpl<ResourcePageItem> imple
public void batchUpdateServeUrlById(List<ResourcePageUrlDTO> list) { public void batchUpdateServeUrlById(List<ResourcePageUrlDTO> list) {
getSessionTemplate().update(getStatement("batchUpdateServeUrlById"), list); getSessionTemplate().update(getStatement("batchUpdateServeUrlById"), list);
} }
@Override
public Map<Long, BookGroupServeCountDTO> mapQrServeCount(List<Long> ruiList) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("sceneIds", ruiList);
return getSessionTemplate().selectMap(getStatement("mapQrServeCount"), paramMap, "sceneId");
}
@Override
public List<Long> getHasResourceCode4Erp(List<Long> sceneIds) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("sceneIds", sceneIds);
return getSessionTemplate().selectList(getStatement("getHasResourceCode4Erp"), paramMap);
}
} }
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
and book_id = #{bookId,jdbcType=BIGINT} and book_id = #{bookId,jdbcType=BIGINT}
and channel_id = #{channelId,jdbcType=BIGINT} and channel_id = #{channelId,jdbcType=BIGINT}
and create_user = #{adviserId,jdbcType=BIGINT} and create_user = #{adviserId,jdbcType=BIGINT}
and join_group_type != 4
</select> </select>
<select id="getDTOByBookIdsAnsAdviserIds" resultMap="BookGroupDTO" parameterType="map"> <select id="getDTOByBookIdsAnsAdviserIds" resultMap="BookGroupDTO" parameterType="map">
...@@ -1416,4 +1417,23 @@ ...@@ -1416,4 +1417,23 @@
HAVING HAVING
count( b.id ) =1 count( b.id ) =1
</select> </select>
<select id="getNotXiaoRui" resultMap="BookGroupDTO" parameterType="map">
select
<include refid="Base_Column_List"/>
from book_group
where is_delete = 0 AND book_id in
<foreach collection="bookIds" open="(" close=")" item="item" separator=",">
${item}
</foreach>
and create_user in
<foreach collection="adviserIds" open="(" close=")" item="item" separator=",">
${item}
</foreach>
and channel_id in
<foreach collection="channelIds" open="(" close=")" item="item" separator=",">
${item}
</foreach>
and join_group_type!=4
</select>
</mapper> </mapper>
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
<foreach collection="adviserIds" item="adviserId" separator="," open="(" close=")"> <foreach collection="adviserIds" item="adviserId" separator="," open="(" close=")">
${adviserId} ${adviserId}
</foreach> </foreach>
AND bg.join_group_type IN (2,3,4) AND bg.join_group_type IN (2,3)
GROUP BY bg.book_id,bg.create_user,bg.channel_id GROUP BY bg.book_id,bg.create_user,bg.channel_id
</select> </select>
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
<foreach collection="bookGroupIds" item="bookGroupId" separator="," open="(" close=")"> <foreach collection="bookGroupIds" item="bookGroupId" separator="," open="(" close=")">
${bookGroupId} ${bookGroupId}
</foreach> </foreach>
AND bg.join_group_type IN (2,3,4) AND bg.join_group_type IN (2,3)
GROUP BY bg.id GROUP BY bg.id
</select> </select>
......
...@@ -228,4 +228,27 @@ ...@@ -228,4 +228,27 @@
AND channel_id = #{channelId} AND channel_id = #{channelId}
AND open_rays = 1 AND open_rays = 1
</select> </select>
<select id="mapRaysCodeServeCount" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupServeCountDTO">
SELECT
CONCAT(bg.book_id,'_',bg.channel_id,'_',bg.create_user) bookChannelAdviserId,ifnull(COUNT(DISTINCT bk.id),0) serveCount,
bg.book_id bookId,bg.create_user adviserId,bg.channel_id channelId
FROM
resource_page bg
LEFT JOIN resource_page_item bk ON bg.id=bk.resource_page_id
WHERE
bg.book_id IN
<foreach collection="bookIds" item="bookId" separator="," open="(" close=")">
${bookId}
</foreach>
AND bg.channel_id IN
<foreach collection="channelIds" item="channelId" separator="," open="(" close=")">
${channelId}
</foreach>
AND bg.create_user IN
<foreach collection="adviserIds" item="adviserId" separator="," open="(" close=")">
${adviserId}
</foreach>
GROUP BY bg.book_id,bg.create_user,bg.channel_id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -257,4 +257,34 @@ ...@@ -257,4 +257,34 @@
${item.id} ${item.id}
</foreach> </foreach>
</update> </update>
<select id="mapQrServeCount" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupServeCountDTO">
SELECT
p.book_group_id bookQrcodeId,
p.scene_id sceneId,
ifnull(count(i.id),0) serveCount
FROM
resource_page p
LEFT JOIN resource_page_item i ON i.resource_page_id = p.id
WHERE
p.scene_id in
<foreach collection="sceneIds" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
group by p.scene_id
</select>
<select id="getHasResourceCode4Erp" parameterType="map" resultType="Long">
SELECT
p.scene_id
FROM
resource_page p
LEFT JOIN resource_page_item i ON i.resource_page_id = p.id
WHERE
p.scene_id in
<foreach collection="sceneIds" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
group by p.scene_id having count(i.id)>0
</select>
</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