ff4f1ba1 by 荆蔚杰

案卷附件查询接口.删除接口.

1 parent e16a5805
...@@ -39,7 +39,7 @@ public class DgArchivesCatalogDO implements Serializable { ...@@ -39,7 +39,7 @@ public class DgArchivesCatalogDO implements Serializable {
39 * 序号 39 * 序号
40 */ 40 */
41 @TableField("XH") 41 @TableField("XH")
42 private String xh; 42 private Integer xh;
43 43
44 /** 44 /**
45 * 材料编码 45 * 材料编码
......
...@@ -32,7 +32,7 @@ public class AddDgArchivesCatalogRequest implements Serializable { ...@@ -32,7 +32,7 @@ public class AddDgArchivesCatalogRequest implements Serializable {
32 * 序号 32 * 序号
33 */ 33 */
34 @ApiModelProperty(name = "xh", value = "序号") 34 @ApiModelProperty(name = "xh", value = "序号")
35 private String xh; 35 private Integer xh;
36 36
37 /** 37 /**
38 * 材料编码 38 * 材料编码
......
...@@ -37,7 +37,7 @@ public class DgArchivesCatalogDetailVO implements Serializable { ...@@ -37,7 +37,7 @@ public class DgArchivesCatalogDetailVO implements Serializable {
37 * 序号 37 * 序号
38 */ 38 */
39 @ApiModelProperty(name = "xh", value = "序号") 39 @ApiModelProperty(name = "xh", value = "序号")
40 private String xh; 40 private Integer xh;
41 41
42 /** 42 /**
43 * 材料编码 43 * 材料编码
......
...@@ -38,7 +38,7 @@ public class DgArchivesCatalogListVO implements Serializable { ...@@ -38,7 +38,7 @@ public class DgArchivesCatalogListVO implements Serializable {
38 * 序号 38 * 序号
39 */ 39 */
40 @ApiModelProperty(name = "xh", value = "序号") 40 @ApiModelProperty(name = "xh", value = "序号")
41 private String xh; 41 private Integer xh;
42 42
43 /** 43 /**
44 * 材料编码 44 * 材料编码
......
...@@ -39,7 +39,7 @@ public class DgArchivesCatalogSearchRequest extends PageInfo implements Serializ ...@@ -39,7 +39,7 @@ public class DgArchivesCatalogSearchRequest extends PageInfo implements Serializ
39 * 序号 39 * 序号
40 */ 40 */
41 @ApiModelProperty(name = "xh", value = "序号") 41 @ApiModelProperty(name = "xh", value = "序号")
42 private String xh; 42 private Integer xh;
43 43
44 /** 44 /**
45 * 材料编码 45 * 材料编码
......
...@@ -37,7 +37,7 @@ public class UpdateDgArchivesCatalogRequest implements Serializable { ...@@ -37,7 +37,7 @@ public class UpdateDgArchivesCatalogRequest implements Serializable {
37 * 序号 37 * 序号
38 */ 38 */
39 @ApiModelProperty(name = "xh", value = "序号") 39 @ApiModelProperty(name = "xh", value = "序号")
40 private String xh; 40 private Integer xh;
41 41
42 /** 42 /**
43 * 材料编码 43 * 材料编码
......
1 package com.pashanhoo.common.util; 1 package com.pashanhoo.common.util.fileupload;
2 2
3 import polaris.fileattachment.AttachmentService; 3 import polaris.fileattachment.AttachmentService;
4 import polaris.fileattachment.models.FileUrl; 4 import polaris.fileattachment.models.FileUrl;
......
1 package com.pashanhoo.common.util.fileupload;
2
3 import com.pashanhoo.common.Result;
4 import io.swagger.annotations.Api;
5 import io.swagger.annotations.ApiOperation;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RequestMethod;
9 import org.springframework.web.bind.annotation.RequestPart;
10 import org.springframework.web.bind.annotation.RestController;
11 import org.springframework.web.multipart.MultipartFile;
12
13 import javax.servlet.http.HttpServletResponse;
14 import java.io.IOException;
15 import java.util.List;
16
17 /**
18 * 文件上传
19 */
20 @Api(tags = "文件控制器")
21 @RequestMapping("/file")
22 @RestController
23 public class FileController {
24
25 @Autowired
26 MinioUtil minioUtil;
27
28
29 @RequestMapping(value = "/upload", method = RequestMethod.POST)
30 @ApiOperation("上传单个文件")
31 public Result upload(@RequestPart("file") MultipartFile file, HttpServletResponse response) {
32
33 try {
34 return Result.ok(minioUtil.upload(file));
35 } catch (Exception e) {
36 return Result.exception(e.getMessage());
37 }
38 }
39
40 @RequestMapping(value = "/batchUpload", method = RequestMethod.POST,headers = "content-type=multipart/form-data")
41 @ApiOperation("上传多个文件")
42 public Result upload(@RequestPart("file") MultipartFile[] files, HttpServletResponse response) {
43
44 try {
45 return Result.ok(minioUtil.batchUpload(files));
46 } catch (Exception e) {
47 return Result.exception(e.getMessage());
48 }
49 }
50
51 }
1 package com.pashanhoo.common.util; 1 package com.pashanhoo.common.util.fileupload;
2 2
3 import lombok.Data; 3 import lombok.Data;
4 import org.springframework.boot.context.properties.ConfigurationProperties; 4 import org.springframework.boot.context.properties.ConfigurationProperties;
......
1 package com.pashanhoo.common.util; 1 package com.pashanhoo.common.util.fileupload;
2 2
3 import io.minio.MinioClient; 3 import io.minio.MinioClient;
4 import io.minio.errors.*; 4 import io.minio.errors.*;
...@@ -17,6 +17,7 @@ import java.util.*; ...@@ -17,6 +17,7 @@ import java.util.*;
17 */ 17 */
18 @Component 18 @Component
19 public class MinioUtil { 19 public class MinioUtil {
20
20 private MinioClient minioClient; 21 private MinioClient minioClient;
21 @Autowired 22 @Autowired
22 MinioConfig minioConfig; 23 MinioConfig minioConfig;
...@@ -34,7 +35,7 @@ public class MinioUtil { ...@@ -34,7 +35,7 @@ public class MinioUtil {
34 * 文件上传 35 * 文件上传
35 * 36 *
36 * @param file 37 * @param file
37 * @return 38 * @return minio文件路径
38 * @throws IOException 39 * @throws IOException
39 */ 40 */
40 public String upload(MultipartFile file) throws IOException { 41 public String upload(MultipartFile file) throws IOException {
...@@ -53,14 +54,14 @@ public class MinioUtil { ...@@ -53,14 +54,14 @@ public class MinioUtil {
53 // 下载地址 54 // 下载地址
54 String saveUrl = savePath + "/" + originalFilename; 55 String saveUrl = savePath + "/" + originalFilename;
55 // 浏览器直接预览地址,针对图片 56 // 浏览器直接预览地址,针对图片
56 String pUrl = minioConfig.getType() + minioConfig.getEndpoint() + "/file/" + savePath + "/" + originalFilename; 57 String pUrl = minioConfig.getType() + minioConfig.getEndpoint() + "/file/" + saveUrl;
57 try { 58 try {
58 minioClient.putObject(minioConfig.getBucket(), saveUrl, file.getInputStream(), contentType); 59 minioClient.putObject(minioConfig.getBucket(), saveUrl, file.getInputStream(), contentType);
59 } catch (Exception e) { 60 } catch (Exception e) {
60 e.printStackTrace(); 61 e.printStackTrace();
61 } 62 }
62 63
63 return pUrl; 64 return saveUrl;
64 } 65 }
65 66
66 /** 67 /**
...@@ -74,8 +75,8 @@ public class MinioUtil { ...@@ -74,8 +75,8 @@ public class MinioUtil {
74 Assert.notNull(files, "上传文件为空"); 75 Assert.notNull(files, "上传文件为空");
75 List<String> list = new ArrayList<>(); 76 List<String> list = new ArrayList<>();
76 for (MultipartFile file : files) { 77 for (MultipartFile file : files) {
77 String pUrl = this.upload(file); 78 String saveUrl = this.upload(file);
78 list.add(pUrl); 79 list.add(saveUrl);
79 } 80 }
80 return list; 81 return list;
81 } 82 }
...@@ -91,6 +92,15 @@ public class MinioUtil { ...@@ -91,6 +92,15 @@ public class MinioUtil {
91 minioClient.removeObject(bucketName, objectName); 92 minioClient.removeObject(bucketName, objectName);
92 } 93 }
93 94
95 /**
96 * 根据存储路径组装下载预览路径
97 * @param saveUrl
98 * @return
99 */
100 public String getPreviewUrl(String saveUrl) {
101 return minioConfig.getType() + minioConfig.getEndpoint() + "/file/" + saveUrl;
102 }
103
94 private static final Map<String, String> contentTypeMap = new HashMap<>() { 104 private static final Map<String, String> contentTypeMap = new HashMap<>() {
95 { 105 {
96 put("323", "text/h323"); 106 put("323", "text/h323");
......
...@@ -3,6 +3,7 @@ package com.pashanhoo.file.controller; ...@@ -3,6 +3,7 @@ package com.pashanhoo.file.controller;
3 3
4 import com.pashanhoo.common.Result; 4 import com.pashanhoo.common.Result;
5 import com.pashanhoo.file.entity.vo.AddDgFileRequest; 5 import com.pashanhoo.file.entity.vo.AddDgFileRequest;
6 import com.pashanhoo.file.entity.vo.DgFileListVO;
6 import com.pashanhoo.file.entity.vo.UpdateDgFileRequest; 7 import com.pashanhoo.file.entity.vo.UpdateDgFileRequest;
7 import com.pashanhoo.file.entity.vo.DgFileSearchRequest; 8 import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
8 import com.pashanhoo.file.service.DgFileService; 9 import com.pashanhoo.file.service.DgFileService;
...@@ -64,9 +65,8 @@ public class DgFileController { ...@@ -64,9 +65,8 @@ public class DgFileController {
64 65
65 @PostMapping("search") 66 @PostMapping("search")
66 @ApiOperation(value = "根据条件进行列表查询") 67 @ApiOperation(value = "根据条件进行列表查询")
67 public Result searchDgFileList(@RequestBody DgFileSearchRequest request) { 68 public Result<List<DgFileListVO>> searchDgFileList(@RequestBody DgFileSearchRequest request) {
68 //TODO 默认排序条件设置 69
69 request.defaultFillPageProp("","");
70 return Result.ok(dgfileService.searchDgFileList(request)); 70 return Result.ok(dgfileService.searchDgFileList(request));
71 } 71 }
72 } 72 }
......
...@@ -2,6 +2,9 @@ package com.pashanhoo.file.entity.vo; ...@@ -2,6 +2,9 @@ package com.pashanhoo.file.entity.vo;
2 2
3 import java.util.Date; 3 import java.util.Date;
4 import java.io.Serializable; 4 import java.io.Serializable;
5 import java.util.List;
6
7 import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogListVO;
5 import io.swagger.annotations.ApiModel; 8 import io.swagger.annotations.ApiModel;
6 import io.swagger.annotations.ApiModelProperty; 9 import io.swagger.annotations.ApiModelProperty;
7 import lombok.Data; 10 import lombok.Data;
...@@ -18,7 +21,6 @@ import lombok.EqualsAndHashCode; ...@@ -18,7 +21,6 @@ import lombok.EqualsAndHashCode;
18 @Data 21 @Data
19 @EqualsAndHashCode(callSuper = false) 22 @EqualsAndHashCode(callSuper = false)
20 @ApiModel(value="档案文件信息列表VO") 23 @ApiModel(value="档案文件信息列表VO")
21 //TODO 该类属性暂时是完整的全部属性,需进行个性化的增删
22 public class DgFileListVO implements Serializable { 24 public class DgFileListVO implements Serializable {
23 25
24 private static final long serialVersionUID = 1L; 26 private static final long serialVersionUID = 1L;
...@@ -65,5 +67,16 @@ public class DgFileListVO implements Serializable { ...@@ -65,5 +67,16 @@ public class DgFileListVO implements Serializable {
65 @ApiModelProperty(name = "fjsize", value = "附件大小") 67 @ApiModelProperty(name = "fjsize", value = "附件大小")
66 private String fjsize; 68 private String fjsize;
67 69
70 /**
71 * 文件名称
72 */
73 @ApiModelProperty(name = "wjmc", value = "档案目录信息")
74 private String wjmc;
75
76 /**
77 * 序号
78 */
79 @ApiModelProperty(name = "xh", value = "序号")
80 private Integer xh;
68 81
69 } 82 }
......
...@@ -19,7 +19,6 @@ import com.pashanhoo.common.PageInfo; ...@@ -19,7 +19,6 @@ import com.pashanhoo.common.PageInfo;
19 @Data 19 @Data
20 @EqualsAndHashCode(callSuper = false) 20 @EqualsAndHashCode(callSuper = false)
21 @ApiModel(value="档案文件信息列表查询请求实体") 21 @ApiModel(value="档案文件信息列表查询请求实体")
22 //TODO 初始查询条件是全部,需要根据情况自行删减
23 public class DgFileSearchRequest extends PageInfo implements Serializable { 22 public class DgFileSearchRequest extends PageInfo implements Serializable {
24 23
25 private static final long serialVersionUID = 1L; 24 private static final long serialVersionUID = 1L;
...@@ -66,5 +65,9 @@ public class DgFileSearchRequest extends PageInfo implements Serializable { ...@@ -66,5 +65,9 @@ public class DgFileSearchRequest extends PageInfo implements Serializable {
66 @ApiModelProperty(name = "fjsize", value = "附件大小") 65 @ApiModelProperty(name = "fjsize", value = "附件大小")
67 private String fjsize; 66 private String fjsize;
68 67
69 68 /**
69 * 档案标识码
70 */
71 @ApiModelProperty(name = "bsmArchives", value = "档案标识码")
72 private String bsmArchives;
70 } 73 }
......
...@@ -3,6 +3,11 @@ package com.pashanhoo.file.mapper; ...@@ -3,6 +3,11 @@ package com.pashanhoo.file.mapper;
3 3
4 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 import com.pashanhoo.file.entity.DgFileDO; 5 import com.pashanhoo.file.entity.DgFileDO;
6 import com.pashanhoo.file.entity.vo.DgFileListVO;
7 import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
8 import org.apache.ibatis.annotations.Param;
9
10 import java.util.List;
6 11
7 /** 12 /**
8 * <p> 13 * <p>
...@@ -14,4 +19,10 @@ import com.pashanhoo.file.entity.DgFileDO; ...@@ -14,4 +19,10 @@ import com.pashanhoo.file.entity.DgFileDO;
14 */ 19 */
15 public interface DgFileMapper extends BaseMapper<DgFileDO> { 20 public interface DgFileMapper extends BaseMapper<DgFileDO> {
16 21
22 /**
23 * 查询附件以及名称和排序
24 * @param request
25 * @return
26 */
27 List<DgFileListVO> selectFileWithNameAndSort(@Param("request") DgFileSearchRequest request);
17 } 28 }
......
1 package com.pashanhoo.file.service; 1 package com.pashanhoo.file.service;
2 2
3 import com.baomidou.mybatisplus.core.metadata.IPage;
3 import com.baomidou.mybatisplus.extension.service.IService; 4 import com.baomidou.mybatisplus.extension.service.IService;
4 import com.pashanhoo.file.entity.DgFileDO; 5 import com.pashanhoo.file.entity.DgFileDO;
5 import com.pashanhoo.file.entity.vo.AddDgFileRequest; 6 import com.pashanhoo.file.entity.vo.*;
6 import com.pashanhoo.file.entity.vo.DgFileDetailVO;
7 import com.pashanhoo.file.entity.vo.UpdateDgFileRequest;
8 import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
9 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
10 8
9 import java.util.List;
10
11 /** 11 /**
12 * <p> 12 * <p>
13 * 档案文件信息 服务类 13 * 档案文件信息 服务类
...@@ -43,5 +43,5 @@ public interface DgFileService extends IService<DgFileDO> { ...@@ -43,5 +43,5 @@ public interface DgFileService extends IService<DgFileDO> {
43 * @param request 43 * @param request
44 * @return 44 * @return
45 */ 45 */
46 Page searchDgFileList(DgFileSearchRequest request); 46 List<DgFileListVO> searchDgFileList(DgFileSearchRequest request);
47 } 47 }
......
1 package com.pashanhoo.file.service.impl; 1 package com.pashanhoo.file.service.impl;
2 2
3 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 3 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 import com.pashanhoo.common.util.fileupload.MinioUtil;
4 import com.pashanhoo.file.entity.DgFileConverter; 5 import com.pashanhoo.file.entity.DgFileConverter;
5 import com.pashanhoo.file.entity.DgFileDO; 6 import com.pashanhoo.file.entity.DgFileDO;
6 import com.pashanhoo.file.entity.vo.AddDgFileRequest; 7 import com.pashanhoo.file.entity.vo.*;
7 import com.pashanhoo.file.entity.vo.DgFileDetailVO;
8 import com.pashanhoo.file.entity.vo.UpdateDgFileRequest;
9 import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
10 import com.pashanhoo.file.mapper.DgFileMapper; 8 import com.pashanhoo.file.mapper.DgFileMapper;
11 import com.pashanhoo.file.service.DgFileService; 9 import com.pashanhoo.file.service.DgFileService;
12 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
14 12
15 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
16 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 13 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
17 14
15 import java.util.List;
16
18 /** 17 /**
19 * <p> 18 * <p>
20 * 档案文件信息 服务实现类 19 * 档案文件信息 服务实现类
...@@ -32,6 +31,9 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple ...@@ -32,6 +31,9 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple
32 @Autowired 31 @Autowired
33 private DgFileMapper dgfileMapper; 32 private DgFileMapper dgfileMapper;
34 33
34 @Autowired
35 MinioUtil minioUtil;
36
35 /** 37 /**
36 * 新增记录 38 * 新增记录
37 * @param request 39 * @param request
...@@ -71,17 +73,19 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple ...@@ -71,17 +73,19 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple
71 * @return 73 * @return
72 */ 74 */
73 @Override 75 @Override
74 public Page searchDgFileList(DgFileSearchRequest request) { 76 public List<DgFileListVO> searchDgFileList(DgFileSearchRequest request) {
75 Page<DgFileDO> pageParam = new Page<DgFileDO>(request.getCurrentPage(), request.getPageSize()); 77
76 QueryWrapper<DgFileDO> wrapper = new QueryWrapper<>(); 78 QueryWrapper<DgFileDO> wrapper = new QueryWrapper<>();
77 //设置默认排序
78 wrapper = "desc".equals(request.getSortOrder()) ? wrapper.orderByDesc(request.getSortField()) : wrapper.orderByAsc(request.getSortField());
79 79
80 //TODO 根据当前情况设置wrapper条件 80 List<DgFileListVO> fileListVOS = dgfileMapper.selectFileWithNameAndSort(request);
81 81
82 Page page = this.page(pageParam, wrapper); 82 for (DgFileListVO fileListVO : fileListVOS) {
83 //将查询出来的DO List转为 ListVO List并重新设置到page对象中,并返回page对象 83 if (fileListVO.getFjurl() != null) {
84 return page.setRecords(dgfileConverter.doList2ListVOList(page.getRecords())); 84 String previewUrl = minioUtil.getPreviewUrl(fileListVO.getFjurl());
85 fileListVO.setFjurl(previewUrl);
86 }
87 }
88 return fileListVOS;
85 } 89 }
86 90
87 } 91 }
......
...@@ -68,7 +68,7 @@ minio: ...@@ -68,7 +68,7 @@ minio:
68 params: 68 params:
69 type: http:// 69 type: http://
70 bucket: archive 70 bucket: archive
71 host: 192.168.2.218 71 endpoint: 192.168.2.218
72 port: 8989 72 port: 8989
73 user: minioadmin 73 accessKeyId: minioadmin
74 password: minioadmin 74 accessKeySecret: minioadmin
......
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="com.pashanhoo.file.mapper.DgFileMapper"> 3 <mapper namespace="com.pashanhoo.file.mapper.DgFileMapper">
4
5 <!-- 通用查询映射结果 --> 4 <!-- 通用查询映射结果 -->
6 <resultMap id="BaseResultMap" type="com.pashanhoo.file.entity.DgFileDO"> 5 <resultMap id="BaseResultMap" type="com.pashanhoo.file.entity.DgFileDO">
7 <id column="BSM_FILE" property="bsmFile" /> 6 <id column="BSM_FILE" property="bsmFile"/>
8 <result column="BSM_CATALOG" property="bsmCatalog" /> 7 <result column="BSM_CATALOG" property="bsmCatalog"/>
9 <result column="KZM" property="kzm" /> 8 <result column="KZM" property="kzm"/>
10 <result column="SCRQ" property="scrq" /> 9 <result column="SCRQ" property="scrq"/>
11 <result column="SCR" property="scr" /> 10 <result column="SCR" property="scr"/>
12 <result column="FJURL" property="fjurl" /> 11 <result column="FJURL" property="fjurl"/>
13 <result column="FJSIZE" property="fjsize" /> 12 <result column="FJSIZE" property="fjsize"/>
14 </resultMap> 13 </resultMap>
15 14
16 <!-- 通用查询结果列 --> 15 <!-- 通用查询结果列 -->
17 <sql id="Base_Column_List"> 16 <sql id="Base_Column_List">
18 BSM_FILE, BSM_CATALOG, KZM, SCRQ, SCR, FJURL, FJSIZE 17 BSM_FILE,
18 BSM_CATALOG,
19 KZM,
20 SCRQ,
21 SCR,
22 FJURL,
23 FJSIZE
19 </sql> 24 </sql>
25
26 <select id="selectFileWithNameAndSort" resultType="com.pashanhoo.file.entity.vo.DgFileListVO">
27 select DF.*, DAC.WJMC, DAC.XH
28 from DG_FILE DF
29 left join DG_ARCHIVES_CATALOG DAC on DAC.BSM_CATALOG =
30 DF.BSM_CATALOG
31 <where>
32 <if test="request.bsmArchives != null and request.bsmArchives != ''">
33 BSM_ARCHIVES = #{request.bsmArchives,jdbcType=VARCHAR}
34 </if>
35 </where>
36 order by XH;
37 </select>
20 </mapper> 38 </mapper>
......