禁止超管读取消息

This commit is contained in:
季圣华
2021-12-17 00:09:54 +08:00
parent e048075538
commit 76f3ac76d7

View File

@@ -80,6 +80,8 @@ public class MsgService {
public List<MsgEx> select(String name, int offset, int rows)throws Exception {
List<MsgEx> list=null;
try{
User userInfo = userService.getCurrentUser();
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
list = msgMapperEx.selectByConditionMsg(name, offset, rows);
if (null != list) {
for (MsgEx msgEx : list) {
@@ -88,6 +90,7 @@ public class MsgService {
}
}
}
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
@@ -100,7 +103,10 @@ public class MsgService {
public Long countMsg(String name)throws Exception {
Long result=null;
try{
User userInfo = userService.getCurrentUser();
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
result = msgMapperEx.countsByMsg(name);
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
@@ -226,6 +232,8 @@ public class MsgService {
public List<MsgEx> getMsgByStatus(String status)throws Exception {
List<MsgEx> resList=new ArrayList<>();
try{
User userInfo = userService.getCurrentUser();
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
MsgExample example = new MsgExample();
example.createCriteria().andStatusEqualTo(status).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Msg> list = msgMapper.selectByExample(example);
@@ -243,6 +251,7 @@ public class MsgService {
}
}
}
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
@@ -273,7 +282,9 @@ public class MsgService {
Long result=null;
try{
User userInfo=userService.getCurrentUser();
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
result = msgMapperEx.getMsgCountByStatus(status, userInfo.getId());
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
@@ -286,10 +297,13 @@ public class MsgService {
public Integer getMsgCountByType(String type)throws Exception {
int msgCount = 0;
try{
User userInfo = userService.getCurrentUser();
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
MsgExample example = new MsgExample();
example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Msg> list = msgMapper.selectByExample(example);
msgCount = list.size();
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);