功能修改

This commit is contained in:
ly19960718 2021-09-01 15:57:38 +08:00
parent 6635542207
commit 20df991bad
14 changed files with 212 additions and 12 deletions

View File

@ -115,6 +115,10 @@ public class DepartmentBaseController extends DefaultBaseController {
break;
}
}
return list;
}

View File

@ -22,6 +22,8 @@ public class DepartmentSynopsisDTO {
private String departmentSynopsisId;
@ApiModelProperty(name = "departmentSynopsisContent", value = "部门简介内容")
private String departmentSynopsisContent;
@ApiModelProperty(name = "departmentSynopsisPhoto", value = "部门宣传照片")
private String departmentSynopsisPhoto;
public String getDepartmentId() {
return departmentId;
@ -47,5 +49,11 @@ public class DepartmentSynopsisDTO {
this.departmentSynopsisContent = departmentSynopsisContent;
}
public String getDepartmentSynopsisPhoto() {
return departmentSynopsisPhoto;
}
public void setDepartmentSynopsisPhoto(String departmentSynopsisPhoto) {
this.departmentSynopsisPhoto = departmentSynopsisPhoto;
}
}

View File

@ -35,7 +35,7 @@ public class ArticleContentVO {
@ApiModelProperty(name = "articleContentIsPublish", value = "是否发布")
private String articleContentIsPublish;
@ApiModelProperty(name = "articleContentPublishTime", value = "发布时间")
@CheckEmptyAnnotation(name = "发布时间", verifyType = "datetime")
@CheckEmptyAnnotation(name = "发布时间", verifyType = "date")
private String articleContentPublishTime;
@ApiModelProperty(name = "articleContentOrderBy", value = "文章排序")
@CheckNumberAnnotation(name = "文章排序")

View File

@ -23,7 +23,8 @@ public class DepartmentSynopsisVO {
private String departmentSynopsisId;
@ApiModelProperty(name = "departmentSynopsisContent", value = "部门简介内容")
private String departmentSynopsisContent;
@ApiModelProperty(name = "departmentSynopsisPhoto", value = "部门宣传照片")
private String departmentSynopsisPhoto;
public String getDepartmentSynopsisId() {
return departmentSynopsisId;
@ -49,5 +50,11 @@ public class DepartmentSynopsisVO {
this.departmentSynopsisContent = departmentSynopsisContent;
}
public String getDepartmentSynopsisPhoto() {
return departmentSynopsisPhoto;
}
public void setDepartmentSynopsisPhoto(String departmentSynopsisPhoto) {
this.departmentSynopsisPhoto = departmentSynopsisPhoto;
}
}

View File

@ -1,6 +1,8 @@
package com.tenlion.twoduty.service.articletype.impl;
import com.tenlion.twoduty.service.articlecontent.IArticleContentService;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.ParamsException;
import ink.wgink.module.dictionary.pojo.dtos.DataDTO;
import ink.wgink.module.dictionary.service.IDataService;
import ink.wgink.pojo.ListPage;
@ -21,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @ClassName: ArticleTypeServiceImpl
@ -36,6 +39,8 @@ public class ArticleTypeServiceImpl extends DefaultBaseService implements IArtic
private IArticleTypeDao articleTypeDao;
@Autowired
private IDataService dataService;
@Autowired
private IArticleContentService articleContentService;
public List<DataDTO> getTypeClassIfDetails(String articleTypeId){
@ -84,6 +89,15 @@ public class ArticleTypeServiceImpl extends DefaultBaseService implements IArtic
@Override
public void remove(String token, List<String> ids) {
List<String> myList = ids.stream().distinct().collect(Collectors.toList());
Map<String,Object> countParams = getHashMap(1);
for (String s : myList) {
countParams.put("articleTypeId",s);
Integer count = articleContentService.count(countParams);
if(count > 0){
throw new ParamsException("文章目录有发布内容,请先删除内容");
}
}
Map<String, Object> params = getHashMap(2);
params.put("articleTypeIds", ids);
if (StringUtils.isBlank(token)) {

View File

@ -428,6 +428,10 @@
duty_article_content t1
WHERE
t1.is_delete = 0
<if test="articleTypeId != null and articleTypeId != ''">
AND
t1.article_type_id = #{articleTypeId}
</if>
</select>
</mapper>

View File

@ -6,6 +6,7 @@
<result column="department_id" property="departmentId"/>
<result column="department_synopsis_id" property="departmentSynopsisId"/>
<result column="department_synopsis_content" property="departmentSynopsisContent"/>
<result column="department_synopsis_photo" property="departmentSynopsisPhoto"/>
</resultMap>
<resultMap id="departmentSynopsisBO" type="com.tenlion.twoduty.pojo.bos.departmentsynopsis.DepartmentSynopsisBO">
@ -36,6 +37,7 @@
department_id,
department_synopsis_id,
department_synopsis_content,
department_synopsis_photo,
creator,
gmt_create,
modifier,
@ -45,6 +47,7 @@
#{departmentId},
#{departmentSynopsisId},
#{departmentSynopsisContent},
#{departmentSynopsisPhoto},
#{creator},
#{gmtCreate},
#{modifier},
@ -86,6 +89,9 @@
SET
<if test="departmentSynopsisContent != null and departmentSynopsisContent != ''">
department_synopsis_content = #{departmentSynopsisContent},
</if>
<if test="departmentSynopsisPhoto != null and departmentSynopsisPhoto != ''">
department_synopsis_photo = #{departmentSynopsisPhoto},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
@ -99,6 +105,7 @@
SELECT
t1.department_id,
t1.department_synopsis_content,
t1.department_synopsis_photo,
t1.department_synopsis_id
FROM
duty_department_synopsis t1
@ -161,7 +168,8 @@
SELECT
t1.department_id,
t1.department_synopsis_id,
t1.department_synopsis_content
t1.department_synopsis_content,
t1.department_synopsis_photo
FROM
duty_department_synopsis t1
WHERE

View File

@ -23,6 +23,40 @@
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<input type="hidden" name="departmentId" value="">
<input type="hidden" name="departmentSynopsisId" value="">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">宣传图片</label>
<div class="layui-input-block">
<input type="hidden" id="departmentSynopsisPhoto" name="departmentSynopsisPhoto">
<div class="layui-btn-container" id="departmentSynopsisPhotoFileBox" style="border: 1px solid #e6e6e6;"></div>
<script id="departmentSynopsisPhotoFileDownload" type="text/html">
{{# var fileName = 'departmentSynopsisPhoto'; }}
{{# if(d[fileName].length > 0) { }}
{{# var files = d[fileName];}}
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
<div class="upload-image-box">
<span class="upload-image-span">
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
</span>
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="departmentSynopsisPhotoRemoveFile">
<i class="fa fa-trash-o"></i>
</a>
</div>
{{# } }}
{{# } }}
{{# if(d[fileName].length < 1) { }}
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="宣传图片" data-name="departmentSynopsisPhoto" lay-filter="departmentSynopsisPhotoUploadFile">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">单位简介内容</label>
<div class="layui-input-block">
@ -118,6 +152,59 @@
}
}
// 初始化宣传图片上传
function initdepartmentSynopsisPhotoUploadFile() {
var files = $('#departmentSynopsisPhoto').val();
initFileList('departmentSynopsisPhoto', files, function(fileName) {
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
viewerObj[fileName] = viewer;
});
form.on('button(departmentSynopsisPhotoUploadFile)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
}
}
});
});
form.on('button(departmentSynopsisPhotoRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 1);
}
initFileList(name, files, function(fileName) {
viewerObj[fileName].update();
});
});
}
// 初始化承诺书富文本
function initDepartmentSynopsisContentText() {
var editor = UE.getEditor('departmentSynopsisContent', {autoHeightEnabled: false});
@ -136,9 +223,10 @@
for(var i in data) {
dataFormData[i] = data[i] +'';
}
initDepartmentSynopsisContentText();
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initDepartmentSynopsisContentText();
initdepartmentSynopsisPhotoUploadFile();
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {

View File

@ -9,6 +9,13 @@
<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">
<style>
.search-item .layui-form-select .layui-input {
width: 141px;
}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
@ -26,6 +33,16 @@
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
</div>
<div class="layui-inline layui-form search-item" id="articleTypeIdTemplateBox" lay-filter="articleTypeIdTemplateBox"></div>
<script id="articleTypeIdTemplate" type="text/html">
<select name="articleTypeId" id="articleTypeId">
<option value="">请选择文章目录</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.articleTypeId}}" data-classify-id="{{item.articleTypeClassifyId}}">{{item.articleTypeName}}</option>
{{# } }}
</select>
</script>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
@ -57,11 +74,12 @@
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common','form'], function() {
}).use(['index', 'table', 'laydate', 'common','form','laytpl'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var common = layui.common;
var form = layui.form;
@ -183,7 +201,8 @@
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
endTime: $('#endTime').val(),
articleTypeId: $('#articleTypeId').val()
},
page: {
curr: currentPage
@ -291,6 +310,18 @@
}
});
initArticleTypeIdTemplate();
//初始化文章目录
function initArticleTypeIdTemplate(){
top.restAjax.get(top.restAjax.path("api/articletype/list",[]),{},null,function (code,data,args) {
laytpl(document.getElementById('articleTypeIdTemplate').innerHTML).render(data, function(html) {
document.getElementById('articleTypeIdTemplateBox').innerHTML = html;
});
form.render('select', 'articleTypeIdTemplateBox');
});
}
form.on('switch(isPublish)', function(data){
var checked = data.elem.checked
var contentId = data.value;

View File

@ -295,7 +295,7 @@
function initArticleContentPublishTimeDateTime() {
laydate.render({
elem: '#articleContentPublishTime',
type: 'datetime',
type: 'date',
value: '',
trigger: 'click'
});

View File

@ -9,6 +9,11 @@
<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">
<style>
.search-item .layui-form-select .layui-input {
width: 141px;
}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
@ -27,6 +32,15 @@
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
</div>
<div class="layui-inline search-item layui-form layui-hide" id="articleClassifyIdTemplateBox" lay-filter="articleClassifyIdTemplateBox"></div>
<script id="articleClassifyIdTemplate" type="text/html">
<select name="articleClassifyId" id="articleClassifyId">
<option value="">请选择文章分类</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dataId}}" >{{item.dataName}}</option>
{{# } }}
</select>
</script>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
@ -58,12 +72,13 @@
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common','form'], function() {
}).use(['index', 'table', 'laydate', 'common','form','laytpl'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var laytpl = layui.laytpl;
var common = layui.common;
var form = layui.form;
var resizeTimeout = null;
@ -187,7 +202,8 @@
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
endTime: $('#endTime').val(),
articleClassifyId:$("#articleClassifyId").val()
},
page: {
curr: currentPage
@ -295,6 +311,26 @@
}
}
});
initArticleTypeName();
function initArticleTypeName(){
top.restAjax.get(top.restAjax.path("api/articlecontent/getArticleType/{articleTypeId}",[$("#articleTypeId").val()]),{},null,function (code,data,args) {
if('show'== data.classIfIsShow){
$('#articleClassifyIdTemplateBox').removeClass("layui-hide")
initArticleClassifyIdTemplate(data.classIfId)
}
});
}
//初始化文章分类
function initArticleClassifyIdTemplate(dataParentId){
top.restAjax.get(top.restAjax.path("api/data/listallbyparentid/{dataParentId}",[dataParentId]),{},null,function (code,data,args) {
laytpl(document.getElementById('articleClassifyIdTemplate').innerHTML).render(data, function(html) {
document.getElementById('articleClassifyIdTemplateBox').innerHTML = html;
});
form.render('select', 'articleClassifyIdTemplateBox');
});
}
form.on('switch(isPublish)', function(data){

View File

@ -297,7 +297,7 @@
function initArticleContentPublishTimeDateTime() {
laydate.render({
elem: '#articleContentPublishTime',
type: 'datetime',
type: 'date',
value: '',
trigger: 'click'
});

View File

@ -295,7 +295,7 @@
function initArticleContentPublishTimeDateTime() {
laydate.render({
elem: '#articleContentPublishTime',
type: 'datetime',
type: 'date',
value: '',
trigger: 'click'
});

View File

@ -297,7 +297,7 @@
function initArticleContentPublishTimeDateTime() {
laydate.render({
elem: '#articleContentPublishTime',
type: 'datetime',
type: 'date',
value: '',
trigger: 'click'
});