yanyan 1 year ago
parent
commit
4a6020e732
  1. 1
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/dept/service/DeptServiceImpl.java
  2. 29
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/notice/controller/NoticeController.java
  3. 90
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/notice/service/NoticeServiceImpl.java
  4. 20
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/notice/add.html
  5. 14
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/notice/edit.html
  6. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/role/dataScope.html
  7. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/role/roleNew.html

1
lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/dept/service/DeptServiceImpl.java

@ -175,6 +175,7 @@ public class DeptServiceImpl implements IDeptService
ztrees = ztrees.stream()
.peek(i -> i.setpId(Objects.equals(i.getZone(), 1) ||
Objects.equals(i.getZone(), 2) ? String.valueOf(i.getZone()) : i.getpId()))
.peek(i -> i.setpId(Objects.equals(i.getZone(), 15) ? "1" : i.getpId()))
.collect(Collectors.toList());

29
lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/notice/controller/NoticeController.java

@ -3,17 +3,22 @@ package com.zdxt.auth.project.system.notice.controller;
import java.text.DateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import com.zdxt.auth.common.utils.StringUtils;
import com.zdxt.auth.common.utils.text.Convert;
import com.zdxt.auth.framework.web.controller.BaseController;
import com.zdxt.auth.framework.web.domain.AjaxResult;
import com.zdxt.auth.framework.web.page.TableDataInfo;
import com.zdxt.auth.project.system.dept.service.IDeptService;
import com.zdxt.auth.project.system.notice.domain.Notice;
import com.zdxt.auth.project.system.notice.service.INoticeService;
import com.zdxt.common.ZDResponse;
import com.zdxt.domain.auth.Dept;
import com.zdxt.log.aspectj.lang.annotation.Log;
import com.zdxt.log.aspectj.lang.enums.BusinessType;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -35,6 +40,9 @@ public class NoticeController extends BaseController
@Autowired
private INoticeService noticeService;
@Autowired
private IDeptService deptService;
@RequiresPermissions("system:notice:view")
@GetMapping()
public String notice()
@ -59,8 +67,11 @@ public class NoticeController extends BaseController
* 新增公告
*/
@GetMapping("/add")
public String add()
public String add(ModelMap mmap)
{
Dept dept = new Dept();
dept.setZoneList(Arrays.asList(1,2,3,4));
mmap.put("posts", deptService.selectDeptList(dept));
return prefix + "/add";
}
@ -106,7 +117,17 @@ public class NoticeController extends BaseController
@GetMapping("/edit/{noticeId}")
public String edit(@PathVariable("noticeId") String noticeId, ModelMap mmap)
{
mmap.put("notice", noticeService.selectNoticeById(noticeId));
Notice notice = noticeService.selectNoticeById(noticeId);
Dept dept = new Dept();
dept.setZoneList(Arrays.asList(1,2,3,4));
List<Dept> depts = deptService.selectDeptList(dept);
if (StringUtils.isNotEmpty(notice.getBureauDeptIds()) && CollectionUtils.isNotEmpty(depts)) {
List<String> strings = Arrays.asList(notice.getBureauDeptIds().split(","));
depts = depts.stream()
.peek(i -> i.setRemark(strings.contains(i.getDeptId()) ? "0" : "1")).collect(Collectors.toList());
}
mmap.put("posts", depts);
mmap.put("notice", notice);
return prefix + "/edit";
}

90
lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/notice/service/NoticeServiceImpl.java

