|
|
@@ -249,6 +249,7 @@ public class ModelVO {
|
|
|
@RequestMapping("/userManage")
|
|
|
public class LoginController {
|
|
|
@Autowired private LoginService loginService;
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @param username
|
|
|
@@ -271,6 +272,11 @@ public class LoginController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param user
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping(value = "/register")
|
|
|
public Response register(@RequestBody User user){ //注册,先判断该用户名是否已经存在
|
|
|
boolean res=loginService.addUser(user);
|
|
|
@@ -372,6 +378,11 @@ public class ConfigController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param configId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@GetMapping(value = "/delete")
|
|
|
public Response deleteModelByConfigId(@RequestParam(value = "configId", required = false) String configId) {
|
|
|
try {
|
|
|
@@ -402,10 +413,516 @@ public class ConfigController {
|
|
|
|
|
|
| 方法名 | 参数 | 有效返回值 | 功能 | 备注 |
|
|
|
| --------------------- | ------------------------------------------------------------ | ----------------- | ------------------------------------------------------------ | ------------------ |
|
|
|
-| addConfig | ConfigVO configVO | String | 添加机器学习模型 | 返回值为configId |
|
|
|
-| getAllConfig | String userId | List\<ConfigPojo> | 获取用户已有的所有机器学习模型 | |
|
|
|
-| getAllConfig_new | String userId | List<_ConfigPojo> | 获取用户已有的所有机器学习模型,但比上面的方法更精简 | |
|
|
|
+| addConfig | ConfigVO configVO | String | 添加机器学习模型配置 | 返回值为configId |
|
|
|
+| getAllConfig | String userId | List\<ConfigPojo> | 获取用户已有的所有机器学习模型配置 | |
|
|
|
+| getAllConfig_new | String userId | List<_ConfigPojo> | 获取用户已有的所有机器学习模型配置,但比上面的方法更精简 | |
|
|
|
| getOneConfig | String configId | ConfigDetilePojo | 根据配置Id获取配置信息 | |
|
|
|
| changeConfig | String configId,String confName,List\<String> trainFeatureList | 无 | 改变某个机器学习模型的配置信息 | |
|
|
|
| deleteModelByConfigId | String configId | boolean | 删除配置与使用该配置的所有模型 | |
|
|
|
-| getFeatureSelection | String fileId,String fieldName | List\<HeaderInfo> | 用户配置机器学习模型时进行自动化特征选择,然后查询这些自动化生成的特征信息 | 没太看懂是什么意思 |
|
|
|
+| getFeatureSelection | String fileId,String fieldName | List\<HeaderInfo> | 用户配置机器学习模型时进行自动化特征选择,然后查询这些自动化生成的特征信息 | 没太看懂是什么意思 |
|
|
|
+
|
|
|
+# 5. ModelController
|
|
|
+
|
|
|
+```java
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/model")
|
|
|
+public class ModelController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ModelService modelService;
|
|
|
+ @Autowired
|
|
|
+ private FileService fileService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param model
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Response addModel(@RequestBody ModelVO model){
|
|
|
+ try {
|
|
|
+ int rsl = modelService.addModel(model);
|
|
|
+ return rsl != 0? new NormalRes(rsl) : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/all")
|
|
|
+ public Response getAllModel(@RequestParam(value="userId", required = false) String userId) {
|
|
|
+ try{
|
|
|
+ return new NormalRes(modelService.getAllModelByUserId(Integer.parseInt(userId)));
|
|
|
+ }catch (Exception e)
|
|
|
+ {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/all/dl")
|
|
|
+ public Response getAllDLModel(@RequestParam(value="userId", required = false) String userId) {
|
|
|
+ try{
|
|
|
+ return new NormalRes(modelService.getAllGeneralModelByUserId(Integer.parseInt(userId)));
|
|
|
+ }catch (Exception e)
|
|
|
+ {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param modelId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/detail/dl")
|
|
|
+ public Response getDLDetailModel(@RequestParam(value="modelId", required = false) String modelId) {
|
|
|
+ try{
|
|
|
+ return new NormalRes(modelService.getDLModelDetailById(Integer.parseInt(modelId)));
|
|
|
+ }catch (Exception e)
|
|
|
+ {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param model
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/add/dl")
|
|
|
+ public Response addDLModel(@RequestBody DLModelVO model){
|
|
|
+ try {
|
|
|
+ int rsl = modelService.addDlModel(model);
|
|
|
+ return rsl != 0? new NormalRes(rsl) : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param modelId
|
|
|
+ * @param modelName
|
|
|
+ * @param modelTypeId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/change")
|
|
|
+ public Response changeModel(@RequestParam(value="modelId", required = false) String modelId,
|
|
|
+ @RequestParam(value="modelName") String modelName,
|
|
|
+ @RequestParam(value="modelTypeId") String modelTypeId) {
|
|
|
+ try{
|
|
|
+ boolean rsl = modelService.changeModel(Integer.parseInt(modelId), modelName, Integer.parseInt(modelTypeId));
|
|
|
+ return rsl? new NormalRes() : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param modelTypeName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/models")
|
|
|
+ public Response getModelType(@RequestParam(value="modelTypeName", required = false) String modelTypeName) {
|
|
|
+ try {
|
|
|
+ return new NormalRes(modelService.getModelTypeByModelTypeName(modelTypeName));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param modelId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value="/train")
|
|
|
+ public Response trainModel(@RequestParam(value="modelId", required = false) String modelId) {
|
|
|
+ try {
|
|
|
+ return new NormalRes(modelService.trainTheModel(Integer.parseInt(modelId)));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param modelId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value="/delete")
|
|
|
+ public Response deleteModelByModelId(@RequestParam(value="modelId", required = false) String modelId){
|
|
|
+ try {
|
|
|
+ return new NormalRes(modelService.deleteModel(Integer.parseInt(modelId)));
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @param file
|
|
|
+ * @param filename
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value="/use/upload")
|
|
|
+ public Response uploadTestFile(@RequestParam(value="userId", required = false) String userId,
|
|
|
+ @RequestParam(value="file", required = false) MultipartFile file,
|
|
|
+ @RequestParam(value="fileName") String filename) {
|
|
|
+ try {
|
|
|
+ TestFileValuePojo rsl = fileService.uploadTestFile(Integer.parseInt(userId), file, filename);
|
|
|
+ return rsl != null ? new NormalRes(rsl) : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param fileId
|
|
|
+ * @param modelId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value="/use")
|
|
|
+ public Response useModel(@RequestParam(value = "fileId", required = false) String fileId,
|
|
|
+ @RequestParam(value = "modelId", required = false) String modelId) {
|
|
|
+ try {
|
|
|
+ return new NormalRes(modelService.useModel(Integer.parseInt(fileId), Integer.parseInt(modelId)));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+| 方法名 | 参数 | 有效返回值 | 功能 | 备注 |
|
|
|
+| -------------------- | -------------------------------------------------- | ------------------------- | ------------------------------------------ | --------------- |
|
|
|
+| addModel | ModelVO model | int | 添加机器学习模型 | 返回值为modelId |
|
|
|
+| getAllModel | String userId | List\<ModelPojo> | 获得某个用户的所有机器学习模型 | |
|
|
|
+| getAllDLModel | String userId | List\<DLGeneralModelPojo> | 获得所有深度学习模型 | |
|
|
|
+| getDLModelDetailById | int modelId | DLModelPojo | 根据模型ID,获得某个深度学习模型的详细信息 | |
|
|
|
+| addDLModel | DLModelVO model | int | 添加深度学习模型 | 返回值为modelId |
|
|
|
+| changeModel | String modelId,String modelName,String modelTypeId | 无 | 改变模型名称和类型 | |
|
|
|
+| getModelType | String modelTypeName | List\<ModelType> | 获得某个模型类型的具体信息 | |
|
|
|
+| trainModel | String modelId | Boolean | 使用机器学习模型进行训练,并返回训练结果 | |
|
|
|
+| deleteModelByModelId | String modelId | Boolean | 通过模型ID删除某个机器学习/深度学习模型 | |
|
|
|
+| uploadTestFile | String userId,MultipartFile file,String filename | TestFileValuePojo | 上传模型需要的测试文件 | |
|
|
|
+| useModel | String fileId,String modelId | List<Map<String, String>> | 使用模型进行预测 | |
|
|
|
+
|
|
|
+# 6. FileController
|
|
|
+
|
|
|
+```java
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/file")
|
|
|
+public class FileController {
|
|
|
+
|
|
|
+ @Autowired private FileService fileService;
|
|
|
+
|
|
|
+ @Autowired private CsvAdapter csvAdapter;
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @return fileId
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/upload")
|
|
|
+ public Response fileLoader(@RequestParam(value="userId", required = false) String userId,
|
|
|
+ @RequestParam(value="file", required = false) MultipartFile file,
|
|
|
+ @RequestParam(value="fileName") String filename) {
|
|
|
+ try {
|
|
|
+ int rsl = fileService.uploadFile(Integer.parseInt(userId), file, filename);
|
|
|
+ return rsl != 0 ? new NormalRes(rsl) : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("error fileLoader");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @param fileLoc
|
|
|
+ * @param fileName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/upload/bigfile")
|
|
|
+ public Response bigFileUploader(@RequestParam(value="userId", required = false) String userId,
|
|
|
+ @RequestParam(value="fileLoc", required = false) String fileLoc,
|
|
|
+ @RequestParam(value="fileName", required = false) String fileName) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ int rsl = csvAdapter.Csv2Parquet(fileLoc, fileName, Integer.parseInt(userId));
|
|
|
+ return rsl != 0 ? new NormalRes(rsl) : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("error bigFileUploader");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/all")
|
|
|
+ public Response getAll(@RequestParam(value="userId", required = false) String userId) {
|
|
|
+ try {
|
|
|
+ return new NormalRes(fileService.getAllFiles(Integer.parseInt(userId)));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("error getAll");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/allfileandfunc")
|
|
|
+ public Response getAllFileAndFunc(@RequestParam(value="userId", required = false)String userId){
|
|
|
+ try {
|
|
|
+
|
|
|
+ return new NormalRes(fileService.getAllFilesAndFunc(Integer.parseInt(userId)));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("error getAllFileAndFunc");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param fileId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/detail")
|
|
|
+ public Response getDetail(@RequestParam(value="fileId", required = false) String fileId){
|
|
|
+ try{
|
|
|
+ return new NormalRes(fileService.getFileDetailInfo(Integer.parseInt(fileId)));
|
|
|
+ } catch (Exception e){
|
|
|
+ log.info("error getDetail");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param fileId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/analysis")
|
|
|
+ public Response analysis(@RequestParam(value="fileId", required = false) String fileId){
|
|
|
+ try{
|
|
|
+ fileService.analysis(Integer.parseInt(fileId));
|
|
|
+ return new NormalRes(fileService.getFileDetailInfo(Integer.parseInt(fileId)));
|
|
|
+ } catch (Exception e){
|
|
|
+ log.info("error analysis");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * for test 数据分布
|
|
|
+ * @param fieldIds
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/analysis/fields1")
|
|
|
+ public Response analysisOfFields(@RequestParam(value="fieldIds", required = false) String[] fieldIds){
|
|
|
+ try{
|
|
|
+ return new NormalRes(fileService.getFieldDistribution(fieldIds));
|
|
|
+ } catch (Exception e){
|
|
|
+ log.info("error analysisOfFields");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param fieldIds
|
|
|
+ * @param funcId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/analysis/fields")
|
|
|
+ public Response analysisOfFields1(@RequestParam(value = "fieldIds", required = false) String[] fieldIds,
|
|
|
+ @RequestParam(value = "funcId", required = false) String funcId){
|
|
|
+ try{
|
|
|
+ return new NormalRes(fileService.getFieldAnalysis(fieldIds, Integer.parseInt(funcId)));
|
|
|
+ } catch (Exception e){
|
|
|
+ log.info("error analysisOfFields1");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param fileId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/delete")
|
|
|
+ public Response delete(@RequestParam(value="fileId", required = false) String fileId){
|
|
|
+ try{
|
|
|
+ return new NormalRes(fileService.deleteFileById(Integer.parseInt(fileId)));
|
|
|
+ } catch (Exception e){
|
|
|
+ log.info("error delete");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param headerInfoUpdatedPojo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "update")
|
|
|
+ public Response updateFileInfo(@RequestBody HeaderInfoUpdatedPojo headerInfoUpdatedPojo){
|
|
|
+ try {
|
|
|
+ boolean rsl = fileService.updateAllHeaders(headerInfoUpdatedPojo.getHeaderInfo(),headerInfoUpdatedPojo.getHeaderNeedUpdate());
|
|
|
+ return rsl? new NormalRes() : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("error updateFileInfo");
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+| 方法名 | 参数 | 有效返回值 | 功能 | 备注 |
|
|
|
+| ----------------- | ------------------------------------------------ | ---------------------------------------- | ---------------------------- | -------------------- |
|
|
|
+| fileLoader | String userId,MultipartFile file,String filename | int | 用户上传结构化文件 | 返回值什么意思不清楚 |
|
|
|
+| bigFileUploader | String userId,String fileLoc,String fileName | int | 用户上传大型的结构化文件 | 返回值什么意思不清楚 |
|
|
|
+| getAll | String userId | List\<FileNamePojo> | 获得用户所有已上传的文件信息 | |
|
|
|
+| getAllFileAndFunc | String userId | FileAndFuncInfoPojo | | 没看懂什么意思 |
|
|
|
+| getDetail | String fileId | FileDetailPojo | 获取文件详细信息 | |
|
|
|
+| analysis | String fileId | FileDetailPojo | 分析文件,并返回文件信息 | |
|
|
|
+| analysisOfFields | String[] fieldIds | HashMap<String, HashMap<String, Object>> | | 没看懂什么意思 |
|
|
|
+| analysisOfFields1 | String[] fieldIds,String funcId | Object | | 没看懂什么意思 |
|
|
|
+| delete | String fileId | Boolean | 删除上传的文件 | |
|
|
|
+| updateFileInfo | HeaderInfoUpdatedPojo headerInfoUpdatedPojo | Boolean | 更新上传的文件信息 | |
|
|
|
+
|
|
|
+# 7. PicController
|
|
|
+
|
|
|
+```java
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/picture")
|
|
|
+public class PicController {
|
|
|
+ @Autowired
|
|
|
+ private PictureService pictureService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param file
|
|
|
+ * @return fileId
|
|
|
+ */
|
|
|
+
|
|
|
+ @PostMapping(value = "/upload")
|
|
|
+ public Response fileLoader(@RequestParam(value = "userId", required = false) String userId,
|
|
|
+ @RequestParam(value = "file", required = false) MultipartFile file,
|
|
|
+ @RequestParam(value = "fileName") String filename) {
|
|
|
+ try {
|
|
|
+ boolean rsl = pictureService.uploadPic(Integer.parseInt(userId), file, filename);
|
|
|
+ return rsl ? new NormalRes() : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/all/proj")
|
|
|
+ public Response getAllProj(@RequestParam(value = "userId", required = false) String userId) {
|
|
|
+ try {
|
|
|
+ return new NormalRes(pictureService.getAllProj(Integer.parseInt(userId)));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param picFileId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/one/proj")
|
|
|
+ public Response getOneProj(@RequestParam(value = "picFileId", required = false) String picFileId) {
|
|
|
+ try {
|
|
|
+ return new NormalRes(pictureService.getOneProj(Integer.parseInt(picFileId)));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param picTag
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/get/pics")
|
|
|
+ public Response getPicInfos(@RequestParam(value = "picTag", required = false) String picTag) {
|
|
|
+ try {
|
|
|
+ return new NormalRes(pictureService.getAllPicAddr(Integer.parseInt(picTag)));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param picId
|
|
|
+ * @param picCategory
|
|
|
+ * @param picTag
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/update/picinfo")
|
|
|
+ public Response updateFileInfo(
|
|
|
+ @RequestParam(value = "picId", required = false) String picId,
|
|
|
+ @RequestParam(value = "picCategory", required = false) String picCategory,
|
|
|
+ @RequestParam(value = "picTag", required = false) String picTag) {
|
|
|
+ try {
|
|
|
+ boolean rsl = pictureService.updatePicInfo(Integer.parseInt(picId), Integer.parseInt(picCategory), picTag);
|
|
|
+ return rsl ? new NormalRes() : new ErrorRes(40002, "Server error.");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ErrorRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+| 方法名 | 参数 | 有效返回值 | 功能 | 备注 |
|
|
|
+| -------------- | ------------------------------------------------ | ---------------------- | ------------------------------------------------------ | ---- |
|
|
|
+| fileLoader | String userId,MultipartFile file,String filename | boolean | 上传图片 | |
|
|
|
+| getAllProj | String userId | List\<PicFilePojo> | 获取该用户所有图片列表,但图片信息只包括图片ID和图片名 | |
|
|
|
+| getOneProj | String picFileId | List\<PicCategoryPojo> | 根据图片ID,获取该图片的分类信息 | |
|
|
|
+| getPicInfos | String picTag | List\<PicInfoPojo> | 根据图片分类(标签),获取该类所有图片的信息 | |
|
|
|
+| updateFileInfo | String picId,String picCategory,String picTag | Boolean | 更新图片信息 | |
|