Merge remote-tracking branch 'refs/remotes/origin/dev'

This commit is contained in:
landaiqing
2024-07-16 15:37:16 +08:00
4 changed files with 15 additions and 24 deletions

View File

@@ -175,6 +175,7 @@ public class SchisandraOssMinioController {
list.get(name).reset();
String key = redisUtil.buildKey(USER_OSS_PREFIX, "download", formattedDate, userId, name);
HashMap<Object, Object> map = new HashMap<>();
map.put("fileName", name);
map.put("size", bytes.length);
map.put("time", formattedDate);
redisUtil.setNx(key, map, 30L, TimeUnit.DAYS);
@@ -227,6 +228,7 @@ public class SchisandraOssMinioController {
String formattedDate = dateFormat.format(date);
String key = redisUtil.buildKey(USER_OSS_PREFIX, "upload", formattedDate, userId, fileName);
HashMap<Object, Object> map = new HashMap<>();
map.put("fileName", fileName);
map.put("descreption", "这是一个文件");
map.put("size", String.valueOf(file.getSize()));
map.put("time", formattedDate);
@@ -310,6 +312,7 @@ public class SchisandraOssMinioController {
String key = redisUtil.buildKey(USER_OSS_PREFIX, "previewFile", formattedDate, userId, filePath);
HashMap<Object, Object> map = new HashMap<>();
String url = bean.getMinioPreviewUrl(filePath);
map.put("fileName", filePath);
map.put("url", url);
map.put("time", formattedDate);
redisUtil.setNx(key, map, 30L, TimeUnit.DAYS);

View File

@@ -1,6 +1,7 @@
package com.schisandra.oss.domain.service.impl;
import cn.hutool.core.io.unit.DataSizeUtil;
import com.mybatisflex.core.row.Row;
import com.schisandra.oss.domain.convert.SchisandraFileHeatmapBOConverter;
import com.schisandra.oss.domain.bo.SchisandraFileHeatmapBO;
import com.schisandra.oss.domain.redis.RedisUtil;
@@ -163,12 +164,9 @@ public class SchisandraFileHeatmapDomainServiceImpl implements SchisandraFileHea
List<HashMap<Object,Object>> list=redisUtil.getDataFromDir(recent);
List<HashMap<Object, Object>> list1 = new ArrayList<>();
list.forEach(obj->{
HashMap<Object,Object> recentFile = new HashMap<>();
String key= String.valueOf(obj.keySet().toArray()[0]);
String fileName=key.split(":")[6];
HashMap<Object,Object>temp= (HashMap<Object, Object>) obj.get(key);
recentFile.put(fileName,temp);
list1.add(recentFile);
list1.add(temp);
});
return list1;
}
@@ -179,12 +177,9 @@ public class SchisandraFileHeatmapDomainServiceImpl implements SchisandraFileHea
List<HashMap<Object,Object>> list=redisUtil.getDataFromDir(recent);
List<HashMap<Object, Object>> list1 = new ArrayList<>();
list.forEach(obj->{
HashMap<Object,Object> recentFile = new HashMap<>();
String key= String.valueOf(obj.keySet().toArray()[0]);
String fileName=key.split(":")[6];
HashMap<Object,Object>temp= (HashMap<Object, Object>) obj.get(key);
recentFile.put(fileName,temp);
list1.add(recentFile);
list1.add(temp);
});
return list1;
}
@@ -208,7 +203,9 @@ public class SchisandraFileHeatmapDomainServiceImpl implements SchisandraFileHea
@Override
public HashMap<Object, Object> selectFileDiagramPerMonth(String userId,int type) {
return schisandraFileHeatmapService.selectFileDiagramPerMonth(userId, type);
HashMap<Object,Object> map=new HashMap<>();
map.put("month",schisandraFileHeatmapService.selectFileDiagramPerMonth(userId, type));
return map;
}
@Override
public List<HashMap<Object, Object>> selectRecentPreviewFile(String userId) {
@@ -216,12 +213,9 @@ public class SchisandraFileHeatmapDomainServiceImpl implements SchisandraFileHea
List<HashMap<Object,Object>> list=redisUtil.getDataFromDir(recent);
List<HashMap<Object, Object>> list1 = new ArrayList<>();
list.forEach(obj->{
HashMap<Object,Object> recentFile = new HashMap<>();
String key= String.valueOf(obj.keySet().toArray()[0]);
String fileName=key.split(":")[6];
HashMap<Object,Object>temp= (HashMap<Object, Object>) obj.get(key);
recentFile.put(fileName,temp);
list1.add(recentFile);
list1.add(temp);
});
return list1;
}

View File

@@ -1,8 +1,8 @@
package com.schisandra.oss.infra.basic.service;
import com.mybatisflex.core.row.Row;
import com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap;
import java.util.HashMap;
import java.util.List;
/**
@@ -57,6 +57,6 @@ public interface SchisandraFileHeatmapService {
Long selectUserUploadAndDownloadflow (String userId,int type);
Long selectUserUploadAndDownloadCount(String userId ,int type);
HashMap<Object,Object>selectFileDiagramPerMonth(String userId,int type);
List<Row> selectFileDiagramPerMonth(String userId, int type);
}

View File

@@ -1,7 +1,7 @@
package com.schisandra.oss.infra.basic.service.impl;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.Row;
import com.schisandra.oss.infra.basic.dao.SchisandraFileHeatmapDao;
import com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap;
import com.schisandra.oss.infra.basic.entity.table.SchisandraFileHeatmapTableDef;
@@ -9,13 +9,9 @@ import com.schisandra.oss.infra.basic.service.SchisandraFileHeatmapService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import static com.mybatisflex.core.query.QueryMethods.*;
import static io.lettuce.core.protocol.CommandKeyword.DB;
/**
* 文件上传热力图表 表服务实现类
@@ -114,7 +110,7 @@ public class SchisandraFileHeatmapServiceImpl implements SchisandraFileHeatmapSe
}
@Override
public HashMap<Object,Object> selectFileDiagramPerMonth(String userId, int type) {
public List<Row> selectFileDiagramPerMonth(String userId, int type) {
QueryWrapper queryFlow = new QueryWrapper().select(sum(SchisandraFileHeatmapTableDef.SCHISANDRA_FILE_HEATMAP.COUNT).as("count"),
dateFormat(SchisandraFileHeatmapTableDef.SCHISANDRA_FILE_HEATMAP.UPDATE_TIME,"%Y-%m").as("date"))
.from(SchisandraFileHeatmapTableDef.SCHISANDRA_FILE_HEATMAP)
@@ -122,9 +118,7 @@ public class SchisandraFileHeatmapServiceImpl implements SchisandraFileHeatmapSe
.where(SchisandraFileHeatmapTableDef.SCHISANDRA_FILE_HEATMAP.USER_ID.eq(userId))
.and(SchisandraFileHeatmapTableDef.SCHISANDRA_FILE_HEATMAP.TYPE.eq(type));
HashMap<Object, Object> map = new HashMap<>();
map.put("month", schisandraFileHeatmapDao.selectRowsByQuery(queryFlow));
return map;
return schisandraFileHeatmapDao.selectRowsByQuery(queryFlow);
}