Commit 187d39b5 by 吴迪

【修改】点击量统计需求

parent cf82092c
......@@ -342,6 +342,12 @@
<version>1.20</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
</dependencies>
<build>
......
package io.office.modules.manage.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sitech.idworkstarter.IdWorkService;
import eu.bitwalker.useragentutils.UserAgent;
import io.office.common.enumpack.manage.ClickTypeEnum;
......@@ -9,17 +11,22 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.ClickDetailEntity;
import io.office.modules.manage.entity.dto.ClickCodeDetailDTO;
import io.office.modules.manage.entity.dto.ClickDetailDTO;
import io.office.modules.manage.service.ClickDetailService;
import io.office.modules.manage.utils.DateUtils;
import io.office.modules.manage.utils.IdKeysConstant;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
/**
......@@ -41,15 +48,71 @@ public class ClickDetailController {
/**
* 列表
*/
//@RequestMapping("/list")
//// @RequiresPermissions("datamanage:clickdetail:list")
//public R list(@RequestParam Map<String, Object> params) {
// PageUtils page = clickDetailService.queryPage(params);
//
// return R.ok().put("page", page);
//}
@RequestMapping("/list")
// @RequiresPermissions("datamanage:clickdetail:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = clickDetailService.queryPage(params);
//@RequiresPermissions("datamanage:clickdetail:list")
public R list(@RequestBody ClickDetailDTO clickDetailDTO) {
Page page = null;
if (StrUtil.equals("1", clickDetailDTO.getTypeValue())) {
page = clickDetailService.selectClickNewsList(clickDetailDTO);
} else if (StrUtil.equals("2", clickDetailDTO.getTypeValue())) {
page = clickDetailService.getListPageImages(clickDetailDTO);
} else if (StrUtil.equals("3", clickDetailDTO.getTypeValue())) {
page = clickDetailService.getListPageViewSubs(clickDetailDTO);
} else if (StrUtil.equals("4", clickDetailDTO.getTypeValue())) {
page = clickDetailService.getListPageMovies(clickDetailDTO);
} else if (StrUtil.equals("5", clickDetailDTO.getTypeValue())) {
page = clickDetailService.getListPagePolicys(clickDetailDTO);
} else if (StrUtil.equals("6", clickDetailDTO.getTypeValue())) {
page = clickDetailService.getListPageApplications(clickDetailDTO);
} else if (StrUtil.equals("7", clickDetailDTO.getTypeValue())) {
page = clickDetailService.getListPageKnowledgeInfos(clickDetailDTO);
} else if (StrUtil.equals("9", clickDetailDTO.getTypeValue())) {
page = clickDetailService.getListPageProducts(clickDetailDTO);
} else if (StrUtil.equals("12", clickDetailDTO.getTypeValue())) {
page = clickDetailService.getListPageAnnounces(clickDetailDTO);
}
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
}
@RequestMapping("/export")
//@RequiresPermissions("datamanage:clickdetail:list")
public void export(@RequestBody ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
if (StrUtil.equals("1", clickDetailDTO.getTypeValue())) {
clickDetailService.selectClickNewsListExport(clickDetailDTO,response);
} else if (StrUtil.equals("2", clickDetailDTO.getTypeValue())) {
clickDetailService.getListPageImagesExport(clickDetailDTO,response);
} else if (StrUtil.equals("3", clickDetailDTO.getTypeValue())) {
clickDetailService.getListPageViewSubsExport(clickDetailDTO,response);
} else if (StrUtil.equals("4", clickDetailDTO.getTypeValue())) {
clickDetailService.getListPageMoviesExport(clickDetailDTO,response);
} else if (StrUtil.equals("5", clickDetailDTO.getTypeValue())) {
clickDetailService.getListPagePolicysExport(clickDetailDTO,response);
} else if (StrUtil.equals("6", clickDetailDTO.getTypeValue())) {
clickDetailService.getListPageApplicationsExport(clickDetailDTO,response);
} else if (StrUtil.equals("7", clickDetailDTO.getTypeValue())) {
clickDetailService.getListPageKnowledgeInfosExport(clickDetailDTO,response);
} else if (StrUtil.equals("9", clickDetailDTO.getTypeValue())) {
clickDetailService.getListPageProductsExport(clickDetailDTO,response);
} else if (StrUtil.equals("12", clickDetailDTO.getTypeValue())) {
clickDetailService.getListPageAnnouncesExport(clickDetailDTO,response);
}
return R.ok().put("page", page);
}
/**
* 信息
*/
......@@ -61,6 +124,16 @@ public class ClickDetailController {
return R.ok().put("clickDetail", clickDetail);
}
@RequestMapping("/getClickDetailList")
// @RequiresPermissions("datamanage:clickdetail:info")
public R getclickDetail(@RequestBody ClickDetailDTO clickDetailDTO) {
Page page = clickDetailService.selectClickList(clickDetailDTO);
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
}
/**
* 保存
*/
......@@ -68,7 +141,7 @@ public class ClickDetailController {
// @RequiresPermissions("datamanage:clickdetail:save")
public R save(@RequestBody ClickCodeDetailDTO clickCodeDetailDTO) {
if(StringUtils.isBlank(clickCodeDetailDTO.getCode())||StringUtils.isBlank(clickCodeDetailDTO.getId())) {
if (StringUtils.isBlank(clickCodeDetailDTO.getCode()) || StringUtils.isBlank(clickCodeDetailDTO.getId())) {
return R.error("参数不能为空");
}
//获取request
......
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.ClickDetailEntity;
import io.office.modules.manage.entity.dto.ClickDetailDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ${comments}
*
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-02 23:22:31
*/
@Mapper
public interface ClickDetailDao extends BaseMapper<ClickDetailEntity> {
/**
* 文章
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPageNews(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
/**
* 图片
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPageImages(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
/**
* 专题
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPageViewSubs(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
/**
* 视频
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPageMovies(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
/**
* 政策法规
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPagePolicys(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
/**
* 应用领域
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPageApplications(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
/**
* 知识统计
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPageKnowledgeInfos(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
/**
* 图书文献
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPageProducts(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
/**
* 公告统计
* @param clickDetailDTO
* @param page
* @return
*/
List<ClickDetailDTO> getListPageAnnounces(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
List<ClickDetailDTO> selectClickList(@Param("clickDetailDTO")ClickDetailDTO clickDetailDTO, Page page);
}
package io.office.modules.manage.entity.dto;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author wudi
* @date 2023/7/30
* @comment
*/
@Data
public class ClickDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
@Excel(name = "ID",width = 20)
private Long id;
/**
* 点击的知识id
*/
private Long cId;
/**
* $column.comments
*/
private String typeValue;
/**
* $column.comments
*/
private String typeName;
/**
* $column.comments
*/
private String clickTime;
/**
* $column.comments
*/
private String clientIp;
/**
* $column.comments
*/
private String clientOs;
/**
* $column.comments
*/
private String clientBrowser;
@Excel(name = "标题",width = 80)
private String title;
private String keyWord;
private String keyWordType;
private String type;
@Excel(name = "点击数",width = 40)
private Integer countNum;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date inputDate;
@Excel(name = "发布时间",width = 60)
private String inputDateStr;
private String jumpPath;
/**
* 编辑
*/
private String editor;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedate;
private long page=1;
private long limit=10;
private String sidx;
private String order;
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.ClickDetailEntity;
import io.office.modules.manage.entity.dto.ClickDetailDTO;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
......@@ -17,5 +21,64 @@ import java.util.Map;
public interface ClickDetailService extends IService<ClickDetailEntity> {
PageUtils queryPage(Map<String, Object> params);
Page<ClickDetailDTO> selectClickNewsList(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> getListPageImages(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> getListPageViewSubs(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> getListPageMovies(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> getListPagePolicys(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> getListPageApplications(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> getListPageKnowledgeInfos(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> getListPageProducts(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> getListPageAnnounces(ClickDetailDTO clickDetailDTO);
Page<ClickDetailDTO> selectClickList(ClickDetailDTO clickDetailDTO);
void selectClickNewsListExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void getListPageImagesExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void getListPageViewSubsExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void getListPageMoviesExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void getListPagePolicysExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void getListPageApplicationsExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void getListPageKnowledgeInfosExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void getListPageProductsExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void getListPageAnnouncesExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
void selectClickListExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException;
}
package io.office.modules.manage.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.ClickDetailDao;
import io.office.modules.manage.entity.ClickDetailEntity;
import io.office.modules.manage.entity.dto.ClickDetailDTO;
import io.office.modules.manage.service.ClickDetailService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service("clickDetailService")
public class ClickDetailServiceImpl extends ServiceImpl<ClickDetailDao, ClickDetailEntity> implements ClickDetailService {
......@@ -22,9 +35,447 @@ public class ClickDetailServiceImpl extends ServiceImpl<ClickDetailDao, ClickDet
IPage<ClickDetailEntity> page = this.page(
new Query<ClickDetailEntity>().getPage(params),
new QueryWrapper<ClickDetailEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
@Override
public Page<ClickDetailDTO> selectClickNewsList(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPageNews(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/News/msg?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> getListPageImages(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPageImages(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/News/msgVideo?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> getListPageViewSubs(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPageViewSubs(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/News/viewsub?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> getListPageMovies(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPageMovies(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/News/msgVideo?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> getListPagePolicys(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPagePolicys(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/Knowledge/Statuteinfo?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> getListPageApplications(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPageApplications(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/News/msg?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> getListPageKnowledgeInfos(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPageKnowledgeInfos(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/Knowledge/Statuteinfo?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> getListPageProducts(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPageKnowledgeInfos(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/Service/Book?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> getListPageAnnounces(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.getListPageKnowledgeInfos(clickDetailDTO,page);
if(CollectionUtils.isNotEmpty(list)) {
for (ClickDetailDTO detailDTO : list) {
if(StringUtils.isBlank(detailDTO.getJumpPath())) {
detailDTO.setJumpPath("http://www.gs1cn.org/News/NoticeArticle?id="+detailDTO.getId());
}
}
}
page.setRecords(list);
return page;
}
@Override
public Page<ClickDetailDTO> selectClickList(ClickDetailDTO clickDetailDTO) {
Page page = new Page(clickDetailDTO.getPage(), clickDetailDTO.getLimit());
List<ClickDetailDTO> list = baseMapper.selectClickList(clickDetailDTO,page);
page.setRecords(list);
return page;
}
@Override
public void selectClickNewsListExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPageNews(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void getListPageImagesExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPageImages(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void getListPageViewSubsExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPageViewSubs(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void getListPageMoviesExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPageMovies(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void getListPagePolicysExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPagePolicys(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void getListPageApplicationsExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPageApplications(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void getListPageKnowledgeInfosExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPageKnowledgeInfos(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void getListPageProductsExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPageProducts(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void getListPageAnnouncesExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.getListPageAnnounces(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
@Override
public void selectClickListExport(ClickDetailDTO clickDetailDTO, HttpServletResponse response) throws IOException {
Page page = new Page(1, 999999);
List<ClickDetailDTO> list = baseMapper.selectClickList(clickDetailDTO,page);
// 存放excel的表头
ArrayList<ExcelExportEntity> entityList = new ArrayList<>();
//表头
ExcelExportEntity title = new ExcelExportEntity("ID", "id");
entityList.add(title);
title=new ExcelExportEntity("标题","title");
entityList.add(title);
title=new ExcelExportEntity("发布时间","inputDateStr");
entityList.add(title);
title=new ExcelExportEntity("点击数","countNum");
entityList.add(title);
Workbook result = ExcelExportUtil.exportExcel(new ExportParams("新闻统计结果", "新闻统计结果"), entityList, list);
//写出
ServletOutputStream outputStream = response.getOutputStream();
//设置请求头,解决文件名中文乱码问题
response.setCharacterEncoding("UTF-8");
response.setHeader("content-disposition","attachment;fileName="+ URLEncoder.encode("新闻统计结果.xlsx","utf-8") );
result.write(outputStream);
result.close();
outputStream.close();
}
}
......@@ -3,7 +3,7 @@
<mapper namespace="io.office.modules.manage.dao.ClickDetailDao">
<!-- 可根据自己的需求,是否要使用 -->
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.ClickDetailEntity" id="clickDetailMap">
<result property="id" column="id"/>
<result property="cId" column="c_id"/>
......@@ -16,4 +16,418 @@
</resultMap>
</mapper>
\ No newline at end of file
<select id="getListPageNews" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from ( select a.ID,title,'1' typeValue,(select count(*) from click_detail b where type_value=1 and
b.c_id=a.Id) countNum,
releasedate inputDate,CONVERT(varchar(100),releasedate,120) inputDateStr,directpath jumpPath ,editor , updatedate from news a where ((classid between 5 and 8) or
(classid in (select Id
from newsClass where p_id=5))) and levels>0
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and content like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.ID =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="getListPageImages" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from ( SELECT
a.pictureid ID,
title,
'2' typeValue,
( SELECT COUNT ( * ) FROM click_detail b WHERE type_value = 2 AND b.c_id= a.pictureid ) countNum,
inputDate,CONVERT(varchar(100),inputDate,120) inputDateStr,
jumpPath,editor
from picture a where piclevel>0
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.pictureid =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="getListPageViewSubs" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from ( SELECT
a.classid ID,
title,
'3' typeValue,
(
SELECT COUNT(*) FROM
click_detail b
WHERE
type_value = 3
AND b.c_id= a.classid
) countNum,
TIME inputDate,
,CONVERT(varchar(100),TIME,120) inputDateStr,
directpath jumpPath,
editor
FROM
NewTopic a
WHERE
levels > 0
AND parentid = 0
AND checkflag = 1
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and shortcontent like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.classid =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="getListPageMovies" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from ( SELECT
a.ID,
title,
'4' typeValue,
(
SELECT
COUNT (*)
FROM
click_detail b
WHERE
b.type_value = 4
AND b.c_id = a.Id
) countNum,
releasedate inputDate,
,CONVERT(varchar(100),releasedate,120) inputDateStr,
directpath jumpPath,
editor
FROM
news_movie a
WHERE
levels > 0
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and brief like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.id =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="getListPagePolicys" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from ( SELECT
a.ID,
title,
'5' typeValue,
( SELECT COUNT ( * ) FROM click_detail b WHERE type_value = 5 AND b.c_id= a.Id ) countNum,
releasedate inputDate,
,CONVERT(varchar(100),releasedate,120) inputDateStr,
directpath jumpPath,
editor
FROM
Policy a
WHERE
levels > 0
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and content like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.id =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="getListPageApplications" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from (
SELECT
a.ID,
title,
'6' typeValue,
( SELECT COUNT ( * ) FROM click_detail b WHERE type_Value = 6 AND b.c_id= a.Id ) countNum,
releasedate inputDate,
,CONVERT(varchar(100),releasedate,120) inputDateStr,
directpath jumpPath,
editor
FROM
news a
WHERE
( classid IN ( SELECT Id FROM newsclass WHERE p_id = 2 ) )
AND levels > 0
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and content like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.ID =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="getListPageKnowledgeInfos" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from ( SELECT
a.knowledgeInfoID ID,
title,
'7' typeValue,
( SELECT COUNT ( * ) FROM click_detail b WHERE type_Value = 7 AND b.c_id= a.knowledgeInfoID ) countNum,
inputDate,
,CONVERT(varchar(100),inputDate,120) inputDateStr,
directpath jumpPath,
editor
FROM
knowledgeInfo a
WHERE
levels > 0
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and content like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.knowledgeInfoID =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="getListPageProducts" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from ( SELECT
a.ID,
prename title,
'9' typeValue,
(
SELECT COUNT
( * )
FROM
click_detail b
WHERE
type_Value = 9
AND b.c_id= a.ID
) countNum,
adddate inputDate,
,CONVERT(varchar(100),adddate,120) inputDateStr,
'' jumpPath,
author
FROM
product a
WHERE
levels >0
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and description like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and prename like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.id =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="getListPageAnnounces" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select * from ( SELECT
a.ID,
title,
'12' typeValue,
( SELECT COUNT ( * ) FROM click_detail b WHERE type_Value = 12 AND b.c_id= a.Id ) countNum,
releasedate inputDate,
,CONVERT(varchar(100),releasedate,120) inputDateStr,
'' jumpPath,
editor
FROM
announce a
WHERE
levels > 0
and announcetype = 1
and status=1
<if test="clickDetailDTO.keyWordType=='1'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and content like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='2'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and title like concat('%',#{clickDetailDTO.keyWord},'%')
</if>
</if>
<if test="clickDetailDTO.keyWordType=='3'.toString()">
<if test="clickDetailDTO.keyWord!=null and clickDetailDTO.keyWord!=''">
and a.id =#{clickDetailDTO.keyWord}
</if>
</if>
) c
<choose>
<when test="clickDetailDTO.sidx!=null and clickDetailDTO.sidx!=''">
ORDER BY c.${clickDetailDTO.sidx} ${clickDetailDTO.order}
</when>
<otherwise>
ORDER BY c.id DESC
</otherwise>
</choose>
</select>
<select id="selectClickList" parameterType="io.office.modules.manage.entity.dto.ClickDetailDTO"
resultType="io.office.modules.manage.entity.dto.ClickDetailDTO">
select type_Value typeValue,
type_name typeName,
click_time clickTime,
client_ip clientIp,
client_os clientOs,
client_browser clientBrowser
from click_detail
<where>
<if test="clickDetailDTO.cId!=null and clickDetailDTO.cId!=''">
c_id = #{clickDetailDTO.cId}
</if>
<if test="clickDetailDTO.typeValue!=null and clickDetailDTO.typeValue!=''">
and type_Value = #{clickDetailDTO.typeValue}
</if>
</where>
order by click_time desc
</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