优化es,去掉评论权
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package com.zyplayer.doc.data.service.elasticsearch.service;
|
package com.zyplayer.doc.data.service.elasticsearch.entity;
|
||||||
|
|
||||||
import com.zyplayer.doc.data.service.elasticsearch.support.Document;
|
import com.zyplayer.doc.data.service.elasticsearch.support.Document;
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zyplayer.doc.data.service.elasticsearch.service;
|
package com.zyplayer.doc.data.service.elasticsearch.service;
|
||||||
|
|
||||||
import com.zyplayer.doc.data.service.elasticsearch.support.ElaticSearchConfig;
|
import com.zyplayer.doc.data.service.elasticsearch.entity.EsWikiPage;
|
||||||
|
import com.zyplayer.doc.data.service.elasticsearch.support.ElasticSearchConfig;
|
||||||
import com.zyplayer.doc.data.service.elasticsearch.support.EsAbstractService;
|
import com.zyplayer.doc.data.service.elasticsearch.support.EsAbstractService;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -11,7 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
* @since 2019-07-07
|
* @since 2019-07-07
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@ConditionalOnBean(ElaticSearchConfig.class)
|
@ConditionalOnBean(ElasticSearchConfig.class)
|
||||||
public class EsWikiPageService extends EsAbstractService<EsWikiPage> {
|
public class EsWikiPageService extends EsAbstractService<EsWikiPage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by Fernflower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package com.zyplayer.doc.data.service.elasticsearch.support;
|
package com.zyplayer.doc.data.service.elasticsearch.support;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import java.net.UnknownHostException;
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnProperty(prefix = "zyplayer.doc.manage.elasticsearch", name = "open", havingValue = "true")
|
@ConditionalOnProperty(prefix = "zyplayer.doc.manage.elasticsearch", name = "open", havingValue = "true")
|
||||||
public class ElaticSearchConfig {
|
public class ElasticSearchConfig {
|
||||||
|
|
||||||
@Value(value = "${zyplayer.doc.manage.elasticsearch.host:''}")
|
@Value(value = "${zyplayer.doc.manage.elasticsearch.host:''}")
|
||||||
private String host;
|
private String host;
|
||||||
@@ -38,7 +38,7 @@ public abstract class EsAbstractService<T> {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(EsAbstractService.class);
|
private static final Logger logger = LoggerFactory.getLogger(EsAbstractService.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TransportClient esClient;
|
private TransportClient transportClient;
|
||||||
@Resource
|
@Resource
|
||||||
private Mapper mapper;
|
private Mapper mapper;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public abstract class EsAbstractService<T> {
|
|||||||
|
|
||||||
public boolean create(T table) {
|
public boolean create(T table) {
|
||||||
String pk = getPrimaryKey(table);
|
String pk = getPrimaryKey(table);
|
||||||
IndexResponse indexResponse = this.esClient
|
IndexResponse indexResponse = this.transportClient
|
||||||
.prepareIndex(this.getIndexName(), this.getIndexType())
|
.prepareIndex(this.getIndexName(), this.getIndexType())
|
||||||
.setId(pk)
|
.setId(pk)
|
||||||
.setSource(JSONObject.toJSONString(table), XContentType.JSON)
|
.setSource(JSONObject.toJSONString(table), XContentType.JSON)
|
||||||
@@ -69,7 +69,7 @@ public abstract class EsAbstractService<T> {
|
|||||||
|
|
||||||
public boolean update(T table) {
|
public boolean update(T table) {
|
||||||
String pk = getPrimaryKey(table);
|
String pk = getPrimaryKey(table);
|
||||||
UpdateResponse updateResponse = this.esClient
|
UpdateResponse updateResponse = this.transportClient
|
||||||
.prepareUpdate(this.getIndexName(), this.getIndexType(), pk)
|
.prepareUpdate(this.getIndexName(), this.getIndexType(), pk)
|
||||||
.setDoc(JSONObject.toJSONString(table), XContentType.JSON)
|
.setDoc(JSONObject.toJSONString(table), XContentType.JSON)
|
||||||
.get();
|
.get();
|
||||||
@@ -79,7 +79,7 @@ public abstract class EsAbstractService<T> {
|
|||||||
|
|
||||||
public void delete(T table) {
|
public void delete(T table) {
|
||||||
String pk = getPrimaryKey(table);
|
String pk = getPrimaryKey(table);
|
||||||
DeleteResponse response = this.esClient
|
DeleteResponse response = this.transportClient
|
||||||
.prepareDelete(this.getIndexName(), this.getIndexType(), pk)
|
.prepareDelete(this.getIndexName(), this.getIndexType(), pk)
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
@@ -150,7 +150,7 @@ public abstract class EsAbstractService<T> {
|
|||||||
highlightBuilder.preTags("<span style=\"color:red\">");
|
highlightBuilder.preTags("<span style=\"color:red\">");
|
||||||
highlightBuilder.postTags("</span>");
|
highlightBuilder.postTags("</span>");
|
||||||
highlightBuilder.field("*");
|
highlightBuilder.field("*");
|
||||||
SearchRequestBuilder requestBuilder = esClient.prepareSearch(this.getIndexName()).setTypes(this.getIndexType())
|
SearchRequestBuilder requestBuilder = transportClient.prepareSearch(this.getIndexName()).setTypes(this.getIndexType())
|
||||||
.setQuery(queryBuilders)
|
.setQuery(queryBuilders)
|
||||||
.highlighter(highlightBuilder)
|
.highlighter(highlightBuilder)
|
||||||
.setFrom(startIndex).setSize(pageSize).setExplain(true);
|
.setFrom(startIndex).setSize(pageSize).setExplain(true);
|
||||||
|
|||||||
@@ -110,8 +110,8 @@
|
|||||||
<el-table-column prop="userName" label="用户" width="150"></el-table-column>
|
<el-table-column prop="userName" label="用户" width="150"></el-table-column>
|
||||||
<el-table-column label="权限">
|
<el-table-column label="权限">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.editPage">查看</el-checkbox>
|
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.editPage">编辑</el-checkbox>
|
||||||
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.commentPage">评论</el-checkbox>
|
<!-- <el-checkbox :true-label="1" :false-label="0" v-model="scope.row.commentPage">评论</el-checkbox>-->
|
||||||
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.deletePage">删除</el-checkbox>
|
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.deletePage">删除</el-checkbox>
|
||||||
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.pageFileUpload">文件上传</el-checkbox>
|
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.pageFileUpload">文件上传</el-checkbox>
|
||||||
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.pageFileDelete">文件删除</el-checkbox>
|
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.pageFileDelete">文件删除</el-checkbox>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.zyplayer.doc.wiki.controller;
|
package com.zyplayer.doc.wiki.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||||
import com.zyplayer.doc.core.json.ResponseJson;
|
import com.zyplayer.doc.core.json.ResponseJson;
|
||||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
|
||||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||||
@@ -14,7 +14,6 @@ import com.zyplayer.doc.data.service.manage.WikiPageService;
|
|||||||
import com.zyplayer.doc.data.service.manage.WikiSpaceService;
|
import com.zyplayer.doc.data.service.manage.WikiSpaceService;
|
||||||
import com.zyplayer.doc.wiki.controller.vo.WikiPageCommentVo;
|
import com.zyplayer.doc.wiki.controller.vo.WikiPageCommentVo;
|
||||||
import com.zyplayer.doc.wiki.framework.consts.SpaceType;
|
import com.zyplayer.doc.wiki.framework.consts.SpaceType;
|
||||||
import com.zyplayer.doc.wiki.framework.consts.WikiAuthType;
|
|
||||||
import org.dozer.Mapper;
|
import org.dozer.Mapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -91,13 +90,13 @@ public class WikiPageCommentController {
|
|||||||
if (SpaceType.isOthersPrivate(wikiSpaceSel.getType(), currentUser.getUserId(), wikiSpaceSel.getCreateUserId())) {
|
if (SpaceType.isOthersPrivate(wikiSpaceSel.getType(), currentUser.getUserId(), wikiSpaceSel.getCreateUserId())) {
|
||||||
return DocResponseJson.warn("您没有该空间的评论权!");
|
return DocResponseJson.warn("您没有该空间的评论权!");
|
||||||
}
|
}
|
||||||
// 空间不是自己的,也没有权限
|
// 空间不是自己的,也没有权限,感觉评论没必要加权限,先去掉
|
||||||
if (SpaceType.isOthersPersonal(wikiSpaceSel.getType(), currentUser.getUserId(), wikiSpaceSel.getCreateUserId())) {
|
// if (SpaceType.isOthersPersonal(wikiSpaceSel.getType(), currentUser.getUserId(), wikiSpaceSel.getCreateUserId())) {
|
||||||
boolean pageAuth = DocUserUtil.havePageAuth(WikiAuthType.COMMENT_PAGE.getName(), pageId);
|
// boolean pageAuth = DocUserUtil.havePageAuth(WikiAuthType.COMMENT_PAGE.getName(), pageId);
|
||||||
if (!pageAuth) {
|
// if (!pageAuth) {
|
||||||
return DocResponseJson.warn("您没有评论该文章的权限!");
|
// return DocResponseJson.warn("您没有评论该文章的权限!");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (id != null && id > 0) {
|
if (id != null && id > 0) {
|
||||||
wikiPageCommentService.updateById(pageComment);
|
wikiPageCommentService.updateById(pageComment);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import com.zyplayer.doc.data.repository.manage.mapper.WikiPageContentMapper;
|
|||||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageMapper;
|
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageMapper;
|
||||||
import com.zyplayer.doc.data.repository.manage.param.SearchByEsParam;
|
import com.zyplayer.doc.data.repository.manage.param.SearchByEsParam;
|
||||||
import com.zyplayer.doc.data.repository.manage.vo.SpaceNewsVo;
|
import com.zyplayer.doc.data.repository.manage.vo.SpaceNewsVo;
|
||||||
import com.zyplayer.doc.data.service.elasticsearch.service.EsWikiPage;
|
import com.zyplayer.doc.data.service.elasticsearch.entity.EsWikiPage;
|
||||||
import com.zyplayer.doc.data.service.elasticsearch.service.EsWikiPageService;
|
import com.zyplayer.doc.data.service.elasticsearch.service.EsWikiPageService;
|
||||||
import com.zyplayer.doc.data.service.elasticsearch.support.EsPage;
|
import com.zyplayer.doc.data.service.elasticsearch.support.EsPage;
|
||||||
import com.zyplayer.doc.data.service.manage.*;
|
import com.zyplayer.doc.data.service.manage.*;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
|||||||
!function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var a,i,f,l=0,s=[];l<t.length;l++)i=t[l],o[i]&&s.push(o[i][0]),o[i]=0;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(e[a]=c[a]);for(n&&n(t,c,u);s.length;)s.shift()();if(u)for(l=0;l<u.length;l++)f=r(r.s=u[l]);return f};var t={},o={2:0};r.e=function(e){function n(){u.onerror=u.onload=null,clearTimeout(a);var r=o[e];0!==r&&(r&&r[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}if(0===o[e])return Promise.resolve();if(o[e])return o[e][2];var t=new Promise(function(r,n){o[e]=[r,n]});o[e][2]=t;var c=document.getElementsByTagName("head")[0],u=document.createElement("script");u.type="text/javascript",u.charset="utf-8",u.async=!0,u.timeout=12e4,r.nc&&u.setAttribute("nonce",r.nc),u.src=r.p+""+e+".js?"+{0:"2b8a785d47f4d7159c21",1:"c0445036078211a7ad77"}[e];var a=setTimeout(n,12e4);return u.onerror=u.onload=n,c.appendChild(u),t},r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r.oe=function(e){throw console.error(e),e}}([]);
|
!function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var a,i,f,l=0,s=[];l<t.length;l++)i=t[l],o[i]&&s.push(o[i][0]),o[i]=0;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(e[a]=c[a]);for(n&&n(t,c,u);s.length;)s.shift()();if(u)for(l=0;l<u.length;l++)f=r(r.s=u[l]);return f};var t={},o={2:0};r.e=function(e){function n(){u.onerror=u.onload=null,clearTimeout(a);var r=o[e];0!==r&&(r&&r[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}if(0===o[e])return Promise.resolve();if(o[e])return o[e][2];var t=new Promise(function(r,n){o[e]=[r,n]});o[e][2]=t;var c=document.getElementsByTagName("head")[0],u=document.createElement("script");u.type="text/javascript",u.charset="utf-8",u.async=!0,u.timeout=12e4,r.nc&&u.setAttribute("nonce",r.nc),u.src=r.p+""+e+".js?"+{0:"2b8a785d47f4d7159c21",1:"f60aacff1fb160c86619"}[e];var a=setTimeout(n,12e4);return u.onerror=u.onload=n,c.appendChild(u),t},r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r.oe=function(e){throw console.error(e),e}}([]);
|
||||||
//# sourceMappingURL=doc-wiki-manifest.js.map?0a16a1d57ed8b4e2133f
|
//# sourceMappingURL=doc-wiki-manifest.js.map?e6fed62ad62f5aa67b0c
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="text/javascript" src="doc-wiki-manifest.js?0a16a1d57ed8b4e2133f"></script><script type="text/javascript" src="doc-wiki-vendor.js?2b8a785d47f4d7159c21"></script><script type="text/javascript" src="doc-wiki-index.js?c0445036078211a7ad77"></script></body>
|
<script type="text/javascript" src="doc-wiki-manifest.js?e6fed62ad62f5aa67b0c"></script><script type="text/javascript" src="doc-wiki-vendor.js?2b8a785d47f4d7159c21"></script><script type="text/javascript" src="doc-wiki-index.js?f60aacff1fb160c86619"></script></body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user