|
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
|
import com.qmth.sop.business.bean.result.SysNoticeResult;
|
|
|
-import com.qmth.sop.business.entity.SysMessage;
|
|
|
import com.qmth.sop.business.entity.SysNotice;
|
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
|
import com.qmth.sop.business.mapper.SysNoticeMapper;
|
|
@@ -21,8 +20,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -40,6 +37,7 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|
|
|
|
|
@Resource
|
|
|
SysMessageService sysMessageService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询列表
|
|
|
*
|
|
@@ -48,7 +46,7 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<SysNoticeResult> query(IPage<Map> iPage, String query, NoticeStatusEnum status, NoticeTypeEnum type, Long startTime, Long endTime) {
|
|
|
- return this.baseMapper.query(iPage,query, Objects.nonNull(status) ? status.name() : null, Objects.nonNull(type) ? type.name() : null, startTime, endTime);
|
|
|
+ return this.baseMapper.query(iPage, query, Objects.nonNull(status) ? status.name() : null, Objects.nonNull(type) ? type.name() : null, startTime, endTime);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -62,14 +60,21 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|
|
public Boolean saveSysNotice(SysNotice sysNotice) {
|
|
|
try {
|
|
|
sysNotice.setEnable(true);
|
|
|
- sysNotice.setStatus(NoticeStatusEnum.UN_PUBLISH);
|
|
|
+ //sysNotice.setStatus(NoticeStatusEnum.UN_PUBLISH);
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
if (Objects.isNull(sysNotice.getId())) {// 新增
|
|
|
sysNotice.insertInfo(sysUser.getId());
|
|
|
} else { // 修改
|
|
|
sysNotice.updateInfo(sysUser.getId());
|
|
|
}
|
|
|
- return saveOrUpdate(sysNotice);
|
|
|
+ if (NoticeStatusEnum.PUBLISH == sysNotice.getStatus()) {
|
|
|
+ sysNotice.setEnable(true);
|
|
|
+ sysNotice.setStatus(NoticeStatusEnum.PUBLISH);
|
|
|
+ sysNotice.setPublishTime(System.currentTimeMillis());
|
|
|
+ //需调发布插入表SysMessage
|
|
|
+ sysMessageService.publishByNotice(sysNotice);
|
|
|
+ }
|
|
|
+ this.saveOrUpdate(sysNotice);
|
|
|
} catch (Exception e) {
|
|
|
if (e instanceof DuplicateKeyException) {
|
|
|
String errorColumn = e.getCause().toString();
|
|
@@ -103,7 +108,7 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|
|
for (long id : ids) {
|
|
|
SysNotice sysNotice = this.getById(id);
|
|
|
sysNotice.setEnable(false);
|
|
|
- if(NoticeStatusEnum.PUBLISH == sysNotice.getStatus()) {
|
|
|
+ if (NoticeStatusEnum.PUBLISH == sysNotice.getStatus()) {
|
|
|
sysNotice.setStatus(NoticeStatusEnum.UN_PUBLISH);
|
|
|
// 需调用撤销发布SysMessage
|
|
|
sysMessageService.deleteByNoticeId(id);
|
|
@@ -123,7 +128,7 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|
|
sysNotice.setStatus(NoticeStatusEnum.UN_PUBLISH);
|
|
|
// 需调用撤销发布删除SysMessage
|
|
|
sysMessageService.deleteByNoticeId(id);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sysNotice.setEnable(true);
|
|
|
sysNotice.setStatus(NoticeStatusEnum.PUBLISH);
|
|
|
sysNotice.setPublishTime(System.currentTimeMillis());
|