统计资源访问量

This commit is contained in:
wangliwen 2022-05-20 11:30:29 +08:00
parent 46851b85f9
commit 8aa344d8a3
5 changed files with 26 additions and 9 deletions

View File

@ -123,7 +123,7 @@ public class CensusController {
});
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
return 0; // 暂时返回0
return resourceService.countAllVisits(); // 暂时返回0
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{

View File

@ -60,4 +60,6 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<ResourceDTO> selectAlgorithmPage(Map<String, Object> params);
Integer selectTypeCountByDist(@Param(("districtName")) String districtName, @Param("resourceType") String resourceType);
Long countAllVisits();
}

View File

@ -47,4 +47,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object algorithmPage(Map<String, Object> params);
Long countAllVisits();
}

View File

@ -84,7 +84,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (params.containsKey("delFlag") && !"".equals(params.get("delFlag").toString())) {
wrapper.eq("del_flag", params.get("delFlag"));
} else {
wrapper.in(true,"del_flag", 0,5);
wrapper.in(true, "del_flag", 0, 5);
}
}
wrapper.orderByAsc("del_flag")
@ -323,7 +323,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录");
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in(true,"del_flag", 0,5)
queryWrapper.in(true, "del_flag", 0, 5)
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"));
resourceMap.put("total", resourceDao.selectCount(queryWrapper));
resultList.add(resourceMap);
@ -365,8 +365,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object algorithmPage(Map<String, Object> params) {
params.put("pageNum", (Integer.parseInt(params.get("page").toString()) -1) * Integer.parseInt(params.get("limit").toString()));
params.put("pageNum", (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()));
params.put("pageSize", params.get("limit"));
return resourceDao.selectAlgorithmPage(params);
}
@Override
public Long countAllVisits() {
return baseDao.countAllVisits();
}
}

View File

@ -145,9 +145,10 @@
AND tdr.district_id = #{dto.districtId}
</if>
<if test="null != dto.deptIds and dto.deptIds.size > 0">
AND tdr.dept_id IN <foreach collection="dto.deptIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
AND tdr.dept_id IN
<foreach collection="dto.deptIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="dto.shareCondition != null and dto.shareCondition != ''">
AND tdr.share_condition = #{dto.shareCondition}
@ -288,9 +289,10 @@
AND tdr.district_id = #{dto.districtId}
</if>
<if test="null != dto.deptIds and dto.deptIds.size > 0">
AND tdr.dept_id IN <foreach collection="dto.deptIds" item="item" open="(" separator="," close=")">
AND tdr.dept_id IN
<foreach collection="dto.deptIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</foreach>
</if>
<if test="dto.shareCondition != null and dto.shareCondition != ''">
AND tdr.share_condition = #{dto.shareCondition}
@ -455,5 +457,11 @@
GROUP BY
temp2.type
</select>
<select id="countAllVisits" resultType="java.lang.Long">
SELECT
COUNT( visits )
FROM
tb_data_resource
</select>
</mapper>