实现庭审笔录上传
This commit is contained in:
@@ -33,4 +33,6 @@ public interface CaseAttachMapper {
|
||||
* @param annexType
|
||||
*/
|
||||
void deleteByCasedIdAndType(@Param("caseAppliId")Long caseAppliId,@Param("annexType") int annexType,@Param("isBatchUpload") int isBatchUpload);
|
||||
|
||||
void deleteCaseAttachByCasedIdAndType(@Param("caseAppliId")Long caseAppliId,@Param("annexType") int annexType);
|
||||
}
|
||||
|
||||
@@ -65,4 +65,6 @@ public interface ICaseEvidenceService {
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
List<CaseEvidenceDirectoryVO> buildCaseEvidenceTreeSelect(List<CaseEvidenceDirectory> caseEvidenceDirectorys);
|
||||
|
||||
AjaxResult uploadRecord(MultipartFile file, Integer annexType, Long id, String username, Long userId);
|
||||
}
|
||||
|
||||
+38
@@ -400,6 +400,44 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
|
||||
return caseEvidenceDirectories.stream().map(CaseEvidenceDirectoryVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult uploadRecord(MultipartFile file, Integer annexType, Long id, String username, Long userId) {
|
||||
if (file.isEmpty()) {
|
||||
return AjaxResult.error("请选择要上传的文件");
|
||||
}
|
||||
try {
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
|
||||
.annexName(fileName)
|
||||
.annexPath(filePath)
|
||||
.annexType(annexType)
|
||||
.userId(userId)
|
||||
.userName(username)
|
||||
.build();
|
||||
|
||||
CaseApplication caseApplicationsel = new CaseApplication();
|
||||
caseApplicationsel.setId(id);
|
||||
caseApplicationsel.setAnnexType(7);
|
||||
List<CaseAttach> caseAttachs = caseAttachMapper.queryCaseAttachList(caseApplicationsel);
|
||||
if(caseAttachs!=null&&caseAttachs.size()>0){
|
||||
caseAttachMapper.deleteCaseAttachByCasedIdAndType(id,7);
|
||||
int count = caseAttachMapper.save(caseAttach);
|
||||
}else {
|
||||
int count = caseAttachMapper.save(caseAttach);
|
||||
}
|
||||
|
||||
return AjaxResult.success("上传成功");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return AjaxResult.error("上传失败");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user