Jelajahi Sumber

调整所有模块附件上传逻辑

zjc 1 tahun lalu
induk
melakukan
e67cedb33a
25 mengubah file dengan 342 tambahan dan 250 penghapusan
  1. 17 16
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
  2. 8 21
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectChannelController.java
  3. 6 19
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectCompanyController.java
  4. 9 21
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectContractController.java
  5. 8 21
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectInformationController.java
  6. 9 24
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectMeetingController.java
  7. 30 51
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectPoolController.java
  8. 8 21
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectRecordController.java
  9. 8 21
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TStudyInformationController.java
  10. 10 8
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TUnifyFileController.java
  11. 16 0
      ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectChannel.java
  12. 16 0
      ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectCompany.java
  13. 16 0
      ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectContract.java
  14. 16 0
      ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectInformation.java
  15. 16 0
      ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectMeeting.java
  16. 29 0
      ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectPool.java
  17. 18 0
      ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectRecord.java
  18. 16 0
      ruoyi-system/src/main/java/com/ruoyi/invest/domain/TStudyInformation.java
  19. 7 0
      ruoyi-system/src/main/java/com/ruoyi/invest/mapper/TProjectCompanyMapper.java
  20. 6 0
      ruoyi-system/src/main/java/com/ruoyi/invest/service/ITProjectCompanyService.java
  21. 10 0
      ruoyi-system/src/main/java/com/ruoyi/invest/service/impl/TProjectCompanyServiceImpl.java
  22. 0 1
      ruoyi-system/src/main/java/com/ruoyi/invest/service/impl/TProjectContactsServiceImpl.java
  23. 1 1
      ruoyi-system/src/main/resources/mapper/invest/TProjectCirculationMapper.xml
  24. 5 0
      ruoyi-system/src/main/resources/mapper/invest/TProjectCompanyMapper.xml
  25. 57 25
      ruoyi-system/src/main/resources/mapper/invest/TProjectPoolMapper.xml

+ 17 - 16
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java

@@ -4,6 +4,9 @@ import java.util.ArrayList;
 import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.common.enums.FileType;
+import com.ruoyi.tool.domain.TUnifyFile;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -82,11 +85,13 @@ public class CommonController
             // 上传并返回新文件名称
             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());
             AjaxResult ajax = AjaxResult.success();
-            ajax.put("url", url);
-            ajax.put("fileName", fileName);
-            ajax.put("newFileName", FileUtils.getName(fileName));
-            ajax.put("originalFilename", file.getOriginalFilename());
+            ajax.put("file", tUnifyFile);
             return ajax;
         }
         catch (Exception e)
@@ -105,25 +110,21 @@ public class CommonController
         {
             // 上传文件路径
             String filePath = RuoYiConfig.getUploadPath();
-            List<String> urls = new ArrayList<String>();
-            List<String> fileNames = new ArrayList<String>();
-            List<String> newFileNames = new ArrayList<String>();
-            List<String> originalFilenames = new ArrayList<String>();
+            List<TUnifyFile> fileList = new ArrayList<TUnifyFile>();
             for (MultipartFile file : files)
             {
                 // 上传并返回新文件名称
                 String fileName = FileUploadUtils.upload(filePath, file);
                 String url = serverConfig.getUrl() + fileName;
-                urls.add(url);
-                fileNames.add(fileName);
-                newFileNames.add(FileUtils.getName(fileName));
-                originalFilenames.add(file.getOriginalFilename());
+                TUnifyFile tUnifyFile = new TUnifyFile();
+                tUnifyFile.setUploadPath(url);
+                tUnifyFile.setUploadName(fileName);
+                tUnifyFile.setNewUploadName(FileUtils.getName(fileName));
+                tUnifyFile.setUploadFormat(file.getOriginalFilename());
+                fileList.add(tUnifyFile);
             }
             AjaxResult ajax = AjaxResult.success();
-            ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
-            ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
-            ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
-            ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
+            ajax.put("fileList", fileList);
             return ajax;
         }
         catch (Exception e)

