文章管理

This commit is contained in:
zkr_liushenlu 2021-03-30 18:05:55 +08:00
parent 6f3dc068e2
commit 777fc2b301
7 changed files with 571 additions and 33 deletions

View File

@ -268,6 +268,7 @@ public class BaseCodeController extends BaseController {
Map<String, Object> policyMap = new HashMap<String, Object>(); Map<String, Object> policyMap = new HashMap<String, Object>();
String codeCode = request.getParameter("codeCode"); String codeCode = request.getParameter("codeCode");
String codeType = request.getParameter("codeType"); String codeType = request.getParameter("codeType");
String flag = request.getParameter("flag");
// 查询栏目树 // 查询栏目树
List<BaseCodeTree> columnList = baseCodeService.columnTree(codeCode, codeType); List<BaseCodeTree> columnList = baseCodeService.columnTree(codeCode, codeType);
// policyMap.put("columnList", columnList); // policyMap.put("columnList", columnList);
@ -275,19 +276,28 @@ public class BaseCodeController extends BaseController {
// msg.setObject(policyMap); // msg.setObject(policyMap);
// msg.setResult(true); // msg.setResult(true);
return initZtree(columnList); return initZtree(columnList, flag);
} }
public List<Ztree> initZtree(List<BaseCodeTree> deptList) { public List<Ztree> initZtree(List<BaseCodeTree> deptList, String flag) {
List<Ztree> ztreeList = new ArrayList<>(); List<Ztree> ztreeList = new ArrayList<>();
if (deptList != null && deptList.size() > 0) { if (deptList != null && deptList.size() > 0) {
Ztree z = new Ztree(); if (StringUtils.isBlank(flag)) {
z.setId("FIRST_COLUMN"); Ztree z = new Ztree();
z.setpId(""); z.setId("FIRST_COLUMN");
z.setName("栏目"); z.setpId("");
z.setTitle("栏目"); z.setName("栏目");
ztreeList.add(z); z.setTitle("栏目");
ztreeList.add(z);
} else if (StringUtils.equals(flag, "1")) {
Ztree z = new Ztree();
z.setId("ARTICLE");
z.setpId("");
z.setName("文库");
z.setTitle("文库");
ztreeList.add(z);
}
for (BaseCodeTree dept : deptList) { for (BaseCodeTree dept : deptList) {
Ztree ztree = new Ztree(); Ztree ztree = new Ztree();
ztree.setId(dept.getCodeCode()); ztree.setId(dept.getCodeCode());

View File

@ -1,6 +1,7 @@
package com.ruoyi.content.controller; package com.ruoyi.content.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.page.TableSupport;
@ -31,7 +32,7 @@ import java.util.*;
*/ */
@Controller @Controller
@RequestMapping("/article") @RequestMapping("/article")
public class LibraryManageController { public class LibraryManageController extends BaseController {
private String prefix = "content/article"; private String prefix = "content/article";
@ -462,10 +463,10 @@ public class LibraryManageController {
*/ */
@RequestMapping("/noSendPublishArticle") @RequestMapping("/noSendPublishArticle")
@ResponseBody @ResponseBody
public PageDTO noSendPublishArticle(HttpServletRequest request, HttpServletResponse response) { public TableDataInfo noSendPublishArticle(HttpServletRequest request, HttpServletResponse response) {
logger.info("查询未推送出去的文章列表!"); logger.info("查询未推送出去的文章列表!");
Thread.currentThread().setName(UUID.randomUUID().toString()); Thread.currentThread().setName(UUID.randomUUID().toString());
PageDTO pageDTO = new PageDTO(); TableDataInfo pageDTO = new TableDataInfo();
try { try {
String rowsVal = request.getParameter("rows"); String rowsVal = request.getParameter("rows");
String page = request.getParameter("page"); String page = request.getParameter("page");
@ -475,7 +476,6 @@ public class LibraryManageController {
String publishId = request.getParameter("publishId"); String publishId = request.getParameter("publishId");
// 1.根据文章id去查publish表找出该文章对应所有业务员 // 1.根据文章id去查publish表找出该文章对应所有业务员
pageDTO = libraryService.noSendPublishArticle(articleId, startRow, rows, publishId); pageDTO = libraryService.noSendPublishArticle(articleId, startRow, rows, publishId);
pageDTO.setPage(Integer.parseInt(page));
return pageDTO; return pageDTO;
} catch (Exception e) { } catch (Exception e) {

View File

@ -1,6 +1,7 @@
package com.ruoyi.content.service; package com.ruoyi.content.service;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.content.domain.BaseCode; import com.ruoyi.content.domain.BaseCode;
import com.ruoyi.content.domain.PageDTO; import com.ruoyi.content.domain.PageDTO;
import com.ruoyi.content.message.Message; import com.ruoyi.content.message.Message;
@ -127,7 +128,7 @@ public interface LibraryService {
public Message onkeyExChange(String from, String to, String companyId, String branchId); public Message onkeyExChange(String from, String to, String companyId, String branchId);
public PageDTO noSendPublishArticle(String articleId, int startRow, int rows, String publishId); public TableDataInfo noSendPublishArticle(String articleId, int startRow, int rows, String publishId);
public Message delOnTimeTask(String delId); public Message delOnTimeTask(String delId);

View File

@ -66,7 +66,7 @@ public class ArticleServiceImpl implements ArticleService {
originalUrl, createUser, author, ids, isAuthorization, isReserve, automaticName, introduction, originalUrl, createUser, author, ids, isAuthorization, isReserve, automaticName, introduction,
isJoinActive); isJoinActive);
String companyId = "1";// 渠道id String companyId = "1";// 渠道id
String email = ""; String email = "13152783264";
// 根据登录人查询登录信息shiro里有缓存数据不是最新 // 根据登录人查询登录信息shiro里有缓存数据不是最新
CmsSysUser cmsSysUser = cmsSysUserExMapper.queryLoginInfoByEmail(email); CmsSysUser cmsSysUser = cmsSysUserExMapper.queryLoginInfoByEmail(email);
// 此时后台管理员 // 此时后台管理员

View File

@ -1,10 +1,12 @@
package com.ruoyi.content.service.impl; package com.ruoyi.content.service.impl;
import com.github.pagehelper.PageInfo;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.content.constants.PropertiesConstants; import com.ruoyi.content.constants.PropertiesConstants;
import com.ruoyi.content.domain.*; import com.ruoyi.content.domain.*;
import com.ruoyi.content.exception.BusinessException; import com.ruoyi.content.exception.BusinessException;
@ -962,9 +964,7 @@ public class LibraryServiceImpl implements LibraryService {
LOGGER.info("接收到的参数articleId【{}】,publishId[{}],agentCode[{}],sendType[{}],partyId[{}],sendTime[{}]", LOGGER.info("接收到的参数articleId【{}】,publishId[{}],agentCode[{}],sendType[{}],partyId[{}],sendTime[{}]",
new Object[]{articleId, publishId, agentCode, sendType, partyId, sendTime}); new Object[]{articleId, publishId, agentCode, sendType, partyId, sendTime});
Message msg = new Message(true, "推送文章成功"); Message msg = new Message(true, "推送文章成功");
CmsSysUser userInfoDTO = (CmsSysUser) SecurityUtils.getSubject().getPrincipal(); String email = "13152783264";
String companyId = userInfoDTO.getCompanyId();
String email = userInfoDTO.getEmail();
CmsSysUser cmsSysUser = this.cmsSysUserExMapper.queryLoginInfoByEmail(email); CmsSysUser cmsSysUser = this.cmsSysUserExMapper.queryLoginInfoByEmail(email);
String userId = cmsSysUser.getUserId(); String userId = cmsSysUser.getUserId();
String sysUserName = cmsSysUser.getName(); String sysUserName = cmsSysUser.getName();
@ -1019,7 +1019,7 @@ public class LibraryServiceImpl implements LibraryService {
} }
@Override @Override
public PageDTO noSendPublishArticle(String articleId, int startRow, int rows, String publishId) { public TableDataInfo noSendPublishArticle(String articleId, int startRow, int rows, String publishId) {
LOGGER.info("查询未定时推送的文章列表,入参 articleId【{}】startRow【{}】rows【{}】publishId【{}】" LOGGER.info("查询未定时推送的文章列表,入参 articleId【{}】startRow【{}】rows【{}】publishId【{}】"
, articleId, startRow, rows, publishId); , articleId, startRow, rows, publishId);
HashMap<String, Object> paramMap = new HashMap<>(); HashMap<String, Object> paramMap = new HashMap<>();
@ -1066,11 +1066,10 @@ public class LibraryServiceImpl implements LibraryService {
ArticlePublishSendExample ex = new ArticlePublishSendExample(); ArticlePublishSendExample ex = new ArticlePublishSendExample();
ex.createCriteria().andArticleIdEqualTo(Integer.parseInt(articleId)).andPublishIdEqualTo(publishId); ex.createCriteria().andArticleIdEqualTo(Integer.parseInt(articleId)).andPublishIdEqualTo(publishId);
int count = articlePublishSendMapper.countByExample(ex); int count = articlePublishSendMapper.countByExample(ex);
PageDTO pageDTO = new PageDTO(); TableDataInfo pageDTO = new TableDataInfo();
pageDTO.setStartRow(startRow); pageDTO.setCode(0);
pageDTO.setDataRows(resultDTO); pageDTO.setRows(resultDTO);
pageDTO.setTotal(count % rows == 0 ? count / rows : (count / rows + 1)); pageDTO.setTotal(count);
pageDTO.setRecords(count);
return pageDTO; return pageDTO;
} }

View File

@ -2,7 +2,15 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org"> <html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head> <head>
<th:block th:include="include :: header('文库管理')"/> <th:block th:include="include :: header('文库管理')"/>
<th:block th:include="include :: layout-latest-css"/>
<th:block th:include="include :: ztree-css"/>
<th:block th:include="include :: datetimepicker-css"/>
</head> </head>
<style>
#tree_1_check {
display: none;
}
</style>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
<div class="row"> <div class="row">
@ -38,19 +46,144 @@
</div> </div>
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-primary" onclick=""> <a class="btn btn-primary" onclick="includeArticle(1)">
<i class="fa fa-plus"></i> 批量收录 <i class="fa fa-plus"></i> 批量收录
</a> </a>
<a class="btn btn-danger single disabled" style="margin-left: 15px;" onclick="$.operate.edit()"> <a class="btn btn-danger single disabled" style="margin-left: 15px;" onclick="includeArticle(2)">
<i class="fa fa-remove"></i> 批量移除 <i class="fa fa-remove"></i> 批量移除
</a> </a>
<a class="btn btn-success single disabled" style="margin-left: 15px;" onclick="includeArticle(2)">
<i class="fa fa-newspaper-o"></i> 创建文章
</a>
</div> </div>
<div class="col-sm-12 select-table table-striped" style="overflow-x: scroll;"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="border-collapse: collapse;"></table> <table id="bootstrap-table"></table>
</div>
</div>
</div>
<div class="modal inmodal" id="myModal1" 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">
<div id="tree" class="ztree"></div>
</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:id="sure">确定</button>
</div>
</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-add1">
<div class="col-md-12" style="margin-top: -15px;">
<div class="form-group" th:id="companyChoice">
<label class="col-sm-4 control-label is-required">公司:</label>
<div class="col-sm-6">
<select class="form-control" th:id="partyId" name="partyId"></select>
</div>
</div>
<div class="form-group" th:id="agentCodeText">
<label class="col-sm-4 control-label is-required">工号:</label>
<div class="col-sm-6">
<input name="jobNumber" th:id="jobNumber" class="form-control" type="text">
</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="sendMsg()">确定</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;">
<form class="form-horizontal m" id="form-picAdverts-add2">
<div class="col-md-12" style="margin-top: -15px;">
<div class="form-group">
<div class="col-sm-12" style="text-align: center;">
<input type="radio" th:id="c1" th:name="sendCheck" th:value="0" th:checked="true"
style="vertical-align: middle; margin-bottom: 6px; margin-right: 5px;"
th:onclick="changeState()">
<label th:for="c1" th:text="推送企业" style="margin-right: 15px;"
th:onclick="changeState()"></label>
<input type="radio" th:id="c2" th:name="sendCheck" th:value="1"
style="vertical-align: middle; margin-bottom: 6px; margin-right: 5px;"
th:onclick="changeState()">
<label th:for="c2" th:text="推送个人" th:onclick="changeState()"></label>
</div>
</div>
<div class="form-group" th:id="companyChoice1">
<label class="col-sm-4 control-label is-required">公司:</label>
<div class="col-sm-6">
<select class="form-control" th:id="partyId1" name="partyId1"></select>
</div>
</div>
<div class="form-group" th:id="agentCodeText1" style="display: none;">
<label class="col-sm-4 control-label is-required">工号:</label>
<div class="col-sm-6">
<input name="jobNumber1" th:id="jobNumber1" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label is-required">发送时间:</label>
<div class="input-group date col-sm-6">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="form-control" id="laydate-demo-3">
</div>
</div>
</div>
<div class="col-md-12" style="margin-top: -15px;">
<table id="bootstrap-table1"></table>
</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="onTimeSend()">确定</button>
</div>
</div> </div>
</div> </div>
</div> </div>
<th:block th:include="include :: footer"/> <th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var path = ctx; var path = ctx;
@ -59,18 +192,24 @@
var baseDataList = []; var baseDataList = [];
var baseDataListSecond = []; var baseDataListSecond = [];
var cloumnTree = []; var cloumnTree = [];
var article;
var publish;
var number;
$(function () { $(function () {
setFirstQuery(); setFirstQuery();
autoChangeInitType("ARTICLE"); autoChangeInitType("ARTICLE");
var options = { var options = {
id: "bootstrap-table",
url: prefix + "/libraryArry", url: prefix + "/libraryArry",
createUrl: prefix + "/add", createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}", updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove", removeUrl: prefix + "/remove",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
fixedColumns: true, fixedColumns: true,
toolbar: 'toolbar',
uniqueId: "articleId",
modalName: "文章", modalName: "文章",
columns: [{ columns: [{
checkbox: true checkbox: true
@ -177,7 +316,7 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.articleId + '\')">推送个人(验证)</a> '); actions.push('<a class="btn btn-success btn-xs" onclick="sendMsgModal(\'' + row.publishId + '\',\'' + row.articleId + '\',\'1\')">推送个人(验证)</a> ');
return actions.join(''); return actions.join('');
} }
}, },
@ -186,7 +325,7 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.articleId + '\')">推送企业号</a>'); actions.push('<a class="btn btn-primary btn-xs" onclick="sendMsgModal(\'' + row.publishId + '\',\'' + row.articleId + '\',\'2\')">推送企业号</a>');
return actions.join(''); return actions.join('');
} }
}, },
@ -195,7 +334,7 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.articleId + '\')">定时推送</a> '); actions.push('<a class="btn btn-info btn-xs" onclick="sendMsgModal(\'' + row.publishId + '\',\'' + row.articleId + '\',\'3\')">定时推送</a> ');
return actions.join(''); return actions.join('');
} }
}, },
@ -213,7 +352,7 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="articleLinkUrl(\'' + row.articleId + '\',\'' + row.publishId + '\');"><i class="fa fa-eye"></i> 预览文章</a>'); actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="loadPreviewData(\'' + row.publishId + '\');"><i class="fa fa-eye"></i> 预览文章</a>');
return actions.join(''); return actions.join('');
} }
}, },
@ -230,6 +369,18 @@
$.table.init(options); $.table.init(options);
cloumnTreeInit(); cloumnTreeInit();
ldcomList();
layui.use('laydate', function () {
var laydate = layui.laydate;
laydate.render({
elem: '#laydate-demo-3',
type: 'datetime',
trigger: 'click'
});
});
}); });
function queryCnameBySpecialChannel(id, type, num) { function queryCnameBySpecialChannel(id, type, num) {
@ -377,6 +528,7 @@
/** **获取文章推送链接** */ /** **获取文章推送链接** */
function articleLinkUrl(sendType, articleId, publishId, agentCode, partyId) { function articleLinkUrl(sendType, articleId, publishId, agentCode, partyId) {
$.modal.loading("努力加载中。。。");
$.ajax({ $.ajax({
url: path + "article/articleSend", url: path + "article/articleSend",
data: { data: {
@ -406,7 +558,7 @@
} }
}); });
$.modal.closeLoading();
} }
function deleteArticle(id) { function deleteArticle(id) {
@ -432,6 +584,382 @@
}); });
} }
function includeArticle(num) {
let arrays = $.table.selectColumns("articleId");
if (arrays.length > 0) {
//移除绑定事件
$('#sure').unbind('click');
$('#myModal1').modal('show');
const url = ctx + "column/columnTree?codeType=ARTICLE&flag=1";
let options = {
url: url,
expandLevel: 1, // 展开等级节点
view: {
selectedMulti: true, // 设置是否允许同时选中多个节点
nameIsHTML: true // 设置 name 属性是否支持 HTML 脚本
},
check: {
enable: true, // 置 zTree 的节点上是否显示 checkbox / radio
nocheckInherit: true // 设置子节点是否自动继承
}
// onClick: zOnClick
};
$.tree.init(options);
//绑定事件
$('#sure').bind('click', function () {
if (num === 2) {
removeArticle();
} else {
include();
}
});
} else {
$.modal.alertWarning('请选择至少一条数据!');
}
return;
}
function include() {
let channel = '';
let idNodes = $.tree.getCheckedNodes('id');
if (idNodes === '') {
$.modal.alertWarning('请选择至少一个栏目!');
return;
}
let pidNodes = $.tree.getCheckedNodes('pId');
let channel1 = idNodes.split(',');
let channel2 = pidNodes.split(',');
for (let i = 1; i < channel1.length; i++) {
if (channel === '') {
channel = channel2[i - 1] + '-' + channel1[i];
} else {
channel = channel + ',' + channel2[i - 1] + '-' + channel1[i];
}
}
let arrays = $.table.selectColumns('articleId');
let ids = [];
for (let i = 0; i < arrays.length; i++) {
let item = {
"articleId": '',
"articleName": '',
"originalUrl": '',
"publishId": ''
}
let rowData = $("#" + table.options.id).bootstrapTable('getRowByUniqueId', arrays[i]);
item.articleId = rowData.articleId;
item.articleName = rowData.articleName;
item.originalUrl = rowData.originalUrl;
item.publishId = rowData.publishId;
ids.push(item);
}
$.ajax({
url: path + "article/addLibrary",
data: {
"channelId": channel,
"articleInfo": JSON.stringify(ids)
},
dataType: "json",
type: "post",
cache: false,
success: function (data) {
$.modal.closeLoading();
if (data.result) {
$.modal.alertSuccess("收录成功!请到文库管理查看");
$.table.search();
} else {
$.modal.alertWarning(data.info);
}
},
error: function (textStatus, e) {
$.modal.closeLoading();
$.modal.alertError('系统异常,请稍后重试!');
}
});
$('#myModal1').modal('hide');
$.modal.loading('正在收录,请稍等!');
}
function removeArticle() {
let channel = '';
let idNodes = $.tree.getCheckedNodes('id');
if (idNodes === '') {
$.modal.alertWarning('请选择至少一个栏目!');
return;
}
let pidNodes = $.tree.getCheckedNodes('pId');
let channel1 = idNodes.split(',');
let channel2 = pidNodes.split(',');
for (let i = 1; i < channel1.length; i++) {
if (channel === '') {
channel = channel2[i - 1] + '-' + channel1[i];
} else {
channel = channel + ',' + channel2[i - 1] + '-' + channel1[i];
}
}
let arrays = $.table.selectColumns('articleId');
let ids = [];
for (let i = 0; i < arrays.length; i++) {
let item = {
"articleId": '',
"articleName": '',
"originalUrl": '',
"publishId": ''
}
let rowData = $("#" + table.options.id).bootstrapTable('getRowByUniqueId', arrays[i]);
item.articleId = rowData.articleId;
item.articleName = rowData.articleName;
item.originalUrl = rowData.originalUrl;
item.publishId = rowData.publishId;
ids.push(item);
}
$.ajax({
url: path + "article/removeArticleItem",
data: {
"channelId": channel,
"articleInfo": JSON.stringify(ids)
},
dataType: "json",
type: "post",
cache: false,
success: function (data) {
$.modal.closeLoading();
if (data.result) {
$.modal.alertSuccess("移除成功!请到文库管理查看");
$.table.search();
} else {
$.modal.alertWarning(data.info);
}
},
error: function (textStatus, e) {
$.modal.closeLoading();
$.modal.alertError('系统异常,请稍后重试!');
}
});
$('#myModal1').modal('hide');
$.modal.loading('正在移除,请稍等!');
}
function sendMsgModal(publishId, articleId, num) {
number = num;
publish = publishId;
article = articleId;
if (num === '1') {
$("#jobNumber").val('');
$('#agentCodeText').css('display', 'block');
$('#companyChoice').css('display', 'none');
$('#myModal2').modal('show');
} else if (num === '2') {
$('#agentCodeText').css('display', 'none');
$('#companyChoice').css('display', 'block');
$('#myModal2').modal('show');
} else {
showSendMsg();
// $('#myModal3 ins').bind('click', function () {
// changeState();
// });
$('#myModal3').modal('show');
}
}
function sendMsg() {
if (number === '1') {
let agentCode = $("#jobNumber").val();
if (agentCode == '' || agentCode == null) {
$.modal.alertError('请填写工号!');
return;
}
articleLinkUrl("0", article, publish, agentCode, null);
} else {
let partyId = $("#partyId").val();
articleLinkUrl("0", article, publish, null, partyId);
}
}
function ldcomList() {
$("#partyId option").remove();
$.ajax({
type: "post",
url: path + 'ldcom/queryldcomList',
data: {},
async: false,
success: function (data) {
let obj = data.object.ldcomList;
for (let i = 0; i < obj.length; i++) {
$("#partyId").append(
"<option value='" + obj[i].partyId + "'>"
+ obj[i].shortname + "</option>");
$("#partyId1").append(
"<option value='" + obj[i].partyId + "'>"
+ obj[i].shortname + "</option>");
}
}
})
}
function showSendMsg() {
let options = {
id: "bootstrap-table1",
url: prefix + "/noSendPublishArticle",
modalName: "定时推送信息",
paginationLoop: true,
toolbar: null,
queryParams: {
articleId: article,
publishId: publish,
page: '1',
rows: '1000'
},
columns: [
{
field: 'id',
title: '任务id',
visible: false
},
{
field: 'operateName',
title: '操作人员'
},
{
field: 'operateTime',
title: '操作时间'
},
{
field: 'groupId',
title: '推送id'
},
{
field: 'sendType',
title: '推送类型'
},
{
field: 'publishTime',
title: '推送时间'
},
{
field: 'sendState',
title: '状态'
},
{
title: '删除',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeSendMsg(\'' + row.id + '\');"><i class="fa fa-remove"></i> 删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
}
function removeSendMsg(id) {
$.ajax({
url: prefix + "/delOnTimeTask",
data: {
delId: id
},
dataType: "json",
type: "post",
cache: false,
success: function (data) {
if (data.result) {
$.modal.alertSuccess("删除成功!");
$.table.search('', 'bootstrap-table1')
} else {
$.modal.alertError("删除失败!");
}
},
});
}
function changeState() {
let code = $("input[name='sendCheck']:checked").val();
if (code == '1') {
$('#agentCodeText1').css('display', 'block');
$('#companyChoice1').css('display', 'none');
} else {
$('#agentCodeText1').css('display', 'none');
$('#companyChoice1').css('display', 'block');
}
}
function onTimeSend() {
var partyId = $("#partyId1").val();
var agentCode = $("#jobNumber1").val();
var sendTime = $("#laydate-demo-3").val();
var sendTimeType = $("input[name='sendCheck']:checked").val();
if ((partyId == '' || partyId == null) && (agentCode == '' || agentCode == null)) {
$.modal.alertError('请选择公司或填写推送人工号!');
} else if (sendTime == '' || sendTime == null) {
$.modal.alertError('请选择填写推送时间!');
}
var strtime = sendTime.replace("/-/g", "/");//时间转换
//时间
var date1 = new Date(strtime);
//现在时间
var date2 = new Date();
if (date1 < date2) {
$.modal.alertError('请选择非过期时间!');
} else {
onTimeSendLinkUrl(article, publish, partyId, agentCode, sendTime, sendTimeType);
}
}
/** **定时推送文章请求接口** */
function onTimeSendLinkUrl(articleId, publishId, partyId, agentCode, sendTime, sendTimeType) {
$.ajax({
url: prefix + "/onTimeSend",
data: {
"articleId": articleId,
"publishId": publishId,
"agentCode": agentCode,
"sendType": sendTimeType,
"partyId": partyId,
"sendTime": sendTime
},
dataType: "json",
type: "post",
cache: false,
success: function (data) {
if (data.result) {
$.modal.alertSuccess("文章定时推送设置成功");
$('#myModal3').modal('hide');
} else {
$.modal.alertError(data.info);
}
},
error: function (textStatus, e) {
}
});
}
function loadPreviewData(id) {
$.ajax({
url : prefix + "/preview",
data : {
"publishId" : id
},
dataType : "json",
type : "post",
cache : false,
success : function(data) {
if (data.result) {
$.modal.open('文章预览', data.object.editUrl)
}else{
$.modal.alertError("预览失败,请稍后重试!");
}
},
error : function(textStatus, e) {
$.modal.alertError('系统异常,请稍后重试!');
}
});
}
</script> </script>
</body> </body>
</html> </html>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head> <head>
<th:block th:include="include :: header('图片广告列表')"/> <th:block th:include="include :: header('图片广告列表')"/>
</head> </head>