文章列表

This commit is contained in:
zkr_liushenlu 2021-03-29 09:50:24 +08:00
parent 631870cbe8
commit 1c6f652642
12 changed files with 967 additions and 392 deletions

View File

@ -1,5 +1,7 @@
package com.ruoyi.content.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.content.domain.ArticleInfo;
import com.ruoyi.content.domain.PageDTO;
@ -12,6 +14,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -30,50 +33,39 @@ import java.util.UUID;
*/
@Controller
@RequestMapping("/article")
public class ArticleManageController {
public class ArticleManageController extends BaseController {
private final static Logger logger = LoggerFactory.getLogger(ArticleManageController.class);
private String prefix = "content/article";
@Autowired
private ArticleService articleService;
@GetMapping("list")
public String articleList() {
return prefix + "/articleList";
}
/**
* 查询所有公司发布的文章信息
*
* @param request
* @param response
* @return
*/
@RequestMapping("/articleArry")
@ResponseBody
public PageDTO articleArry(HttpServletRequest request, HttpServletResponse response) {
public TableDataInfo articleArry(HttpServletRequest request) throws Exception {
logger.info("查询文章列表的控制层方法开始!");
Thread.currentThread().setName(UUID.randomUUID().toString());
PageDTO pageDTO = new PageDTO();
try {
String rowsVal = request.getParameter("rows");
String page = request.getParameter("page");
String articelName = request.getParameter("articelName");
String articelName = request.getParameter("articleName");
String articelAuthor = request.getParameter("articelAuthor");
String channelId = request.getParameter("channelId");
String special = request.getParameter("special");
String articleState = request.getParameter("articleState");
int rows = Integer.parseInt(rowsVal);
int startRow = rows * (Integer.parseInt(page) - 1);
List<PublishedArticleInfo> list = articleService.queryArticle(startRow, rows, articelName, articelAuthor,
startPage();
List<PublishedArticleInfo> list = articleService.queryArticle(articelName, articelAuthor,
special, channelId, articleState);
pageDTO.setPage(Integer.parseInt(page));
pageDTO.setStartRow(startRow);
pageDTO.setDataRows(list);
int count = articleService.countArticleInfoByState(articelName, articelAuthor, special, channelId,
articleState);
pageDTO.setTotal(count % rows == 0 ? count / rows : (count / rows + 1));
pageDTO.setRecords(count);
pageDTO.setPage(Integer.parseInt(page));
} catch (Exception e) {
logger.info("查询当前用户发布的文章失败【{}】", e.getMessage());
e.printStackTrace();
}
logger.info("查询文章列表的控制层方法结束!");
return pageDTO;
return getDataTable(list);
}
/**

View File

@ -1,5 +1,8 @@
package com.ruoyi.content.controller;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.content.domain.ClickTrackInfo;
import com.ruoyi.content.domain.ClickUserInfo;
import com.ruoyi.content.domain.PageDTO;
@ -42,24 +45,27 @@ public class StaffArticleManageController {
*/
@RequestMapping("/articleSharingTrackList")
@ResponseBody
public PageDTO articleSharingTrack(HttpServletRequest request) {
public TableDataInfo articleSharingTrack(HttpServletRequest request) {
logger.info("查询文章分享阅读轨迹的控制层方法开始!");
Thread.currentThread().setName(UUID.randomUUID().toString());
PageDTO pageDTO = new PageDTO();
TableDataInfo pageDTO = new TableDataInfo();
try {
String rowsVal = request.getParameter("rows");
String page = request.getParameter("page");
int rows = Integer.parseInt(rowsVal);
int startRow = rows * (Integer.parseInt(page) - 1);
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum() - 1;
Integer pageSize = pageDomain.getPageSize();
String articleId = request.getParameter("articleId");
if (StringUtils.isBlank(articleId)) {
return pageDTO;
}
// 1.根据文章id去查publish表找出该文章对应所有业务员
pageDTO = staffArticleManageService.querySalesmanByArticleId(articleId, startRow, rows);
pageDTO.setPage(Integer.parseInt(page));
pageDTO = staffArticleManageService.querySalesmanByArticleId(articleId, pageNum, pageSize);
return pageDTO;
} catch (Exception e) {
logger.info("系统异常!", e);
pageDTO.setCode(0);
pageDTO.setRows(new ArrayList<>());
pageDTO.setTotal(0);
return pageDTO;
}
@ -73,29 +79,31 @@ public class StaffArticleManageController {
*/
@RequestMapping("/publishInfoList")
@ResponseBody
public PageDTO publishInfoList(HttpServletRequest request) {
public TableDataInfo publishInfoList(HttpServletRequest request) {
Thread.currentThread().setName(UUID.randomUUID().toString());
PageDTO pageDTO = new PageDTO();
TableDataInfo pageDTO = new TableDataInfo();
try {
String rowsVal = request.getParameter("rows");
String page = request.getParameter("page");
int rows = Integer.parseInt(rowsVal);
int startRow = rows * (Integer.parseInt(page) - 1);
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum() - 1;
Integer pageSize = pageDomain.getPageSize();
String userId = request.getParameter("userId");
String articleId = request.getParameter("articleId");
if (StringUtils.isAnyBlank(articleId, userId)) {
return pageDTO;
}
logger.info("查询该业务员userId[{}]的文章articleId[{}]发布情况开始!", userId, articleId);
// 1.根据文章id去查publish表找出该文章对应所有业务员
pageDTO = staffArticleManageService.queryClickInfoByUserId(userId, articleId, startRow, rows);
pageDTO.setPage(Integer.parseInt(page));
pageDTO = staffArticleManageService.queryClickInfoByUserId(userId, articleId, pageNum, pageSize);
return pageDTO;
} catch (Exception e) {
logger.info("系统异常!", e);
pageDTO.setCode(0);
pageDTO.setRows(new ArrayList<>());
pageDTO.setTotal(0);
return pageDTO;
}
@ -109,16 +117,18 @@ public class StaffArticleManageController {
*/
@RequestMapping("/articleSharingTrackInfo")
@ResponseBody
public Message articleSharingTrackInfo(HttpServletRequest request) {
public TableDataInfo articleSharingTrackInfo(HttpServletRequest request) {
Thread.currentThread().setName(UUID.randomUUID().toString());
Message msg = new Message();
Map<String, Object> returnMap = new HashMap<String, Object>();
List<ClickUserInfo> clickUserInfos = new ArrayList<ClickUserInfo>();
ClickTrackInfo clickTrackInfo = new ClickTrackInfo();
logger.info("查询用户查看分享文章轨迹信息的控制层方法开始!");
String clickId = request.getParameter("clickId");
TableDataInfo pageDTO = new TableDataInfo();
if (StringUtils.isBlank(clickId)) {
returnMap.put("ClickTrackInfo", clickTrackInfo);
pageDTO.setCode(0);
pageDTO.setRows(new ArrayList<>());
pageDTO.setTotal(0);
} else {
clickTrackInfo = staffArticleManageService.articleSharingTrackInfo(clickId);
//发布人id
@ -135,41 +145,51 @@ public class StaffArticleManageController {
logger.info("转换后的用户昵称为:" + userInfo.getNickName());
} else {
userInfo.setNickName("后台管理员");
userInfo.setHeadImgUrl("/static/common/image/logo.png");
userInfo.setHeadImgUrl("/img/admin.png");
userInfo.setOpenid("");
}
returnMap.put("userInfo", userInfo);
ClickUserInfo clickUserInfo1 = new ClickUserInfo();
clickUserInfo1.setNickName(userInfo.getNickName());
clickUserInfo1.setHeadImgUrl(userInfo.getHeadImgUrl());
clickUserInfo1.setOpenId(userInfo.getOpenid());
clickUserInfos.add(clickUserInfo1);
String clickUserInfo = clickTrackInfo.getClickUserInfo();
List<ClickUserInfo> c = new ArrayList<ClickUserInfo>();
if (StringUtils.isNotBlank(clickUserInfo)) {
clickUserInfos = JsonUtil.JsonToCollectionType(clickUserInfo, List.class, ClickUserInfo.class);
c = JsonUtil.JsonToCollectionType(clickUserInfo, List.class, ClickUserInfo.class);
for (ClickUserInfo clickUserInfo2 : clickUserInfos) {
for (ClickUserInfo clickUserInfo2 : c) {
try {
clickUserInfo2.setNickName(
new String(Base64.getDecoder().decode(clickUserInfo2.getNickName()), "UTF-8"));
clickUserInfos.add(clickUserInfo2);
} catch (UnsupportedEncodingException e) {
throw new BusinessException("用户昵称解码异常[{" + e.getMessage() + "}]");
}
}
}
returnMap.put("ClickUserInfoList", clickUserInfos);
String clickUserNickname = clickTrackInfo.getClickUserNickname();
if (StringUtils.isNotBlank(clickUserNickname)) {
try {
clickTrackInfo.setClickUserNickname(
new String(Base64.getDecoder().decode(clickUserNickname), "UTF-8"));
ClickUserInfo clickUserInfo4 = new ClickUserInfo();
clickUserInfo4.setNickName(clickTrackInfo.getClickUserNickname());
clickUserInfo4.setHeadImgUrl(clickTrackInfo.getClickUserHeadimgurl());
clickUserInfo4.setOpenId(clickTrackInfo.getClickOpenId());
clickUserInfo4.setToShareState(clickTrackInfo.getFromShareState());
clickUserInfos.add(clickUserInfo4);
} catch (UnsupportedEncodingException e) {
throw new BusinessException("用户昵称解码异常[{" + e.getMessage() + "}]");
}
}
returnMap.put("ClickTrackInfo", clickTrackInfo);
msg.setInfo("获取浏览详情查询成功");
msg.setResult(true);
msg.setObject(returnMap);
pageDTO.setCode(0);
pageDTO.setRows(clickUserInfos);
pageDTO.setTotal(clickUserInfos.size());
}
logger.info("查询用户查看分享文章轨迹信息的控制层方法结束!");
return msg;
return pageDTO;
}
// // 复制链路

View File

@ -23,8 +23,7 @@ public interface ArticleQueryMapper {
int updatePublishedArticle(Map<String, String> articleMap);
public List<PublishedArticleInfo> selectAllWithLimit(@Param(value = "companyId") String companyId,
@Param(value = "articleState") List<String> articleState, @Param(value = "startRow") int startRow,
@Param(value = "rows") int rows, @Param(value = "articelName") String articelName,
@Param(value = "articleState") List<String> articleState, @Param(value = "articelName") String articelName,
@Param(value = "articelAuthor") String articelAuthor, @Param(value = "special") String special, @Param(value = "channelId") String channelId);
ArticleInfo queryArticleInfoByCompanyId(@Param("companyId") String companyId, @Param("originalUrl") String originalUrl);

View File

@ -85,7 +85,7 @@ public interface ArticleService {
*
* @return
*/
public List<PublishedArticleInfo> queryArticle(int startRow, int rows, String articelName, String articelAuthor,
public List<PublishedArticleInfo> queryArticle(String articelName, String articelAuthor,
String special, String articelType, String articleState) throws Exception;
/**

View File

@ -1,5 +1,6 @@
package com.ruoyi.content.service;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.content.domain.ArticleInfo;
import com.ruoyi.content.domain.ClickTrackInfo;
import com.ruoyi.content.domain.PageDTO;
@ -34,7 +35,7 @@ public interface StaffArticleManageService {
* @param rows
* @return
*/
public PageDTO querySalesmanByArticleId(String articleId, int startRow, int rows);
public TableDataInfo querySalesmanByArticleId(String articleId, int startRow, int rows);
/**
* 根据用户id查询浏览表
@ -44,6 +45,6 @@ public interface StaffArticleManageService {
* @param rows
* @return
*/
public PageDTO queryClickInfoByUserId(String userId, String articleId, int startRow, int rows);
public TableDataInfo queryClickInfoByUserId(String userId, String articleId, int startRow, int rows);
}

View File

@ -471,13 +471,12 @@ public class ArticleServiceImpl implements ArticleService {
* 查询用户当前发布的文章分页展示
*/
@Override
public List<PublishedArticleInfo> queryArticle(int startRow, int rows, String articelName, String articelAuthor,
public List<PublishedArticleInfo> queryArticle(String articelName, String articelAuthor,
String special, String channelId, String articleState) {
LOGGER.info("查询文章列表的业务层方法开始!");
LOGGER.info("拿到的参数 startRow【{}】rows【{}】,文章名称【{}】,文章作者【{}】,一级分类【{}】,二级分类【{}】,文章状态【{}】", startRow, rows,
LOGGER.info("拿到的参数 ,文章名称【{}】,文章作者【{}】,一级分类【{}】,二级分类【{}】,文章状态【{}】",
articelName, articelAuthor, special, channelId, articleState);
CmsSysUser userInfoDTO = (CmsSysUser) SecurityUtils.getSubject().getPrincipal();
String companyId = userInfoDTO.getCompanyId();// 公司id
String companyId = "1";// 公司id
List<String> list = new ArrayList<String>();
if (StringUtils.isBlank(articleState)) {
@ -498,10 +497,10 @@ public class ArticleServiceImpl implements ArticleService {
if (StringUtils.isBlank(channelId)) {
channelId = "";
}
List<PublishedArticleInfo> articleList = articleQueryMapper.selectAllWithLimit(companyId, list, startRow, rows,
List<PublishedArticleInfo> articleList = articleQueryMapper.selectAllWithLimit(companyId, list,
articelName, articelAuthor, special, channelId);
if (articleList == null || articleList.size() < 1) {
LOGGER.info("根据用户查询已发布的文章,未查询到数据【{}】", JsonUtil.objectToJackson(userInfoDTO));
LOGGER.info("根据用户查询已发布的文章,未查询到数据");
throw new BusinessException("您还没有发布过文章!");
}
for (PublishedArticleInfo publishedArticleInfo : articleList) {
@ -916,8 +915,7 @@ public class ArticleServiceImpl implements ArticleService {
LOGGER.info("文章列表的删除功能的业务层方法开始!");
String updateDate = DateUtil.currentDate();
String updateTime = DateUtil.currentTime();
CmsSysUser userInfoDTO = (CmsSysUser) SecurityUtils.getSubject().getPrincipal();
String updateUser = userInfoDTO.getUserId();
String updateUser = "1";
LOGGER.info("管理员updateUser【{}】文章列表的删除功能的业务层方法中拿到的文章的id【{}】", updateUser, id);
Message msg = new Message();
if (StringUtils.isBlank(id)) {

View File

@ -1,5 +1,6 @@
package com.ruoyi.content.service.impl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.content.domain.*;
import com.ruoyi.content.exception.BusinessException;
import com.ruoyi.content.mapper.*;
@ -51,7 +52,7 @@ public class StaffArticleManageServiceimpl implements StaffArticleManageService
}
@Override
public PageDTO querySalesmanByArticleId(String articleId, int startRow, int rows) {
public TableDataInfo querySalesmanByArticleId(String articleId, int startRow, int rows) {
List<ArticlePublishTrack> list = articlePublishTrackQueryMapper.queryPublishUserInfo(articleId, startRow, rows);
List<YwyForwardUserInfo> ywyList = new ArrayList<>();
@ -87,7 +88,7 @@ public class StaffArticleManageServiceimpl implements StaffArticleManageService
ywyForwardUserInfo.setNickName("后台管理员");
ywyForwardUserInfo.setArticleId(articleId);
ywyForwardUserInfo.setCreateDate(apt.getCreateDate());
ywyForwardUserInfo.setHeadImgUrl("/static/common/image/logo.png");
ywyForwardUserInfo.setHeadImgUrl("/img/admin.png");
ywyForwardUserInfo.setUserId(publishUserId);
}
ywyList.add(ywyForwardUserInfo);
@ -99,16 +100,15 @@ public class StaffArticleManageServiceimpl implements StaffArticleManageService
ArticlePublishTrackExample.Criteria criteria = example.createCriteria();
criteria.andArticleIdEqualTo(articleId);
int count = articlePublishTrackMapper.countByExample(example);
PageDTO pageDTO = new PageDTO();
pageDTO.setStartRow(startRow);
pageDTO.setDataRows(ywyList);
pageDTO.setTotal(count % rows == 0 ? count / rows : (count / rows + 1));
pageDTO.setRecords(count);
return pageDTO;
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(ywyList);
rspData.setTotal(count);
return rspData;
}
@Override
public PageDTO queryClickInfoByUserId(String userId, String articleId, int startRow, int rows) {
public TableDataInfo queryClickInfoByUserId(String userId, String articleId, int startRow, int rows) {
List<ClickTrackInfo> list = clickTrackInfoQueryMapper.queryClickInfoByUserId(userId, articleId, startRow, rows);
List<YwyPublishInfo> YwyPublishInfolList = new ArrayList<>();
@ -139,11 +139,10 @@ public class StaffArticleManageServiceimpl implements StaffArticleManageService
criteria.andPublishUserIdEqualTo(userId);
criteria.andArticleIdEqualTo(articleId);
int count = clickTrackInfoMapper.countByExample(example);
PageDTO pageDTO = new PageDTO();
pageDTO.setStartRow(startRow);
pageDTO.setDataRows(YwyPublishInfolList);
pageDTO.setTotal(count % rows == 0 ? count / rows : (count / rows + 1));
pageDTO.setRecords(count);
TableDataInfo pageDTO = new TableDataInfo();
pageDTO.setCode(0);
pageDTO.setRows(YwyPublishInfolList);
pageDTO.setTotal(count);
return pageDTO;
}
}

View File

@ -246,11 +246,13 @@
article_info ai WHERE 1=1
<if test="articelName != null and articelName!=''">
and ai.ARTICLE_NAME like CONCAT(CONCAT('%', #{articelName,
jdbcType=VARCHAR}), '%') </if>
jdbcType=VARCHAR}), '%')
</if>
<if test="articelAuthor != null and articelAuthor!=''">
and ai.ARTICLE_AUTHOR like CONCAT(CONCAT('%',
#{articelAuthor,
jdbcType=VARCHAR}), '%') </if>
jdbcType=VARCHAR}), '%')
</if>
<if test="special != null and special!=''">
and ai.SPECIAL = #{special,jdbcType=VARCHAR}
</if>
@ -263,17 +265,13 @@
<if test="articleState != null">
and ai.ARTICLE_STATE in
<foreach collection="articleState" item="articleState" index="index"
open="(" close=")" separator=","> #{articleState} </foreach>
open="(" close=")" separator=",">#{articleState}
</foreach>
</if>
order by ai.CREATE_DATE DESC,ai.CREATE_TIME DESC, ai.UPDATE_DATE
DESC,ai.UPDATE_TIME DESC
limit
#{startRow,jdbcType=DECIMAL},#{rows,jdbcType=DECIMAL}
order by ai.CREATE_DATE DESC,ai.CREATE_TIME DESC, ai.UPDATE_DATE DESC,ai.UPDATE_TIME DESC
</select>
<select id="queryModifiedEditUrlByArticleId" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select ARTICLE_ID, ARTICLE_NAME, PUSH_DATE,
@ -373,6 +371,4 @@
</select>
</mapper>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,571 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('文章列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>文章名称:</label>
<input type="text" name="articleName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" style="width: 500px;">
<div class="modal-content animated fadeIn">
<div class="modal-header" style="border-bottom: 0px solid #e5e5e5; padding: 15px 15px;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span>
</button>
<h5 class="modal-title" style="text-align: left; font-size: 23px;">添加标签</h5>
</div>
<div class="modal-body" style="background: #ffffff;">
<form class="form-horizontal m" id="form-picAdverts-add">
<div class="col-md-12" style="margin-top: -15px;">
<div class="form-group">
<label class="col-sm-4 control-label is-required">添加标签:</label>
<div class="col-sm-6">
<select class="form-control" th:id="labelChoice" name="labelChoice"></select>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer" style="border-top: 0px solid #e5e5e5;">
<button type="button" class="btn btn-white" data-dismiss="modal" th:id="modalColse">关闭</button>
<button type="button" class="btn btn-primary" th:onclick="addArticleLabel()">确定</button>
</div>
</div>
</div>
</div>
<div class="modal inmodal" id="myModal3" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" style="width: 800px;">
<div class="modal-content animated fadeIn">
<div class="modal-header" style="border-bottom: 0px solid #e5e5e5; padding: 15px 15px;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span>
</button>
<h5 class="modal-title" style="text-align: left; font-size: 23px;">业务员分享情况</h5>
</div>
<div class="modal-body" style="background: #ffffff; margin-top: -20px;">
<form id="form2">
<div class="select-list">
<input type="text" th:hidden="true" name="articleId" th:id="articleId"/>
<input type="text" th:hidden="true" name="userId" th:id="userId"/>
</div>
</form>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table1"></table>
</div>
</div>
<div class="modal-footer" style="border-top: 0px solid #e5e5e5;">
</div>
</div>
</div>
</div>
<div class="modal inmodal" id="myModal4" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" style="width: 900px;">
<div class="modal-content animated fadeIn">
<div class="modal-header" style="border-bottom: 0px solid #e5e5e5; padding: 15px 15px;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span>
</button>
<h5 class="modal-title" style="text-align: left; font-size: 23px;">客户观看情况</h5>
</div>
<div class="modal-body" style="background: #ffffff; margin-top: -20px;">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table3"></table>
</div>
</div>
<div class="modal-footer" style="border-top: 0px solid #e5e5e5;">
</div>
</div>
</div>
</div>
<div class="modal inmodal" id="myModal5" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" style="width: 800px;">
<div class="modal-content animated fadeIn">
<div class="modal-header" style="border-bottom: 0px solid #e5e5e5; padding: 15px 15px;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span>
</button>
<h5 class="modal-title" style="text-align: left; font-size: 23px;">客户来源</h5>
</div>
<div class="modal-body" style="background: #ffffff; margin-top: -20px;">
<form id="form5">
<div class="select-list">
<input type="text" th:hidden="true" name="clickId" th:id="clickId"/>
</div>
</form>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table5"></table>
</div>
</div>
<div class="modal-footer" style="border-top: 0px solid #e5e5e5;">
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var path = ctx;
var prefix = ctx + "article";
var labelArticleId = "";
var clickCount = 0;
var publishCount = 0;
var sharingCount = 0;
$(function () {
var options = {
id: "bootstrap-table",
url: prefix + "/articleArry",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "文章信息",
columns: [
{
field: 'articleId',
title: 'id',
visible: false
},
{
field: 'articleName',
title: '文章名称'
},
{
field: 'pushDate',
title: '发布时间',
visible: false
},
{
field: 'articleAuthor',
title: '文章作者',
visible: false
},
{
field: 'SPECIAL',
title: '专栏',
visible: false
},
{
field: 'channelId',
title: '所属栏目id',
visible: false
},
{
field: 'articleState',
title: '收录状态0未被收录2已收录1删除',
visible: false
},
{
field: 'createUser',
title: '创建人',
visible: false
},
{
field: 'originalUrl',
title: '原文连接地址',
visible: false
},
{
field: 'shareTitle',
title: '分享标题',
visible: false
},
{
field: 'shareDes',
title: '分享描述',
visible: false
},
{
field: 'updateDate',
title: '更新日期'
},
{
field: 'updateTime',
title: '更新时间'
},
{
field: 'visitorCount',
title: '浏览量'
},
{
field: 'shareCount',
title: '分享量'
},
{
field: 'modifiedEditUrl',
title: '预览路径',
visible: false
},
{
field: 'modifiedViewUrl',
title: '编辑路径',
visible: false
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-primary btn-xs" data-toggle="modal" data-target="#myModal3" onclick="sharingTrack(\'' + row.articleId + '\')")"><i class="fa fa-eye"></i>分享与浏览情况</a> ');
actions.push('<a class="btn btn-success btn-xs" data-toggle="modal" data-target="#myModal2" onclick="changeArticleId(\'' + row.articleId + '\')"><i class="fa fa-bookmark-o"></i>添加标签</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="delArticleInfo(\'' + row.articleId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
articleLabelChoice();
sharingTrack();
publishInfoList();
sharingTrackList();
});
function changeArticleId(id) {
labelArticleId = id;
}
/**
* 查询标签信息
*/
function articleLabelChoice() {
$.ajax({
type: "post",
url: path + 'label/queryLabel',
data: {},
async: false,
success: function (data) {
if (data.result) {
var obj = data.object.labelList;
for (var i = 0; i < obj.length; i++) {
$("#labelChoice").append(
"<option value='" + obj[i].labelId + "'>"
+ obj[i].labelName + "</option>");
}
} else {
$.modal.alertError("网络异常,请稍后再试!");
}
}
});
}
function delArticleInfo(id) {
$.ajax({
url: "delArticleInfo",
data: {
ids: id
},
dataType: "json",
type: "post",
cache: false,
success: function (data) {
if (data.result) {
const code = {
'code': 0
};
$.operate.successCallback(code);
} else {
$.modal.alertError(data.info);
}
},
error: function (textStatus, e) {
$.modal.alertError('系统异常,请稍后重试!');
}
});
}
/**
* 文章添加标签
*/
function addArticleLabel() {
var labelIds = [];
$("#labelChoice option:selected").each(function () {
labelIds.push($(this).val())
})
$.ajax({
url: path + "label/addlabel",
data: {
"labelIds": labelIds.join(','),
"articleId": labelArticleId,
},
dataType: "json",
type: "post",
cache: false,
success: function (data) {
if (data.result) {
$.modal.alertSuccess(data.info);
$('#modalColse').trigger("click");
} else {
$.modal.alertError(data.info);
}
},
error: function (textStatus, e) {
$.modal.alertError('系统异常,请稍后重试!');
}
});
}
function sharingTrack(id) {
$('#articleId').val(id);
if (clickCount > 0) {
$.table.search('form2', 'bootstrap-table1');
} else {
var options = {
id: "bootstrap-table1",
url: path + "article/articleSharingTrackList",
createUrl: prefix + "/add",
removeUrl: prefix + "/remove",
updateUrl: prefix + "/edit/{id}",
modalName: "业务员分享情况",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
columns: [
{
field: 'userId',
title: '用户ID',
visible: false
},
{
field: 'articleId',
title: '文章id',
visible: false
},
{
field: 'headImgUrl',
title: '发布业务员头像',
formatter: function (value, row, index) {
var actions = [];
actions.push('<img src="'
+ decodeURIComponent(row.headImgUrl)
+ '" id="img'
+ row.userId
+ '" style = "width:30;height:30px;border-radius:50px" />');
return actions.join('');
}
},
{
field: 'nickName',
title: '发布业务员昵称'
},
{
field: 'createUser',
title: '工号'
},
{
field: 'createDate',
title: '发布日期'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" data-toggle="modal" data-target="#myModal4" onclick="publishInfoList(\'' + row.userId + '\')"><i class="fa fa-user"></i>有谁看了</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
clickCount++;
}
}
function publishInfoList(id) {
$('#userId').val(id);
if (publishCount > 0) {
$.table.search('form2', 'bootstrap-table3');
} else {
var options = {
id: "bootstrap-table3",
url: path + "article/publishInfoList",
createUrl: prefix + "/add",
removeUrl: prefix + "/remove",
updateUrl: prefix + "/edit/{id}",
modalName: "客户观看情况",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
columns: [
{
field: 'clickId',
title: '用户clickid',
visible: false
},
{
field: 'openId',
title: '用户openId'
},
{
field: 'clientHeadImgurl',
title: '用户头像',
formatter: function (value, row, index) {
var actions = [];
actions.push('<img src="'
+ decodeURIComponent(row.clientHeadImgurl)
+ '" id="img'
+ row.userId
+ '" style = "width:30;height:30px;border-radius:50px" />');
return actions.join('');
}
},
{
field: 'clientNickName',
title: '用户昵称',
formatter: function (value, row, index) {
if (row.clientNickName == "") {
return '匿名';
}
return row.clientNickName;
}
},
{
field: 'watchTime',
title: '观看时长(s/秒)'
},
{
field: 'clickDate',
title: '观看日期'
},
{
field: 'clickTime',
title: '观看时间'
},
{
field: 'shareState',
title: '分享状态',
formatter: function (value, row, index) {
var actions = [];
if (row.shareState === '0' || row.shareState === '' || row.shareState === null) {
actions.push('未分享');
}
if (row.shareState === '1') {
actions.push('对话框分享');
}
if (row.shareState === '2') {
actions.push('朋友圈分享');
}
if (row.shareState === '5') {
actions.push('对话框和朋友圈都分享');
}
return actions.join('');
}
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" data-toggle="modal" data-target="#myModal5" onclick="sharingTrackList(\'' + row.clickId + '\')"><i class="fa fa-user"></i>客户来源</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
publishCount++;
}
}
function sharingTrackList(id) {
$('#clickId').val(id);
if (sharingCount > 0) {
$.table.search('form5', 'bootstrap-table5');
} else {
var options = {
id: "bootstrap-table5",
url: path + "article/articleSharingTrackInfo",
createUrl: prefix + "/add",
removeUrl: prefix + "/remove",
updateUrl: prefix + "/edit/{id}",
modalName: "客户来源",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
columns: [
{
title: "序号",
formatter: function (value, row, index) {
return $.table.serialNumber(index);
}
},
{
field: 'headImgUrl',
title: '用户头像',
formatter: function (value, row, index) {
var actions = [];
actions.push('<img src="'
+ decodeURIComponent(row.headImgUrl)
+ '" style = "width:30;height:30px;border-radius:50px" />');
return actions.join('');
}
},
{
field: 'nickName',
title: '用户昵称',
formatter: function (value, row, index) {
if (row.nickName == "") {
return '匿名';
}
return row.nickName;
}
},
{
field: 'toShareState',
title: '点开方式',
formatter: function (value, row, index) {
var actions = [];
if (row.toShareState == "groupmessage") {
actions.push('群组');
}
if (row.toShareState == "timeline") {
actions.push('朋友圈');
}
if (row.toShareState == "singlemessage") {
actions.push('个人');
}
return actions.join('');
}
},
{
field: 'openId',
title: '用户openId'
}]
};
$.table.init(options);
sharingCount++;
}
}
</script>
</body>
</html>

View File

@ -28,7 +28,6 @@
</div>
</div>
</div>
<div class="ui-layout-center">
<div class="container-div">
<div class="row">
@ -74,7 +73,7 @@
</div>
<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content animated flipInY">
<div class="modal-content animated fadeIn">
<div class="modal-header" style="border-bottom: 0px solid #e5e5e5;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span>
@ -168,7 +167,7 @@
</div>
<div class="modal inmodal" id="myModal3" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content animated flipInY">
<div class="modal-content animated fadeIn">
<div class="modal-header" style="border-bottom: 0px solid #e5e5e5;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span>

View File

@ -50,7 +50,7 @@
</div>
<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content animated flipInY">
<div class="modal-content animated fadeIn">
<div class="modal-header" style="border-bottom: 0px solid #e5e5e5;">
<input th:hidden="true" value="" th:id="pictureId"/>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span