|
@@ -103,9 +103,7 @@ public class TProjectPoolController extends BaseController
|
|
|
@GetMapping(value = "/{id}")
|
|
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
|
|
{
|
|
|
- TProjectPool tProjectPool = tProjectPoolService.selectTProjectPoolById(id);
|
|
|
-
|
|
|
- return success(tProjectPool);
|
|
|
+ return success(tProjectPoolService.selectTProjectPoolById(id));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -115,7 +113,7 @@ public class TProjectPoolController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('invest:pool:add')")
|
|
|
@Log(title = "项目池", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody TProjectPool tProjectPool,List<MultipartFile> files)
|
|
|
+ public AjaxResult add(@RequestBody TProjectPool tProjectPool)
|
|
|
{
|
|
|
tProjectPool.setCreateBy(getNickName());
|
|
|
tProjectPool.setId(IdUtils.fastSimpleUUID());
|
|
@@ -125,31 +123,22 @@ public class TProjectPoolController extends BaseController
|
|
|
TProjectContacts tProjectContacts = tProjectPool.gettProjectContacts();
|
|
|
tProjectContacts.setCreateBy(getNickName());
|
|
|
tProjectContacts.setId(IdUtils.fastSimpleUUID());
|
|
|
- try {
|
|
|
-
|
|
|
- String filePath = RuoYiConfig.getUploadPath();
|
|
|
- if(!files.isEmpty()){
|
|
|
- for (MultipartFile file : files)
|
|
|
- {
|
|
|
-
|
|
|
- String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
- String url = serverConfig.getUrl() + fileName;
|
|
|
- TUnifyFile tUnifyFile = new TUnifyFile();
|
|
|
- tUnifyFile.setUploadPath(url);
|
|
|
- tUnifyFile.setUploadName(fileName);
|
|
|
- tUnifyFile.setNewUploadName(FileUtils.getName(fileName));
|
|
|
- tUnifyFile.setUploadFormat(file.getOriginalFilename());
|
|
|
- tUnifyFile.setFileBusinessId(tProjectCompany.getId());
|
|
|
- tUnifyFile.setUploadType(String.valueOf(FileType.COMPANY.ordinal()));
|
|
|
- tUnifyFile.setCreateBy(getNickName());
|
|
|
- tUnifyFileService.insertTUnifyFile(tUnifyFile);
|
|
|
- }
|
|
|
+
|
|
|
+ tProjectPool.setProjectContacts(tProjectContacts.getId());
|
|
|
+
|
|
|
+ tProjectCompany.setProjectPoolId(tProjectPool.getId());
|
|
|
+
|
|
|
+ List<TUnifyFile> tUnifyFileList = tProjectPool.getListFile();
|
|
|
+ if(!tUnifyFileList.isEmpty()){
|
|
|
+ for (TUnifyFile tUnifyFile:
|
|
|
+ tUnifyFileList) {
|
|
|
+ tUnifyFile.setFileBusinessId(tProjectCompany.getId());
|
|
|
+ tUnifyFile.setUploadType(String.valueOf(FileType.COMPANY.ordinal()));
|
|
|
+ tUnifyFile.setCreateBy(getNickName());
|
|
|
+ tUnifyFileService.insertTUnifyFile(tUnifyFile);
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- return AjaxResult.error(e.getMessage());
|
|
|
- }
|
|
|
+
|
|
|
tProjectCompanyService.insertTProjectCompany(tProjectCompany);
|
|
|
tProjectContactsService.insertTProjectContacts(tProjectContacts);
|
|
|
|
|
@@ -169,38 +158,28 @@ public class TProjectPoolController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('invest:pool:edit')")
|
|
|
@Log(title = "项目池", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody TProjectPool tProjectPool,List<MultipartFile> files)
|
|
|
+ public AjaxResult edit(@RequestBody TProjectPool tProjectPool)
|
|
|
{
|
|
|
tProjectPool.setUpdateBy(getNickName());
|
|
|
TProjectCompany tProjectCompany = tProjectPool.gettProjectCompany();
|
|
|
tProjectCompany.setUpdateBy(getNickName());
|
|
|
TProjectContacts tProjectContacts = tProjectPool.gettProjectContacts();
|
|
|
tProjectContacts.setUpdateBy(getNickName());
|
|
|
- try {
|
|
|
-
|
|
|
- String filePath = RuoYiConfig.getUploadPath();
|
|
|
- for (MultipartFile file : files)
|
|
|
- {
|
|
|
-
|
|
|
- String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
- String url = serverConfig.getUrl() + fileName;
|
|
|
- TUnifyFile tUnifyFile = new TUnifyFile();
|
|
|
- tUnifyFile.setUploadPath(url);
|
|
|
- tUnifyFile.setUploadName(fileName);
|
|
|
- tUnifyFile.setNewUploadName(FileUtils.getName(fileName));
|
|
|
- tUnifyFile.setUploadFormat(file.getOriginalFilename());
|
|
|
- tUnifyFile.setFileBusinessId(tProjectCompany.getId());
|
|
|
- tUnifyFile.setUploadType(String.valueOf(FileType.COMPANY.ordinal()));
|
|
|
- tUnifyFile.setCreateBy(getNickName());
|
|
|
-
|
|
|
-
|
|
|
- tUnifyFileService.insertTUnifyFile(tUnifyFile);
|
|
|
+
|
|
|
+
|
|
|
+ List<TUnifyFile> tUnifyFileList = tProjectPool.getListFile();
|
|
|
+ if(!tUnifyFileList.isEmpty()){
|
|
|
+ for (TUnifyFile tUnifyFile:tUnifyFileList) {
|
|
|
+ if(tUnifyFile.getId() == null){
|
|
|
+ tUnifyFile.setFileBusinessId(tProjectCompany.getId());
|
|
|
+ tUnifyFile.setUploadType(String.valueOf(FileType.COMPANY.ordinal()));
|
|
|
+ tUnifyFile.setCreateBy(getNickName());
|
|
|
+ tUnifyFileService.insertTUnifyFile(tUnifyFile);
|
|
|
+ }else{
|
|
|
+ tUnifyFileService.updateTUnifyFile(tUnifyFile);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- return AjaxResult.error(e.getMessage());
|
|
|
- }
|
|
|
tProjectCompanyService.updateTProjectCompany(tProjectCompany);
|
|
|
tProjectContactsService.updateTProjectContacts(tProjectContacts);
|
|
|
return toAjax(tProjectPoolService.updateTProjectPool(tProjectPool));
|