...
This commit is contained in:
parent
7d4b2abd43
commit
345ca548dc
@ -81,6 +81,11 @@ public class ContentController extends BaseController {
|
||||
return "content/application";
|
||||
}
|
||||
|
||||
@GetMapping("/index-census")
|
||||
public String census(Model model){
|
||||
return "content/census";
|
||||
}
|
||||
|
||||
/**
|
||||
* i技术开发案例页面
|
||||
* @param model
|
||||
@ -249,6 +254,9 @@ public class ContentController extends BaseController {
|
||||
entity.setTagLists(strings);
|
||||
entity.setCount(strings.length);
|
||||
}
|
||||
//查询用户的职位信息
|
||||
String roleId = userService.getUserRole(user.getUserId());
|
||||
entity.setRoleId(roleId);
|
||||
PageHelper.startPage(PageUtil.getPageNo(limit, offset),limit);
|
||||
List<Content> userList = service.getList2(entity);
|
||||
PageInfo<Content> pages = new PageInfo<>(userList);
|
||||
@ -287,7 +295,7 @@ public class ContentController extends BaseController {
|
||||
//更新审核申请单状态
|
||||
service.updateApplicationStatus(entity.getApplicationId());
|
||||
}
|
||||
desc="修改案例,案例类型:"+ContentType.getNameByCode(type)+",案例ID:"+entity.getId()+",案例标题:"+entity.getTitle();
|
||||
desc="修改案例,案例类型:"+type+",案例ID:"+entity.getId()+",案例标题:"+entity.getTitle();
|
||||
}else{
|
||||
User loginUser = getLoginUser();
|
||||
User user = userService.selectByUsername(loginUser.getUsername());
|
||||
@ -301,7 +309,7 @@ public class ContentController extends BaseController {
|
||||
contentTags.setTid(Long.parseLong(s));
|
||||
service.addContentTags(contentTags);
|
||||
}
|
||||
desc="添加案例,案例类型:"+ContentType.getNameByCode(type)+",案例ID:"+entity.getId()+",案例标题:"+entity.getTitle();
|
||||
desc="添加案例,案例类型:"+type+",案例ID:"+entity.getId()+",案例标题:"+entity.getTitle();
|
||||
}
|
||||
User user = getLoginUser();
|
||||
sysLogService.add(new SysLog(SysLogType.cases.key(), user.getUserId()+"("+user.getUsername()+")", getIpAddr(), desc));
|
||||
@ -314,6 +322,16 @@ public class ContentController extends BaseController {
|
||||
@ResponseBody
|
||||
public Result delete(String ids) {
|
||||
List<Long> IdList = CommonUtils.toLongList(ids);
|
||||
for (Long aLong : IdList) {
|
||||
//案例是否发布
|
||||
Content editContent = service.getEditContent(aLong);
|
||||
if(editContent.getRelease() != 5 && editContent.getRelease() !=3){
|
||||
throw new ParameterException("案例已上线或审核中,无法删除!");
|
||||
}
|
||||
if(editContent.getRelease() == 3){
|
||||
|
||||
}
|
||||
}
|
||||
service.delete(IdList);
|
||||
//取消案例关联标签的关系
|
||||
service.deleteContentTags(IdList);
|
||||
@ -332,19 +350,8 @@ public class ContentController extends BaseController {
|
||||
public Result syncEsData(Content entity, @RequestParam(defaultValue="false")Boolean isReBuild) {
|
||||
long total = service.syncEsData(entity, isReBuild);
|
||||
User user = getLoginUser();
|
||||
String type = "";
|
||||
if(entity.getTagLists().length != 0){
|
||||
for (String tagList : entity.getTagLists()) {
|
||||
if(tagList.equals("106") || tagList.equals("107")
|
||||
|| tagList.equals("108") || tagList.equals("109")
|
||||
|| tagList.equals("110") || tagList.equals("111")
|
||||
|| tagList.equals("112")){
|
||||
type = ContentType.getNameByCode(tagList);
|
||||
}
|
||||
}
|
||||
}
|
||||
sysLogService.add(new SysLog(SysLogType.cases.key(), user.getUserId()+"("+user.getUsername()+")", getIpAddr(),
|
||||
"同步案例到ElasticSearch,案例类型:"+ContentType.getNameByCode(type)+",是否重建:"+isReBuild+",受影响的记录数:"+total));
|
||||
"同步案例到ElasticSearch,是否重建:"+isReBuild+",受影响的记录数:"+total));
|
||||
return Result.success(total);
|
||||
}
|
||||
|
||||
|
||||
@ -209,7 +209,9 @@ public interface ContentMapper extends MyMapper<Content> {
|
||||
* 更新案例状态
|
||||
* @param contentId
|
||||
*/
|
||||
void updateContentRelease(Long contentId,Integer release);
|
||||
void updateContentRelease(@Param("contentId") Long contentId,
|
||||
@Param("release") Integer release,
|
||||
@Param("visibility") Integer visibility);
|
||||
|
||||
/**
|
||||
* 根据案例id查询申请单信息
|
||||
|
||||
@ -128,6 +128,11 @@ public class Content implements Serializable {
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 上线时间
|
||||
*/
|
||||
private Date onlineTime;
|
||||
|
||||
/**
|
||||
* 可见性
|
||||
*/
|
||||
@ -196,4 +201,7 @@ public class Content implements Serializable {
|
||||
//查询标签个数 控制前端案例列表的查看操作
|
||||
private Integer count;
|
||||
|
||||
//用户角色Id
|
||||
private String roleId;
|
||||
|
||||
}
|
||||
|
||||
@ -303,9 +303,9 @@ public class ContentServiceImpl implements ContentService {
|
||||
|
||||
@Override
|
||||
public long syncEsData(Content entity, boolean isReBuild) {
|
||||
if(StringUtils.isBlank(entity.getType())) {
|
||||
/*if(StringUtils.isBlank(entity.getType())) {
|
||||
throw new ParameterException("案例类型不能为空");
|
||||
}
|
||||
}*/
|
||||
if(isReBuild) {
|
||||
// 如果重建索引,则先把所有记录删除,这个也可用于删除脏数据。
|
||||
esService.deleteDocByQuery(entity);
|
||||
@ -388,7 +388,7 @@ public class ContentServiceImpl implements ContentService {
|
||||
mapper.saveCheck(check);
|
||||
}
|
||||
//更新案例状态(审核可能是下架重新申请的)
|
||||
mapper.updateContentRelease(application.getContentId(),1);
|
||||
mapper.updateContentRelease(application.getContentId(),1,2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -434,7 +434,7 @@ public class ContentServiceImpl implements ContentService {
|
||||
//查询案例id
|
||||
Long contentId = mapper.getContentId(check.getApplicationId());
|
||||
//更新案例状态
|
||||
mapper.updateContentRelease(contentId,2);
|
||||
mapper.updateContentRelease(contentId,2,1);
|
||||
}else {
|
||||
//审核驳回
|
||||
application.setStatus(3);
|
||||
@ -463,7 +463,7 @@ public class ContentServiceImpl implements ContentService {
|
||||
//删除审核表信息
|
||||
mapper.deleteCheck(application.getId());
|
||||
//案例表状态修改为已下线
|
||||
mapper.updateContentRelease(contentId,4);
|
||||
mapper.updateContentRelease(contentId,4,2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ import org.elasticsearch.client.indices.CreateIndexResponse;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.reindex.BulkByScrollResponse;
|
||||
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
||||
@ -165,13 +166,14 @@ public class ElasticSearchServiceImpl implements ElasticSearchService {
|
||||
// termQuery:不会对搜索词进行分词处理,而是作为一个整体与目标字段进行匹配,若完全匹配,则可查询到。
|
||||
@Override
|
||||
public void deleteDocByQuery(Content entity) {
|
||||
if(entity.getType()!=null) {
|
||||
/*if(entity.getType()!=null) {
|
||||
throw new ParameterException("案例类型不能为空");
|
||||
}
|
||||
}*/
|
||||
try {
|
||||
DeleteByQueryRequest request = new DeleteByQueryRequest(es_index_content);
|
||||
request.setConflicts("proceed"); // 发生冲突即略过
|
||||
request.setQuery(QueryBuilders.termQuery("type", entity.getType()));
|
||||
//request.setQuery(QueryBuilders.termQuery("type", entity.getType()));
|
||||
request.setQuery(QueryBuilders.matchAllQuery());
|
||||
BulkByScrollResponse bulkResponse = restHighLevelClient.deleteByQuery(request, RequestOptions.DEFAULT);
|
||||
|
||||
TimeValue timeTaken = bulkResponse.getTook();
|
||||
|
||||
@ -98,4 +98,9 @@ public interface UserService {
|
||||
*/
|
||||
public void updateQyWxUser(User user);
|
||||
|
||||
/**
|
||||
* 查询用户的职位信息
|
||||
* @return
|
||||
*/
|
||||
String getUserRole(String userId);
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ import com.nbclass.system.service.UserService;
|
||||
import com.nbclass.util.ResultUtil;
|
||||
import com.nbclass.vo.UserOnlineVo;
|
||||
import com.nbclass.vo.base.ResponseVo;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
/**
|
||||
* @version V1.0
|
||||
@ -227,5 +228,12 @@ public class UserServiceImpl implements UserService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRole(String userId) {
|
||||
Example example = new Example(UserRole.class);
|
||||
example.createCriteria().andEqualTo("userId",userId);
|
||||
return userRoleMapper.selectOneByExample(example).getRoleId();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
<result column="content_text" property="content_text"/>
|
||||
<result column="attachment" property="attachment"/>
|
||||
<result column="label_feedback" property="labelFeedback"/>
|
||||
<result column="online_time" property="onlineTime"/>
|
||||
<result column="visibility" property="visibility"/>
|
||||
<result column="comments" property="comments"/>
|
||||
<result column="name" property="userName"/>
|
||||
@ -108,7 +109,7 @@
|
||||
INNER JOIN data_dict_item item ON tags.tid = item.id
|
||||
INNER JOIN data_dict dict ON dict.id = item.dictid
|
||||
<where>
|
||||
<if test="userId!=null">
|
||||
<if test="userId!=null and roleId == 3">
|
||||
c.user_id = #{userId}
|
||||
</if>
|
||||
<if test="id!=null">
|
||||
@ -349,8 +350,7 @@
|
||||
u.user_id as name,
|
||||
u2.position,
|
||||
IF(a.status=2,c.`release`,IFNULL(a.status,5)) as status,
|
||||
IFNULL(a.id,null) as applicationId,
|
||||
IFNULL(ck.`status`,null) as checkStatus
|
||||
IFNULL(a.id,null) as applicationId
|
||||
FROM
|
||||
content c
|
||||
LEFT JOIN application a on c.id = a.content_id
|
||||
@ -413,8 +413,8 @@
|
||||
|
||||
<update id="updateContentRelease">
|
||||
update content set
|
||||
<if test="contentId!=null and release!=null">
|
||||
`release` = #{release}
|
||||
<if test="contentId!=null and release!=null and visibility!=null">
|
||||
`release` = #{release},visibility = #{visibility},online_time = now()
|
||||
</if>
|
||||
where id = #{contentId}
|
||||
</update>
|
||||
|
||||
@ -142,7 +142,7 @@
|
||||
|
||||
}},
|
||||
{field: 'visibility', title: '可见性', align : "center", width: "60", formatter:function(value,row, index){
|
||||
return row.visibility === '1' ? "可见" : "不可见";
|
||||
return row.visibility === 1 ? "可见" : "不可见";
|
||||
}},
|
||||
{field: 'labelFeedback', title: '索引标签反馈次数', align : "center", width: "50"},
|
||||
{field: 'purposeCase', title: '案例用途', align : "center", width: "60", formatter:function(value,row, index){
|
||||
@ -199,7 +199,7 @@
|
||||
{field: 'comments', title: '评论数', align : "center", width: "50"},
|
||||
{field: 'createtime', title: '创建时间', align : "center", width: "50"},
|
||||
{field: 'updatetime', title: '修改时间', align : "center", width: "50"},
|
||||
{field: '', title: '上线时间', align : "center", width: "50"},
|
||||
{field: 'onlineTime', title: '上线时间', align : "center", width: "50"},
|
||||
{field: 'position', title: '关联部门', align : "center", width: "50"},
|
||||
{field: 'userName', title: '创建者', align : "center", width: "50"},
|
||||
/* {field: 'title', title: '标题', align : "left", width: "25%", formatter: function(value, row, index) {
|
||||
@ -221,16 +221,16 @@
|
||||
let rejectHtml = "";
|
||||
let seeHtml = "";
|
||||
let editHtml = "";
|
||||
if(row.checkStatus === 1){
|
||||
if(row.status === 1){
|
||||
adoptHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="operationApplication('+row.applicationId+',2)">发布</a>';
|
||||
rejectHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="operationApplication('+row.applicationId+',3)">驳回</a>';
|
||||
seeHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="seeApplication('+row.id+',1)">查看</a>';
|
||||
editHtml = ' <a class="table-btn table-btn-info" href="javascript:void(0)" onclick="editPage('+row.id+')">修改</a>';
|
||||
}else if(row.checkStatus === 2){
|
||||
}else if(row.status === 2){
|
||||
adoptHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="offlineApplication('+row.id+')">下线</a>';
|
||||
seeHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="seeApplication('+row.id+',1)">查看</a>';
|
||||
editHtml = ' <a class="table-btn table-btn-info" href="javascript:void(0)" onclick="editPage('+row.id+')">修改</a>';
|
||||
}else if(row.checkStatus === 3){
|
||||
}else if(row.status === 3){
|
||||
seeHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="seeApplication('+row.id+',1)">查看</a>';
|
||||
}
|
||||
return adoptHtml+rejectHtml+editHtml+seeHtml;
|
||||
@ -388,6 +388,10 @@
|
||||
$("#tags").append("<option value='"+item.tid+"'>"+item.tagName+"</option>\n");
|
||||
}
|
||||
});
|
||||
//使用refresh方法更新UI以匹配新状态
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
//render方法强制重新渲染引导程序
|
||||
$('.selectpicker').selectpicker('render');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
46
src/main/resources/templates/content/census.html
Normal file
46
src/main/resources/templates/content/census.html
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
|
||||
<div id="main" style="width: 600px;height:400px;"></div>
|
||||
<script type="text/javascript">
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var myChart = echarts.init(document.getElementById('main'));
|
||||
|
||||
// 指定图表的配置项和数据
|
||||
var option = {
|
||||
title: {
|
||||
text: '本周案例上传'
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data:['数量']
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [120, 200, 150, 80, 70, 110, 130],
|
||||
type: 'bar',
|
||||
showBackground: true,
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
myChart.setOption(option);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -192,11 +192,12 @@ var caseType = [[${caseType}]];
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
//使用refresh方法更新UI以匹配新状态
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
//render方法强制重新渲染引导程序
|
||||
$('.selectpicker').selectpicker('render');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -344,7 +345,6 @@ var caseType = [[${caseType}]];
|
||||
|
||||
function initLoad(){
|
||||
|
||||
|
||||
// 加载附件内容
|
||||
if($('#dataid').val() > 0){
|
||||
var attachment = '[[${attachment}]]';
|
||||
@ -434,11 +434,12 @@ var caseType = [[${caseType}]];
|
||||
|
||||
$(function () {
|
||||
|
||||
getDropDownBox();
|
||||
|
||||
if($("#result").val() > 0){
|
||||
$("#btn_save").hide();
|
||||
}
|
||||
|
||||
getDropDownBox();
|
||||
initLoad();
|
||||
|
||||
$('#tagNames').tagsInput({
|
||||
|
||||
@ -161,7 +161,7 @@
|
||||
|
||||
}},
|
||||
{field: 'visibility', title: '可见性', align : "center", width: "60", formatter:function(value,row, index){
|
||||
return row.visibility === '1' ? "可见" : "不可见";
|
||||
return row.visibility === 1 ? "可见" : "不可见";
|
||||
}},
|
||||
{field: 'labelFeedback', title: '索引标签反馈次数', align : "center", width: "50"},
|
||||
{field: 'purposeCase', title: '案例用途', align : "center", width: "60", formatter:function(value,row, index){
|
||||
@ -216,7 +216,7 @@
|
||||
{field: 'comments', title: '评论数', align : "center", width: "50"},
|
||||
{field: 'createtime', title: '创建时间', align : "center", width: "50"},
|
||||
{field: 'updatetime', title: '修改时间', align : "center", width: "50"},
|
||||
{field: '', title: '上线时间', align : "center", width: "50"},
|
||||
{field: 'onlineTime', title: '上线时间', align : "center", width: "50"},
|
||||
{field: 'position', title: '关联部门', align : "center", width: "50"},
|
||||
{field: 'userName', title: '创建者', align : "center", width: "450"},
|
||||
/* {field: 'title', title: '标题', align : "left", width: "25%", formatter: function(value, row, index) {
|
||||
@ -247,6 +247,7 @@
|
||||
}else {
|
||||
//这里的1标记为查看状态
|
||||
seeHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="seeApplication('+row.id+',1)">查看</a>';
|
||||
delHtml = ' <a class="table-btn table-btn-danger" href="javascript:void(0)" onclick="deleteAction('+row.id+',1)">删除</a>';
|
||||
}
|
||||
}else if(row.status === 1){
|
||||
if($("#name").val() !== 'admin'){
|
||||
@ -254,21 +255,24 @@
|
||||
}
|
||||
//这里的1标记为查看状态
|
||||
seeHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="seeApplication('+row.id+',1)">查看</a>';
|
||||
delHtml = ' <a class="table-btn table-btn-danger" href="javascript:void(0)" onclick="deleteAction('+row.id+',1)">删除</a>';
|
||||
}else if(row.status === 2 || row.status === 3){
|
||||
if($("#name").val() !== 'admin'){
|
||||
submitHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="updateApplication('+row.id+','+row.applicationId+')">更新</a>';
|
||||
}
|
||||
seeHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="seeApplication('+row.id+',1)">查看</a>';
|
||||
delHtml = ' <a class="table-btn table-btn-danger" href="javascript:void(0)" onclick="deleteAction('+row.id+',1)">删除</a>';
|
||||
}
|
||||
if(row.status === 2){
|
||||
if($("#name").val() !== 'admin'){
|
||||
offlineHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="offlineApplication('+row.id+')">下线</a>';
|
||||
}
|
||||
seeHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="seeApplication('+row.id+',1)">查看</a>';
|
||||
}
|
||||
if(row.status === 3){
|
||||
delHtml = ' <a class="table-btn table-btn-danger" href="javascript:void(0)" onclick="deleteAction('+row.id+',1)">删除</a>';
|
||||
}
|
||||
/*if(row.status === 3){
|
||||
delHtml = ' <a class="table-btn table-btn-danger" href="javascript:void(0)" onclick="deleteAction('+row.id+',1)">删除</a>';
|
||||
}*/
|
||||
|
||||
return offlineHtml+submitHtml+editHtml + delHtml + seeHtml;
|
||||
}}
|
||||
@ -419,6 +423,10 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
//使用refresh方法更新UI以匹配新状态
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
//render方法强制重新渲染引导程序
|
||||
$('.selectpicker').selectpicker('render');
|
||||
}
|
||||
|
||||
//提交审核
|
||||
|
||||
@ -40,7 +40,8 @@
|
||||
<!-- tagsinput引用JS -->
|
||||
<script charset="utf-8" type="text/javascript" th:src="@{https://s0.pstatp.com/cdn/expire-1-M/jqueryui/1.12.1/jquery-ui.min.js}"></script>
|
||||
<script charset="utf-8" type="text/javascript" th:src="@{https://s0.pstatp.com/cdn/expire-1-M/jquery-tagsinput/1.3.6/jquery.tagsinput.min.js}"></script>
|
||||
|
||||
<!-- 引入 echarts.js -->
|
||||
<script th:src="@{https://cdn.jsdelivr.net/npm/echarts@5.2.2/dist/echarts.min.js}"></script>
|
||||
<script th:src="@{/js/core.js}"></script>
|
||||
</head>
|
||||
<body class="hold-transition skin-blue-light sidebar-mini fixed" onhashchange="loadContent()">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user