eeb29e78 by 荆蔚杰

文件上传和排序接口整合

1 parent e0d189e5
......@@ -34,6 +34,12 @@ public class AddDgFileRequest implements Serializable {
private String bsmCatalog;
/**
* 档案标识码
*/
@ApiModelProperty(name = "bsmArchive", value = "档案标识码")
private String bsmArchive;
/**
* 文件类型
*/
@ApiModelProperty(name = "kzm", value = "文件类型")
......
......@@ -16,6 +16,12 @@ public class DgCatalogWithFileVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 档案标识码
*/
@ApiModelProperty(name = "bsmArchive", value = "档案标识码")
private String bsmArchive;
/**
* 目录标识码
*/
@ApiModelProperty(name = "bsmCatalog", value = "目录标识码")
......
......@@ -65,5 +65,5 @@ public interface DgFileService extends IService<DgFileDO> {
* @param fileRequest
* @return
*/
boolean upload(MultipartFile file, AddDgFileRequest fileRequest) throws IOException;
List<DgCatalogWithFileVO> upload(MultipartFile file, AddDgFileRequest fileRequest) throws IOException;
}
......
......@@ -124,15 +124,15 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple
/**
* 上传材料附件.材料附件信息入库
*
* @param file
* @param uploadFile
* @param fileRequest
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean upload(MultipartFile file, AddDgFileRequest fileRequest) throws IOException {
public List<DgCatalogWithFileVO> upload(MultipartFile uploadFile, AddDgFileRequest fileRequest) throws IOException {
//文件上传
FileAttribute fileAttribute = minioUtil.upload(file);
FileAttribute fileAttribute = minioUtil.upload(uploadFile);
Integer firstXh = fileRequest.getXh();
String firstBsmCatalog = fileRequest.getBsmCatalog();
......@@ -153,7 +153,13 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple
fileWrapper.lambda().eq(DgFileDO::getBsmCatalog, firstBsmCatalog).gt(DgFileDO::getXh, firstXh + 1);
List<DgFileDO> list = this.list(fileWrapper);
list.forEach(item -> item.setXh(item.getXh() + 1));
return this.updateBatchById(list);
this.updateBatchById(list);
List<DgCatalogWithFileVO> fileList = dgfileMapper.getFileList(fileRequest.getBsmArchive());
fileList.forEach(item->item.getFileLists().forEach(file->file.setSaveUrl(file.getFjurl())));
fileList.forEach(catalogWithFiles->catalogWithFiles.getFileLists().forEach(file->file.setFjurl(minioUtil.getPreviewUrl(file.getFjurl()))));
return fileList;
}
......
......@@ -26,6 +26,7 @@
</sql>
<resultMap id="result" type="com.pashanhoo.file.entity.vo.DgCatalogWithFileVO">
<result column="BSM_ARCHIVES" property="bsmArchive"/>
<result column="bsm_catalog" property="bsmCatalog"/>
<result column="wjmc" property="wjmc"/>
<result column="catalogXh" property="catalogXh"/>
......@@ -42,9 +43,10 @@
</resultMap>
<select id="getFileList" resultMap="result">
select DF.*, DAC.XH as catalogXh, DAC.WJMC,DAC.BSM_CATALOG
select DF.*, DAC.XH as catalogXh, DAC.WJMC,DAC.BSM_CATALOG,DA.BSM_ARCHIVES
from DG_FILE DF
join DG_ARCHIVES_CATALOG DAC on DAC.BSM_CATALOG = DF.BSM_CATALOG
join DG_ARCHIVES DA on DAC.BSM_ARCHIVES = DA.BSM_ARCHIVES
<where>
<if test="bsmArchive != null and bsmArchive != ''">
BSM_ARCHIVES = #{bsmArchive,jdbcType=VARCHAR}
......