Commit d447b545 by 朱亚洁

feat:[1003539]小睿数据看板-大屏

parent 230be4c2
...@@ -252,4 +252,12 @@ public interface BookAdviserBiz { ...@@ -252,4 +252,12 @@ public interface BookAdviserBiz {
PageBeanNew<QrcodeStatisticsDTO> getBookQrcodeStatistics(Long adviserId, Long bookId, Long channelId, Integer currentPage, Integer numPerPage); PageBeanNew<QrcodeStatisticsDTO> getBookQrcodeStatistics(Long adviserId, Long bookId, Long channelId, Integer currentPage, Integer numPerPage);
/**
* 小睿数据看板-书刊品种数
* @author:zhuyajie
* @date:2020/8/25 11:31
* * @param null
*/
Map<String,Object> getRayBookCountAndRate(Boolean showRate);
} }
...@@ -1340,4 +1340,25 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1340,4 +1340,25 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
return new PageBeanNew(currentPage, numPerPage, qrcodeSceneDtoList.size(),qrcodeSceneDtoList.stream().skip(currentPage * numPerPage).limit(numPerPage).collect(Collectors.toList())); return new PageBeanNew(currentPage, numPerPage, qrcodeSceneDtoList.size(),qrcodeSceneDtoList.stream().skip(currentPage * numPerPage).limit(numPerPage).collect(Collectors.toList()));
} }
@Override
public Map<String, Object> getRayBookCountAndRate(Boolean showRate) {
Map<String, Object> map = Maps.newHashMap();
Long bookCount = bookAdviserDao.getRayBookCount(null, null);
map.put("totalCount", bookCount);
if (showRate) {
//展示同比上周增长率
String thisWeekStart = DateUtils.formatDate(DateUtils.getWeekStart(new Date()));
Long thisWeekCount = bookAdviserDao.getRayBookCount(thisWeekStart, DateUtils.currentTime());
Date lastWeekStart = DateUtils.addDay(DateUtils.getWeekStart(new Date()), -7);
Date lastWeekEnd = DateUtils.addDay(new Date(), -7);
Long lastWeekCount = bookAdviserDao.getRayBookCount(DateUtils.formatDate(lastWeekStart, DateUtils.DATE_FORMAT_DATETIME), DateUtils.formatDate(lastWeekEnd, DateUtils.DATE_FORMAT_DATETIME));
Long addCount = thisWeekCount - lastWeekCount;
BigDecimal rate = (lastWeekCount.equals(0L)) ? BigDecimal.ZERO :
new BigDecimal(addCount.doubleValue() / lastWeekCount).setScale(4, BigDecimal.ROUND_HALF_UP);
map.put("weekGrowthRate", rate);
}
return map;
}
} }
...@@ -279,4 +279,9 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> { ...@@ -279,4 +279,9 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
* * @param null * * @param null
*/ */
Integer getBookCountByTime(List<Long> adviserIds, String startTime, String endTime); Integer getBookCountByTime(List<Long> adviserIds, String startTime, String endTime);
/**
* 走小睿流程的现代纸书的书刊数量
*/
Long getRayBookCount(String startTime, String endTime);
} }
...@@ -283,4 +283,12 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book ...@@ -283,4 +283,12 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
map.put("endTime", endTime); map.put("endTime", endTime);
return getSessionTemplate().selectOne(getStatement("getBookCountByTime"), map); return getSessionTemplate().selectOne(getStatement("getBookCountByTime"), map);
} }
@Override
public Long getRayBookCount(String startTime, String endTime) {
Map<String,Object> map = Maps.newHashMap();
map.put("startTime", startTime);
map.put("endTime", endTime);
return getSessionTemplate().selectOne(getStatement("getRayBookCount"), map);
}
} }
...@@ -233,4 +233,9 @@ public interface BookAdviserFacade { ...@@ -233,4 +233,9 @@ public interface BookAdviserFacade {
@ApiOperation("获取书刊二维码统计数据") @ApiOperation("获取书刊二维码统计数据")
@PostMapping("mapBookQrcodeStatistics") @PostMapping("mapBookQrcodeStatistics")
ResponseDto<Map<String, BookQrcodeStatisticsDTO>> mapBookQrcodeStatistics(@RequestBody MapResourceTotalCountDTO mapResourceTotalCountDTO); ResponseDto<Map<String, BookQrcodeStatisticsDTO>> mapBookQrcodeStatistics(@RequestBody MapResourceTotalCountDTO mapResourceTotalCountDTO);
@ApiOperation("小睿数据看板-书刊品种数")
@GetMapping("getRayBookCountAndRate")
ResponseDto<?> getRayBookCountAndRate(@RequestParam(value = "showRate", defaultValue = "false") Boolean showRate);
} }
...@@ -243,4 +243,11 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade { ...@@ -243,4 +243,11 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
return new ResponseDto<>(bookAdviserBiz.getBookQrcodeStatistics(adviserId, bookId, channelId, currentPage, numPerPage)); return new ResponseDto<>(bookAdviserBiz.getBookQrcodeStatistics(adviserId, bookId, channelId, currentPage, numPerPage));
} }
@Override
@GetMapping("getRayBookCountAndRate")
public ResponseDto<?> getRayBookCountAndRate(@RequestParam(value = "showRate", defaultValue = "false") Boolean showRate){
return new ResponseDto<>(bookAdviserBiz.getRayBookCountAndRate(showRate));
}
} }
...@@ -2409,7 +2409,9 @@ ...@@ -2409,7 +2409,9 @@
</select> </select>
<update id="updateIsOpenRobotProcess" parameterType="map"> <update id="updateIsOpenRobotProcess" parameterType="map">
update book_adviser set is_open_robot_process=#{isOpenRobotProcess} update book_adviser
set is_open_robot_process=#{isOpenRobotProcess},
LAST_MODIFIED_DATE = NOW()
where book_id=#{bookId} where book_id=#{bookId}
and adviser_id=#{adviserId} and adviser_id=#{adviserId}
and is_delete=0 and is_delete=0
......
...@@ -753,4 +753,41 @@ ...@@ -753,4 +753,41 @@
AND A.IS_MAIN_EDITOR = 1 AND A.IS_MAIN_EDITOR = 1
</select> </select>
<!--走小睿流程的现代纸书的书刊数量-->
<select id="getRayBookCount" resultType="long" parameterType="map">
SELECT
COUNT(1)
FROM
(
SELECT
a.BOOK_ADVISER_ID
FROM
book_adviser a
LEFT JOIN book_group g ON a.BOOK_ID = g.book_id
AND a.ADVISER_ID = g.create_user
AND a.CHANNEL_ID = g.channel_id
AND g.is_delete = 0
WHERE
a.IS_DELETE = 0
AND g.join_group_type = 4
<if test="startTime != null and endTime != null">
AND g.create_time BETWEEN #{startTime} AND #{endTime}
</if>
UNION
(
SELECT
BOOK_ADVISER_ID
FROM
book_adviser
WHERE
is_delete = 0
AND is_open_robot_process = 1
<if test="startTime != null and endTime != null">
AND LAST_MODIFIED_DATE BETWEEN #{startTime} AND #{endTime}
</if>
)
) AS a
</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