@ -2,16 +2,22 @@ package com.zdxt.auth.project.system.notice.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.zdxt.auth.common.utils.StringUtils;
import com.zdxt.auth.dto.ZdxtFileBean;
import com.zdxt.auth.feign.FileUploadApi;
import com.zdxt.auth.feign.ZdxtFileCommonApi;
import com.zdxt.auth.project.system.dept.mapper.DeptMapper;
import com.zdxt.auth.project.system.dept.service.IDeptService;
import com.zdxt.common.annotation.DataScope;
import com.zdxt.common.zdxtFile.AttFileRespDTO;
import com.zdxt.common.zdxtFile.FilePreviewUtilBean;
import com.zdxt.common.zdxtFile.ZdxtFileCommon;
import com.zdxt.domain.auth.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zdxt.auth.common.utils.security.ShiroUtils;
@ -22,7 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
/**
* 公告 服务层实现
*
*
* @author ruoyi
* @date 2018-06-25
*/
@ -32,6 +38,9 @@ public class NoticeServiceImpl implements INoticeService
@Autowired
private NoticeMapper noticeMapper;
@Autowired
private DeptMapper deptMapper;
@Autowired
private ZdxtFileCommonApi zdxtFileCommonApi;
@ -40,7 +49,7 @@ public class NoticeServiceImpl implements INoticeService
/**
* 查询公告信息
*
*
* @param noticeId 公告ID
* @return 公告信息
*/
@ -64,7 +73,7 @@ public class NoticeServiceImpl implements INoticeService
/**
* 查询公告列表
*
*
* @param notice 公告信息
* @return 公告集合
*/
@ -75,6 +84,7 @@ public class NoticeServiceImpl implements INoticeService
}
@Override
@DataScope
public List<Notice> selectNoticeListNoPermission(Notice notice) {
List<Notice> list =
noticeMapper.selectNoticeList(notice);
@ -92,7 +102,7 @@ public class NoticeServiceImpl implements INoticeService
/**
* 新增公告
*
*
* @param notice 公告信息
* @return 结果
*/
@ -101,6 +111,23 @@ public class NoticeServiceImpl implements INoticeService
{
notice.setNoticeId(IdUtil.fastSimpleUUID());
notice.setCreateBy(ShiroUtils.getLoginName());
//通过部门id获取部门名称
if (StringUtils.isNotEmpty(notice.getBureauDeptIds())) {
StringBuilder deptNames = null;
String[] strings = Convert.toStrArray(notice.getBureauDeptIds());
for (String string : strings) {
Dept dept = deptMapper.selectDeptById(string);
if (Objects.nonNull(dept)) {
if (deptNames == null) {
deptNames = new StringBuilder("");
deptNames.append(dept.getDeptName());
} else {
deptNames.append(",").append(dept.getDeptName());
}
}
}
notice.setBureauDeptNames(deptNames.toString());
}
return noticeMapper.insertNotice(notice);
}
@ -109,6 +136,23 @@ public class NoticeServiceImpl implements INoticeService
String busId = IdUtil.fastSimpleUUID();
notice.setNoticeId(busId);
notice.setCreateBy(ShiroUtils.getLoginName());
//通过部门id获取部门名称
if (StringUtils.isNotEmpty(notice.getBureauDeptIds())) {
StringBuilder deptNames = null;
String[] strings = Convert.toStrArray(notice.getBureauDeptIds());
for (String string : strings) {
Dept dept = deptMapper.selectDeptById(string);
if (Objects.nonNull(dept)) {
if (deptNames == null) {
deptNames = new StringBuilder("");
deptNames.append(dept.getDeptName());
} else {
deptNames.append(",").append(dept.getDeptName());
}
}
}
notice.setBureauDeptNames(deptNames.toString());
}
// 上传文件,并在附件表中添加记录
if (ObjectUtil.isNotEmpty(files)) {
for (MultipartFile file : files) {
@ -122,7 +166,7 @@ public class NoticeServiceImpl implements INoticeService
/**
* 修改公告
*
*
* @param notice 公告信息
* @return 结果
*/
@ -130,6 +174,23 @@ public class NoticeServiceImpl implements INoticeService
public int updateNotice(Notice notice)
{
notice.setUpdateBy(ShiroUtils.getLoginName());
//通过部门id获取部门名称
if (StringUtils.isNotEmpty(notice.getBureauDeptIds())) {
StringBuilder deptNames = null;
String[] strings = Convert.toStrArray(notice.getBureauDeptIds());
for (String string : strings) {
Dept dept = deptMapper.selectDeptById(string);
if (Objects.nonNull(dept)) {
if (deptNames == null) {
deptNames = new StringBuilder("");
deptNames.append(dept.getDeptName());
} else {
deptNames.append(",").append(dept.getDeptName());
}
}
}
notice.setBureauDeptNames(deptNames.toString());
}
return noticeMapper.updateNotice(notice);
}
@ -143,13 +204,30 @@ public class NoticeServiceImpl implements INoticeService
}
}
}
//通过部门id获取部门名称
if (StringUtils.isNotEmpty(notice.getBureauDeptIds())) {
StringBuilder deptNames = null;
String[] strings = Convert.toStrArray(notice.getBureauDeptIds());
for (String string : strings) {
Dept dept = deptMapper.selectDeptById(string);
if (Objects.nonNull(dept)) {
if (deptNames == null) {
deptNames = new StringBuilder("");
deptNames.append(dept.getDeptName());
} else {
deptNames.append(",").append(dept.getDeptName());
}
}
}
notice.setBureauDeptNames(deptNames.toString());
}
notice.setUpdateBy(ShiroUtils.getLoginName());
return noticeMapper.updateNotice(notice);
}
/**
* 删除公告对象
*
*
* @param ids 需要删除的数据ID
* @return 结果
*/

