Commit 4e140d36 by 梅存智

增加阅读人数

parent 3b8cfd21
...@@ -114,6 +114,9 @@ public class InformationVo{ ...@@ -114,6 +114,9 @@ public class InformationVo{
@ApiModelProperty(value = "阅读数量") @ApiModelProperty(value = "阅读数量")
private Integer readNum = 0; private Integer readNum = 0;
@ApiModelProperty(value = "阅读人数")
private Integer readDistinctNum = 0;
@ApiModelProperty(value = "点赞数量") @ApiModelProperty(value = "点赞数量")
private Integer admireNum = 0; private Integer admireNum = 0;
......
...@@ -141,6 +141,10 @@ public class Information extends Model<Information> { ...@@ -141,6 +141,10 @@ public class Information extends Model<Information> {
@TableField(exist = false) @TableField(exist = false)
private Integer readNum = 0; private Integer readNum = 0;
@ApiModelProperty(value = "阅读人数")
@TableField(exist = false)
private Integer readDistinctNum = 0;
@ApiModelProperty(value = "点赞数量") @ApiModelProperty(value = "点赞数量")
@TableField(exist = false) @TableField(exist = false)
private Integer admireNum = 0; private Integer admireNum = 0;
......
package com.yizhi.site.application.mapper; package com.yizhi.site.application.mapper;
import com.yizhi.site.application.domain.TrInformationReadNumber; import com.yizhi.site.application.domain.TrInformationReadNumber;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper; import com.baomidou.mybatisplus.mapper.BaseMapper;
/** /**
...@@ -13,4 +16,6 @@ import com.baomidou.mybatisplus.mapper.BaseMapper; ...@@ -13,4 +16,6 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
*/ */
public interface TrInformationReadNumberMapper extends BaseMapper<TrInformationReadNumber> { public interface TrInformationReadNumberMapper extends BaseMapper<TrInformationReadNumber> {
Integer getInformationReadDistinctCount(@Param("informationId") Long informationId);
} }
...@@ -22,4 +22,7 @@ public interface ITrInformationReadNumberService extends IService<TrInformationR ...@@ -22,4 +22,7 @@ public interface ITrInformationReadNumberService extends IService<TrInformationR
public Integer getInformationReadCountPc(Long informationId); public Integer getInformationReadCountPc(Long informationId);
public Integer getInformationReadDistinctCount(Long informationId);
} }
...@@ -1052,6 +1052,7 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1052,6 +1052,7 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
info.setFavoriteNum(eventTrackService.getNum("event_comment_"+info.getTypeOne(),info.getId())); info.setFavoriteNum(eventTrackService.getNum("event_comment_"+info.getTypeOne(),info.getId()));
info.setRelayNum(eventTrackService.getNum("event_relay_"+info.getTypeOne(),info.getId())); info.setRelayNum(eventTrackService.getNum("event_relay_"+info.getTypeOne(),info.getId()));
info.setReadNum(informationReadNumberService.getInformationReadCountPc(info.getId())); info.setReadNum(informationReadNumberService.getInformationReadCountPc(info.getId()));
info.setReadDistinctNum(informationReadNumberService.getInformationReadDistinctCount(info.getId()));
} }
} }
page.setRecords(list); page.setRecords(list);
......
...@@ -25,6 +25,7 @@ import com.yizhi.util.application.constant.ReturnCode; ...@@ -25,6 +25,7 @@ import com.yizhi.util.application.constant.ReturnCode;
import com.yizhi.util.application.date.DateUtil; import com.yizhi.util.application.date.DateUtil;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -177,7 +178,9 @@ public class PublicationServiceImpl extends ServiceImpl<PublicationMapper, Publi ...@@ -177,7 +178,9 @@ public class PublicationServiceImpl extends ServiceImpl<PublicationMapper, Publi
try { try {
JSONArray jsonArray = JSONArray.parseArray(selectById.getOssUrl()); JSONArray jsonArray = JSONArray.parseArray(selectById.getOssUrl());
if(jsonArray.size()>0){ if(jsonArray.size()>0){
if(StringUtils.isEmpty(selectById.getLogoPath())){
information.setLogoPath(jsonArray.getString(0)); information.setLogoPath(jsonArray.getString(0));
}
information.setPdfOssUrl(selectById.getOssUrl()); information.setPdfOssUrl(selectById.getOssUrl());
String imgDiv = "<p></p><div class=\"media-wrap image-wrap\"><img id=\"%s\" title=\"%s\" alt=\"image\" src=\"%s\"/></div><p></p>\n"; String imgDiv = "<p></p><div class=\"media-wrap image-wrap\"><img id=\"%s\" title=\"%s\" alt=\"image\" src=\"%s\"/></div><p></p>\n";
String content = selectById.getContent(); String content = selectById.getContent();
......
...@@ -30,6 +30,9 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio ...@@ -30,6 +30,9 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio
@Autowired @Autowired
private IdGenerator idGenerator; private IdGenerator idGenerator;
@Autowired
TrInformationReadNumberMapper informationReadNumberMapper;
/** /**
* 获取阅读次数d * 获取阅读次数d
* @param informationId 咨询id * @param informationId 咨询id
...@@ -47,7 +50,7 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio ...@@ -47,7 +50,7 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio
trInformationReadNumber.setInformationId(informationId); trInformationReadNumber.setInformationId(informationId);
trInformationReadNumber.setSiteId(context.getSiteId()); trInformationReadNumber.setSiteId(context.getSiteId());
trInformationReadNumber.setCreateTime(new Date()); trInformationReadNumber.setCreateTime(new Date());
trInformationReadNumber.setCreateById(context.getAccountId());
this.insert(trInformationReadNumber); this.insert(trInformationReadNumber);
TrInformationReadNumber informationReadNumber = new TrInformationReadNumber(); TrInformationReadNumber informationReadNumber = new TrInformationReadNumber();
...@@ -68,4 +71,9 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio ...@@ -68,4 +71,9 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio
Integer num=this.selectCount(QueryUtil.condition(informationReadNumber)); Integer num=this.selectCount(QueryUtil.condition(informationReadNumber));
return num==null?0:num; return num==null?0:num;
} }
@Override
public Integer getInformationReadDistinctCount(Long informationId) {
return informationReadNumberMapper.getInformationReadDistinctCount(informationId);
}
} }
...@@ -67,9 +67,11 @@ ...@@ -67,9 +67,11 @@
and my.site_id = #{siteId} and my.site_id = #{siteId}
</if> </if>
<if test="accountId !=null"> <if test="accountId !=null">
and my.id in( and (my.id in(
select item_id from my_item_config_role where role_id in( select item_id from my_item_config_role where role_id in(
select role_id from cloud_system.authz_account_role aar where account_id =#{accountId})) select role_id from cloud_system.authz_account_role aar where account_id =#{accountId}))
OR my.id IN(1237069526114295815)
)
</if> </if>
<if test="accountId ==null"> <if test="accountId ==null">
and my.id not in(1237069526114295813) and my.id not in(1237069526114295813)
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.site.application.mapper.TrInformationReadNumberMapper">
<select id="getInformationReadDistinctCount" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT create_by_id)
FROM tr_information_read_number
WHERE information_id=#{informationId}
</select>
</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