文件上传和排序接口整合
Showing
5 changed files
with
26 additions
and
6 deletions
| ... | @@ -34,6 +34,12 @@ public class AddDgFileRequest implements Serializable { | ... | @@ -34,6 +34,12 @@ public class AddDgFileRequest implements Serializable { |
| 34 | private String bsmCatalog; | 34 | private String bsmCatalog; |
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | * 档案标识码 | ||
| 38 | */ | ||
| 39 | @ApiModelProperty(name = "bsmArchive", value = "档案标识码") | ||
| 40 | private String bsmArchive; | ||
| 41 | |||
| 42 | /** | ||
| 37 | * 文件类型 | 43 | * 文件类型 |
| 38 | */ | 44 | */ |
| 39 | @ApiModelProperty(name = "kzm", value = "文件类型") | 45 | @ApiModelProperty(name = "kzm", value = "文件类型") | ... | ... |
| ... | @@ -16,6 +16,12 @@ public class DgCatalogWithFileVO implements Serializable { | ... | @@ -16,6 +16,12 @@ public class DgCatalogWithFileVO implements Serializable { |
| 16 | private static final long serialVersionUID = 1L; | 16 | private static final long serialVersionUID = 1L; |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * 档案标识码 | ||
| 20 | */ | ||
| 21 | @ApiModelProperty(name = "bsmArchive", value = "档案标识码") | ||
| 22 | private String bsmArchive; | ||
| 23 | |||
| 24 | /** | ||
| 19 | * 目录标识码 | 25 | * 目录标识码 |
| 20 | */ | 26 | */ |
| 21 | @ApiModelProperty(name = "bsmCatalog", value = "目录标识码") | 27 | @ApiModelProperty(name = "bsmCatalog", value = "目录标识码") | ... | ... |
| ... | @@ -65,5 +65,5 @@ public interface DgFileService extends IService<DgFileDO> { | ... | @@ -65,5 +65,5 @@ public interface DgFileService extends IService<DgFileDO> { |
| 65 | * @param fileRequest | 65 | * @param fileRequest |
| 66 | * @return | 66 | * @return |
| 67 | */ | 67 | */ |
| 68 | boolean upload(MultipartFile file, AddDgFileRequest fileRequest) throws IOException; | 68 | List<DgCatalogWithFileVO> upload(MultipartFile file, AddDgFileRequest fileRequest) throws IOException; |
| 69 | } | 69 | } | ... | ... |
| ... | @@ -124,15 +124,15 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple | ... | @@ -124,15 +124,15 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple |
| 124 | /** | 124 | /** |
| 125 | * 上传材料附件.材料附件信息入库 | 125 | * 上传材料附件.材料附件信息入库 |
| 126 | * | 126 | * |
| 127 | * @param file | 127 | * @param uploadFile |
| 128 | * @param fileRequest | 128 | * @param fileRequest |
| 129 | * @return | 129 | * @return |
| 130 | */ | 130 | */ |
| 131 | @Override | 131 | @Override |
| 132 | @Transactional(rollbackFor = Exception.class) | 132 | @Transactional(rollbackFor = Exception.class) |
| 133 | public boolean upload(MultipartFile file, AddDgFileRequest fileRequest) throws IOException { | 133 | public List<DgCatalogWithFileVO> upload(MultipartFile uploadFile, AddDgFileRequest fileRequest) throws IOException { |
| 134 | //文件上传 | 134 | //文件上传 |
| 135 | FileAttribute fileAttribute = minioUtil.upload(file); | 135 | FileAttribute fileAttribute = minioUtil.upload(uploadFile); |
| 136 | 136 | ||
| 137 | Integer firstXh = fileRequest.getXh(); | 137 | Integer firstXh = fileRequest.getXh(); |
| 138 | String firstBsmCatalog = fileRequest.getBsmCatalog(); | 138 | String firstBsmCatalog = fileRequest.getBsmCatalog(); |
| ... | @@ -153,7 +153,13 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple | ... | @@ -153,7 +153,13 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple |
| 153 | fileWrapper.lambda().eq(DgFileDO::getBsmCatalog, firstBsmCatalog).gt(DgFileDO::getXh, firstXh + 1); | 153 | fileWrapper.lambda().eq(DgFileDO::getBsmCatalog, firstBsmCatalog).gt(DgFileDO::getXh, firstXh + 1); |
| 154 | List<DgFileDO> list = this.list(fileWrapper); | 154 | List<DgFileDO> list = this.list(fileWrapper); |
| 155 | list.forEach(item -> item.setXh(item.getXh() + 1)); | 155 | list.forEach(item -> item.setXh(item.getXh() + 1)); |
| 156 | return this.updateBatchById(list); | 156 | this.updateBatchById(list); |
| 157 | |||
| 158 | List<DgCatalogWithFileVO> fileList = dgfileMapper.getFileList(fileRequest.getBsmArchive()); | ||
| 159 | fileList.forEach(item->item.getFileLists().forEach(file->file.setSaveUrl(file.getFjurl()))); | ||
| 160 | fileList.forEach(catalogWithFiles->catalogWithFiles.getFileLists().forEach(file->file.setFjurl(minioUtil.getPreviewUrl(file.getFjurl())))); | ||
| 161 | |||
| 162 | return fileList; | ||
| 157 | } | 163 | } |
| 158 | 164 | ||
| 159 | 165 | ... | ... |
| ... | @@ -26,6 +26,7 @@ | ... | @@ -26,6 +26,7 @@ |
| 26 | </sql> | 26 | </sql> |
| 27 | 27 | ||
| 28 | <resultMap id="result" type="com.pashanhoo.file.entity.vo.DgCatalogWithFileVO"> | 28 | <resultMap id="result" type="com.pashanhoo.file.entity.vo.DgCatalogWithFileVO"> |
| 29 | <result column="BSM_ARCHIVES" property="bsmArchive"/> | ||
| 29 | <result column="bsm_catalog" property="bsmCatalog"/> | 30 | <result column="bsm_catalog" property="bsmCatalog"/> |
| 30 | <result column="wjmc" property="wjmc"/> | 31 | <result column="wjmc" property="wjmc"/> |
| 31 | <result column="catalogXh" property="catalogXh"/> | 32 | <result column="catalogXh" property="catalogXh"/> |
| ... | @@ -42,9 +43,10 @@ | ... | @@ -42,9 +43,10 @@ |
| 42 | </resultMap> | 43 | </resultMap> |
| 43 | 44 | ||
| 44 | <select id="getFileList" resultMap="result"> | 45 | <select id="getFileList" resultMap="result"> |
| 45 | select DF.*, DAC.XH as catalogXh, DAC.WJMC,DAC.BSM_CATALOG | 46 | select DF.*, DAC.XH as catalogXh, DAC.WJMC,DAC.BSM_CATALOG,DA.BSM_ARCHIVES |
| 46 | from DG_FILE DF | 47 | from DG_FILE DF |
| 47 | join DG_ARCHIVES_CATALOG DAC on DAC.BSM_CATALOG = DF.BSM_CATALOG | 48 | join DG_ARCHIVES_CATALOG DAC on DAC.BSM_CATALOG = DF.BSM_CATALOG |
| 49 | join DG_ARCHIVES DA on DAC.BSM_ARCHIVES = DA.BSM_ARCHIVES | ||
| 48 | <where> | 50 | <where> |
| 49 | <if test="bsmArchive != null and bsmArchive != ''"> | 51 | <if test="bsmArchive != null and bsmArchive != ''"> |
| 50 | BSM_ARCHIVES = #{bsmArchive,jdbcType=VARCHAR} | 52 | BSM_ARCHIVES = #{bsmArchive,jdbcType=VARCHAR} | ... | ... |
-
Please register or sign in to post a comment