+ 8 - 21
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectChannelController.java

@@ -98,34 +98,21 @@ public class TProjectChannelController extends BaseController
     @PreAuthorize("@ss.hasPermi('invest:channel:add')")
     @Log(title = "渠道信息", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TProjectChannel tProjectChannel,List<MultipartFile> files)
+    public AjaxResult add(@RequestBody TProjectChannel tProjectChannel)
     {
         tProjectChannel.setId(IdUtils.fastSimpleUUID());
         tProjectChannel.setCreateBy(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(tProjectChannel.getId());//渠道信息ID
-                tUnifyFile.setUploadType(String.valueOf(FileType.CHANNEL.ordinal()));//文件类型:渠道信息
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tProjectChannel.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:
+                    tUnifyFileList) {
+                tUnifyFile.setFileBusinessId(tProjectChannel.getId());//公司ID
+                tUnifyFile.setUploadType(String.valueOf(FileType.CHANNEL.ordinal()));//文件类型:公司信息
                 tUnifyFile.setCreateBy(getNickName());
                 tUnifyFileService.insertTUnifyFile(tUnifyFile);
             }
         }
-        catch (Exception e)
-        {
-            return AjaxResult.error(e.getMessage());
-        }
         return toAjax(tProjectChannelService.insertTProjectChannel(tProjectChannel));
     }
 

+ 6 - 19
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectCompanyController.java

@@ -98,34 +98,21 @@ public class TProjectCompanyController extends BaseController
     @PreAuthorize("@ss.hasPermi('invest:company:add')")
     @Log(title = "项目公司信息", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TProjectCompany tProjectCompany,List<MultipartFile> files)
+    public AjaxResult add(@RequestBody TProjectCompany tProjectCompany)
     {
         tProjectCompany.setId(IdUtils.fastSimpleUUID());
         tProjectCompany.setCreateBy(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());
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tProjectCompany.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:
+                    tUnifyFileList) {
                 tUnifyFile.setFileBusinessId(tProjectCompany.getId());//公司ID
                 tUnifyFile.setUploadType(String.valueOf(FileType.COMPANY.ordinal()));//文件类型:公司信息
                 tUnifyFile.setCreateBy(getNickName());
                 tUnifyFileService.insertTUnifyFile(tUnifyFile);
             }
         }
-        catch (Exception e)
-        {
-            return AjaxResult.error(e.getMessage());
-        }
         return toAjax(tProjectCompanyService.insertTProjectCompany(tProjectCompany));
     }
 

+ 9 - 21
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectContractController.java

@@ -98,34 +98,22 @@ public class TProjectContractController extends BaseController
     @PreAuthorize("@ss.hasPermi('invest:contract:add')")
     @Log(title = "合同管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TProjectContract tProjectContract,List<MultipartFile> files)
+    public AjaxResult add(@RequestBody TProjectContract tProjectContract)
     {
         tProjectContract.setId(IdUtils.fastSimpleUUID());
         tProjectContract.setCreateBy(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(tProjectContract.getId());//合同管理ID
-                tUnifyFile.setUploadType(String.valueOf(FileType.CONTRACT.ordinal()));//文件类型:合同管理
+
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tProjectContract.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:
+                    tUnifyFileList) {
+                tUnifyFile.setFileBusinessId(tProjectContract.getId());//公司ID
+                tUnifyFile.setUploadType(String.valueOf(FileType.CONTRACT.ordinal()));//文件类型:公司信息
                 tUnifyFile.setCreateBy(getNickName());
                 tUnifyFileService.insertTUnifyFile(tUnifyFile);
             }
         }
-        catch (Exception e)
-        {
-            return AjaxResult.error(e.getMessage());
-        }
         return toAjax(tProjectContractService.insertTProjectContract(tProjectContract));
     }
 

+ 8 - 21
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectInformationController.java

