Commit 4e140d36 by 梅存智

增加阅读人数

parent 3b8cfd21
......@@ -114,6 +114,9 @@ public class InformationVo{
@ApiModelProperty(value = "阅读数量")
private Integer readNum = 0;
@ApiModelProperty(value = "阅读人数")
private Integer readDistinctNum = 0;
@ApiModelProperty(value = "点赞数量")
private Integer admireNum = 0;
......
......@@ -140,6 +140,10 @@ public class Information extends Model<Information> {
@ApiModelProperty(value = "阅读数量")
@TableField(exist = false)
private Integer readNum = 0;
@ApiModelProperty(value = "阅读人数")
@TableField(exist = false)
private Integer readDistinctNum = 0;
@ApiModelProperty(value = "点赞数量")
@TableField(exist = false)
......
package com.yizhi.site.application.mapper;
import com.yizhi.site.application.domain.TrInformationReadNumber;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
......@@ -13,4 +16,6 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
*/
public interface TrInformationReadNumberMapper extends BaseMapper<TrInformationReadNumber> {
Integer getInformationReadDistinctCount(@Param("informationId") Long informationId);
}
......@@ -22,4 +22,7 @@ public interface ITrInformationReadNumberService extends IService<TrInformationR
public Integer getInformationReadCountPc(Long informationId);
public Integer getInformationReadDistinctCount(Long informationId);
}
......@@ -1052,6 +1052,7 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
info.setFavoriteNum(eventTrackService.getNum("event_comment_"+info.getTypeOne(),info.getId()));
info.setRelayNum(eventTrackService.getNum("event_relay_"+info.getTypeOne(),info.getId()));
info.setReadNum(informationReadNumberService.getInformationReadCountPc(info.getId()));
info.setReadDistinctNum(informationReadNumberService.getInformationReadDistinctCount(info.getId()));
}
}
page.setRecords(list);
......
......@@ -25,6 +25,7 @@ import com.yizhi.util.application.constant.ReturnCode;
import com.yizhi.util.application.date.DateUtil;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -177,7 +178,9 @@ public class PublicationServiceImpl extends ServiceImpl<PublicationMapper, Publi
try {
JSONArray jsonArray = JSONArray.parseArray(selectById.getOssUrl());
if(jsonArray.size()>0){
information.setLogoPath(jsonArray.getString(0));
if(StringUtils.isEmpty(selectById.getLogoPath())){
information.setLogoPath(jsonArray.getString(0));
}
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 content = selectById.getContent();
......
......@@ -29,6 +29,9 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio
@Autowired
private IdGenerator idGenerator;
@Autowired
TrInformationReadNumberMapper informationReadNumberMapper;
/**
* 获取阅读次数d
......@@ -47,8 +50,8 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio
trInformationReadNumber.setInformationId(informationId);
trInformationReadNumber.setSiteId(context.getSiteId());
trInformationReadNumber.setCreateTime(new Date());
this.insert(trInformationReadNumber);
trInformationReadNumber.setCreateById(context.getAccountId());
this.insert(trInformationReadNumber);
TrInformationReadNumber informationReadNumber = new TrInformationReadNumber();
......@@ -68,4 +71,9 @@ public class TrInformationReadNumberServiceImpl extends ServiceImpl<TrInformatio
Integer num=this.selectCount(QueryUtil.condition(informationReadNumber));
return num==null?0:num;
}
@Override
public Integer getInformationReadDistinctCount(Long informationId) {
return informationReadNumberMapper.getInformationReadDistinctCount(informationId);
}
}
......@@ -67,9 +67,11 @@
and my.site_id = #{siteId}
</if>
<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 role_id from cloud_system.authz_account_role aar where account_id =#{accountId}))
OR my.id IN(1237069526114295815)
)
</if>
<if test="accountId ==null">
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