mirror of
https://github.com/dataease/dataease.git
synced 2026-05-24 06:18:10 +08:00
Merge branch 'dev' of github.com:dataease/dataease into dev
This commit is contained in:
@@ -45,6 +45,8 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
//验证链接
|
||||
filterChainDefinitionMap.put("/api/link/validate**", ANON);
|
||||
filterChainDefinitionMap.put("/api/map/areaEntitys/**", ANON);
|
||||
//未读消息数量
|
||||
filterChainDefinitionMap.put("/api/sys_msg/unReadCount", ANON);
|
||||
|
||||
filterChainDefinitionMap.put("/**/*.json", ANON);
|
||||
filterChainDefinitionMap.put("/system/ui/**", ANON);
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package io.dataease.base.mapper.ext;
|
||||
|
||||
public interface ExtBaseMapper {
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="io.dataease.base.mapper.ext.ExtBaseMapper">
|
||||
|
||||
|
||||
<sql id="orders">
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
${order.name} ${order.type}
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="condition">
|
||||
<choose>
|
||||
<when test='${object}.operator == "like"'>
|
||||
like CONCAT('%', #{${object}.value},'%')
|
||||
</when>
|
||||
<when test='${object}.operator == "not like"'>
|
||||
not like CONCAT('%', #{${object}.value},'%')
|
||||
</when>
|
||||
<when test='${object}.operator == "in"'>
|
||||
in
|
||||
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test='${object}.operator == "not in"'>
|
||||
not in
|
||||
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test='${object}.operator == "between"'>
|
||||
between #{${object}.value[0]} and #{${object}.value[1]}
|
||||
</when>
|
||||
<when test='${object}.operator == "gt"'>
|
||||
> #{${object}.value}
|
||||
</when>
|
||||
<when test='${object}.operator == "lt"'>
|
||||
< #{${object}.value}
|
||||
</when>
|
||||
<when test='${object}.operator == "ge"'>
|
||||
>= #{${object}.value}
|
||||
</when>
|
||||
<when test='${object}.operator == "le"'>
|
||||
<= #{${object}.value}
|
||||
</when>
|
||||
<when test='${object}.operator == "current user"'>
|
||||
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
|
||||
</when>
|
||||
<otherwise>
|
||||
= #{${object}.value}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -1,34 +0,0 @@
|
||||
package io.dataease.commons.utils;
|
||||
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
public class FileUtils {
|
||||
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
|
||||
|
||||
public static void createBodyFiles(List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {
|
||||
if (CollectionUtils.isNotEmpty(bodyUploadIds) && CollectionUtils.isNotEmpty(bodyFiles)) {
|
||||
File testDir = new File(BODY_FILE_DIR);
|
||||
if (!testDir.exists()) {
|
||||
testDir.mkdirs();
|
||||
}
|
||||
for (int i = 0; i < bodyUploadIds.size(); i++) {
|
||||
MultipartFile item = bodyFiles.get(i);
|
||||
File file = new File(BODY_FILE_DIR + "/" + bodyUploadIds.get(i) + "_" + item.getOriginalFilename());
|
||||
try (InputStream in = item.getInputStream(); OutputStream out = new FileOutputStream(file)) {
|
||||
file.createNewFile();
|
||||
FileUtil.copyStream(in, out);
|
||||
} catch (IOException e) {
|
||||
LogUtil.error(e);
|
||||
DEException.throwException(Translator.get("upload_fail"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.base.domain.SysMsgChannel;
|
||||
import io.dataease.base.domain.SysMsgSetting;
|
||||
import io.dataease.base.domain.SysMsgType;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.PageUtils;
|
||||
import io.dataease.commons.utils.Pager;
|
||||
@@ -21,6 +22,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "系统:消息管理")
|
||||
@@ -46,6 +48,16 @@ public class MsgController {
|
||||
return listPager;
|
||||
}
|
||||
|
||||
@ApiOperation("查询未读数量")
|
||||
@PostMapping("/unReadCount")
|
||||
public Long unReadCount(@RequestBody Map<String, Long> request) {
|
||||
if(null == request || null == request.get("userId")) {
|
||||
throw new RuntimeException("缺少用户ID");
|
||||
}
|
||||
Long userId = request.get("userId");
|
||||
return sysMsgService.queryCount(userId);
|
||||
}
|
||||
|
||||
@ApiOperation("设置已读")
|
||||
@PostMapping("/setReaded/{msgId}")
|
||||
public void setReaded(@PathVariable Long msgId) {
|
||||
|
||||
@@ -105,6 +105,13 @@ public class SysMsgService {
|
||||
return msgGridDtos;
|
||||
}
|
||||
|
||||
public Long queryCount(Long userId) {
|
||||
SysMsgExample example = new SysMsgExample();
|
||||
SysMsgExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andUserIdEqualTo(userId).andStatusEqualTo(false);
|
||||
return sysMsgMapper.countByExample(example);
|
||||
}
|
||||
|
||||
public void setReaded(Long msgId) {
|
||||
SysMsg sysMsg = new SysMsg();
|
||||
sysMsg.setMsgId(msgId);
|
||||
|
||||
Reference in New Issue
Block a user