@@ -98,34 +98,21 @@ public class TProjectInformationController extends BaseController
     @PreAuthorize("@ss.hasPermi('invest:information:add')")
     @Log(title = "文件资料", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TProjectInformation tProjectInformation,List<MultipartFile> files)
+    public AjaxResult add(@RequestBody TProjectInformation tProjectInformation)
     {
         tProjectInformation.setId(IdUtils.fastSimpleUUID());
         tProjectInformation.setCreateBy(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(tProjectInformation.getId());//文件资料ID
-                tUnifyFile.setUploadType(String.valueOf(FileType.INFORMATION.ordinal()));//文件类型:文件资料
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tProjectInformation.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:
+                    tUnifyFileList) {
+                tUnifyFile.setFileBusinessId(tProjectInformation.getId());//公司ID
+                tUnifyFile.setUploadType(String.valueOf(FileType.INFORMATION.ordinal()));//文件类型:公司信息
                 tUnifyFile.setCreateBy(getNickName());
                 tUnifyFileService.insertTUnifyFile(tUnifyFile);
             }
         }
-        catch (Exception e)
-        {
-            return AjaxResult.error(e.getMessage());
-        }
         return toAjax(tProjectInformationService.insertTProjectInformation(tProjectInformation));
     }
 

+ 9 - 24
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectMeetingController.java

@@ -50,9 +50,6 @@ public class TProjectMeetingController extends BaseController
     @Autowired
     private ITUnifyFileService tUnifyFileService;
 
-    @Autowired
-    private ServerConfig serverConfig;
-
     /**
      * 查询会议记录列表
      */
@@ -98,34 +95,22 @@ public class TProjectMeetingController extends BaseController
     @PreAuthorize("@ss.hasPermi('invest:meeting:add')")
     @Log(title = "会议记录", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TProjectMeeting tProjectMeeting,List<MultipartFile> files)
+    public AjaxResult add(@RequestBody TProjectMeeting tProjectMeeting)
     {
         tProjectMeeting.setId(IdUtils.fastSimpleUUID());
         tProjectMeeting.setCreateBy(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(tProjectMeeting.getId());//会议记录ID
-                tUnifyFile.setUploadType(String.valueOf(FileType.MEETING.ordinal()));//文件类型:会议记录
+
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tProjectMeeting.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:
+                    tUnifyFileList) {
+                tUnifyFile.setFileBusinessId(tProjectMeeting.getId());//公司ID
+                tUnifyFile.setUploadType(String.valueOf(FileType.MEETING.ordinal()));//文件类型:公司信息
                 tUnifyFile.setCreateBy(getNickName());
                 tUnifyFileService.insertTUnifyFile(tUnifyFile);
             }
         }
-        catch (Exception e)
-        {
-            return AjaxResult.error(e.getMessage());
-        }
         return toAjax(tProjectMeetingService.insertTProjectMeeting(tProjectMeeting));
     }
 

+ 30 - 51
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectPoolController.java

@@ -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());//公司ID
-                    tUnifyFile.setUploadType(String.valueOf(FileType.COMPANY.ordinal()));//文件类型:公司信息
-                    tUnifyFile.setCreateBy(getNickName());
-                    tUnifyFileService.insertTUnifyFile(tUnifyFile);
-                }
+        // todo 设置项目联系人
+        tProjectPool.setProjectContacts(tProjectContacts.getId());
+        // todo 设置公司信息关联关系
+        tProjectCompany.setProjectPoolId(tProjectPool.getId());
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tProjectPool.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:
+                    tUnifyFileList) {
+                tUnifyFile.setFileBusinessId(tProjectCompany.getId());//公司ID
+                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);
         // todo 增加项目创建记录
@@ -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());//公司ID
-                tUnifyFile.setUploadType(String.valueOf(FileType.COMPANY.ordinal()));//文件类型:公司信息
-                tUnifyFile.setCreateBy(getNickName());
-                // todo 修改时删除原附件上传后保存新上传附件内容
-
-                tUnifyFileService.insertTUnifyFile(tUnifyFile);
+        // 上传并返回新文件名称
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tProjectPool.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:tUnifyFileList) {
+                if(tUnifyFile.getId() == null){
+                    tUnifyFile.setFileBusinessId(tProjectCompany.getId());//公司ID
+                    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));