20
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/notice/add.html

@ -4,6 +4,7 @@
<th:block th:include="include :: header('新增通知公告')" />
<th:block th:include="include :: summernote-css" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -16,8 +17,13 @@
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">发布部门:</label>
<!-- <div class="col-sm-10">-->
<!-- <input id="bureauDeptNames" name="bureauDeptNames" class="form-control" type="text">-->
<!-- </div>-->
<div class="col-sm-10">
<input id="bureauDeptNames" name="bureauDeptNames" class="form-control" type="text">
<select id="bureauDeptIds" name="bureauDeptIds" class="form-control select2-multiple" multiple>
<option th:each="post:${posts}" th:value="${post.deptId}" th:text="${post.deptName}" th:disabled="${post.status == '2'}"></option>
</select>
</div>
<label class="col-sm-2 control-label"></label>
<div class="col-sm-10">注:多部门请用,分隔</div>
@ -57,10 +63,15 @@
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<th:block th:include="include :: summernote-js" />
<th:block th:include="include :: select2-js" />
<script type="text/javascript">
var prefix = ctx + "system/notice";
$(function (){
$('#bureauDeptIds').select2({
placeholder: "请选择发布部门",
allowClear: true
});
uploadFiles();
})
@ -110,9 +121,13 @@
if($("#fileinput").fileinput('getFilesCount') > 0){
$('#fileinput').fileinput('upload');
}else{
// var data = $("#form-notice-add").serializeArray();
// data.push({"name": "bureauDeptNames", "value": $.form.selectSelects("bureauDeptNames")});
// data.push({"name": "noticeContent", "value": $('.summernote').summernote('code')});
var sHTML = $('.summernote').summernote('code');
$("#noticeContent").val(sHTML);
$.operate.save(prefix + "/add", $('#form-notice-add').serialize());
$.operate.save(prefix + "/add", $("#form-notice-add").serialize());
}
}
}
@ -162,6 +177,7 @@
// var value = str.replaceAll("+", " ");
// data["noticeContent"] = value;
// }
data.bureauDeptNames = $.form.selectSelects("bureauDeptNames");
data.content = $('#itemContentSummernote').summernote('code');
return data;
},

14
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/notice/edit.html

@ -4,6 +4,7 @@
<th:block th:include="include :: header('修改通知公告')" />
<th:block th:include="include :: summernote-css" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -17,8 +18,13 @@
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">发布部门:</label>
<!-- <div class="col-sm-10">-->
<!-- <input id="bureauDeptNames" name="bureauDeptNames" th:field="*{bureauDeptNames}" class="form-control" type="text">-->
<!-- </div>-->
<div class="col-sm-10">
<input id="bureauDeptNames" name="bureauDeptNames" th:field="*{bureauDeptNames}" class="form-control" type="text">
<select id="bureauDeptIds" name="bureauDeptIds" class="form-control select2-multiple" multiple>
<option th:each="post:${posts}" th:value="${post.deptId}" th:text="${post.deptName}" th:selected="${post.remark == '0'}" th:disabled="${post.status == '2'}"></option>
</select>
</div>
<label class="col-sm-2 control-label"></label>
<div class="col-sm-10">注:多部门请用,分隔</div>
@ -58,10 +64,15 @@
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<th:block th:include="include :: summernote-js" />
<th:block th:include="include :: select2-js" />
<script type="text/javascript">
var prefix = ctx + "system/notice";
$(function (){
$('#bureauDeptIds').select2({
placeholder: "请选择发布部门",
allowClear: true
});
initFile();
})
@ -182,6 +193,7 @@
// var value = str.replaceAll("+", " ");
// data["noticeContent"] = value;
// }
data.bureauDeptNames = $.form.selectSelects("bureauDeptNames");
data.content = $('#editor').summernote('code');
return data;
},

2
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/role/dataScope.html

@ -48,7 +48,7 @@
// var url = ctx + "system/dept/treeData?roleId=" + $("#roleId").val()+"&zoneList="+list;
$(function() {
var list = [1,2,3,4];
var list = [1,2,3,4,15];
var url = ctx + "system/dept/roleDeptTreeData?roleId=" + $("#roleId").val()+"&zoneList="+list;;
var options = {
id: "deptTrees",

2
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/role/roleNew.html

@ -195,7 +195,7 @@
function queryDeptTree()
{
var list = [1,2,3,4];
var list = [1,2,3,4,15];
var url = ctx + "system/dept/treeData?zoneList="+list;
var options = {
url: url,

Loading…
Cancel
Save