32f7d044 by 荆蔚杰

档案目录展示

材料附件列表
1 parent 72b7cb07
......@@ -3,7 +3,7 @@ package com.pashanhoo.archive.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pashanhoo.archive.entity.vo.*;
import com.pashanhoo.archive.service.DgArchivesService;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogListVO;
import com.pashanhoo.catalog.entity.vo.UpdateDgArchivesCatalogRequest;
import com.pashanhoo.common.Result;
import org.springframework.web.bind.annotation.RestController;
......@@ -90,6 +90,7 @@ public class DgArchivesController {
}
/**
* 目录修改保存
* 1.比对新增的记录数据库是否存在,如果不存在则新增
* 2.比对数据库的数据是否存在前端传递的集合中,不存在则删除,并且删除对应的电子附件数据
* 3.如果目录记录标识码与数据库一致,直接更新当前的记录
......@@ -98,7 +99,7 @@ public class DgArchivesController {
* @return
*/
@PostMapping("saveCatalogs")
@ApiOperation(value = "目录保存")
@ApiOperation(value = "目录修改保存")
public Result saveCatalogs(@RequestBody List<UpdateDgArchivesCatalogRequest> requests) {
if (dgarchivesService.updateCatalog(requests)) {
......@@ -106,4 +107,17 @@ public class DgArchivesController {
}
return Result.error("修改失败");
}
/**
* 档案目录查找
*
* @param bsmArchive
* @return
*/
@GetMapping("searchCatalog")
@ApiOperation(value = "查询档案目录")
public Result<List<DgArchivesCatalogListVO>> searchCatalog(@RequestParam String bsmArchive) {
return Result.ok(dgarchivesService.searchCatalog(bsmArchive));
}
}
......
......@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.pashanhoo.archive.entity.DgArchivesDO;
import com.pashanhoo.archive.entity.vo.SearchArchiveRequest;
import com.pashanhoo.archive.entity.vo.SearchArchiveVO;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO;
import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -24,4 +26,10 @@ public interface DgArchivesMapper extends BaseMapper<DgArchivesDO> {
IPage<SearchArchiveVO> searchArchive(@Param("pageParam") IPage<SearchArchiveVO> pageParam, @Param("request") SearchArchiveRequest request);
/**
* 查询附件以及名称和排序
* @param request
* @return
*/
List<DgArchivesCatalogWithFileVO> selectCatalogWithFile(@Param("request") DgFileSearchRequest request);
}
......
......@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.pashanhoo.archive.entity.DgArchivesDO;
import com.pashanhoo.archive.entity.vo.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogListVO;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO;
import com.pashanhoo.catalog.entity.vo.UpdateDgArchivesCatalogRequest;
import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
import java.util.List;
......@@ -84,4 +86,18 @@ public interface DgArchivesService extends IService<DgArchivesDO> {
* @return
*/
boolean updateCatalog(List<UpdateDgArchivesCatalogRequest> requests);
/**
* 根据条件进行列表查询
* @param request
* @return
*/
List<DgArchivesCatalogWithFileVO> searchDgFileList(DgFileSearchRequest request);
/**
* 档案目录查找
* @param bsmArchive
* @return
*/
List<DgArchivesCatalogListVO> searchCatalog(String bsmArchive);
}
......
......@@ -20,9 +20,13 @@ import com.pashanhoo.business.entity.vo.UpdateDgBusinessRequest;
import com.pashanhoo.business.service.DgBusinessService;
import com.pashanhoo.catalog.entity.DgArchivesCatalogConverter;
import com.pashanhoo.catalog.entity.DgArchivesCatalogDO;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogListVO;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO;
import com.pashanhoo.catalog.entity.vo.UpdateDgArchivesCatalogRequest;
import com.pashanhoo.catalog.service.DgArchivesCatalogService;
import com.pashanhoo.common.util.fileupload.MinioUtil;
import com.pashanhoo.file.entity.DgFileDO;
import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
import com.pashanhoo.file.service.DgFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -75,6 +79,9 @@ public class DgArchivesServiceImpl extends ServiceImpl<DgArchivesMapper, DgArchi
@Autowired
private DgFileService dgFileService;
@Autowired
private MinioUtil minioUtil;
/**
* 新增记录
*
......@@ -273,6 +280,41 @@ public class DgArchivesServiceImpl extends ServiceImpl<DgArchivesMapper, DgArchi
}
/**
* 查找档案目录和对应的附件列表
* @param request
* @return
*/
@Override
public List<DgArchivesCatalogWithFileVO> searchDgFileList(DgFileSearchRequest request) {
List<DgArchivesCatalogWithFileVO> fileListVOS = dgarchivesMapper.selectCatalogWithFile(request);
for (DgArchivesCatalogWithFileVO fileListVO : fileListVOS) {
for (DgFileDO dgFileDO : fileListVO.getDgFileDOS()) {
if (dgFileDO.getFjurl() != null) {
String previewUrl = minioUtil.getPreviewUrl(dgFileDO.getFjurl());
dgFileDO.setFjurl(previewUrl);
}
}
}
return fileListVOS;
}
/**
* 档案目录查找
*
* @param bsmArchive
* @return
*/
@Override
public List<DgArchivesCatalogListVO> searchCatalog(String bsmArchive) {
QueryWrapper<DgArchivesCatalogDO> catalogWrapper = new QueryWrapper<>();
catalogWrapper.lambda().eq(DgArchivesCatalogDO::getBsmArchives, bsmArchive).orderByAsc(DgArchivesCatalogDO::getXh);
List<DgArchivesCatalogDO> list = catalogService.list(catalogWrapper);
return catalogConverter.doList2ListVOList(list);
}
private ArchiveDetailAndCoverVO getCover(String bsmArchive) {
DgArchivesDO archivesDO = this.getById(bsmArchive);
DgArchivesDetailVO dgArchivesDetailVO = dgarchivesConverter.do2DetailVO(archivesDO);
......
package com.pashanhoo.file.controller;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO;
import com.pashanhoo.common.Result;
import com.pashanhoo.file.entity.vo.AddDgFileRequest;
import com.pashanhoo.file.entity.vo.DgCatalogWithFileVO;
import com.pashanhoo.file.entity.vo.DgFileListVO;
import com.pashanhoo.file.entity.vo.UpdateDgFileRequest;
import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
import com.pashanhoo.file.service.DgFileService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
......@@ -58,15 +57,17 @@ public class DgFileController {
}
@GetMapping("getDgFileDetailById")
@ApiOperation(value = "读取明细")
public Result getDgFileDetailById(@ApiParam("档案文件信息ID") @RequestParam String id){
return Result.ok(dgfileService.getDgFileDetailById(id));
@ApiOperation(value = "获取附件列表")
public Result<List<DgCatalogWithFileVO>> getDgFileDetailById(@ApiParam("档案标识码") @RequestParam String bsmArchive){
return Result.ok(dgfileService.getFileList(bsmArchive));
}
@PostMapping("search")
@ApiOperation(value = "查询档案目录和对应的附件")
public Result<List<DgArchivesCatalogWithFileVO>> searchDgFileList(@RequestBody DgFileSearchRequest request) {
return Result.ok(dgfileService.searchDgFileList(request));
}
// @PutMapping("updateFileSort")
// @ApiOperation("附件排序")
// public Result updateFileSort(@RequestBody UpdateDgFileRequest request){
// if(dgfileService.updateFileSort(request)) {
// return Result.ok("修改成功");
// }
// return Result.error("修改失败");
// }
}
......
package com.pashanhoo.file.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="档案目录对应文件信息列表VO")
public class DgCatalogWithFileVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 目录标识码
*/
@ApiModelProperty(name = "bsmCatalog", value = "目录标识码")
private String bsmCatalog;
/**
* 文件名称
*/
@ApiModelProperty(name = "wjmc", value = "档案目录信息")
private String wjmc;
/**
* 序号
*/
@ApiModelProperty(name = "xh", value = "序号")
private Integer xh;
/**
* 档案文件信息列表VO
*/
@ApiModelProperty(name = "fileLists", value = "档案文件信息列表VO")
private List<DgFileListVO> fileLists;
}
......@@ -2,13 +2,13 @@ package com.pashanhoo.file.entity.vo;
import java.util.Date;
import java.io.Serializable;
import java.util.List;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogListVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* <p>
......@@ -47,6 +47,8 @@ public class DgFileListVO implements Serializable {
* 上传日期
*/
@ApiModelProperty(name = "scrq", value = "上传日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date scrq;
/**
......@@ -67,16 +69,4 @@ public class DgFileListVO implements Serializable {
@ApiModelProperty(name = "fjsize", value = "附件大小")
private String fjsize;
/**
* 文件名称
*/
@ApiModelProperty(name = "wjmc", value = "档案目录信息")
private String wjmc;
/**
* 序号
*/
@ApiModelProperty(name = "xh", value = "序号")
private Integer xh;
}
......
package com.pashanhoo.file.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="附件列表排序修改实体")
public class UpdateFileSortRequest implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 目录标识码
*/
@ApiModelProperty(name = "bsmCatalog", value = "目录标识码")
private String bsmCatalog;
/**
* 档案标识码
*/
@ApiModelProperty(name = "bsmArchives", value = "档案标识码")
private String bsmArchives;
/**
* 序号
*/
@ApiModelProperty(name = "xh", value = "序号")
private Integer xh;
}
......@@ -2,14 +2,13 @@ package com.pashanhoo.file.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO;
import com.pashanhoo.file.entity.DgFileDO;
import com.pashanhoo.file.entity.vo.DgFileListVO;
import com.pashanhoo.file.entity.vo.DgFileSearchRequest;
import com.pashanhoo.file.entity.vo.DgCatalogWithFileVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 档案文件信息 Mapper 接口
......@@ -21,9 +20,10 @@ import java.util.List;
public interface DgFileMapper extends BaseMapper<DgFileDO> {
/**
* 查询附件以及名称和排序
* @param request
* 获取附件列表
*
* @param bsmArchive
* @return
*/
List<DgArchivesCatalogWithFileVO> selectCatalogWithFile(@Param("request") DgFileSearchRequest request);
List<DgCatalogWithFileVO> getFileList(@Param("bsmArchive") String bsmArchive);
}
......
package com.pashanhoo.file.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO;
import com.pashanhoo.file.entity.DgFileDO;
import com.pashanhoo.file.entity.vo.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
......@@ -40,9 +37,9 @@ public interface DgFileService extends IService<DgFileDO> {
boolean updateDgFile(UpdateDgFileRequest request);
/**
* 根据条件进行列表查询
* @param request
* 获取附件列表
* @param bsmArchive
* @return
*/
List<DgArchivesCatalogWithFileVO> searchDgFileList(DgFileSearchRequest request);
List<DgCatalogWithFileVO> getFileList(String bsmArchive);
}
......
package com.pashanhoo.file.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO;
import com.pashanhoo.common.util.fileupload.MinioUtil;
import com.pashanhoo.file.entity.DgFileConverter;
import com.pashanhoo.file.entity.DgFileDO;
......@@ -13,6 +12,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
......@@ -71,24 +71,15 @@ public class DgFileServiceImpl extends ServiceImpl<DgFileMapper, DgFileDO> imple
}
/**
* 根据条件进行列表查询
* @param request
* 获取附件列表
* @param bsmArchive
* @return
*/
@Override
public List<DgArchivesCatalogWithFileVO> searchDgFileList(DgFileSearchRequest request) {
List<DgArchivesCatalogWithFileVO> fileListVOS = dgfileMapper.selectCatalogWithFile(request);
for (DgArchivesCatalogWithFileVO fileListVO : fileListVOS) {
for (DgFileDO dgFileDO : fileListVO.getDgFileDOS()) {
if (dgFileDO.getFjurl() != null) {
String previewUrl = minioUtil.getPreviewUrl(dgFileDO.getFjurl());
dgFileDO.setFjurl(previewUrl);
}
}
}
return fileListVOS;
public List<DgCatalogWithFileVO> getFileList(String bsmArchive) {
List<DgCatalogWithFileVO> fileList = dgfileMapper.getFileList(bsmArchive);
fileList.forEach(catalogWithFiles->catalogWithFiles.getFileLists().forEach(file->file.setFjurl(minioUtil.getPreviewUrl(file.getFjurl()))));
return fileList;
}
}
......
......@@ -89,4 +89,41 @@
</where>
</select>
<resultMap id="CatalogWithFile" type="com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO">
<result column="bsm_catalog" property="bsmCatalog"/>
<result column="bsm_archives" property="bsmArchives"/>
<result column="xh" property="xh"/>
<result column="wjbm" property="wjbm"/>
<result column="wjmc" property="wjmc"/>
<result column="cllxbm" property="cllxbm"/>
<result column="cllxmc" property="cllxmc"/>
<result column="ys" property="ys"/>
<result column="yh" property="yh"/>
<result column="fs" property="fs"/>
<result column="wh" property="wh"/>
<result column="bz" property="bz"/>
<collection property="dgFileDOS" ofType="com.pashanhoo.file.entity.DgFileDO">
<result column="BSM_FILE" property="bsmFile"/>
<result column="DF_BSM_CATALOG" property="bsmCatalog"/>
<result column="KZM" property="kzm"/>
<result column="SCRQ" property="scrq"/>
<result column="SCR" property="scr"/>
<result column="FJURL" property="fjurl"/>
<result column="FJSIZE" property="fjsize"/>
</collection>
</resultMap>
<select id="selectCatalogWithFile" resultMap="CatalogWithFile">
select DAC.*, DF.BSM_FILE as BSM_FILE, DF.BSM_CATALOG as DF_BSM_CATALOG, DF.KZM as KZM,DF.SCRQ as SCRQ,DF.SCR as SCR,DF.FJURL as FJURL,DF.FJSIZE as FJSIZE
from DG_FILE DF
left join DG_ARCHIVES_CATALOG DAC on DAC.BSM_CATALOG =
DF.BSM_CATALOG
<where>
<if test="request.bsmArchives != null and request.bsmArchives != ''">
BSM_ARCHIVES = #{request.bsmArchives,jdbcType=VARCHAR}
</if>
</where>
order by XH
</select>
</mapper>
......
......@@ -23,40 +23,30 @@
FJSIZE
</sql>
<resultMap id="CatalogWithFile" type="com.pashanhoo.catalog.entity.vo.DgArchivesCatalogWithFileVO">
<resultMap id="result" type="com.pashanhoo.file.entity.vo.DgCatalogWithFileVO">
<result column="bsm_catalog" property="bsmCatalog"/>
<result column="bsm_archives" property="bsmArchives"/>
<result column="xh" property="xh"/>
<result column="wjbm" property="wjbm"/>
<result column="wjmc" property="wjmc"/>
<result column="cllxbm" property="cllxbm"/>
<result column="cllxmc" property="cllxmc"/>
<result column="ys" property="ys"/>
<result column="yh" property="yh"/>
<result column="fs" property="fs"/>
<result column="wh" property="wh"/>
<result column="bz" property="bz"/>
<collection property="dgFileDOS" ofType="com.pashanhoo.file.entity.DgFileDO">
<result column="BSM_FILE" property="bsmFile"/>
<result column="DF_BSM_CATALOG" property="bsmCatalog"/>
<result column="KZM" property="kzm"/>
<result column="SCRQ" property="scrq"/>
<result column="SCR" property="scr"/>
<result column="FJURL" property="fjurl"/>
<result column="FJSIZE" property="fjsize"/>
<result column="xh" property="xh"/>
<collection property="fileLists" ofType="com.pashanhoo.file.entity.vo.DgFileListVO">
<result column="bsm_file" property="bsmFile"/>
<result column="bsm_catalog" property="bsmCatalog"/>
<result column="kzm" property="kzm"/>
<result column="scrq" property="scrq"/>
<result column="scr" property="scr"/>
<result column="fjurl" property="fjurl"/>
<result column="fjsize" property="fjsize"/>
</collection>
</resultMap>
<select id="selectCatalogWithFile" resultMap="CatalogWithFile">
select DAC.*, DF.BSM_FILE as BSM_FILE, DF.BSM_CATALOG as DF_BSM_CATALOG, DF.KZM as KZM,DF.SCRQ as SCRQ,DF.SCR as SCR,DF.FJURL as FJURL,DF.FJSIZE as FJSIZE
<select id="getFileList" resultType="com.pashanhoo.file.entity.vo.DgFileListVO">
select DF.*, DAC.XH, DAC.WJMC,DAC.BSM_CATALOG
from DG_FILE DF
left join DG_ARCHIVES_CATALOG DAC on DAC.BSM_CATALOG =
DF.BSM_CATALOG
join DG_ARCHIVES_CATALOG DAC on DAC.BSM_CATALOG = DF.BSM_CATALOG
<where>
<if test="request.bsmArchives != null and request.bsmArchives != ''">
BSM_ARCHIVES = #{request.bsmArchives,jdbcType=VARCHAR}
<if test="bsmArchive != null and bsmArchive != ''">
BSM_ARCHIVES = #{bsmArchive,jdbcType=VARCHAR}
</if>
</where>
order by XH
order by DAC.XH
</select>
</mapper>
......