+ 8 - 21
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TProjectRecordController.java

@@ -98,34 +98,21 @@ public class TProjectRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('invest:record:add')")
     @Log(title = "跟进记录", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TProjectRecord tProjectRecord,List<MultipartFile> files)
+    public AjaxResult add(@RequestBody TProjectRecord tProjectRecord)
     {
         tProjectRecord.setId(IdUtils.fastSimpleUUID());
         tProjectRecord.setCreateBy(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(tProjectRecord.getId());//跟进记录ID
-                tUnifyFile.setUploadType(String.valueOf(FileType.RECORD.ordinal()));//文件类型:跟进记录
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tProjectRecord.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:
+                    tUnifyFileList) {
+                tUnifyFile.setFileBusinessId(tProjectRecord.getId());//公司ID
+                tUnifyFile.setUploadType(String.valueOf(FileType.RECORD.ordinal()));//文件类型:公司信息
                 tUnifyFile.setCreateBy(getNickName());
                 tUnifyFileService.insertTUnifyFile(tUnifyFile);
             }
         }
-        catch (Exception e)
-        {
-            return AjaxResult.error(e.getMessage());
-        }
         return toAjax(tProjectRecordService.insertTProjectRecord(tProjectRecord));
     }
 

+ 8 - 21
ruoyi-admin/src/main/java/com/ruoyi/web/controller/invest/TStudyInformationController.java

