Commit a9dfe1ea by 阮思源

1002161个人号新增数据需求

parent c113eb6c
...@@ -1785,7 +1785,7 @@ public class BookBizImpl implements BookBiz { ...@@ -1785,7 +1785,7 @@ public class BookBizImpl implements BookBiz {
if (adviserId != null) { if (adviserId != null) {
paramMap.put("adviserId", adviserId); paramMap.put("adviserId", adviserId);
} }
paramMap.put("joinGroupType", JoinGroupTypeEnum.ROBOT.getCode()); paramMap.put("joinGroupTypes", Arrays.asList(JoinGroupTypeEnum.ROBOT.getCode(),JoinGroupTypeEnum.AI_ROBOT.getCode()));
PageBeanNew<AdviserBookInfoDTO> pageBean = bookDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "getListPage4BookGroup"); PageBeanNew<AdviserBookInfoDTO> pageBean = bookDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "getListPage4BookGroup");
if (null == pageBean || ListUtils.isEmpty(pageBean.getRecordList())) { if (null == pageBean || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
......
...@@ -18,4 +18,9 @@ public interface AppClickRecordBiz { ...@@ -18,4 +18,9 @@ public interface AppClickRecordBiz {
* 根据类型按照时间获取资源服务点击人数 * 根据类型按照时间获取资源服务点击人数
*/ */
List<CountAndTimeDTO> getAppClickByTime(Integer joinGroupType, Integer timeType, String startTime, String endTime); List<CountAndTimeDTO> getAppClickByTime(Integer joinGroupType, Integer timeType, String startTime, String endTime);
/**
* 根据社群书id和应用或作品id获取各个时间段的点击次数
*/
List<CountAndTimeDTO> getAppClickGroupByTime(Long bookGroupId, Long serveId, String serveType);
} }
...@@ -69,4 +69,29 @@ public class AppClickRecordBizImpl implements AppClickRecordBiz { ...@@ -69,4 +69,29 @@ public class AppClickRecordBizImpl implements AppClickRecordBiz {
list = list.stream().sorted(Comparator.comparing(CountAndTimeDTO::getTime)).collect(Collectors.toList()); list = list.stream().sorted(Comparator.comparing(CountAndTimeDTO::getTime)).collect(Collectors.toList());
return list; return list;
} }
@ParamLog("根据社群书id和应用或作品id获取各个时间段的点击次数")
@Override
public List<CountAndTimeDTO> getAppClickGroupByTime(Long bookGroupId, Long serveId, String serveType) {
if (bookGroupId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "bookGroupId不能为空!");
}
List<CountAndTimeDTO> list = appClickRecordDao.getAppClickGroupByTime(bookGroupId, serveId, serveType);
fill24Hour(list);
list = list.stream().sorted(Comparator.comparing(CountAndTimeDTO::getHour)).collect(Collectors.toList());
return list;
}
@ParamLog("填充24小时")
private void fill24Hour(List<CountAndTimeDTO> list) {
List<Integer> hours = list.stream().map(CountAndTimeDTO::getHour).collect(Collectors.toList());
for (int i = 0; i < 24; i++) {
if (!hours.contains(i)) {
CountAndTimeDTO countAndTimeDTO = new CountAndTimeDTO();
countAndTimeDTO.setHour(i);
countAndTimeDTO.setCount(0);
list.add(countAndTimeDTO);
}
}
}
} }
...@@ -480,14 +480,14 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz { ...@@ -480,14 +480,14 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz {
if (AppAndProductTypeEnum.APP.value.equalsIgnoreCase(serveType)) { if (AppAndProductTypeEnum.APP.value.equalsIgnoreCase(serveType)) {
GroupMoneyDto groupMoneyDto=appSaleMap.get(serveId); GroupMoneyDto groupMoneyDto=appSaleMap.get(serveId);
if (groupMoneyDto!=null){ if (groupMoneyDto!=null){
bookGroupAppDTO.setBuyPeopleCount(groupMoneyDto.getSaleCount().intValue()); bookGroupAppDTO.setBuyPeopleCount(groupMoneyDto.getPayUserCount().intValue());
bookGroupAppDTO.setSaleAmount(groupMoneyDto.getSaleMoney()); bookGroupAppDTO.setSaleAmount(groupMoneyDto.getSaleMoney());
} }
} }
if (AppAndProductTypeEnum.PRODUCT.value.equalsIgnoreCase(serveType)) { if (AppAndProductTypeEnum.PRODUCT.value.equalsIgnoreCase(serveType)) {
GroupMoneyDto groupMoneyDto=productSaleMap.get(serveId); GroupMoneyDto groupMoneyDto=productSaleMap.get(serveId);
if (groupMoneyDto!=null){ if (groupMoneyDto!=null){
bookGroupAppDTO.setBuyPeopleCount(groupMoneyDto.getSaleCount().intValue()); bookGroupAppDTO.setBuyPeopleCount(groupMoneyDto.getPayUserCount().intValue());
bookGroupAppDTO.setSaleAmount(groupMoneyDto.getSaleMoney()); bookGroupAppDTO.setSaleAmount(groupMoneyDto.getSaleMoney());
} }
String typeCode = bookGroupAppDTO.getTypeCode(); String typeCode = bookGroupAppDTO.getTypeCode();
...@@ -579,7 +579,7 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz { ...@@ -579,7 +579,7 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz {
bookGroupAppDTO.setBuyPeopleCount(0); bookGroupAppDTO.setBuyPeopleCount(0);
} }
if (groupMoneyDto.getSaleCount()!=null){ if (groupMoneyDto.getSaleCount()!=null){
bookGroupAppDTO.setBuyPeopleCount(bookGroupAppDTO.getBuyPeopleCount()+groupMoneyDto.getSaleCount().intValue()); bookGroupAppDTO.setBuyPeopleCount(bookGroupAppDTO.getBuyPeopleCount()+groupMoneyDto.getPayUserCount().intValue());
} }
if (bookGroupAppDTO.getSaleAmount()==null){ if (bookGroupAppDTO.getSaleAmount()==null){
bookGroupAppDTO.setSaleAmount(0D); bookGroupAppDTO.setSaleAmount(0D);
......
...@@ -3171,6 +3171,7 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -3171,6 +3171,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
} }
PageParam pageParam = new PageParam(selfBookGroupStParamDTO.getCurrentPage(), selfBookGroupStParamDTO.getNumPerPage()); PageParam pageParam = new PageParam(selfBookGroupStParamDTO.getCurrentPage(), selfBookGroupStParamDTO.getNumPerPage());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("joinGroupTypes", Arrays.asList(JoinGroupTypeEnum.ROBOT.getCode(),JoinGroupTypeEnum.AI_ROBOT.getCode()));
map.put("name", selfBookGroupStParamDTO.getName()); map.put("name", selfBookGroupStParamDTO.getName());
map.put("proLabelId", selfBookGroupStParamDTO.getProLabelId()); map.put("proLabelId", selfBookGroupStParamDTO.getProLabelId());
map.put("depLabelId", selfBookGroupStParamDTO.getDepLabelId()); map.put("depLabelId", selfBookGroupStParamDTO.getDepLabelId());
......
...@@ -80,4 +80,9 @@ public interface AppClickRecordDao extends BaseDao<AppClickRecord> { ...@@ -80,4 +80,9 @@ public interface AppClickRecordDao extends BaseDao<AppClickRecord> {
* 根据bookGroupIds获取应用点击人数 * 根据bookGroupIds获取应用点击人数
*/ */
List<BookGroupIdAndCountDTO> getClCoByBookGroupIds(List<Long> bookGroupIds); List<BookGroupIdAndCountDTO> getClCoByBookGroupIds(List<Long> bookGroupIds);
/**
* 根据社群书id和应用或作品id获取各个时间段的点击次数
*/
List<CountAndTimeDTO> getAppClickGroupByTime(Long bookGroupId, Long serveId, String serveType);
} }
...@@ -133,4 +133,13 @@ public class AppClickRecordDaoImpl extends BaseDaoImpl<AppClickRecord> implement ...@@ -133,4 +133,13 @@ public class AppClickRecordDaoImpl extends BaseDaoImpl<AppClickRecord> implement
return getSessionTemplate().selectList(getStatement("getClCoByBookGroupIds"), map); return getSessionTemplate().selectList(getStatement("getClCoByBookGroupIds"), map);
} }
@Override
public List<CountAndTimeDTO> getAppClickGroupByTime(Long bookGroupId, Long serveId, String serveType) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("serveId", serveId);
map.put("serveType", serveType);
return getSessionTemplate().selectList(getStatement("getAppClickGroupByTime"), map);
}
} }
...@@ -16,6 +16,9 @@ public class CountAndTimeDTO implements Serializable { ...@@ -16,6 +16,9 @@ public class CountAndTimeDTO implements Serializable {
@ApiModelProperty("时间") @ApiModelProperty("时间")
private String time; private String time;
@ApiModelProperty("小时")
private Integer hour;
@ApiModelProperty("数量") @ApiModelProperty("数量")
private Integer count; private Integer count;
...@@ -30,6 +33,14 @@ public class CountAndTimeDTO implements Serializable { ...@@ -30,6 +33,14 @@ public class CountAndTimeDTO implements Serializable {
this.time = time; this.time = time;
} }
public Integer getHour() {
return hour;
}
public void setHour(Integer hour) {
this.hour = hour;
}
public Integer getCount() { public Integer getCount() {
return count; return count;
} }
...@@ -50,6 +61,7 @@ public class CountAndTimeDTO implements Serializable { ...@@ -50,6 +61,7 @@ public class CountAndTimeDTO implements Serializable {
public String toString() { public String toString() {
return "CountAndTimeDTO{" + return "CountAndTimeDTO{" +
"time='" + time + '\'' + "time='" + time + '\'' +
", hour=" + hour +
", count=" + count + ", count=" + count +
", date='" + date + '\'' + ", date='" + date + '\'' +
'}'; '}';
......
...@@ -34,4 +34,13 @@ public interface AppClickRecordFacade { ...@@ -34,4 +34,13 @@ public interface AppClickRecordFacade {
@RequestParam("endTime") @ApiParam("结束时间") String endTime @RequestParam("endTime") @ApiParam("结束时间") String endTime
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("根据社群书id和应用或作品id获取各个时间段的点击次数")
@GetMapping("getAppClickGroupByTime")
ResponseDto<?> getAppClickGroupByTime(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") Long bookGroupId,
@RequestParam(value = "serveId", required = false) Long serveId,
@RequestParam(value = "serveType", required = false) String serveType
) throws BizException, PermissionException;
} }
...@@ -58,4 +58,20 @@ public class AppClickRecordFacadeImpl implements AppClickRecordFacade { ...@@ -58,4 +58,20 @@ public class AppClickRecordFacadeImpl implements AppClickRecordFacade {
} }
return new ResponseDto<>(appClickRecordBiz.getAppClickByTime(joinGroupType, timeType, startTime, endTime)); return new ResponseDto<>(appClickRecordBiz.getAppClickByTime(joinGroupType, timeType, startTime, endTime));
} }
@ApiOperation("根据社群书id和应用或作品id获取各个时间段的点击次数")
@GetMapping("getAppClickGroupByTime")
@Override
public ResponseDto<?> getAppClickGroupByTime(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") Long bookGroupId,
@RequestParam(value = "serveId", required = false) Long serveId,
@RequestParam(value = "serveType", required = false) String serveType
) throws BizException, PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(appClickRecordBiz.getAppClickGroupByTime(bookGroupId,serveId,serveType));
}
} }
...@@ -1828,12 +1828,17 @@ ...@@ -1828,12 +1828,17 @@
FROM FROM
book_group g book_group g
LEFT JOIN book_adviser a ON g.book_id = a.BOOK_ID 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
LEFT JOIN book b ON b.BOOK_ID = a.BOOK_ID LEFT JOIN book b ON b.BOOK_ID = a.BOOK_ID
WHERE WHERE
b.IS_DELETE = 0 b.IS_DELETE = 0
AND a.IS_DELETE = 0 AND a.IS_DELETE = 0
AND g.is_delete = 0 AND g.is_delete = 0
AND g.join_group_type = #{joinGroupType} AND g.join_group_type in
<foreach collection="joinGroupTypes" item="item" open="(" separator="," close=")">
${item}
</foreach>
<if test="name!=null"> <if test="name!=null">
AND AND
(b.BOOK_NAME LIKE CONCAT('%', #{name},'%') OR b.ISBN LIKE CONCAT(#{name},'%')) (b.BOOK_NAME LIKE CONCAT('%', #{name},'%') OR b.ISBN LIKE CONCAT(#{name},'%'))
......
...@@ -334,4 +334,23 @@ ...@@ -334,4 +334,23 @@
GROUP BY GROUP BY
t.book_group_id t.book_group_id
</select> </select>
<!--根据社群书id和应用或作品id获取各个时间段的点击次数-->
<select id="getAppClickGroupByTime" parameterType="map" resultType="com.pcloud.book.group.dto.CountAndTimeDTO">
SELECT
DATE_FORMAT(t.create_time, '%H') hour,
COUNT(1) count
FROM
app_click_record t
WHERE
t.book_group_id = #{bookGroupId}
<if test="serveId!=null">
and serve_id=#{serveId}
</if>
<if test="serveType!=null">
and serve_type=#{serveType}
</if>
GROUP BY
DATE_FORMAT(t.create_time, '%H');
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -742,7 +742,10 @@ ...@@ -742,7 +742,10 @@
book_group t book_group t
INNER JOIN book t1 ON t.BOOK_ID = t1.BOOK_ID INNER JOIN book t1 ON t.BOOK_ID = t1.BOOK_ID
WHERE WHERE
t.join_group_type=2 t.join_group_type in
<foreach collection="joinGroupTypes" item="item" open="(" separator="," close=")">
${item}
</foreach>
<if test="depLabelId!=null"> <if test="depLabelId!=null">
AND t.dep_label_id = #{depLabelId} AND t.dep_label_id = #{depLabelId}
</if> </if>
......
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