案件列表联调
This commit is contained in:
@@ -77,7 +77,7 @@ public class CommonController
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType, @RequestParam("id") Long id) throws Exception
|
||||
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -86,8 +86,10 @@ public class CommonController
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
saveCaseAttach(id, annexType, fileName,file.getOriginalFilename());
|
||||
Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("annexId", annexId);
|
||||
ajax.put("annexType", annexType);
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
@@ -102,13 +104,13 @@ public class CommonController
|
||||
|
||||
/**
|
||||
* 保存到案件附件表
|
||||
* @param id
|
||||
* @param
|
||||
* @param annexType
|
||||
* @param fileName
|
||||
* @param originalFilename
|
||||
*/
|
||||
private void saveCaseAttach(Long id, Integer annexType, String fileName, String originalFilename) {
|
||||
MsCaseAttach caseAttach = MsCaseAttach.builder().caseAppliId(id)
|
||||
private Long saveCaseAttach(Integer annexType, String fileName, String originalFilename) {
|
||||
MsCaseAttach caseAttach = MsCaseAttach.builder()
|
||||
.annexName(originalFilename)
|
||||
.annexPath(fileName)
|
||||
.annexType(annexType)
|
||||
@@ -116,6 +118,7 @@ public class CommonController
|
||||
.useAccount(SecurityUtils.getUsername())
|
||||
.build();
|
||||
msCaseAttachMapper.save(caseAttach);
|
||||
return caseAttach.getAnnexId();
|
||||
}
|
||||
/**
|
||||
* 根据案件id获取附件
|
||||
@@ -140,7 +143,7 @@ public class CommonController
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(@RequestParam("files") MultipartFile[] files, @RequestParam("annexType")Integer annexType, @RequestParam("id")Long id ) throws Exception
|
||||
public AjaxResult uploadFiles(@RequestParam("files") MultipartFile[] files, @RequestParam("annexType")Integer annexType ) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -150,6 +153,7 @@ public class CommonController
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
List<Long> annexIds = new ArrayList<>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
@@ -159,9 +163,12 @@ public class CommonController
|
||||
fileNames.add(fileName);
|
||||
newFileNames.add(FileUtils.getName(fileName));
|
||||
originalFilenames.add(file.getOriginalFilename());
|
||||
saveCaseAttach(id, annexType, fileName,file.getOriginalFilename());
|
||||
Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename());
|
||||
annexIds.add(annexId);
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("annexIds", annexIds);
|
||||
ajax.put("annexType", annexType);
|
||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
|
||||
+37
@@ -7,8 +7,10 @@ import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
||||
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 案件列表控制层
|
||||
@@ -42,6 +44,41 @@ public class MsCaseApplicationController extends BaseController {
|
||||
return success(caseApplicationService.insert(caseApplication));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改案件
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody MsCaseApplicationVO caseApplication )
|
||||
{
|
||||
if(caseApplication.getId()==null){
|
||||
error("id不能为空");
|
||||
}
|
||||
return caseApplicationService.update(caseApplication);
|
||||
}
|
||||
/**
|
||||
* 根据id查询案件
|
||||
*/
|
||||
@GetMapping("/selectById")
|
||||
public AjaxResult selectById(@RequestParam Long id )
|
||||
{
|
||||
if(id==null){
|
||||
error("id不能为空");
|
||||
}
|
||||
return success(caseApplicationService.selectById(id));
|
||||
}
|
||||
/**
|
||||
* 案件压缩包导入
|
||||
* @param file
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/uploadCaseZipFile")
|
||||
public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file, @RequestParam("templateId") Long templateId) throws IOException {
|
||||
if(file.isEmpty()||templateId==null){
|
||||
return error("参数不能为空");
|
||||
}
|
||||
return caseApplicationService.uploadCaseZipFile(file,templateId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user