Commit 6b28a2ad by 田超

Merge branch 'feature/1028321' into 'master'

bug: [1028321] 未配置资源二维码弹框,翻页到最后一页无法翻页,getQrList接口500

See merge request rays/pcloud-book!1232
parents 50855c42 2e69890a
...@@ -377,4 +377,9 @@ public interface BookAdviserBiz { ...@@ -377,4 +377,9 @@ public interface BookAdviserBiz {
List<Long> getBooksByAgentToken(Long agentId, int index); List<Long> getBooksByAgentToken(Long agentId, int index);
BookServeInfo listBookServes4Book(String cursor, Integer limit); BookServeInfo listBookServes4Book(String cursor, Integer limit);
/**
* 小睿书下面的书刊权益数量
*/
Map<Long,Integer> rightsCountByBookIds(List<Long> bookIds);
} }
...@@ -80,6 +80,7 @@ import com.pcloud.book.group.enums.JoinGroupTypeEnum; ...@@ -80,6 +80,7 @@ import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz; import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.constants.RightsSettingConstant; import com.pcloud.book.rightsSetting.constants.RightsSettingConstant;
import com.pcloud.book.rightsSetting.dao.RightsSettingDAO; import com.pcloud.book.rightsSetting.dao.RightsSettingDAO;
import com.pcloud.book.rightsSetting.dto.BookRightsCountsDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingQueryDTO; import com.pcloud.book.rightsSetting.dto.RightsSettingQueryDTO;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
...@@ -1251,21 +1252,14 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1251,21 +1252,14 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
return new PageBeanNew<>(currentPage, numPerPage,new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage,new ArrayList<>());
} }
List<QrCodeVO> record = new ArrayList<>(); List<QrCodeVO> record = new ArrayList<>();
if (qrCodeVOS.size() > (currentPage + 1) * numPerPage){
//type 代表的是过滤二维码。如果是0,展示所有的二维码。如果是1(展示没有资源的码。但是要过滤小睿教育的书的非公众号二维码) //type 代表的是过滤二维码。如果是0,展示所有的二维码。如果是1(展示没有资源的码。但是要过滤小睿教育的书的非公众号二维码)
if(null!=type && 1==type){ if(null!=type && 1==type) {
qrCodeVOS = qrCodeVOS.stream().filter(a -> (null == a.getServeCount() || 0 == a.getServeCount()) && !(null != a.getXiaoRuiEducation() && a.getXiaoRuiEducation() && !"wechat".equalsIgnoreCase(a.getCodeType()))).collect(Collectors.toList()); qrCodeVOS = qrCodeVOS.stream().filter(a -> (null == a.getServeCount() || 0 == a.getServeCount()) && !(null != a.getXiaoRuiEducation() && a.getXiaoRuiEducation() && !"wechat".equalsIgnoreCase(a.getCodeType()))).collect(Collectors.toList());
record = qrCodeVOS.subList(currentPage * numPerPage,(currentPage + 1) * numPerPage);
}else{
record = qrCodeVOS.subList(currentPage * numPerPage,(currentPage + 1) * numPerPage);
} }
if (qrCodeVOS.size() > (currentPage + 1) * numPerPage){
record = qrCodeVOS.subList(currentPage * numPerPage,(currentPage + 1) * numPerPage);
} else { } else {
if(null!=type && 1==type){
qrCodeVOS = qrCodeVOS.stream().filter(a -> (null == a.getServeCount() || 0 == a.getServeCount()) && !(null != a.getXiaoRuiEducation() && a.getXiaoRuiEducation() && !"wechat".equalsIgnoreCase(a.getCodeType()))).collect(Collectors.toList());
record = qrCodeVOS.subList(currentPage * numPerPage, qrCodeVOS.size()); record = qrCodeVOS.subList(currentPage * numPerPage, qrCodeVOS.size());
}else{
record = qrCodeVOS.subList(currentPage * numPerPage, qrCodeVOS.size());
}
} }
return new PageBeanNew<>(currentPage, numPerPage,qrCodeVOS.size(), record); return new PageBeanNew<>(currentPage, numPerPage,qrCodeVOS.size(), record);
} }
...@@ -1307,13 +1301,13 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1307,13 +1301,13 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
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, RightsSettingDto>> rightsMapSubmit = ThreadPoolUtils.OTHER_POOL.submit(()-> rightsSettingDAO.listByBookIds(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, 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, RightsSettingDto> rightsMap=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) {
...@@ -1370,10 +1364,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1370,10 +1364,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
continue; continue;
} }
// 如果是小睿码,则显示权益数 // 如果是小睿码,则显示权益数
RightsSettingDto rightsSettingDto = rightsMap.get(bookGroupServeCountDTO.getBookId()); Integer count = rightsMap.get(bookGroupServeCountDTO.getBookId());
if(rightsSettingDto!=null){ bookGroupServeCountDTO.setRightsCount(count);
bookGroupServeCountDTO.setRightsCount(rightsSettingDto.getCount());
}
} }
} }
...@@ -2716,4 +2708,17 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -2716,4 +2708,17 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
} }
return list; return list;
} }
/**
* 小睿书下面的书刊权益数量
*/
@Override
public Map<Long, Integer> rightsCountByBookIds(List<Long> bookIds) {
if(CollUtil.isEmpty(bookIds)){
return new HashMap<>();
}
List<BookRightsCountsDto> bookRightsCountsDtos = rightsSettingDAO.rightsCountByBookIds(bookIds);
Map<Long, Integer> result = CollUtil.isEmpty(bookRightsCountsDtos) ? new HashMap<>() : bookRightsCountsDtos.stream().collect(Collectors.toMap(a -> a.getBookId(), a -> a.getCount(), (k1, k2) -> k2));
return result;
}
} }
package com.pcloud.book.rightsSetting.dao; package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.dto.BookRightsCountsDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO; import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
...@@ -34,6 +35,8 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> { ...@@ -34,6 +35,8 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> {
Map<Long, RightsSettingDto> listByBookIds(List<Long> bookIds); Map<Long, RightsSettingDto> listByBookIds(List<Long> bookIds);
List<BookRightsCountsDto> rightsCountByBookIds(List<Long> bookIds);
void updateUser(RightsSetting rightsSetting); void updateUser(RightsSetting rightsSetting);
RightsSettingDto getDTOById(Long id); RightsSettingDto getDTOById(Long id);
......
package com.pcloud.book.rightsSetting.dao.impl; package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsSettingDAO; import com.pcloud.book.rightsSetting.dao.RightsSettingDAO;
import com.pcloud.book.rightsSetting.dto.BookRightsCountsDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO; import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
...@@ -97,4 +98,11 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement ...@@ -97,4 +98,11 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement
public RightsSettingDto getDTOById(Long id) { public RightsSettingDto getDTOById(Long id) {
return super.getSqlSession().selectOne(getStatement("getDTOById"),id); return super.getSqlSession().selectOne(getStatement("getDTOById"),id);
} }
@Override
public List<BookRightsCountsDto> rightsCountByBookIds(List<Long> bookIds) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookIds",bookIds);
return getSessionTemplate().selectList(getStatement("rightsCountByBookIds"),paramMap );
}
} }
package com.pcloud.book.rightsSetting.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 书刊权益数量(只是书刊权益)
*/
@Data
public class BookRightsCountsDto {
@ApiModelProperty("书刊id")
private Long bookId;
@ApiModelProperty("书刊权益数量")
private Integer count;
}
...@@ -431,4 +431,19 @@ ...@@ -431,4 +431,19 @@
id = #{id,jdbcType=BIGINT} id = #{id,jdbcType=BIGINT}
</select> </select>
<select id="rightsCountByBookIds" resultType="com.pcloud.book.rightsSetting.dto.BookRightsCountsDto">
SELECT
a.book_id bookId,
ifnull(count(1),0) count
FROM
rights_setting_book_relation a
INNER JOIN rights_now_item b ON a.rights_setting_id = b.rights_setting_id
WHERE
a.book_id IN
<foreach collection="bookIds" item="item" separator="," open="(" close=")" >
#{item}
</foreach>
GROUP BY a.book_id
</select>
</mapper> </mapper>
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