实现庭审笔录上传

This commit is contained in:
qitz
2023-12-12 11:49:48 +08:00
parent 4be7832789
commit 5558debc20
5 changed files with 64 additions and 0 deletions
@@ -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);
}
@@ -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("上传失败");
}
/**
* 递归列表
*/
@@ -62,6 +62,12 @@
</where>
</select>
<delete id="deleteCaseAttachByCasedIdAndType">
delete from case_attach
where case_appli_id = #{caseAppliId}
and annex_type = #{annexType}
</delete>
<select id="queryCaseAttachList" resultMap="CaseAttachResult">
select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
from case_attach