|
@@ -7,20 +7,16 @@ import com.ruoyi.system.api.domain.SysUser;
|
|
|
import com.ruoyi.system.domain.JiGuangVo;
|
|
|
import com.ruoyi.system.domain.SysNotice;
|
|
|
import com.ruoyi.system.domain.SysNoticeDept;
|
|
|
-import com.ruoyi.system.domain.SysUserDept;
|
|
|
import com.ruoyi.system.mapper.SysNoticeMapper;
|
|
|
import com.ruoyi.system.remoteapi.service.center.message.RemoteMessageBaseService;
|
|
|
import com.ruoyi.system.service.ISysNoticeService;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
-import java.util.Timer;
|
|
|
|
|
|
/**
|
|
|
* 公告 服务层实现
|
|
@@ -28,8 +24,7 @@ import java.util.Timer;
|
|
|
* @author ruoyi
|
|
|
*/
|
|
|
@Service
|
|
|
-public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
-{
|
|
|
+public class SysNoticeServiceImpl implements ISysNoticeService {
|
|
|
@Resource
|
|
|
private SysNoticeMapper noticeMapper;
|
|
|
|
|
@@ -47,8 +42,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
* @return 公告信息
|
|
|
*/
|
|
|
@Override
|
|
|
- public SysNotice selectNoticeById(Long noticeId)
|
|
|
- {
|
|
|
+ public SysNotice selectNoticeById(Long noticeId) {
|
|
|
return noticeMapper.selectNoticeById(noticeId);
|
|
|
}
|
|
|
|
|
@@ -59,15 +53,14 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
* @return 公告集合
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<SysNotice> selectNoticeList(SysNotice notice)
|
|
|
- {
|
|
|
+ public List<SysNotice> selectNoticeList(SysNotice notice) {
|
|
|
return noticeMapper.selectNoticeList(notice);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 按部门获取通知公告列表
|
|
|
*/
|
|
|
- public List<SysNotice> listNoticeByDeptId(SysNotice notice){
|
|
|
+ public List<SysNotice> listNoticeByDeptId(SysNotice notice) {
|
|
|
Integer size = notice.getPageSize();
|
|
|
Integer start = (notice.getPageNum() - 1) * size;
|
|
|
notice.setPageNum(start);
|
|
@@ -78,7 +71,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
* 获取最新一条通知公告
|
|
|
* limeng
|
|
|
*/
|
|
|
- public SysNotice getLatestNotice(SysNotice notice){
|
|
|
+ public SysNotice getLatestNotice(SysNotice notice) {
|
|
|
return noticeMapper.getLatestNotice(notice);
|
|
|
}
|
|
|
|
|
@@ -90,10 +83,9 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int insertNotice(SysNotice notice)
|
|
|
- {
|
|
|
+ public int insertNotice(SysNotice notice) {
|
|
|
//去掉文本中所有空格
|
|
|
- notice.setNoticeContent(notice.getNoticeContent().replace(" ",""));
|
|
|
+ notice.setNoticeContent(notice.getNoticeContent().replace(" ", ""));
|
|
|
notice.setRelease("2");
|
|
|
int rows = noticeMapper.insertNotice(notice);
|
|
|
insertNoticeDept(notice);
|
|
@@ -105,30 +97,26 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
*
|
|
|
* @param notice 通知公告对象
|
|
|
*/
|
|
|
- public void insertNoticeDept(SysNotice notice)
|
|
|
- {
|
|
|
+ public void insertNoticeDept(SysNotice notice) {
|
|
|
Long[] deptIds = notice.getDeptIds();
|
|
|
- if (StringUtils.isNotNull(deptIds))
|
|
|
- {
|
|
|
+ if (StringUtils.isNotNull(deptIds)) {
|
|
|
// 新增用户与部门
|
|
|
List<SysNoticeDept> list = new ArrayList<>();
|
|
|
- for (Long deptId : deptIds)
|
|
|
- {
|
|
|
+ for (Long deptId : deptIds) {
|
|
|
SysNoticeDept nd = new SysNoticeDept();
|
|
|
nd.setId(UuidUtils.generateUuid());
|
|
|
nd.setNoticeId(notice.getNoticeId());
|
|
|
nd.setDeptId(deptId);
|
|
|
list.add(nd);
|
|
|
}
|
|
|
- if (list.size() > 0)
|
|
|
- {
|
|
|
+ if (list.size() > 0) {
|
|
|
noticeMapper.batchNoticeDept(list);
|
|
|
}
|
|
|
//推送
|
|
|
SysUser sysUser = new SysUser();
|
|
|
sysUser.setDeptIds(deptIds);
|
|
|
List<SysUser> sysUsers = userService.selectDeptAndUsersByIsPushmsg(sysUser);
|
|
|
- for (SysUser user:sysUsers) {
|
|
|
+ for (SysUser user : sysUsers) {
|
|
|
JiGuangVo jiGuangVo = new JiGuangVo();
|
|
|
jiGuangVo.setTaskId(notice.getNoticeId().toString());
|
|
|
jiGuangVo.setUserId(user.getUserId());
|
|
@@ -147,13 +135,14 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int updateNotice(SysNotice notice)
|
|
|
- {
|
|
|
+ public int updateNotice(SysNotice notice) {
|
|
|
noticeMapper.delNoticeDeptById(notice.getNoticeId());
|
|
|
insertNoticeDept(notice);
|
|
|
//去掉文本中所有空格
|
|
|
- notice.setNoticeContent(notice.getNoticeContent().replace(" ",""));
|
|
|
- notice.setNoticeFile(notice.getNoticeFile().replaceAll("10.6.52.32:8081","218.27.3.115:9301"));
|
|
|
+ notice.setNoticeContent(notice.getNoticeContent().replace(" ", ""));
|
|
|
+ if (StringUtils.isNotEmpty(notice.getNoticeFile())) {
|
|
|
+ notice.setNoticeFile(notice.getNoticeFile().replaceAll("10.6.52.32:8081", "218.27.3.115:9301"));
|
|
|
+ }
|
|
|
return noticeMapper.updateNotice(notice);
|
|
|
}
|
|
|
|
|
@@ -165,8 +154,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int deleteNoticeById(Long noticeId)
|
|
|
- {
|
|
|
+ public int deleteNoticeById(Long noticeId) {
|
|
|
noticeMapper.delNoticeDeptById(noticeId);
|
|
|
return noticeMapper.deleteNoticeById(noticeId);
|
|
|
}
|
|
@@ -179,9 +167,8 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int deleteNoticeByIds(Long[] noticeIds)
|
|
|
- {
|
|
|
- for (Long noticeId : noticeIds){
|
|
|
+ public int deleteNoticeByIds(Long[] noticeIds) {
|
|
|
+ for (Long noticeId : noticeIds) {
|
|
|
noticeMapper.delNoticeDeptById(noticeId);
|
|
|
}
|
|
|
return noticeMapper.deleteNoticeByIds(noticeIds);
|
|
@@ -189,6 +176,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
|
|
|
/**
|
|
|
* 根据部门id查公告
|
|
|
+ *
|
|
|
* @return 结果
|
|
|
*/
|
|
|
public List<SysNotice> listNotice(List<SysDept> depts) {
|
|
@@ -197,7 +185,8 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
|
|
|
/**
|
|
|
* 根据公告id查详情
|
|
|
- * @param noticeId 需要传入的公告id
|
|
|
+ *
|
|
|
+ * @param noticeId 需要传入的公告id
|
|
|
* @return 结果
|
|
|
*/
|
|
|
public SysNotice details(Integer noticeId) {
|