first version of aida_back

This commit is contained in:
LiaoFJ
2023-01-06 15:17:37 +08:00
parent 7bafabb046
commit 4c531e3961
477 changed files with 15030 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
package com.ai.da.controller;
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
import com.ai.da.common.response.Response;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.common.utils.MD5Utils;
import com.ai.da.model.dto.CollectionDeleteFileDTO;
import com.ai.da.model.dto.CollectionElementUploadDTO;
import com.ai.da.model.dto.CollectionGeneratePrintDTO;
import com.ai.da.model.dto.CollectionSavePrintDTO;
import com.ai.da.model.vo.*;
import com.ai.da.python.PythonService;
import com.ai.da.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Api(tags = "python对接模块")
@Slf4j
@RestController
@RequestMapping("/api/python")
public class PythonController {
@Resource
private PythonService pythonService;
@Resource
private SysFileService sysFileService;
@Resource
private LibraryService libraryService;
@ApiOperation(value = "python服务保存图片到java服务")
@PostMapping("/saveGeneratePicture")
public Response<String> upload(@RequestParam("file") MultipartFile file,
@ApiParam("操作类型 generatePrint ->生成印花 " +
"designCollection ->设计collection generateAdvancedDesign ->生成高级design")
@RequestParam(value = "operateType") String operateType) {
return Response.success(pythonService.upload(file,operateType));
}
@ApiOperation(value = "通过文件类型获取系统文件")
@GetMapping("/getSysFileByLevel2Type")
public Response<List<SysFileVO>> getSysFileByLevel2Type(/*@RequestParam(value = "level2Type",required = false) String level2Type*/) {
return Response.success(sysFileService.getByLevel2Type("All"));
}
@ApiOperation(value = "通过用户id获取library")
@GetMapping("/getLibraryByUserId")
public Response<Map<String,List<String>>> getLibraryByUserId(@RequestParam(value = "userId") Long userId) {
List<PythonLibraryVo> response = CopyUtil.copyList(libraryService.selectByAccountIdAnd1TypeList(userId,
Collections.singletonList(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName())),PythonLibraryVo.class);
//key转小写 统一
return Response.success(response.stream().collect(Collectors.groupingBy(v ->v.getLevel2Type().toLowerCase(),
Collectors.mapping(PythonLibraryVo::getUrl,Collectors.toList()))));
}
}