Commit a3d6b3c0 by tc

bug[none]优化首页接口

parent b770f792
......@@ -83,4 +83,6 @@ public interface ServeCollectBiz {
* @return
*/
List<ServeCollectDTO> getList4Collect(List<ServeCollectDTO> serveCollects);
List<ServeCollect> getList4RightsSettingByWechatUserId(Long wechatUserId);
}
\ No newline at end of file
......@@ -333,6 +333,11 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
}
@Override
public List<ServeCollect> getList4RightsSettingByWechatUserId(Long wechatUserId) {
return serveCollectDao.getList4RightsSettingByWechatUserId(wechatUserId);
}
@Override
public List<Long> getAllCollect(Long wechatUserId) {
return serveCollectDao.getAllCollect(wechatUserId);
}
......
......@@ -23,4 +23,6 @@ public interface ServeCollectDao extends BaseDao<ServeCollect> {
List<Long> getAllCollect(Long wechatUserId);
List<ServeCollectDTO> getList4Collect(List<ServeCollectDTO> serveCollects);
List<ServeCollect> getList4RightsSettingByWechatUserId(Long wechatUserId);
}
\ No newline at end of file
......@@ -32,6 +32,12 @@ public class ServeCollectDaoImpl extends BaseDaoImpl<ServeCollect> implements Se
return getSessionTemplate().selectList(getStatement("getList4RightsSetting"), serveCollects);
}
@Override
public List<ServeCollect> getList4RightsSettingByWechatUserId(Long wechatUserId) {
return getSessionTemplate().selectList(getStatement("getList4RightsSettingByWechatUserId"), wechatUserId);
}
@Override
public List<Long> getAllCollect(Long wechatUserId) {
return getSessionTemplate().selectList(getStatement("getAllCollect"), wechatUserId);
......
......@@ -1006,4 +1006,6 @@ public interface BookGroupBiz {
*社群码下载选择样式
*/
BackgroundGroupQrcodeDTO getBackgroundGroupQr(BackgroundGroupQrcodeDTO backgroundGroupQrcodeDTO);
List<BookServeDTO> getBookAndBookGroupServeIdsFive(Long adviserId, Long bookId, Long channelId);
}
......@@ -5204,7 +5204,93 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
@Override
public List<BookServeDTO> getBookAndBookGroupServeIdsFive(Long adviserId, Long bookId, Long channelId) {
List<BookServeDTO> serveDTOList = new ArrayList<>();
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOByBookId(bookId, channelId, adviserId);
List<Long> appIds = new ArrayList<>();
List<Long> productIds = new ArrayList<>();
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(channelId);
if (null == accountSettingDto){
return new ArrayList<>();
}
//先排纸书二维码资源,后排社群书资源,张文庆
//现代纸书二维码配置资源
BookServeParamVO serveParamVO = new BookServeParamVO();
serveParamVO.setAdviserId(adviserId);
serveParamVO.setBookId(bookId);
serveParamVO.setChannelId(channelId);
List<BookServeVO> bookServeVOS = qrcodeSceneConsr.listBookServeIds(serveParamVO);
if (!ListUtils.isEmpty(bookServeVOS)) {
for (BookServeVO bookServeVO : bookServeVOS) {
if(serveDTOList.size()>=5){
break;
}
Long serveId = bookServeVO.getServeId();
BookServeDTO bookServeDTO = new BookServeDTO();
bookServeDTO.setTypeCode(bookServeVO.getTypeCode());
bookServeDTO.setFromType(bookServeVO.getFromType());
bookServeDTO.setFromTypeName(bookServeVO.getFromTypeName());
String url = SendWeixinRequestTools.splitUrl(accountSettingDto, bookServeVO.getUrl());
if (AppAndProductTypeEnum.APP.value.equals(bookServeVO.getTypeCode()) && !appIds.contains(serveId)) {
bookServeDTO.setServeId(serveId);
bookServeDTO.setServeType(bookServeVO.getTypeCode());
bookServeDTO.setUrl(url);
serveDTOList.add(bookServeDTO);
appIds.add(serveId);
} else if (AppAndProductTypeEnum.PRODUCT.value.equals(bookServeVO.getTypeCode()) && !productIds.contains(serveId)) {
bookServeDTO.setServeId(serveId);
bookServeDTO.setServeType(bookServeVO.getTypeCode());
bookServeDTO.setUrl(url);
serveDTOList.add(bookServeDTO);
productIds.add(serveId);
}
}
}
if (null != bookGroupDTO && serveDTOList.size()<5) {//有社群书
//社群书配置资源
List<BookGroupServe> bookGroupServes = bookGroupServeDao.getListByBookGroupId(bookGroupDTO.getId());
if (!ListUtils.isEmpty(bookGroupServes)) {
for (BookGroupServe bookGroupServe : bookGroupServes) {
if(serveDTOList.size()>=5){
break;
}
BookServeDTO bookServeDTO = new BookServeDTO();
BeanUtils.copyProperties(bookGroupServe, bookServeDTO);
String url = SendWeixinRequestTools.splitUrl(accountSettingDto, bookGroupServe.getServeUrl());
bookServeDTO.setUrl(url);
bookServeDTO.setTypeCode(bookServeDTO.getServeType());
bookServeDTO.setFromType(bookGroupServe.getTypeCode());
bookServeDTO.setFromTypeName(bookGroupServe.getFromType());
Long serveId = bookGroupServe.getServeId();
if (AppAndProductTypeEnum.APP.value.equals(bookServeDTO.getServeType()) && !appIds.contains(serveId)) {
serveDTOList.add(bookServeDTO);
appIds.add(serveId);
} else if (AppAndProductTypeEnum.PRODUCT.value.equals(bookServeDTO.getServeType()) && !productIds.contains(serveId)){
serveDTOList.add(bookServeDTO);
productIds.add(serveId);
}
}
}
}
return serveDTOList;
}
@Override
public List<BookServeDTO> getBookAndBookGroupServeIds( Long adviserId, Long bookId, Long channelId ) {
List<BookServeDTO> result = new ArrayList();
String key = "getBookAndBookGroupServeIds"+adviserId+"_"+bookId+"_"+channelId;
if(JedisClusterUtils.exists(key)){
result = JedisClusterUtils.getJsonList(key, BookServeDTO.class);
}else {
result = getBookServes(adviserId, bookId, channelId);
JedisClusterUtils.setJsonList(key,result,300);
}
return result;
}
private List<BookServeDTO> getBookServes( Long adviserId, Long bookId, Long channelId ) {
List<BookServeDTO> serveDTOList = new ArrayList<>();
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOByBookId(bookId, channelId, adviserId);
List<Long> appIds = new ArrayList<>();
......
......@@ -120,7 +120,7 @@ public interface RightsSettingBiz {
FillRightsSettingAppletsDTO getFillRightsSettingApplets(Long rightsSettingId, Long wechatUserId, Long rightsClassifyId,
Integer top, Long bookId, Long officialAccountsId);
List<RightsItemGroup> getRightsItemGroups(Long rightsSettingId, Long adviserId, Long bookId, Long channelId, Boolean removeCanNotBuy, Integer readType, Long wechatUserId);
List<RightsItemGroup> getRightsItemGroups(Long rightsSettingId, Long adviserId, Long bookId, Long channelId, Boolean removeCanNotBuy, Integer readType, Long wechatUserId,boolean homePage);
RightsSettingDto getRightSettingByBookId(Long bookId, Long adviserId, Long channelId);
......
......@@ -233,7 +233,7 @@ public class RightsSettingFacede {
if (null==rightsSettingId){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(rightsSettingBiz.getRightsItemGroups(rightsSettingId, adviserId, bookId, channelId, true,readType, wechatUserId));
return new ResponseDto<>(rightsSettingBiz.getRightsItemGroups(rightsSettingId, adviserId, bookId, channelId, true,readType, wechatUserId,false));
}
@ApiOperation("根据书刊的分类获取对应的分类权益信息")
......
......@@ -6,7 +6,7 @@ eureka:
instance:
status-page-url-path: /book/v1.0/swagger-ui.html
client:
register-with-eureka: false #禁止自己当做服务注册
register-with-eureka: true #禁止自己当做服务注册
spring:
application:
......
......@@ -342,7 +342,7 @@
n.pic1,
n.pic2,
n.pic3,
n.content,
-- n.content,
n.show_state showState,
n.create_time createTime,
n.first_classify firstClassify,
......
......@@ -183,6 +183,19 @@
and serve_type = 1
</update>
<select id="getList4RightsSettingByWechatUserId" parameterType="list" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
serve_collect
where
is_delete = 0
and
wechat_user_id = #{wechatUserId}
</select>
<select id="getList4RightsSetting" parameterType="list" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
......
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