|
|
@ -2,16 +2,22 @@ package com.zdxt.auth.project.system.notice.service; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.util.IdUtil; |
|
|
import cn.hutool.core.util.IdUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import com.zdxt.auth.common.utils.StringUtils; |
|
|
import com.zdxt.auth.dto.ZdxtFileBean; |
|
|
import com.zdxt.auth.dto.ZdxtFileBean; |
|
|
import com.zdxt.auth.feign.FileUploadApi; |
|
|
import com.zdxt.auth.feign.FileUploadApi; |
|
|
import com.zdxt.auth.feign.ZdxtFileCommonApi; |
|
|
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.AttFileRespDTO; |
|
|
import com.zdxt.common.zdxtFile.FilePreviewUtilBean; |
|
|
import com.zdxt.common.zdxtFile.FilePreviewUtilBean; |
|
|
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|
|
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|
|
|
|
|
import com.zdxt.domain.auth.Dept; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.zdxt.auth.common.utils.security.ShiroUtils; |
|
|
import com.zdxt.auth.common.utils.security.ShiroUtils; |
|
|
@ -32,6 +38,9 @@ public class NoticeServiceImpl implements INoticeService |
|
|
@Autowired |
|
|
@Autowired |
|
|
private NoticeMapper noticeMapper; |
|
|
private NoticeMapper noticeMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private DeptMapper deptMapper; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ZdxtFileCommonApi zdxtFileCommonApi; |
|
|
private ZdxtFileCommonApi zdxtFileCommonApi; |
|
|
|
|
|
|
|
|
@ -75,6 +84,7 @@ public class NoticeServiceImpl implements INoticeService |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@DataScope |
|
|
public List<Notice> selectNoticeListNoPermission(Notice notice) { |
|
|
public List<Notice> selectNoticeListNoPermission(Notice notice) { |
|
|
List<Notice> list = |
|
|
List<Notice> list = |
|
|
noticeMapper.selectNoticeList(notice); |
|
|
noticeMapper.selectNoticeList(notice); |
|
|
@ -101,6 +111,23 @@ public class NoticeServiceImpl implements INoticeService |
|
|
{ |
|
|
{ |
|
|
notice.setNoticeId(IdUtil.fastSimpleUUID()); |
|
|
notice.setNoticeId(IdUtil.fastSimpleUUID()); |
|
|
notice.setCreateBy(ShiroUtils.getLoginName()); |
|
|
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); |
|
|
return noticeMapper.insertNotice(notice); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -109,6 +136,23 @@ public class NoticeServiceImpl implements INoticeService |
|
|
String busId = IdUtil.fastSimpleUUID(); |
|
|
String busId = IdUtil.fastSimpleUUID(); |
|
|
notice.setNoticeId(busId); |
|
|
notice.setNoticeId(busId); |
|
|
notice.setCreateBy(ShiroUtils.getLoginName()); |
|
|
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)) { |
|
|
if (ObjectUtil.isNotEmpty(files)) { |
|
|
for (MultipartFile file : files) { |
|
|
for (MultipartFile file : files) { |
|
|
@ -130,6 +174,23 @@ public class NoticeServiceImpl implements INoticeService |
|
|
public int updateNotice(Notice notice) |
|
|
public int updateNotice(Notice notice) |
|
|
{ |
|
|
{ |
|
|
notice.setUpdateBy(ShiroUtils.getLoginName()); |
|
|
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); |
|
|
return noticeMapper.updateNotice(notice); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -143,6 +204,23 @@ 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()); |
|
|
notice.setUpdateBy(ShiroUtils.getLoginName()); |
|
|
return noticeMapper.updateNotice(notice); |
|
|
return noticeMapper.updateNotice(notice); |
|
|
} |
|
|
} |
|
|
|