Commit b2ee0ec5 by 田超

Merge branch 'feature/bookGroupInterface' into 'master'

feat: [none] bookgroup接口优化

See merge request rays/pcloud-book!921
parents 29973a29 0a536890
...@@ -3262,14 +3262,32 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -3262,14 +3262,32 @@ public class BookGroupBizImpl implements BookGroupBiz {
if (!ListUtils.isEmpty(bookGroupAnalysisParam.getAgentIds())) { if (!ListUtils.isEmpty(bookGroupAnalysisParam.getAgentIds())) {
paramMap.put("agentIds", bookGroupAnalysisParam.getAgentIds()); paramMap.put("agentIds", bookGroupAnalysisParam.getAgentIds());
} }
paramMap.put("isFundSupport", bookGroupAnalysisParam.getIsFundSupport()); if (null != bookGroupAnalysisParam.getIsFundSupport()){
paramMap.put("isCopyright", bookGroupAnalysisParam.getIsCopyright()); paramMap.put("isFundSupport", bookGroupAnalysisParam.getIsFundSupport());
}
if (null != bookGroupAnalysisParam.getIsCopyright()){
paramMap.put("isCopyright", bookGroupAnalysisParam.getIsCopyright());
}
String monthDate = bookGroupAnalysisParam.getMonthDate();
String monthKey = monthDate == null?"all":monthDate;
String key = BookBusinessConstants.AGENT_STATISTIC;
String field = bookGroupAnalysisParam.getCurrentPage()+"_"+bookGroupAnalysisParam.getNumPerPage()+"_"+monthKey;
String countKey = BookBusinessConstants.AGENT_STATISTIC_COUNT;
if (MapUtils.isEmpty(paramMap)){
List<BookGroupAnalysisVO> list = JedisClusterUtils.hgetJson2List(key,field,BookGroupAnalysisVO.class);
Integer count= 0;
if (!StringUtil.isEmpty(JedisClusterUtils.get(countKey))){
count = Integer.valueOf(JedisClusterUtils.get(countKey));
}
if (!ListUtils.isEmpty(list) && count>0){
return new PageBeanNew<>(bookGroupAnalysisParam.getCurrentPage(),bookGroupAnalysisParam.getNumPerPage(),count,list);
}
}
PageBeanNew<BookGroupAnalysisVO> pageBeanNew = bookGroupDao.listPageNew( PageBeanNew<BookGroupAnalysisVO> pageBeanNew = bookGroupDao.listPageNew(
new PageParam(bookGroupAnalysisParam.getCurrentPage(), bookGroupAnalysisParam.getNumPerPage()), paramMap, "listPageBookGroupAnalysis"); new PageParam(bookGroupAnalysisParam.getCurrentPage(), bookGroupAnalysisParam.getNumPerPage()), paramMap, "listPageBookGroupAnalysis");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) { if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(bookGroupAnalysisParam.getCurrentPage(), bookGroupAnalysisParam.getNumPerPage(), 0, new ArrayList<>()); return new PageBeanNew<>(bookGroupAnalysisParam.getCurrentPage(), bookGroupAnalysisParam.getNumPerPage(), 0, new ArrayList<>());
} }
String monthDate = bookGroupAnalysisParam.getMonthDate();
//设置书刊分类名称 //设置书刊分类名称
groupSet.setTempletName(pageBeanNew.getRecordList()); groupSet.setTempletName(pageBeanNew.getRecordList());
//设置出版运营编辑名称 //设置出版运营编辑名称
...@@ -3280,6 +3298,11 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -3280,6 +3298,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
groupSet.setGroupStatistic(pageBeanNew.getRecordList(), monthDate); groupSet.setGroupStatistic(pageBeanNew.getRecordList(), monthDate);
//设置资源数据(浏览量,读者量,销售额,支付率,客单价) //设置资源数据(浏览量,读者量,销售额,支付率,客单价)
groupSet.setResourceStatistic(pageBeanNew.getRecordList(), monthDate); groupSet.setResourceStatistic(pageBeanNew.getRecordList(), monthDate);
if (MapUtils.isEmpty(paramMap)){
JedisClusterUtils.hset2Json(key,field,pageBeanNew.getRecordList());
JedisClusterUtils.expire(key,60);
JedisClusterUtils.set(countKey,String.valueOf(pageBeanNew.getTotalCount()),60);
}
return pageBeanNew; return pageBeanNew;
} }
...@@ -3494,6 +3517,20 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -3494,6 +3517,20 @@ public class BookGroupBizImpl implements BookGroupBiz {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) { if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION; throw BookBizException.PAGE_PARAM_DELETION;
} }
isSpecial = isSpecial==null?false:isSpecial;
String key = BookBusinessConstants.AGENT_STATISTIC;
String field = currentPage+"_"+numPerPage;
String countKey = BookBusinessConstants.AGENT_STATISTIC_COUNT;
if (null == agentId && !isSpecial){
List<AgentStatisticsInfoDTO> list = JedisClusterUtils.hgetJson2List(key,field,AgentStatisticsInfoDTO.class);
Integer count= 0;
if (!StringUtil.isEmpty(JedisClusterUtils.get(countKey))){
count = Integer.valueOf(JedisClusterUtils.get(countKey));
}
if (!ListUtils.isEmpty(list) && count>0){
return new PageBeanNew<>(currentPage,numPerPage,count,list);
}
}
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("agentId", agentId); paramMap.put("agentId", agentId);
if (isSpecial != null && isSpecial) { if (isSpecial != null && isSpecial) {
...@@ -3508,6 +3545,11 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -3508,6 +3545,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
List<AgentStatisticsInfoDTO> agentStatisticsInfoDTOS = pageBeanNew.getRecordList(); List<AgentStatisticsInfoDTO> agentStatisticsInfoDTOS = pageBeanNew.getRecordList();
groupSet.setAgentStatisticsDetailInfo(agentStatisticsInfoDTOS); groupSet.setAgentStatisticsDetailInfo(agentStatisticsInfoDTOS);
} }
if (null == agentId && !isSpecial){
JedisClusterUtils.hset2Json(key,field,pageBeanNew.getRecordList());
JedisClusterUtils.expire(key,60);
JedisClusterUtils.set(countKey,String.valueOf(pageBeanNew.getTotalCount()),60);
}
return pageBeanNew; return pageBeanNew;
} }
......
package com.pcloud.book.group.constant; package com.pcloud.book.group.constant;
import com.pcloud.book.group.dto.AutoUpdateGroupNumDTO; import com.pcloud.book.group.dto.AutoUpdateGroupNumDTO;
import com.pcloud.common.constant.CacheConstant;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -57,4 +58,14 @@ public class BookBusinessConstants { ...@@ -57,4 +58,14 @@ public class BookBusinessConstants {
} }
} }
/**
* 个人号-出版社统计
*/
public static final String AGENT_STATISTIC = CacheConstant.BOOK+"BOOKGROUP:getAgentStatisticsInfo";
public static final String AGENT_STATISTIC_COUNT = CacheConstant.BOOK+"BOOKGROUP:getAgentStatisticsInfo_count";
/**
* 平台端-社群书分析
*/
public static final String BOOKGROUP_ANALYSIS = CacheConstant.BOOK+"BOOKGROUP:listPageBookGroupAnalysis";
public static final String BOOKGROUP_ANALYSIS_COUNT = CacheConstant.BOOK+"BOOKGROUP:listPageBookGroupAnalysis_count";
} }
...@@ -595,21 +595,12 @@ ...@@ -595,21 +595,12 @@
G.join_group_type G.join_group_type
FROM FROM
book_group G book_group G
LEFT JOIN BOOK_ADVISER A ON G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID INNER JOIN BOOK_ADVISER A ON G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID AND A.IS_DELETE = 0
LEFT JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND B.IS_DELETE = 0
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW() LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
LEFT JOIN book_auth_info i ON G.book_id = i.book_id AND i.book_status = 1 AND i.is_group_book = 1 LEFT JOIN book_auth_info i ON G.book_id = i.book_id AND i.book_status = 1 AND i.is_group_book = 1
WHERE 1 = 1 WHERE 1 = 1
AND G.is_delete = 0 AND G.is_delete = 0
AND A.BOOK_ID IS NOT NULL
AND (
A.BOOK_ADVISER_ID IS NULL
OR A.IS_DELETE = 0
)
AND (
B.BOOK_ID IS NULL
OR B.IS_DELETE = 0
)
<if test="isFundSupport != null and isFundSupport == 1"> <if test="isFundSupport != null and isFundSupport == 1">
AND BF.BOOK_FUND_ID IS NOT NULL AND BF.BOOK_FUND_ID IS NOT NULL
</if> </if>
...@@ -749,8 +740,8 @@ ...@@ -749,8 +740,8 @@
${item} ${item}
</foreach> </foreach>
</if> </if>
AND agent_id > 0
GROUP BY agent_id GROUP BY agent_id
HAVING agent_id IS NOT NULL
ORDER BY groupBookCount DESC ORDER BY groupBookCount DESC
</select> </select>
......
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