Commit 1bf8f443 by 朱亚洁

feat:[1004188[getti外刊阅读

parent ea17d3b3
package com.pcloud.book.consumer.app;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.app.dto.AppRaysDTO;
import com.pcloud.appcenter.app.dto.AppTypeDto;
import com.pcloud.appcenter.app.service.AppService;
import com.pcloud.appcenter.app.service.AppTypeService;
import com.pcloud.appcenter.base.dto.AppPriceCacheDTO;
import com.pcloud.appcenter.cache.service.AppPriceCacheService;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Repository;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.app.service.AppService;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 应用接口
......@@ -234,4 +235,24 @@ public class AppConsr {
throw new BookBizException(BookBizException.INVOKE_USER_ERROR, "listAllCode 获取应用类型名称失败~!");
}
}
@ParamLog("RAYS应用")
public Map<Long, AppRaysDTO> mapRaysApp(List<Long> raysAppIds) {
Map<Long, AppRaysDTO> map = new HashMap<>();
if (ListUtils.isEmpty(raysAppIds)) {
return map;
}
try {
map = ResponseHandleUtil.parseMapResponse(appService.mapRaysApp(raysAppIds), Long.class, AppRaysDTO.class);
} catch (Exception e) {
LOGGER.error("调用失败" + e.getMessage(), e);
}
return map;
}
@ParamLog("getRaysAppTypeCodes")
public List<String> getRaysAppTypeCodes() {
return ResponseHandleUtil.parseList(appService.getRaysAppTypeCodes(), String.class);
}
}
......@@ -479,4 +479,16 @@ public class QrcodeSceneConsr {
}
return list;
}
@ParamLog("根据条件获取书刊下所有服务id")
public List<BookServeVO> listBookServeIdsByType(BookServeParamVO bookServeParamVO){
List<BookServeVO> list = new ArrayList<>();
try {
list = ResponseHandleUtil.parseList(messageService.listBookServeIdsByType(bookServeParamVO),BookServeVO.class);
}catch (Exception e){
LOGGER.error("调用messageService.listBookServeIdsByType失败" + e.getMessage(), e);
}
return list;
}
}
......@@ -1043,4 +1043,12 @@ public interface BookGroupBiz {
Long getRightsSettingId4Book(Long adviserId, Long channelId, Long bookId);
List<HotAppDTO> listHotApp();
/**
* 获取书刊配置的RAYS应用
* @author:zhuyajie
* @date:2021/1/20 11:02
* * @param null
*/
List<BookServeDTO> getBookAndBookGroupRaysApps(Long adviserId, Long bookId, Long channelId);
}
......@@ -12,6 +12,7 @@ import com.pcloud.analysisengine.browse.dto.GroupBrowseStatisticVO;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.app.dto.AppTypeDto;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.appcenter.app.dto.AppRaysDTO;
import com.pcloud.appcenter.base.dto.AppPriceCacheDTO;
import com.pcloud.appcenter.cache.service.AppPriceCacheService;
import com.pcloud.audioapp.audioLesson.service.AudioLessonService;
......@@ -5247,6 +5248,12 @@ public class BookGroupBizImpl implements BookGroupBiz {
if ((AppAndProductTypeEnum.APP.value.equals(item.getServeType()) && ArrayUtils.contains(RightsSettingConstant.APPLET_APP_NOT_SUPPORT, item.getFromType()))
|| (AppAndProductTypeEnum.PRODUCT.value.equals(item.getServeType()) && ArrayUtils.contains(RightsSettingConstant.APPLET_PRODUCT_NOT_SUPPORT, item.getFromType())) || StringUtil.isEmpty(item.getFromType())) {
toRemoveList.add(item);
} else {
//RAYS应用在小程序里单独展示
List<String> typeCodes = appConsr.getRaysAppTypeCodes();
if (!ListUtils.isEmpty(typeCodes) && typeCodes.contains(item.getFromType())) {
toRemoveList.add(item);
}
}
}
if (!ListUtils.isEmpty(toRemoveList)) {
......@@ -6611,4 +6618,67 @@ public class BookGroupBizImpl implements BookGroupBiz {
return new ArrayList<>();
}
@Override
public List<BookServeDTO> getBookAndBookGroupRaysApps(Long adviserId, Long bookId, Long channelId) {
List<BookServeDTO> serveDTOList = new ArrayList<>();
List<Long> raysAppIds = new ArrayList<>();
List<String> typeCodes = appConsr.getRaysAppTypeCodes();
//书刊配置的RAYS应用
BookServeParamVO serveParamVO = new BookServeParamVO();
serveParamVO.setAdviserId(adviserId);
serveParamVO.setBookId(bookId);
serveParamVO.setChannelId(channelId);
serveParamVO.setFromTypes(typeCodes);
List<BookServeVO> bookServeVOS = qrcodeSceneConsr.listBookServeIdsByType(serveParamVO);
if (!ListUtils.isEmpty(bookServeVOS)) {
for (BookServeVO bookServeVO : bookServeVOS) {
Long serveId = bookServeVO.getServeId();
BookServeDTO bookServeDTO = new BookServeDTO();
BeanUtils.copyProperties(bookServeVO, bookServeDTO);
if (!raysAppIds.contains(serveId)) {
bookServeDTO.setServeId(serveId);
bookServeDTO.setServeType(bookServeVO.getTypeCode());
serveDTOList.add(bookServeDTO);
raysAppIds.add(serveId);
}
}
}
//社群书配置的RAYS应用
List<BookGroupServe> bookGroupServes = bookGroupServeDao.getServeListByBookAndType(bookId, channelId, adviserId, typeCodes);
if (!ListUtils.isEmpty(bookGroupServes)) {
for (BookGroupServe bookGroupServe : bookGroupServes) {
BookServeDTO bookServeDTO = new BookServeDTO();
BeanUtils.copyProperties(bookGroupServe, bookServeDTO);
bookServeDTO.setUrl(bookGroupServe.getServeUrl());
bookServeDTO.setTypeCode(bookGroupServe.getServeType());
bookServeDTO.setFromType(bookGroupServe.getTypeCode());
Long serveId = bookGroupServe.getServeId();
if (!raysAppIds.contains(serveId)) {
serveDTOList.add(bookServeDTO);
raysAppIds.add(serveId);
}
}
}
Map<Long, AppRaysDTO> appRaysDTOMap = appConsr.mapRaysApp(raysAppIds);
List<BookServeDTO> resultList = new ArrayList<>();
if (!MapUtils.isEmpty(appRaysDTOMap)) {
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(channelId);
for (BookServeDTO bookServeDTO : serveDTOList) {
AppRaysDTO appRaysDTO = appRaysDTOMap.get(bookServeDTO.getServeId());
if (null != appRaysDTO) {
bookServeDTO.setServeName(appRaysDTO.getTitle());
bookServeDTO.setFromTypeName(appRaysDTO.getTypeName());
bookServeDTO.setCoverImg(appRaysDTO.getSquareImg());
bookServeDTO.setTransverseImg(appRaysDTO.getTransverseImg());
if (null != accountSettingDto){
String resultLinkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, bookServeDTO.getUrl());
bookServeDTO.setResultUrl(resultLinkUrl);
}
resultList.add(bookServeDTO);
}
}
}
return resultList;
}
}
......@@ -90,4 +90,11 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> {
List<BookGroupServe> getServeListByBook(Long bookId, Long channelId, Long adviserId);
List<BookResourceNumDTO> listResourceNum4AdviserBook(List<Long> adviserIds, List<Long> channelIds, List<Long> bookIds);
/**
* 根据书刊和类型查社群书配置资源
* @author:zhuyajie
* @date:2021/1/20 14:00
* * @param null
*/
List<BookGroupServe> getServeListByBookAndType(Long bookId, Long channelId, Long adviserId, List<String> typeCodes);
}
......@@ -170,4 +170,14 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement
param.put("bookIds", bookIds);
return getSessionTemplate().selectList(getStatement("listResourceNum4AdviserBook"), param);
}
@Override
public List<BookGroupServe> getServeListByBookAndType(Long bookId, Long channelId, Long adviserId, List<String> typeCodes) {
Map<String,Object> map = new HashMap<>();
map.put("adviserId", adviserId);
map.put("bookId", bookId);
map.put("channelId", channelId);
map.put("typeCodes", typeCodes);
return getSessionTemplate().selectList(getStatement("getServeListByBookAndType"), map);
}
}
......@@ -1384,4 +1384,11 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
"[{\"count\":32,\"increment\":0,\"typeCode\":\"MATCH_LISTEN\",\"typeName\":\"配套听力\"},{\"count\":209,\"increment\":0,\"typeCode\":\"VIDEO\",\"typeName\":\"视频\"},{\"count\":16,\"increment\":0,\"typeCode\":\"COURSE_WARE\",\"typeName\":\"课件\"},{\"count\":13,\"increment\":0,\"typeCode\":\"WORD_DICTATION\",\"typeName\":\"生词听写\"},{\"count\":81,\"increment\":0,\"typeCode\":\"AUDIO\",\"typeName\":\"音频\"},{\"count\":19,\"increment\":0,\"typeCode\":\"SPECIAL\",\"typeName\":\"专题拓展\"},{\"count\":9,\"increment\":0,\"typeCode\":\"STROKE_ORDER\",\"typeName\":\"笔顺动图\"},{\"count\":17,\"increment\":0,\"typeCode\":\"WISH\",\"typeName\":\"愿望单\"},{\"count\":13,\"increment\":0,\"typeCode\":\"QA\",\"typeName\":\"专家咨询\"},{\"count\":20,\"increment\":0,\"typeCode\":\"IMAGE\",\"typeName\":\"高清大图\"},{\"count\":3,\"increment\":0,\"typeCode\":\"INTERACT\",\"typeName\":\"签到互动墙\"},{\"count\":12,\"increment\":0,\"typeCode\":\"SUBJECTNOTE\",\"typeName\":\"错题本\"},{\"count\":0,\"increment\":0,\"typeCode\":\"ENROLL\",\"typeName\":\"编创赛报名\"},{\"count\":4,\"increment\":0,\"typeCode\":\"LISTEN\",\"typeName\":\"听力音频\"},{\"count\":18,\"increment\":0,\"typeCode\":\"ZSCORE\",\"typeName\":\"查弱项\"},{\"count\":12,\"increment\":0,\"typeCode\":\"AUDIO_MAGIC\",\"typeName\":\"伴读魔法箱\"},{\"count\":10,\"increment\":0,\"typeCode\":\"EF\",\"typeName\":\"专题问答\"},{\"count\":85,\"increment\":0,\"typeCode\":\"TEST\",\"typeName\":\"趣味测试\"},{\"count\":49,\"increment\":6,\"typeCode\":\"CLOCK\",\"typeName\":\"打卡\"},{\"count\":2,\"increment\":0,\"typeCode\":\"NAIRE\",\"typeName\":\"读者反馈\"},{\"count\":44,\"increment\":0,\"typeCode\":\"LIVE_TIMETABLE\",\"typeName\":\"直播课\"},{\"count\":17,\"increment\":0,\"typeCode\":\"ARTICLE_READING\",\"typeName\":\"课文诵读\"},{\"count\":15,\"increment\":0,\"typeCode\":\"VOTE\",\"typeName\":\"投票\"},{\"count\":11,\"increment\":0,\"typeCode\":\"EBOOK\",\"typeName\":\"热门电子书\"},{\"count\":12,\"increment\":0,\"typeCode\":\"TEST_PAPER\",\"typeName\":\"试卷\"},{\"count\":27,\"increment\":0,\"typeCode\":\"RECITE_WORD\",\"typeName\":\"背单词\"},{\"count\":9,\"increment\":0,\"typeCode\":\"BM\",\"typeName\":\"活动报名\"},{\"count\":55,\"increment\":1,\"typeCode\":\"FLAG\",\"typeName\":\"立Flag\"},{\"count\":15,\"increment\":0,\"typeCode\":\"MEMBER\",\"typeName\":\"开通会员\"},{\"count\":7,\"increment\":0,\"typeCode\":\"BOOKCARD\",\"typeName\":\"读书卡片\"},{\"count\":5,\"increment\":0,\"typeCode\":\"TUTOR\",\"typeName\":\"名师辅导\"},{\"count\":21,\"increment\":0,\"typeCode\":\"GROUP\",\"typeName\":\"读者交流圈\"},{\"count\":33,\"increment\":1,\"typeCode\":\"PDF\",\"typeName\":\"图文\"},{\"count\":35,\"increment\":1,\"typeCode\":\"TEACH_RESOURCE\",\"typeName\":\"教辅资料包\"},{\"count\":8,\"increment\":0,\"typeCode\":\"VOICE_MSG\",\"typeName\":\"作者留言\"},{\"count\":39,\"increment\":1,\"typeCode\":\"ITEM_BANK\",\"typeName\":\"在线题库\"},{\"count\":4,\"increment\":0,\"typeCode\":\"KK\",\"typeName\":\"扫扫看\"},{\"count\":100,\"increment\":1,\"typeCode\":\"ANSWER\",\"typeName\":\"答案\"},{\"count\":20,\"increment\":0,\"typeCode\":\"DRAW\",\"typeName\":\"抽奖\"},{\"count\":11,\"increment\":0,\"typeCode\":\"PBSTORY\",\"typeName\":\"绘本伴读\"},{\"count\":3,\"increment\":2,\"typeCode\":\"FOREIGN_READ\",\"typeName\":\"外刊阅读\"},{\"count\":56,\"increment\":0,\"typeCode\":\"ARTICLE\",\"typeName\":\"精品文章\"},{\"count\":27,\"increment\":0,\"typeCode\":\"COLD_KNOWLEDGE\",\"typeName\":\"冷知识\"},{\"count\":14,\"increment\":0,\"typeCode\":\"BOOK\",\"typeName\":\"资源合集\"},{\"count\":19,\"increment\":1,\"typeCode\":\"TICKET\",\"typeName\":\"准考证\"},{\"count\":17,\"increment\":0,\"typeCode\":\"ENGLISH_WALKMAN\",\"typeName\":\"英语随声听\"},{\"count\":18,\"increment\":0,\"typeCode\":\"ORAL_EVALUATION\",\"typeName\":\"口语评测\"},{\"count\":1,\"increment\":0,\"typeCode\":\"ACTIVITY\",\"typeName\":\"分享互动\"},{\"count\":12,\"increment\":0,\"typeCode\":\"BOOK_CLICK\",\"typeName\":\"点读书\"}]");
JedisClusterUtils.del(BookConstant.BOOK_HOT_APP + DateUtil.format(new Date(), DatePattern.NORM_DATE_FORMAT));
}
@ApiOperation("书刊配置的RAYS应用")
@GetMapping("getBookAndBookGroupRaysApps")
public ResponseDto<?> getBookAndBookGroupRaysApps(
@RequestParam("adviserId") Long adviserId, @RequestParam("bookId")Long bookId, @RequestParam("channelId") Long channelId){
return new ResponseDto<>(bookGroupBiz.getBookAndBookGroupRaysApps(adviserId, bookId, channelId));
}
}
......@@ -3493,6 +3493,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
|| AppAndProductTypeEnum.PRODUCT.value.equals(item.getServeType()) && ArrayUtils
.contains(RightsSettingConstant.APPLET_PRODUCT_NOT_SUPPORT, item.getServeTypeCode())) {
toRemoveList.add(item);
} else {
//RAYS应用在小程序里单独展示
List<String> typeCodes = appConsr.getRaysAppTypeCodes();
if (!ListUtils.isEmpty(typeCodes) && typeCodes.contains(item.getServeTypeCode())) {
toRemoveList.add(item);
}
}
}
if (!ListUtils.isEmpty(toRemoveList)) {
......
......@@ -283,6 +283,35 @@
g.book_id = #{bookId}
AND g.channel_id = #{channelId}
AND g.create_user = #{adviserId}
AND s.serve_type IN ("APP", "PRODUCT")
GROUP BY
s.serve_id
ORDER BY
s.id
</select>
<select id="getServeListByBookAndType" parameterType="map" resultMap="BaseResultMap">
SELECT
s.id,
s.serve_id,
s.serve_type,
s.serve_url,
s.short_url,
s.book_group_id,
s.create_user,
s.create_time,
s.type_code
FROM
book_group_serve s
LEFT JOIN book_group g ON s.book_group_id = g.id
WHERE
g.book_id = #{bookId}
AND g.channel_id = #{channelId}
AND g.create_user = #{adviserId}
AND s.type_code IN
<foreach collection="typeCodes" open="(" close=")" item="item" index="index" separator=",">
#{item}
</foreach>
GROUP BY
s.serve_id
ORDER BY
......
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