@@ -98,34 +98,21 @@ public class TStudyInformationController extends BaseController
     @PreAuthorize("@ss.hasPermi('study:gen:add')")
     @Log(title = "研究资料管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TStudyInformation tStudyInformation,List<MultipartFile> files)
+    public AjaxResult add(@RequestBody TStudyInformation tStudyInformation)
     {
         tStudyInformation.setId(IdUtils.fastSimpleUUID());
         tStudyInformation.setCreateBy(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(tStudyInformation.getId());//研究资料ID
-                tUnifyFile.setUploadType(String.valueOf(FileType.GEN.ordinal()));//文件类型:研究资料
+        // todo 保存附件信息
+        List<TUnifyFile> tUnifyFileList = tStudyInformation.getListFile();
+        if(!tUnifyFileList.isEmpty()){
+            for (TUnifyFile tUnifyFile:
+                    tUnifyFileList) {
+                tUnifyFile.setFileBusinessId(tStudyInformation.getId());//公司ID
+                tUnifyFile.setUploadType(String.valueOf(FileType.GEN.ordinal()));//文件类型:公司信息
                 tUnifyFile.setCreateBy(getNickName());
                 tUnifyFileService.insertTUnifyFile(tUnifyFile);
             }
         }
-        catch (Exception e)
-        {
-            return AjaxResult.error(e.getMessage());
-        }
         return toAjax(tStudyInformationService.insertTStudyInformation(tStudyInformation));
     }
 

+ 10 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TUnifyFileController.java

@@ -13,6 +13,7 @@ import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.framework.config.ServerConfig;
 import com.ruoyi.web.controller.common.CommonController;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.http.MediaType;
@@ -58,7 +59,7 @@ public class TUnifyFileController extends BaseController
     /**
      * 查询附件列表
      */
-    @PreAuthorize("@ss.hasPermi('system:file:list')")
+    @ApiOperation("查询附件列表")
     @GetMapping("/list")
     public TableDataInfo list(TUnifyFile tUnifyFile)
     {
@@ -70,7 +71,7 @@ public class TUnifyFileController extends BaseController
     /**
      * 导出附件列表
      */
-    @PreAuthorize("@ss.hasPermi('system:file:export')")
+    @ApiOperation("导出附件列表")
     @Log(title = "附件", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, TUnifyFile tUnifyFile)
@@ -83,7 +84,7 @@ public class TUnifyFileController extends BaseController
     /**
      * 获取附件详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:file:query')")
+    @ApiOperation("获取附件详细信息")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") String id)
     {
@@ -93,7 +94,7 @@ public class TUnifyFileController extends BaseController
     /**
      * 新增附件
      */
-    @PreAuthorize("@ss.hasPermi('system:file:add')")
+    @ApiOperation("新增附件")
     @Log(title = "附件", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TUnifyFile tUnifyFile)
@@ -105,7 +106,7 @@ public class TUnifyFileController extends BaseController
     /**
      * 修改附件
      */
-    @PreAuthorize("@ss.hasPermi('system:file:edit')")
+    @ApiOperation("修改附件")
     @Log(title = "附件", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TUnifyFile tUnifyFile)
@@ -116,7 +117,7 @@ public class TUnifyFileController extends BaseController
     /**
      * 删除附件
      */
-    @PreAuthorize("@ss.hasPermi('system:file:remove')")
+    @ApiOperation("删除附件")
     @Log(title = "附件", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable String[] ids)
@@ -127,7 +128,7 @@ public class TUnifyFileController extends BaseController
     /**
      * 上传附件
      */
-    @PreAuthorize("@ss.hasPermi('system:file:add')")
+    @ApiOperation("上传附件")
     @Log(title = "附件", businessType = BusinessType.INSERT)
     @PostMapping("/uploads")
     public AjaxResult uploadFiles(List<MultipartFile> files)
@@ -158,6 +159,7 @@ public class TUnifyFileController extends BaseController
         }
     }
 
+    @ApiOperation("下载")
     @GetMapping("/download/{id}")
     public void fileDownload(@PathVariable("id")String id, HttpServletResponse response, HttpServletRequest request){
         try
@@ -186,7 +188,7 @@ public class TUnifyFileController extends BaseController
     /**
      * 根据附件业务ID()获取附件详情信息列表
      */
-    @PreAuthorize("@ss.hasPermi('system:file:query')")
+    @ApiOperation("根据附件业务ID()获取附件详情信息列表")
     @GetMapping("/listFileBusinessId")
     public AjaxResult listFileBusinessId(String fileBusinessId)
     {

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectChannel.java

@@ -1,10 +1,13 @@
 package com.ruoyi.invest.domain;
 
+import com.ruoyi.tool.domain.TUnifyFile;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import java.util.List;
+
 /**
  * 渠道信息对象 t_project_channel
  * 
@@ -58,6 +61,11 @@ public class TProjectChannel extends BaseEntity
     /** 是否删除 */
     private String delFlag;
 
+    /**
+     * 附件信息
+     */
+    private List<TUnifyFile> listFile;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -167,6 +175,14 @@ public class TProjectChannel extends BaseEntity
         return delFlag;
     }
 
+    public List<TUnifyFile> getListFile() {
+        return listFile;
+    }
+
+    public void setListFile(List<TUnifyFile> listFile) {
+        this.listFile = listFile;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectCompany.java

@@ -1,7 +1,10 @@
 package com.ruoyi.invest.domain;
 
 import java.util.Date;
+import java.util.List;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.tool.domain.TUnifyFile;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -66,6 +69,11 @@ public class TProjectCompany extends BaseEntity
     /** 状态 */
     private String delFlag;
 
+    /**
+     * 附件信息
+     */
+    private List<TUnifyFile> listFile;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -193,6 +201,14 @@ public class TProjectCompany extends BaseEntity
         return delFlag;
     }
 
+    public List<TUnifyFile> getListFile() {
+        return listFile;
+    }
+
+    public void setListFile(List<TUnifyFile> listFile) {
+        this.listFile = listFile;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectContract.java

@@ -1,10 +1,13 @@
 package com.ruoyi.invest.domain;
 
+import com.ruoyi.tool.domain.TUnifyFile;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import java.util.List;
+
 /**
  * 合同管理对象 t_project_contract
  * 
@@ -44,6 +47,11 @@ public class TProjectContract extends BaseEntity
     /** 附件业务ID */
     private String fileBusinessId;
 
+    /**
+     * 附件信息
+     */
+    private List<TUnifyFile> listFile;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -117,6 +125,14 @@ public class TProjectContract extends BaseEntity
         return fileBusinessId;
     }
 
+    public List<TUnifyFile> getListFile() {
+        return listFile;
+    }
+
+    public void setListFile(List<TUnifyFile> listFile) {
+        this.listFile = listFile;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectInformation.java

@@ -1,10 +1,13 @@
 package com.ruoyi.invest.domain;
 
+import com.ruoyi.tool.domain.TUnifyFile;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import java.util.List;
+
 /**
  * 文件资料对象 t_project_information
  * 
@@ -43,6 +46,11 @@ public class TProjectInformation extends BaseEntity
     /** 状态 */
     private String delFlag;
 
+    /**
+     * 附件信息
+     */
+    private List<TUnifyFile> listFile;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -116,6 +124,14 @@ public class TProjectInformation extends BaseEntity
         return delFlag;
     }
 
+    public List<TUnifyFile> getListFile() {
+        return listFile;
+    }
+
+    public void setListFile(List<TUnifyFile> listFile) {
+        this.listFile = listFile;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectMeeting.java

@@ -1,7 +1,10 @@
 package com.ruoyi.invest.domain;
 
 import java.util.Date;
+import java.util.List;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.tool.domain.TUnifyFile;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -59,6 +62,11 @@ public class TProjectMeeting extends BaseEntity
     /** 状态 */
     private String delFlag;
 
+    /**
+     * 附件信息
+     */
+    private List<TUnifyFile> listFile;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -159,6 +167,14 @@ public class TProjectMeeting extends BaseEntity
         return delFlag;
     }
 
+    public List<TUnifyFile> getListFile() {
+        return listFile;
+    }
+
+    public void setListFile(List<TUnifyFile> listFile) {
+        this.listFile = listFile;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 29 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectPool.java

@@ -1,7 +1,10 @@
 package com.ruoyi.invest.domain;
 
 import java.util.Date;
+import java.util.List;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.tool.domain.TUnifyFile;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -141,6 +144,16 @@ public class TProjectPool extends BaseEntity
     /** 公司信息 */
     private TProjectContacts tProjectContacts;
 
+    /**
+     * 附件信息
+     */
+    private List<TUnifyFile> listFile;
+
+    /**
+     * 阶段名称
+     */
+    private String stageName;
+
 
     public void setId(String id) 
     {
@@ -429,6 +442,22 @@ public class TProjectPool extends BaseEntity
         this.tProjectContacts = tProjectContacts;
     }
 
+    public List<TUnifyFile> getListFile() {
+        return listFile;
+    }
+
+    public void setListFile(List<TUnifyFile> listFile) {
+        this.listFile = listFile;
+    }
+
+    public String getStageName() {
+        return stageName;
+    }
+
+    public void setStageName(String stageName) {
+        this.stageName = stageName;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 18 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/domain/TProjectRecord.java

@@ -1,7 +1,11 @@
 package com.ruoyi.invest.domain;
 
 import java.util.Date;
+import java.util.List;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.tool.domain.TUnifyFile;
+import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -14,6 +18,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * @author ruoyi
  * @date 2024-02-21
  */
+@ApiModel("跟进记录对象")
 public class TProjectRecord extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -60,6 +65,11 @@ public class TProjectRecord extends BaseEntity
     @ApiModelProperty("状态")
     private String delFlag;
 
+    /**
+     * 附件信息
+     */
+    private List<TUnifyFile> listFile;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -142,6 +152,14 @@ public class TProjectRecord extends BaseEntity
         return delFlag;
     }
 
+    public List<TUnifyFile> getListFile() {
+        return listFile;
+    }
+
+    public void setListFile(List<TUnifyFile> listFile) {
+        this.listFile = listFile;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/domain/TStudyInformation.java

@@ -1,10 +1,13 @@
 package com.ruoyi.invest.domain;
 
+import com.ruoyi.tool.domain.TUnifyFile;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import java.util.List;
+
 /**
  * 研究资料管理对象 t_study_information
  * 
@@ -33,6 +36,11 @@ public class TStudyInformation extends BaseEntity
     @Excel(name = "附件业务ID")
     private String fileBusinessId;
 
+    /**
+     * 附件信息
+     */
+    private List<TUnifyFile> listFile;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -79,6 +87,14 @@ public class TStudyInformation extends BaseEntity
         return fileBusinessId;
     }
 
+    public List<TUnifyFile> getListFile() {
+        return listFile;
+    }
+
+    public void setListFile(List<TUnifyFile> listFile) {
+        this.listFile = listFile;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/mapper/TProjectCompanyMapper.java

@@ -67,4 +67,11 @@ public interface TProjectCompanyMapper
      * @return 结果
      */
     public int updateTProjectCompanyByIds(String[] ids);
+
+    /**
+     * 根据项目ID查询项目公司信息
+     * @param projectPoolId
+     * @return
+     */
+    TProjectCompany selectTProjectCompanyByProjectPoolId(String projectPoolId);
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/service/ITProjectCompanyService.java

@@ -68,4 +68,10 @@ public interface ITProjectCompanyService
      */
     public int updateTProjectCompanyByIds(String[] ids);
 
+    /**
+     * 根据项目ID查询项目公司信息
+     * @param projectPoolId
+     * @return
+     */
+    TProjectCompany selectTProjectCompanyByProjectPoolId(String projectPoolId);
 }

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/invest/service/impl/TProjectCompanyServiceImpl.java

@@ -105,4 +105,14 @@ public class TProjectCompanyServiceImpl implements ITProjectCompanyService
     public int updateTProjectCompanyByIds(String[] ids) {
         return tProjectCompanyMapper.updateTProjectCompanyByIds(ids);
     }
+
+    /**
+     * 根据项目ID查询项目公司信息
+     * @param projectPoolId
+     * @return
+     */
+    @Override
+    public TProjectCompany selectTProjectCompanyByProjectPoolId(String projectPoolId) {
+        return tProjectCompanyMapper.selectTProjectCompanyByProjectPoolId(projectPoolId);
+    }
 }

+ 0 - 1
ruoyi-system/src/main/java/com/ruoyi/invest/service/impl/TProjectContactsServiceImpl.java

@@ -55,7 +55,6 @@ public class TProjectContactsServiceImpl implements ITProjectContactsService
     public int insertTProjectContacts(TProjectContacts tProjectContacts)
     {
         tProjectContacts.setCreateTime(DateUtils.getNowDate());
-        tProjectContacts.setId(IdUtils.fastSimpleUUID());
         return tProjectContactsMapper.insertTProjectContacts(tProjectContacts);
     }
 

+ 1 - 1
ruoyi-system/src/main/resources/mapper/invest/TProjectCirculationMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.system.mapper.TProjectCirculationMapper">
+<mapper namespace="com.ruoyi.invest.mapper.TProjectCirculationMapper">
     
     <resultMap type="TProjectCirculation" id="TProjectCirculationResult">
         <result property="id"    column="id"    />

+ 5 - 0
ruoyi-system/src/main/resources/mapper/invest/TProjectCompanyMapper.xml

@@ -134,5 +134,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
 
+    <select id="selectTProjectCompanyByProjectPoolId" parameterType="String" resultMap="TProjectCompanyResult">
+        <include refid="selectTProjectCompanyVo"/>
+        where project_pool_id = #{projectPoolId}
+    </select>
+
 
 </mapper>

File diff ditekan karena terlalu besar
+ 57 - 25
ruoyi-system/src/main/resources/mapper/invest/TProjectPoolMapper.xml