1.发布新闻增加配置
This commit is contained in:
parent
4a87e79b0b
commit
b4362059b9
3
pom.xml
3
pom.xml
@ -86,7 +86,7 @@
|
||||
<groupId>ink.wgink</groupId>
|
||||
<artifactId>login-wechat</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<!--<scope>provided</scope>-->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -187,7 +187,6 @@
|
||||
<layout>ZIP</layout>
|
||||
<includes>
|
||||
<include>
|
||||
|
||||
<groupId>non-exists</groupId>
|
||||
<artifactId>non-exists</artifactId>
|
||||
</include>
|
||||
|
@ -54,7 +54,7 @@ public class NewsDirectoriesController extends DefaultBaseController {
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/dataauth/{newsDirectoriesId}/{directoriesDataAuth}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult updateDirectoriesDataAuth(@PathVariable("newsDirectoriesId") String newsDirectoriesId, @PathVariable("directoriesDataAuth") Boolean directoriesDataAuth) throws Exception {
|
||||
public SuccessResult updateDirectoriesDataAuth(@PathVariable("newsDirectoriesId") String newsDirectoriesId, @PathVariable("directoriesDataAuth") String directoriesDataAuth) throws Exception {
|
||||
return newsDirectoriesService.updateDirectoriesDataAuth(newsDirectoriesId, directoriesDataAuth);
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,8 @@ public class NewsDirectoriesVO {
|
||||
private String directoriesPlateShow;
|
||||
@ApiModelProperty(name = "directoriesWebView", value = "web端列表显示方式")
|
||||
private String directoriesWebView;
|
||||
@ApiModelProperty(name = "directoriesDataAuth", value = "数据权限")
|
||||
private String directoriesDataAuth;
|
||||
|
||||
public String getDirectoriesTarget1() {
|
||||
return directoriesTarget1 == null ? "" : directoriesTarget1;
|
||||
@ -184,4 +186,12 @@ public class NewsDirectoriesVO {
|
||||
public void setDirectoriesWebView(String directoriesWebView) {
|
||||
this.directoriesWebView = directoriesWebView;
|
||||
}
|
||||
|
||||
public String getDirectoriesDataAuth() {
|
||||
return directoriesDataAuth;
|
||||
}
|
||||
|
||||
public void setDirectoriesDataAuth(String directoriesDataAuth) {
|
||||
this.directoriesDataAuth = directoriesDataAuth;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.department.IDepartmentUserBaseService;
|
||||
import ink.wgink.interfaces.user.IUserBaseService;
|
||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||
import ink.wgink.module.dictionary.service.IAreaService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.app.AppTokenUser;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
@ -91,6 +93,8 @@ public class NewsContentServiceImpl extends DefaultBaseService implements INewsC
|
||||
private TemplateProperties templateProperties;
|
||||
@Autowired
|
||||
private IUserExpandService userExpandService;
|
||||
@Autowired
|
||||
private IAreaService areaService;
|
||||
|
||||
|
||||
|
||||
@ -415,7 +419,8 @@ public class NewsContentServiceImpl extends DefaultBaseService implements INewsC
|
||||
public SuccessResultList<List<NewsContentAppDTO>> listPageNewsContentToAppByAreaCode(ListPage page,String areaCode) throws SearchException {
|
||||
Map<String, Object> params = page.getParams();
|
||||
//按新闻区域查询
|
||||
params.put("newsContertAreaCode",this.checkAreaCode(areaCode,params));
|
||||
//params.put("newsContertAreaCode",this.checkDataAreaAuth(areaCode,params));
|
||||
params.put("areaCodeList",this.checkDataAreaAuth(areaCode,params));
|
||||
/**
|
||||
* start
|
||||
* 废弃 新增字段 newsContertAreaCode-新闻区域
|
||||
@ -803,24 +808,87 @@ public class NewsContentServiceImpl extends DefaultBaseService implements INewsC
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
private String checkAreaCode(String areaCode,Map<String, Object> params){
|
||||
private List<String> checkDataAreaAuth(String areaCode,Map<String, Object> params){
|
||||
Object newsDirectoriesId = params.get("newsDirectoriesId");
|
||||
Object newsDirectoriesParentId = params.get("newsDirectoriesParentId");
|
||||
//只查询本级新闻
|
||||
|
||||
if(newsDirectoriesId != null){
|
||||
NewsDirectoriesDTO newsDirectories = iNewsDirectoriesService.getNewsDirectoriesById(newsDirectoriesId.toString());
|
||||
if("1".equals(newsDirectories.getDirectoriesDataAuth())){
|
||||
return areaCode;
|
||||
}
|
||||
String directoriesDataAuth = newsDirectories.getDirectoriesDataAuth();
|
||||
return checkDataAuth(directoriesDataAuth,areaCode);
|
||||
}
|
||||
if(newsDirectoriesParentId != null){
|
||||
NewsDirectoriesDTO newsDirectories = iNewsDirectoriesService.getNewsDirectoriesById(newsDirectoriesParentId.toString());
|
||||
if("1".equals(newsDirectories.getDirectoriesDataAuth())){
|
||||
return areaCode;
|
||||
}
|
||||
String directoriesDataAuth = newsDirectories.getDirectoriesDataAuth();
|
||||
return checkDataAuth(directoriesDataAuth,areaCode);
|
||||
}
|
||||
//查询下级新闻
|
||||
return areaCode.replaceAll("(0)+$", "");
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
private List<String> checkDataAuth(String directoriesDataAuth, String areaCode){
|
||||
List<String> areaList = new ArrayList<>();
|
||||
// 上级显示
|
||||
if("1".equals(directoriesDataAuth)){
|
||||
return downAllArea(areaCode,areaList);
|
||||
}
|
||||
// 本级显示
|
||||
if("2".equals(directoriesDataAuth)){
|
||||
areaList.add(areaCode);
|
||||
}
|
||||
// 下级显示
|
||||
if("3".equals(directoriesDataAuth)){
|
||||
return onAllArea(areaCode,areaList);
|
||||
}
|
||||
// 全部展示
|
||||
if("4".equals(directoriesDataAuth)){
|
||||
return areaList;
|
||||
}
|
||||
// 没配置默认本级显示
|
||||
return areaList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获得所有上级区域编码(截止到市级)
|
||||
* @param areaCode
|
||||
* @param onAreaList
|
||||
* @return
|
||||
*/
|
||||
private List<String> onAllArea(String areaCode,List<String> onAreaList){
|
||||
onAreaList.add(areaCode);
|
||||
AreaDTO area = areaService.getByCode(areaCode);
|
||||
if(area == null){
|
||||
return onAreaList;
|
||||
}
|
||||
// 到市级截止
|
||||
if("1".equals(area.getAreaLevel())){
|
||||
return onAreaList;
|
||||
}
|
||||
AreaDTO areaParent = areaService.get(area.getAreaParentId());
|
||||
if(areaParent == null){
|
||||
return onAreaList;
|
||||
}
|
||||
return onAllArea(areaParent.getAreaCode(),onAreaList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有下级区域编码
|
||||
* @param areaCode
|
||||
* @param downAreaList
|
||||
* @return
|
||||
*/
|
||||
private List<String> downAllArea(String areaCode,List<String> downAreaList){
|
||||
downAreaList.add(areaCode);
|
||||
List<AreaDTO> areaDTOS = areaService.listSubByCode(areaCode);
|
||||
areaDTOS.forEach( data -> {
|
||||
downAreaList.add(data.getAreaCode());
|
||||
});
|
||||
return downAreaList;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public interface INewsDirectoriesService {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
SuccessResult updateDirectoriesDataAuth(String newsDirectoriesId, Boolean directoriesDataAuth) throws Exception;
|
||||
SuccessResult updateDirectoriesDataAuth(String newsDirectoriesId, String directoriesDataAuth) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -103,10 +103,10 @@ public class NewsDirectoriesServiceImpl extends DefaultBaseService implements IN
|
||||
|
||||
|
||||
@Override
|
||||
public SuccessResult updateDirectoriesDataAuth(String newsDirectoriesId, Boolean directoriesDataAuth) throws Exception {
|
||||
public SuccessResult updateDirectoriesDataAuth(String newsDirectoriesId, String directoriesDataAuth) throws Exception {
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(3);
|
||||
params.put("newsDirectoriesId", newsDirectoriesId);
|
||||
params.put("directoriesDataAuth", directoriesDataAuth ? "1" : "0");
|
||||
params.put("directoriesDataAuth", directoriesDataAuth);
|
||||
setUpdateInfo(params);
|
||||
newsDirectoriesDao.updateDirectoriesDataAuth(params);
|
||||
return new SuccessResult();
|
||||
|
@ -442,7 +442,12 @@
|
||||
<if test="newsContertAreaCode != null and newsContertAreaCode != ''">
|
||||
AND t1.news_contert_area_code LIKE CONCAT('%', #{newsContertAreaCode}, '%')
|
||||
</if>
|
||||
|
||||
<if test="areaCodeList != null and areaCodeList.size > 0 ">
|
||||
AND t1.news_contert_area_code IN
|
||||
<foreach collection="areaCodeList" index="index" open="(" separator="," close=")">
|
||||
#{areaCodeList[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
) app
|
||||
ORDER BY app.news_config_top DESC, app.news_config_hot DESC, app.news_content_score DESC , app.news_content_publish_time DESC, app.gmt_create DESC
|
||||
</select>
|
||||
|
@ -166,6 +166,7 @@
|
||||
directories_menu_show,
|
||||
directories_plate_show,
|
||||
directories_web_view,
|
||||
directories_data_auth,
|
||||
creator,
|
||||
gmt_create,
|
||||
modifier,
|
||||
@ -189,6 +190,7 @@
|
||||
#{directoriesMenuShow},
|
||||
#{directoriesPlateShow},
|
||||
#{directoriesWebView},
|
||||
#{directoriesDataAuth},
|
||||
#{creator},
|
||||
#{gmtCreate},
|
||||
#{modifier},
|
||||
@ -264,6 +266,9 @@
|
||||
</if>
|
||||
<if test="directoriesWebView != null and directoriesWebView != ''">
|
||||
directories_web_view = #{directoriesWebView},
|
||||
</if>
|
||||
<if test="directoriesDataAuth != null and directoriesDataAuth != ''">
|
||||
directories_data_auth = #{directoriesDataAuth},
|
||||
</if>
|
||||
modifier = #{modifier},
|
||||
gmt_modified = #{gmtModified}
|
||||
|
@ -9,9 +9,10 @@
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
@ -53,6 +54,11 @@
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
// 数据权限
|
||||
function dataAuthChange(data) {
|
||||
alert(data.value)
|
||||
}
|
||||
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
@ -76,7 +82,7 @@
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, [parentId]),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
height: $win.height() - 60,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
@ -84,15 +90,20 @@
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
defaultToolbar: ['filter', 'print', 'exports', {
|
||||
title: '提示' //标题
|
||||
,layEvent: 'LAYTABLE_TIPS' //事件名,用于 toolbar 事件中使用
|
||||
,icon: 'layui-icon-tips' //图标类名
|
||||
}],
|
||||
cols: [[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:60, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'directories', width: 100, title: '发布权限', align:'center',
|
||||
{field: 'directories', width: 110, title: '发布权限 <i class="layui-icon layui-icon-tips" lay-tips="用户对栏目的发布权限"></i>', align:'center',
|
||||
templet: function(row) {
|
||||
return '<button lay-event="directoriesEvent" type="button" class="layui-btn layui-btn-xs">权限设置</button>';
|
||||
}
|
||||
},
|
||||
{field: 'directoriesAreas', width: 100, title: '查看权限', align:'center',
|
||||
{field: 'directoriesAreas', width: 110, title: '查看权限 <i class="layui-icon layui-icon-tips" lay-tips="区域对栏目的查看权限"></i>', align:'center',
|
||||
templet: function(row) {
|
||||
return '<button lay-event="directoriesAreasEvent" type="button" class="layui-btn layui-btn-xs">区域设置</button>';
|
||||
}
|
||||
@ -121,34 +132,41 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'directoriesSwitch', width: 110, fixed: 'right', title: '版块开关', align:'center',
|
||||
{field: 'directoriesSwitch', width: 110, fixed: 'right', title: '版块开关 <i class="layui-icon layui-icon-tips" lay-tips="栏目版块总开关,如设置关闭其他配置不起作用"></i>', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
return '<input type="checkbox" value="' + rowData + '" '+ ( rowData == 1 ? "checked" : "") + ' newsDirectoriesId="'+ row.newsDirectoriesId +'" lay-filter="directoriesSwitchEvent" name="directoriesSwitch" lay-skin="switch" lay-text="开启|关闭">';
|
||||
}
|
||||
},
|
||||
{field: 'directoriesCheck', width: 110, fixed: 'right', title: '审核开关', align:'center',
|
||||
{field: 'directoriesCheck', width: 110, fixed: 'right', title: '审核开关 <i class="layui-icon layui-icon-tips" lay-tips="设置开启该栏目发布新闻需要经过审核,审核通过门户或APP才能看到"></i>', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
return '<input type="checkbox" value="' + rowData + '" '+ ( rowData == 1 ? "checked" : "") + ' newsDirectoriesId="'+ row.newsDirectoriesId +'" lay-filter="directoriesCheckEvent" name="directoriesCheck" lay-skin="switch" lay-text="开启|关闭">';
|
||||
}
|
||||
},
|
||||
{field: 'directoriesMenuShow', width: 110, fixed: 'right', title: '导航显示', align:'center',
|
||||
{field: 'directoriesMenuShow', width: 110, fixed: 'right', title: '导航显示 <i class="layui-icon layui-icon-tips" lay-tips="设置门户,APP的导航条是否显示该栏目"></i>', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
return '<input type="checkbox" value="' + rowData + '" '+ ( rowData == 1 ? "checked" : "") + ' newsDirectoriesId="'+ row.newsDirectoriesId +'" lay-filter="directoriesMenuShow" name="directoriesMenuShow" lay-skin="switch" lay-text="是|否">';
|
||||
}
|
||||
},
|
||||
{field: 'directoriesPlateShow', width: 110, fixed: 'right', title: '版块显示', align:'center',
|
||||
{field: 'directoriesPlateShow', width: 110, fixed: 'right', title: '版块显示 <i class="layui-icon layui-icon-tips" lay-tips="设置门户,APP的首页或新闻二级页面的版块显示"></i>', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
return '<input type="checkbox" value="' + rowData + '" '+ ( rowData == 1 ? "checked" : "") + ' newsDirectoriesId="'+ row.newsDirectoriesId +'" lay-filter="directoriesPlateShow" name="directoriesPlateShow" lay-skin="switch" lay-text="是|否">';
|
||||
}
|
||||
},
|
||||
{field: 'directoriesDataAuth', width: 120, fixed: 'right', title: '数据权限', align:'center',
|
||||
{field: 'directoriesDataAuth', width: 120, fixed: 'right', title: '数据权限 <i class="layui-icon layui-icon-tips" lay-tips="设置栏目展示数据的范围<br> 1.上级显示:当前栏目发布的新闻上级区域也可以查询到<br> 2.本级显示:当前栏目发布的新闻只有新闻发布区域可以查询到<br> 3.下级展示:当前栏目发布的新闻下级区域可以查询的到<br> "></i>', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
return '<input type="checkbox" value="' + rowData + '" '+ ( rowData == 1 ? "checked" : "") + ' newsDirectoriesId="'+ row.newsDirectoriesId +'" lay-filter="directoriesDataAuth" name="directoriesDataAuth" lay-skin="switch" lay-text="本级展示|上级展示">';
|
||||
var html_ = '<select class="layui-border data-auth-select" lay-ignore newsDirectoriesId="'+ row.newsDirectoriesId +'">'
|
||||
html_ += '<option value="1" '+ (rowData == "1" ? "selected" : "") +'>上级显示</option>'
|
||||
html_ += '<option value="2" '+ (rowData == "2" ? "selected" : "") +'>本级显示</option>'
|
||||
html_ += '<option value="3" '+ (rowData == "3" ? "selected" : "") +'>下级显示</option>'
|
||||
html_ += '<option value="4" '+ (rowData == "4" ? "selected" : "") +'>全部显示</option>'
|
||||
html_ += '</select>'
|
||||
return html_;
|
||||
//return '<input type="checkbox" value="' + rowData + '" '+ ( rowData == 1 ? "checked" : "") + ' newsDirectoriesId="'+ row.newsDirectoriesId +'" lay-filter="directoriesDataAuth" name="directoriesDataAuth" lay-skin="switch" lay-text="本级展示|上级展示">';
|
||||
}
|
||||
}
|
||||
]],
|
||||
@ -176,7 +194,7 @@
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
height: $win.height() - 60,
|
||||
});
|
||||
}
|
||||
// 初始化日期
|
||||
@ -309,8 +327,21 @@
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// 数据权限
|
||||
$(document).on('change', '.data-auth-select', function() {
|
||||
var loadLayerIndex;
|
||||
var obj = {};
|
||||
top.restAjax.put(top.restAjax.path('api/newsdirectories/update/dataauth/{newsDirectoriesId}/{directoriesDataAuth}', [$(this).attr("newsDirectoriesId"), this.value]), obj, null, function(code, data) {
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
|
||||
/* // 数据权限
|
||||
form.on('switch(directoriesDataAuth)', function () {
|
||||
var loadLayerIndex;
|
||||
var obj = {};
|
||||
@ -322,7 +353,12 @@
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 删除
|
||||
|
@ -12,7 +12,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
@ -106,6 +106,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row">
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">版块显示<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="directoriesDataAuth" value="1" title="上级显示" checked>
|
||||
<input type="radio" name="directoriesDataAuth" value="2" title="本级显示">
|
||||
<input type="radio" name="directoriesDataAuth" value="3" title="下级显示">
|
||||
<input type="radio" name="directoriesDataAuth" value="4" title="全部显示">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label" style="width: 160px !important;">APP列表显示方式<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block" style="margin-left: 160px !important;">
|
||||
|
@ -105,6 +105,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">版块显示<span style="color: red">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="directoriesDataAuth" value="1" title="上级显示" checked>
|
||||
<input type="radio" name="directoriesDataAuth" value="2" title="本级显示">
|
||||
<input type="radio" name="directoriesDataAuth" value="3" title="下级显示">
|
||||
<input type="radio" name="directoriesDataAuth" value="4" title="全部显示">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label" style="width: 160px !important;">APP列表显示方式<span style="color: red">*</span></label>
|
||||
|
Loading…
Reference in New Issue
Block a user