TASK:模块化;
This commit is contained in:
@@ -124,4 +124,11 @@ public class ProjectController {
|
||||
public void downloadZip(@RequestParam(value = "threeDSimpleId") Long threeDSimpleId, @RequestParam(value = "sizeType") String sizeType, @RequestParam(value = "size") String size, HttpServletResponse response) throws MinioException, IOException {
|
||||
userLikeGroupService.downloadZip(threeDSimpleId, sizeType, size, response);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperationSupport(order = 12)
|
||||
@ApiOperation(value = "删除", notes = "传入project")
|
||||
public Response<Boolean> delete(@RequestParam("projectId") Long projectId) {
|
||||
return Response.success(userLikeGroupService.delete(projectId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,4 +103,6 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
||||
void getThreeDGlb(Long threeDSimpleId, HttpServletResponse response) throws MinioException, IOException;
|
||||
|
||||
void downloadZip(Long threeDSimpleId, String sizeType, String size, HttpServletResponse response) throws MinioException, IOException;
|
||||
|
||||
Boolean delete(Long projectId);
|
||||
}
|
||||
|
||||
@@ -678,41 +678,83 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
InputStream download = minioUtil.download(exportFiles.get(0).getUrl());
|
||||
String convert = convert(download);
|
||||
JSONObject jsonObject = JSONObject.parseObject(convert);
|
||||
JSONArray objectJSONArrayLevel1 = jsonObject.getJSONArray("objects");
|
||||
for (int i = 0; i < objectJSONArrayLevel1.size(); i++) {
|
||||
JSONObject jsonObjectLevel1 = objectJSONArrayLevel1.getJSONObject(i);
|
||||
String type = jsonObjectLevel1.getString("type");
|
||||
if (type.equals("image")) {
|
||||
String minioUrl = jsonObjectLevel1.getString("minioUrl");
|
||||
jsonObjectLevel1.put("src", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
}
|
||||
if (type.equals("group")) {
|
||||
JSONArray objectJSONArrayLevel2 = jsonObjectLevel1.getJSONArray("objects");
|
||||
for (int j = 0; j < objectJSONArrayLevel2.size(); j++) {
|
||||
JSONObject jsonObjectLevel2 = objectJSONArrayLevel2.getJSONObject(j);
|
||||
String typeGroup = jsonObjectLevel2.getString("type");
|
||||
if (typeGroup.equals("image")) {
|
||||
String minioUrl = jsonObjectLevel2.getString("minioUrl");
|
||||
jsonObjectLevel2.put("src", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
}
|
||||
objectJSONArrayLevel2.set(j, jsonObjectLevel2);
|
||||
}
|
||||
jsonObjectLevel1.put("objects", objectJSONArrayLevel2);
|
||||
}
|
||||
if (type.equals("rect")) {
|
||||
JSONObject custom = jsonObjectLevel1.getJSONObject("custom");
|
||||
if (custom.getString("type").equals("init")) {
|
||||
|
||||
JSONObject canvas = jsonObject.getJSONObject("canvas");
|
||||
if (Objects.nonNull(canvas)) {
|
||||
JSONArray objectJSONArrayLevel1 = canvas.getJSONArray("objects");
|
||||
for (int i = 0; i < objectJSONArrayLevel1.size(); i++) {
|
||||
JSONObject jsonObjectLevel1 = objectJSONArrayLevel1.getJSONObject(i);
|
||||
String type = jsonObjectLevel1.getString("type");
|
||||
if (type.equals("image")) {
|
||||
String minioUrl = jsonObjectLevel1.getString("minioUrl");
|
||||
if (!StringUtils.isEmpty(minioUrl)) {
|
||||
JSONObject fill = jsonObjectLevel1.getJSONObject("fill");
|
||||
fill.put("source", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
jsonObjectLevel1.put("fill", fill);
|
||||
jsonObjectLevel1.put("src", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
}
|
||||
if (type.equals("group")) {
|
||||
JSONArray objectJSONArrayLevel2 = jsonObjectLevel1.getJSONArray("objects");
|
||||
for (int j = 0; j < objectJSONArrayLevel2.size(); j++) {
|
||||
JSONObject jsonObjectLevel2 = objectJSONArrayLevel2.getJSONObject(j);
|
||||
String typeGroup = jsonObjectLevel2.getString("type");
|
||||
if (typeGroup.equals("image")) {
|
||||
String minioUrl = jsonObjectLevel2.getString("minioUrl");
|
||||
jsonObjectLevel2.put("src", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
}
|
||||
objectJSONArrayLevel2.set(j, jsonObjectLevel2);
|
||||
}
|
||||
jsonObjectLevel1.put("objects", objectJSONArrayLevel2);
|
||||
}
|
||||
if (type.equals("rect")) {
|
||||
JSONObject custom = jsonObjectLevel1.getJSONObject("custom");
|
||||
if (custom.getString("type").equals("init")) {
|
||||
String minioUrl = jsonObjectLevel1.getString("minioUrl");
|
||||
if (!StringUtils.isEmpty(minioUrl)) {
|
||||
JSONObject fill = jsonObjectLevel1.getJSONObject("fill");
|
||||
fill.put("source", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
jsonObjectLevel1.put("fill", fill);
|
||||
}
|
||||
}
|
||||
}
|
||||
objectJSONArrayLevel1.set(i, jsonObjectLevel1);
|
||||
}
|
||||
objectJSONArrayLevel1.set(i, jsonObjectLevel1);
|
||||
canvas.put("objects", objectJSONArrayLevel1);
|
||||
jsonObject.put("canvas", canvas);
|
||||
}else {
|
||||
JSONArray objectJSONArrayLevel1 = jsonObject.getJSONArray("objects");
|
||||
for (int i = 0; i < objectJSONArrayLevel1.size(); i++) {
|
||||
JSONObject jsonObjectLevel1 = objectJSONArrayLevel1.getJSONObject(i);
|
||||
String type = jsonObjectLevel1.getString("type");
|
||||
if (type.equals("image")) {
|
||||
String minioUrl = jsonObjectLevel1.getString("minioUrl");
|
||||
jsonObjectLevel1.put("src", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
}
|
||||
if (type.equals("group")) {
|
||||
JSONArray objectJSONArrayLevel2 = jsonObjectLevel1.getJSONArray("objects");
|
||||
for (int j = 0; j < objectJSONArrayLevel2.size(); j++) {
|
||||
JSONObject jsonObjectLevel2 = objectJSONArrayLevel2.getJSONObject(j);
|
||||
String typeGroup = jsonObjectLevel2.getString("type");
|
||||
if (typeGroup.equals("image")) {
|
||||
String minioUrl = jsonObjectLevel2.getString("minioUrl");
|
||||
jsonObjectLevel2.put("src", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
}
|
||||
objectJSONArrayLevel2.set(j, jsonObjectLevel2);
|
||||
}
|
||||
jsonObjectLevel1.put("objects", objectJSONArrayLevel2);
|
||||
}
|
||||
if (type.equals("rect")) {
|
||||
JSONObject custom = jsonObjectLevel1.getJSONObject("custom");
|
||||
if (custom.getString("type").equals("init")) {
|
||||
String minioUrl = jsonObjectLevel1.getString("minioUrl");
|
||||
if (!StringUtils.isEmpty(minioUrl)) {
|
||||
JSONObject fill = jsonObjectLevel1.getJSONObject("fill");
|
||||
fill.put("source", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
jsonObjectLevel1.put("fill", fill);
|
||||
}
|
||||
}
|
||||
}
|
||||
objectJSONArrayLevel1.set(i, jsonObjectLevel1);
|
||||
}
|
||||
jsonObject.put("objects", objectJSONArrayLevel1);
|
||||
}
|
||||
jsonObject.put("objects", objectJSONArrayLevel1);
|
||||
|
||||
System.out.println(jsonObject);
|
||||
return jsonObject;
|
||||
}catch (Exception e){
|
||||
@@ -2176,4 +2218,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
throw new RuntimeException("Failed to download ZIP file", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delete(Long projectId) {
|
||||
projectMapper.deleteById(projectId);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user