remove AttachmentRequest and AttachmentView
This commit is contained in:
@ -20,7 +20,6 @@ import com.imyeyu.api.modules.common.service.TemplateService;
|
|||||||
import com.imyeyu.api.modules.common.service.VersionService;
|
import com.imyeyu.api.modules.common.service.VersionService;
|
||||||
import com.imyeyu.api.modules.common.vo.FeedbackRequest;
|
import com.imyeyu.api.modules.common.vo.FeedbackRequest;
|
||||||
import com.imyeyu.api.modules.common.vo.TempFileResponse;
|
import com.imyeyu.api.modules.common.vo.TempFileResponse;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentView;
|
|
||||||
import com.imyeyu.api.modules.system.util.ResourceHandler;
|
import com.imyeyu.api.modules.system.util.ResourceHandler;
|
||||||
import com.imyeyu.api.util.CaptchaManager;
|
import com.imyeyu.api.util.CaptchaManager;
|
||||||
import com.imyeyu.io.IO;
|
import com.imyeyu.io.IO;
|
||||||
@ -264,8 +263,8 @@ public class CommonController {
|
|||||||
@AOPLog
|
@AOPLog
|
||||||
@RequestRateLimit
|
@RequestRateLimit
|
||||||
@GetMapping("/attachment/{mongoId}")
|
@GetMapping("/attachment/{mongoId}")
|
||||||
public AttachmentView getAttachment(@PathVariable String mongoId) {
|
public Attachment getAttachment(@PathVariable String mongoId) {
|
||||||
return attachmentService.viewByMongoId(mongoId);
|
return attachmentService.getByMongoId(mongoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AOPLog
|
@AOPLog
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.common.service;
|
package com.imyeyu.api.modules.common.service;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentRequest;
|
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentView;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.service.BaseService;
|
import com.imyeyu.spring.service.BaseService;
|
||||||
import com.mongodb.client.gridfs.model.GridFSFile;
|
import com.mongodb.client.gridfs.model.GridFSFile;
|
||||||
@ -22,27 +20,6 @@ public interface AttachmentService extends BaseService<Attachment, Long> {
|
|||||||
|
|
||||||
Attachment createMedia(Attachment attachment);
|
Attachment createMedia(Attachment attachment);
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
default void create(AttachmentRequest request) {
|
|
||||||
create((Attachment) request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建媒体附件,同步创建缩略图
|
|
||||||
*
|
|
||||||
* @param request 附件请求
|
|
||||||
* @return 缩略图附件
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
default Attachment createMedia(AttachmentRequest request) throws TimiException {
|
|
||||||
return createMedia((Attachment) request);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteMedia(Long thumbId) throws TimiException;
|
void deleteMedia(Long thumbId) throws TimiException;
|
||||||
|
|
||||||
Attachment getByBizId(Attachment.BizType bizType, long bizId);
|
Attachment getByBizId(Attachment.BizType bizType, long bizId);
|
||||||
@ -51,8 +28,6 @@ public interface AttachmentService extends BaseService<Attachment, Long> {
|
|||||||
|
|
||||||
Attachment getByMongoId(String mongoId);
|
Attachment getByMongoId(String mongoId);
|
||||||
|
|
||||||
AttachmentView viewByMongoId(String mongoId);
|
|
||||||
|
|
||||||
GridFSFile readByMongoId(String mongoId);
|
GridFSFile readByMongoId(String mongoId);
|
||||||
|
|
||||||
InputStream getInputStreamByMongoId(String mongoId);
|
InputStream getInputStreamByMongoId(String mongoId);
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import com.imyeyu.api.modules.common.entity.Attachment;
|
|||||||
import com.imyeyu.api.modules.common.mapper.AttachmentMapper;
|
import com.imyeyu.api.modules.common.mapper.AttachmentMapper;
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||||
import com.imyeyu.api.modules.common.service.SettingService;
|
import com.imyeyu.api.modules.common.service.SettingService;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentView;
|
|
||||||
import com.imyeyu.api.util.JavaCV;
|
import com.imyeyu.api.util.JavaCV;
|
||||||
import com.imyeyu.io.IO;
|
import com.imyeyu.io.IO;
|
||||||
import com.imyeyu.java.TimiJava;
|
import com.imyeyu.java.TimiJava;
|
||||||
@ -25,7 +24,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.coobird.thumbnailator.Thumbnails;
|
import net.coobird.thumbnailator.Thumbnails;
|
||||||
import org.apache.tika.Tika;
|
import org.apache.tika.Tika;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.data.mongodb.core.query.Criteria;
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
import org.springframework.data.mongodb.core.query.Query;
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
import org.springframework.data.mongodb.gridfs.GridFsTemplate;
|
import org.springframework.data.mongodb.gridfs.GridFsTemplate;
|
||||||
@ -201,17 +199,6 @@ public class AttachmentServiceImplement extends AbstractEntityService<Attachment
|
|||||||
return mapper.selectByMongoId(mongoId);
|
return mapper.selectByMongoId(mongoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AttachmentView viewByMongoId(String mongoId) {
|
|
||||||
Attachment attachment = getByMongoId(mongoId);
|
|
||||||
if (attachment == null) {
|
|
||||||
throw new TimiException(TimiCode.RESULT_NULL).msgKey("TODO not found attachment");
|
|
||||||
}
|
|
||||||
AttachmentView view = new AttachmentView();
|
|
||||||
BeanUtils.copyProperties(attachment, view);
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GridFSFile readByMongoId(String mongoId) {
|
public GridFSFile readByMongoId(String mongoId) {
|
||||||
Attachment view = mapper.selectByMongoId(mongoId);
|
Attachment view = mapper.selectByMongoId(mongoId);
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package com.imyeyu.api.modules.common.service.implement;
|
package com.imyeyu.api.modules.common.service.implement;
|
||||||
|
|
||||||
import com.imyeyu.io.IOSize;
|
|
||||||
import com.imyeyu.java.TimiJava;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiCode;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
|
||||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.entity.User;
|
import com.imyeyu.api.modules.common.entity.User;
|
||||||
@ -12,8 +8,11 @@ import com.imyeyu.api.modules.common.mapper.UserProfileMapper;
|
|||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||||
import com.imyeyu.api.modules.common.service.UserProfileService;
|
import com.imyeyu.api.modules.common.service.UserProfileService;
|
||||||
import com.imyeyu.api.modules.common.service.UserService;
|
import com.imyeyu.api.modules.common.service.UserService;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentRequest;
|
|
||||||
import com.imyeyu.api.modules.common.vo.user.UserRequest;
|
import com.imyeyu.api.modules.common.vo.user.UserRequest;
|
||||||
|
import com.imyeyu.io.IOSize;
|
||||||
|
import com.imyeyu.java.TimiJava;
|
||||||
|
import com.imyeyu.java.bean.timi.TimiCode;
|
||||||
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.mapper.BaseMapper;
|
import com.imyeyu.spring.mapper.BaseMapper;
|
||||||
import com.imyeyu.spring.service.AbstractEntityService;
|
import com.imyeyu.spring.service.AbstractEntityService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -73,7 +72,7 @@ public class UserProfileServiceImplement extends AbstractEntityService<UserProfi
|
|||||||
if (IOSize.MB < bytes.length) {
|
if (IOSize.MB < bytes.length) {
|
||||||
throw new TimiException(TimiCode.ARG_BAD).msgKey("限制上传文件大小 1 MB");
|
throw new TimiException(TimiCode.ARG_BAD).msgKey("限制上传文件大小 1 MB");
|
||||||
}
|
}
|
||||||
AttachmentRequest wrapperAttach = new AttachmentRequest();
|
Attachment wrapperAttach = new Attachment();
|
||||||
wrapperAttach.setName(request.getId() + ".png");
|
wrapperAttach.setName(request.getId() + ".png");
|
||||||
wrapperAttach.setBizType(Attachment.BizType.USER);
|
wrapperAttach.setBizType(Attachment.BizType.USER);
|
||||||
wrapperAttach.setBizId(request.getId());
|
wrapperAttach.setBizId(request.getId());
|
||||||
@ -88,7 +87,7 @@ public class UserProfileServiceImplement extends AbstractEntityService<UserProfi
|
|||||||
attachmentService.delete(dbAvatar.getId());
|
attachmentService.delete(dbAvatar.getId());
|
||||||
}
|
}
|
||||||
MultipartFile avatar = request.getProfile().getAvatar();
|
MultipartFile avatar = request.getProfile().getAvatar();
|
||||||
AttachmentRequest avatarAttach = new AttachmentRequest();
|
Attachment avatarAttach = new Attachment();
|
||||||
avatarAttach.setName(request.getId() + ".png");
|
avatarAttach.setName(request.getId() + ".png");
|
||||||
avatarAttach.setBizType(Attachment.BizType.USER);
|
avatarAttach.setBizType(Attachment.BizType.USER);
|
||||||
avatarAttach.setBizId(request.getId());
|
avatarAttach.setBizId(request.getId());
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.common.vo.attachment;
|
|
||||||
|
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
|
||||||
import com.imyeyu.spring.annotation.table.Transient;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 夜雨
|
|
||||||
* @since 2024-02-21 10:58
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Transient
|
|
||||||
@Deprecated
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class AttachmentRequest extends Attachment {
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.common.vo.attachment;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import com.imyeyu.api.bean.MultilingualHandler;
|
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 夜雨
|
|
||||||
* @since 2024-02-21 10:55
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class AttachmentView extends Attachment implements MultilingualHandler {
|
|
||||||
}
|
|
||||||
@ -1,18 +1,17 @@
|
|||||||
package com.imyeyu.api.modules.lyric.service.implement;
|
package com.imyeyu.api.modules.lyric.service.implement;
|
||||||
|
|
||||||
import com.imyeyu.java.TimiJava;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiCode;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
|
||||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.entity.User;
|
import com.imyeyu.api.modules.common.entity.User;
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||||
import com.imyeyu.api.modules.common.service.UserService;
|
import com.imyeyu.api.modules.common.service.UserService;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentRequest;
|
|
||||||
import com.imyeyu.api.modules.lyric.entity.LyricCorrect;
|
import com.imyeyu.api.modules.lyric.entity.LyricCorrect;
|
||||||
import com.imyeyu.api.modules.lyric.mapper.LyricCorrectMapper;
|
import com.imyeyu.api.modules.lyric.mapper.LyricCorrectMapper;
|
||||||
import com.imyeyu.api.modules.lyric.service.LyricCorrectService;
|
import com.imyeyu.api.modules.lyric.service.LyricCorrectService;
|
||||||
import com.imyeyu.api.modules.lyric.vo.LyricCorrectRequest;
|
import com.imyeyu.api.modules.lyric.vo.LyricCorrectRequest;
|
||||||
|
import com.imyeyu.java.TimiJava;
|
||||||
|
import com.imyeyu.java.bean.timi.TimiCode;
|
||||||
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.TimiSpring;
|
import com.imyeyu.spring.TimiSpring;
|
||||||
import com.imyeyu.spring.bean.Page;
|
import com.imyeyu.spring.bean.Page;
|
||||||
import com.imyeyu.spring.bean.PageResult;
|
import com.imyeyu.spring.bean.PageResult;
|
||||||
@ -76,7 +75,7 @@ public class LyricCorrectServiceImplement extends AbstractEntityService<LyricCor
|
|||||||
create(correct);
|
create(correct);
|
||||||
try {
|
try {
|
||||||
MultipartFile file = request.getFile();
|
MultipartFile file = request.getFile();
|
||||||
AttachmentRequest attachment = new AttachmentRequest();
|
Attachment attachment = new Attachment();
|
||||||
attachment.setBizType(Attachment.BizType.LYRIC);
|
attachment.setBizType(Attachment.BizType.LYRIC);
|
||||||
attachment.setBizId(correct.getId());
|
attachment.setBizId(correct.getId());
|
||||||
attachment.setName(correct.getId() + ".lrc");
|
attachment.setName(correct.getId() + ".lrc");
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
package com.imyeyu.api.modules.mirror;
|
package com.imyeyu.api.modules.mirror;
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import com.imyeyu.api.TimiServerAPI;
|
import com.imyeyu.api.TimiServerAPI;
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentRequest;
|
|
||||||
import com.imyeyu.api.modules.mirror.entity.Mirror;
|
import com.imyeyu.api.modules.mirror.entity.Mirror;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ public abstract class AttachmentMirror extends AbstractMirror {
|
|||||||
* @return 新增附件
|
* @return 新增附件
|
||||||
* @throws Exception 处理异常
|
* @throws Exception 处理异常
|
||||||
*/
|
*/
|
||||||
protected abstract List<AttachmentRequest> diffAdd(List<Attachment> dbFiles) throws Exception;
|
protected abstract List<Attachment> diffAdd(List<Attachment> dbFiles) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 差分移除附件
|
* 差分移除附件
|
||||||
@ -70,10 +69,10 @@ public abstract class AttachmentMirror extends AbstractMirror {
|
|||||||
attachmentService.destroy(diffRemoveList.get(i).getId());
|
attachmentService.destroy(diffRemoveList.get(i).getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AttachmentRequest> diffAddList = diffAdd(dbFiles);
|
List<Attachment> diffAddList = diffAdd(dbFiles);
|
||||||
syncAdded = diffAddList.size();
|
syncAdded = diffAddList.size();
|
||||||
for (int i = 0; i < diffAddList.size(); i++) {
|
for (int i = 0; i < diffAddList.size(); i++) {
|
||||||
AttachmentRequest request = diffAddList.get(i);
|
Attachment request = diffAddList.get(i);
|
||||||
request.setBizType(Attachment.BizType.MIRROR);
|
request.setBizType(Attachment.BizType.MIRROR);
|
||||||
request.setBizId(mirror.getId());
|
request.setBizId(mirror.getId());
|
||||||
attachmentService.create(request);
|
attachmentService.create(request);
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com.imyeyu.api.modules.mirror;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentRequest;
|
|
||||||
import com.imyeyu.api.modules.mirror.bean.AttachType;
|
import com.imyeyu.api.modules.mirror.bean.AttachType;
|
||||||
import com.imyeyu.api.modules.mirror.data.FabricAPI;
|
import com.imyeyu.api.modules.mirror.data.FabricAPI;
|
||||||
import com.imyeyu.api.modules.mirror.entity.Mirror;
|
import com.imyeyu.api.modules.mirror.entity.Mirror;
|
||||||
@ -106,10 +105,10 @@ public class FabricAPIMirror extends AttachmentMirror {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<AttachmentRequest> diffAdd(List<Attachment> dbFiles) throws Exception {
|
protected List<Attachment> diffAdd(List<Attachment> dbFiles) throws Exception {
|
||||||
Set<String> dbNameSet = dbFiles.stream().map(Attachment::getName).collect(Collectors.toSet());
|
Set<String> dbNameSet = dbFiles.stream().map(Attachment::getName).collect(Collectors.toSet());
|
||||||
|
|
||||||
List<AttachmentRequest> result = new ArrayList<>();
|
List<Attachment> result = new ArrayList<>();
|
||||||
for (Map.Entry<String, String> item : versionMap.entrySet()) {
|
for (Map.Entry<String, String> item : versionMap.entrySet()) {
|
||||||
String version = "%s+%s".formatted(item.getValue(), item.getKey());
|
String version = "%s+%s".formatted(item.getValue(), item.getKey());
|
||||||
String name = "fabric-api-%s.jar".formatted(version);
|
String name = "fabric-api-%s.jar".formatted(version);
|
||||||
@ -119,7 +118,7 @@ public class FabricAPIMirror extends AttachmentMirror {
|
|||||||
|
|
||||||
byte[] bytes = Request.get(url).viaProxy(proxy).execute().returnContent().asBytes();
|
byte[] bytes = Request.get(url).viaProxy(proxy).execute().returnContent().asBytes();
|
||||||
|
|
||||||
AttachmentRequest attachment = new AttachmentRequest();
|
Attachment attachment = new Attachment();
|
||||||
attachment.setAttachTypeValue(AttachType.FABRIC_API);
|
attachment.setAttachTypeValue(AttachType.FABRIC_API);
|
||||||
attachment.setName(name);
|
attachment.setName(name);
|
||||||
attachment.setSize((long) bytes.length);
|
attachment.setSize((long) bytes.length);
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com.imyeyu.api.modules.mirror;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentRequest;
|
|
||||||
import com.imyeyu.api.modules.mirror.bean.AttachType;
|
import com.imyeyu.api.modules.mirror.bean.AttachType;
|
||||||
import com.imyeyu.api.modules.mirror.data.OpenJDK;
|
import com.imyeyu.api.modules.mirror.data.OpenJDK;
|
||||||
import com.imyeyu.api.modules.mirror.entity.Mirror;
|
import com.imyeyu.api.modules.mirror.entity.Mirror;
|
||||||
@ -70,11 +69,11 @@ public class OpenJDKMirror extends AttachmentMirror {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<AttachmentRequest> diffAdd(List<Attachment> dbFiles) throws Exception {
|
protected List<Attachment> diffAdd(List<Attachment> dbFiles) throws Exception {
|
||||||
Map<String, OpenJDK> githubNameMap = githubMirrorResult.stream().collect(Collectors.toMap(OpenJDK::getName, item -> item));
|
Map<String, OpenJDK> githubNameMap = githubMirrorResult.stream().collect(Collectors.toMap(OpenJDK::getName, item -> item));
|
||||||
Set<String> dbNameSet = dbFiles.stream().map(Attachment::getName).collect(Collectors.toSet());
|
Set<String> dbNameSet = dbFiles.stream().map(Attachment::getName).collect(Collectors.toSet());
|
||||||
|
|
||||||
List<AttachmentRequest> result = new ArrayList<>();
|
List<Attachment> result = new ArrayList<>();
|
||||||
for (Map.Entry<String, OpenJDK> item : githubNameMap.entrySet()) {
|
for (Map.Entry<String, OpenJDK> item : githubNameMap.entrySet()) {
|
||||||
if (!dbNameSet.contains(item.getKey())) {
|
if (!dbNameSet.contains(item.getKey())) {
|
||||||
String url = item.getValue().getData();
|
String url = item.getValue().getData();
|
||||||
@ -82,7 +81,7 @@ public class OpenJDKMirror extends AttachmentMirror {
|
|||||||
|
|
||||||
byte[] bytes = Request.get(url).viaProxy(proxy).execute().returnContent().asBytes();
|
byte[] bytes = Request.get(url).viaProxy(proxy).execute().returnContent().asBytes();
|
||||||
|
|
||||||
AttachmentRequest attachment = new AttachmentRequest();
|
Attachment attachment = new Attachment();
|
||||||
attachment.setAttachTypeValue(AttachType.OPEN_JDK);
|
attachment.setAttachTypeValue(AttachType.OPEN_JDK);
|
||||||
attachment.setName(item.getKey());
|
attachment.setName(item.getKey());
|
||||||
attachment.setSize((long) bytes.length);
|
attachment.setSize((long) bytes.length);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.imyeyu.api.modules.system.controller;
|
package com.imyeyu.api.modules.system.controller;
|
||||||
|
|
||||||
|
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentRequest;
|
|
||||||
import com.imyeyu.api.modules.system.bean.ServerStatus;
|
import com.imyeyu.api.modules.system.bean.ServerStatus;
|
||||||
import com.imyeyu.api.modules.system.service.SystemService;
|
import com.imyeyu.api.modules.system.service.SystemService;
|
||||||
import com.imyeyu.api.modules.system.vo.TempAttachRequest;
|
import com.imyeyu.api.modules.system.vo.TempAttachRequest;
|
||||||
@ -119,7 +119,7 @@ public class SystemController {
|
|||||||
for (MultipartFile file : request.getFile()) {
|
for (MultipartFile file : request.getFile()) {
|
||||||
byte[] bytes = IO.toBytes(file.getInputStream());
|
byte[] bytes = IO.toBytes(file.getInputStream());
|
||||||
|
|
||||||
AttachmentRequest attach = new AttachmentRequest();
|
Attachment attach = new Attachment();
|
||||||
attach.setName(file.getOriginalFilename());
|
attach.setName(file.getOriginalFilename());
|
||||||
attach.setBizType(request.getBizType());
|
attach.setBizType(request.getBizType());
|
||||||
attach.setBizId(request.getBizId());
|
attach.setBizId(request.getBizId());
|
||||||
|
|||||||
Reference in New Issue
Block a user