Commit 6857289b authored by 徐俊's avatar 徐俊

xujun

parent 401dd323
......@@ -18,4 +18,6 @@ import org.apache.ibatis.annotations.Param;
public interface ComDownloadDAO extends BaseMapper<ComDownload>, BaseDAO<ComDownloadQueryVO, ComDownloadDTO, ComDownload> {
Page<ComDownloadDTO> getAllListByPage(Page<ComDownloadQueryVO> page, @Param("ew") Wrapper<ComDownloadQueryVO> queryWrapper);
ComDownload getDownloadByFileName(String fileName);
}
\ No newline at end of file
......@@ -51,6 +51,14 @@ public class ComDownloadController extends BaseController<ComDownloadService, Co
return ResponseDataModel.ok(ComDownloadService.asyncUpload(file));
}
@ApiOperation(value = "文件上传", httpMethod = "POST", notes = "文件上传")
@PostMapping("/asyncApplyBookUpload")
// @Logs(value = CommonEnum.logType.fileUpload)
public ResponseDataModel<ComDownload> asyncApplyBookUpload(@RequestParam("file") MultipartFile file) {
return ResponseDataModel.ok(ComDownloadService.asyncApplyBookUpload(file));
}
@ApiOperation(value = "删除文件", httpMethod = "DELETE", notes = "删除文件")
@DeleteMapping(value = "delete/{id}")
@Logs(value = CommonEnum.logType.fileDelete)
......
......@@ -21,6 +21,13 @@ public interface ComDownloadService extends BaseService<ComDownloadQueryVO, ComD
* @param
*/
ComDownload asyncUpload(MultipartFile file);
/**
* 文件上传
* @param file
* @return
*/
ComDownload asyncApplyBookUpload(MultipartFile file);
/**
* 删除文件
*
......@@ -46,4 +53,6 @@ public interface ComDownloadService extends BaseService<ComDownloadQueryVO, ComD
String getFilePath(String basePath);
String getPhysicalPath(String filePath);
ComDownload getDownloadByFileName(String fileName);
}
\ No newline at end of file
......@@ -147,6 +147,21 @@ public class ComDownloadServiceImpl extends BaseServiceImpl<ComDownloadDAO, ComD
throw new BusinessException("文件上传失败!");
}
public ComDownload asyncApplyBookUpload(MultipartFile file) {
ComDownload entity = this.asyncUpload(file);
ComDownload applyBookFile = this.getDownloadByFileName(file.getOriginalFilename().replace(".pdf", ".doc"));
if (null != applyBookFile) {
applyBookFile.setConvertUrl(entity.getDownloadUrl());
this.update(applyBookFile);
}
return applyBookFile;
}
public ComDownload getDownloadByFileName(String fileName) {
return comDownloadDAO.getDownloadByFileName(fileName);
}
public String delete(String id) {
ComDownload comDownload =this.getById(id);
if(null!=comDownload){
......
......@@ -16,4 +16,8 @@
</where>
ORDER BY c.created desc
</select>
<select id="getDownloadByFileName" parameterType="java.lang.String" resultType="com.yiboshi.science.entity.ComDownload">
select * from com_download where download_url like concat('%', #{fileName}, '%')
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment