档案修改查询列表数据去重.
档案补录新增上传文件时判断是否有卷内目录
Showing
9 changed files
with
33 additions
and
9 deletions
| 1 | package com.pashanhoo.file.controller; | 1 | package com.pashanhoo.file.controller; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.StrUtil; | ||
| 3 | import com.pashanhoo.common.Result; | 4 | import com.pashanhoo.common.Result; |
| 4 | import com.pashanhoo.file.entity.vo.AddDgFileRequest; | 5 | import com.pashanhoo.file.entity.vo.AddDgFileRequest; |
| 5 | import com.pashanhoo.file.entity.vo.DgCatalogWithFileVO; | 6 | import com.pashanhoo.file.entity.vo.DgCatalogWithFileVO; |
| 6 | import com.pashanhoo.file.entity.vo.UpdateDgFileRequest; | 7 | import com.pashanhoo.file.entity.vo.UpdateDgFileRequest; |
| 7 | import com.pashanhoo.file.service.DgFileService; | 8 | import com.pashanhoo.file.service.DgFileService; |
| 8 | import org.springframework.web.bind.annotation.RestController; | ||
| 9 | import org.springframework.web.bind.annotation.*; | ||
| 10 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; |
| 11 | import io.swagger.annotations.ApiOperation; | 10 | import io.swagger.annotations.ApiOperation; |
| 12 | import io.swagger.annotations.ApiParam; | 11 | import io.swagger.annotations.ApiParam; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.web.bind.annotation.*; | ||
| 14 | import org.springframework.web.multipart.MultipartFile; | 14 | import org.springframework.web.multipart.MultipartFile; |
| 15 | 15 | ||
| 16 | import java.util.List; | 16 | import java.util.List; |
| ... | @@ -79,6 +79,9 @@ public class DgFileController { | ... | @@ -79,6 +79,9 @@ public class DgFileController { |
| 79 | @RequestMapping(value = "/upload", method = RequestMethod.POST) | 79 | @RequestMapping(value = "/upload", method = RequestMethod.POST) |
| 80 | @ApiOperation("上传材料附件") | 80 | @ApiOperation("上传材料附件") |
| 81 | public Result upload(@RequestPart("file") MultipartFile file, AddDgFileRequest fileRequest) { | 81 | public Result upload(@RequestPart("file") MultipartFile file, AddDgFileRequest fileRequest) { |
| 82 | if (StrUtil.isNullOrUndefined(fileRequest.getBsmArchive()) && StrUtil.isNullOrUndefined(fileRequest.getBsmCatalog())) { | ||
| 83 | return Result.error("请先新增档案基本信息和目录"); | ||
| 84 | } | ||
| 82 | try { | 85 | try { |
| 83 | return Result.ok(dgfileService.upload(file, fileRequest)); | 86 | return Result.ok(dgfileService.upload(file, fileRequest)); |
| 84 | } catch (Exception e) { | 87 | } catch (Exception e) { | ... | ... |
| ... | @@ -16,7 +16,6 @@ import org.springframework.stereotype.Service; | ... | @@ -16,7 +16,6 @@ import org.springframework.stereotype.Service; |
| 16 | import org.springframework.transaction.annotation.Transactional; | 16 | import org.springframework.transaction.annotation.Transactional; |
| 17 | import org.springframework.web.multipart.MultipartFile; | 17 | import org.springframework.web.multipart.MultipartFile; |
| 18 | 18 | ||
| 19 | |||
| 20 | import java.util.List; | 19 | import java.util.List; |
| 21 | import java.util.stream.Collectors; | 20 | import java.util.stream.Collectors; |
| 22 | 21 | ... | ... |
| ... | @@ -25,6 +25,7 @@ import com.pashanhoo.modify.entity.DgModifyDO; | ... | @@ -25,6 +25,7 @@ import com.pashanhoo.modify.entity.DgModifyDO; |
| 25 | import com.pashanhoo.modify.entity.vo.*; | 25 | import com.pashanhoo.modify.entity.vo.*; |
| 26 | import com.pashanhoo.modify.mapper.DgArchivesModifyMapper; | 26 | import com.pashanhoo.modify.mapper.DgArchivesModifyMapper; |
| 27 | import com.pashanhoo.modify.service.DgArchivesModifyService; | 27 | import com.pashanhoo.modify.service.DgArchivesModifyService; |
| 28 | import com.pashanhoo.replenish.service.impl.DgArchivesReplenishServiceImpl; | ||
| 28 | import org.springframework.beans.factory.annotation.Autowired; | 29 | import org.springframework.beans.factory.annotation.Autowired; |
| 29 | import org.springframework.stereotype.Service; | 30 | import org.springframework.stereotype.Service; |
| 30 | 31 | ||
| ... | @@ -169,6 +170,9 @@ public class DgArchivesModifyServiceImpl extends ServiceImpl<DgArchivesModifyMap | ... | @@ -169,6 +170,9 @@ public class DgArchivesModifyServiceImpl extends ServiceImpl<DgArchivesModifyMap |
| 169 | public IPage<DgArchivesModifyListVO> searchDgArchivesModifyList(DgArchivesModifySearchRequest request) { | 170 | public IPage<DgArchivesModifyListVO> searchDgArchivesModifyList(DgArchivesModifySearchRequest request) { |
| 170 | IPage<DgArchivesModifyListVO> pageParam = new Page<>(request.getCurrentPage(), request.getPageSize()); | 171 | IPage<DgArchivesModifyListVO> pageParam = new Page<>(request.getCurrentPage(), request.getPageSize()); |
| 171 | IPage<DgArchivesModifyListVO> list = dgarchivesmodifyMapper.searchDgArchivesModifyList(pageParam, request); | 172 | IPage<DgArchivesModifyListVO> list = dgarchivesmodifyMapper.searchDgArchivesModifyList(pageParam, request); |
| 173 | List<DgArchivesModifyListVO> records = list.getRecords(); | ||
| 174 | List<DgArchivesModifyListVO> clean = records.stream().filter(DgArchivesReplenishServiceImpl.distinctByKey(DgArchivesModifyListVO::getBsmModify)).collect(Collectors.toList()); | ||
| 175 | list.setRecords(clean).setTotal(clean.size()); | ||
| 172 | return list; | 176 | return list; |
| 173 | } | 177 | } |
| 174 | 178 | ... | ... |
| ... | @@ -59,7 +59,7 @@ public class DgArchivesReplenishController { | ... | @@ -59,7 +59,7 @@ public class DgArchivesReplenishController { |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | @PostMapping("search") | 61 | @PostMapping("search") |
| 62 | @ApiOperation(value = "根据条件进行列表查询") | 62 | @ApiOperation(value = "补录列表根据条件查询") |
| 63 | public Result<IPage<DgArchivesReplenishListVO>> searchDgArchivesReplenishList(@RequestBody DgArchivesReplenishSearchRequest request) { | 63 | public Result<IPage<DgArchivesReplenishListVO>> searchDgArchivesReplenishList(@RequestBody DgArchivesReplenishSearchRequest request) { |
| 64 | 64 | ||
| 65 | return Result.ok(dgarchivesreplenishService.searchDgArchivesReplenishList(request)); | 65 | return Result.ok(dgarchivesreplenishService.searchDgArchivesReplenishList(request)); | ... | ... |
| ... | @@ -19,6 +19,12 @@ import org.apache.ibatis.annotations.Param; | ... | @@ -19,6 +19,12 @@ import org.apache.ibatis.annotations.Param; |
| 19 | */ | 19 | */ |
| 20 | public interface DgArchivesReplenishMapper extends BaseMapper<DgArchivesReplenishDO> { | 20 | public interface DgArchivesReplenishMapper extends BaseMapper<DgArchivesReplenishDO> { |
| 21 | 21 | ||
| 22 | /** | ||
| 23 | * 补录列表根据条件查询 | ||
| 24 | * @param pageParam | ||
| 25 | * @param request | ||
| 26 | * @return | ||
| 27 | */ | ||
| 22 | IPage<DgArchivesReplenishListVO> search(@Param("pageParam") IPage<DgArchivesReplenishListVO> pageParam, @Param("request") DgArchivesReplenishSearchRequest request); | 28 | IPage<DgArchivesReplenishListVO> search(@Param("pageParam") IPage<DgArchivesReplenishListVO> pageParam, @Param("request") DgArchivesReplenishSearchRequest request); |
| 23 | 29 | ||
| 24 | } | 30 | } | ... | ... |
| ... | @@ -33,7 +33,7 @@ public interface DgArchivesReplenishService extends IService<DgArchivesReplenish | ... | @@ -33,7 +33,7 @@ public interface DgArchivesReplenishService extends IService<DgArchivesReplenish |
| 33 | DgArchivesReplenishDetailVO getDgArchivesReplenishDetailById(String id); | 33 | DgArchivesReplenishDetailVO getDgArchivesReplenishDetailById(String id); |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * 根据条件进行列表查询 | 36 | * 补录列表根据条件查询 |
| 37 | * | 37 | * |
| 38 | * @param request | 38 | * @param request |
| 39 | * @return | 39 | * @return | ... | ... |
| ... | @@ -44,6 +44,9 @@ import org.springframework.transaction.annotation.Transactional; | ... | @@ -44,6 +44,9 @@ import org.springframework.transaction.annotation.Transactional; |
| 44 | 44 | ||
| 45 | import java.util.ArrayList; | 45 | import java.util.ArrayList; |
| 46 | import java.util.List; | 46 | import java.util.List; |
| 47 | import java.util.concurrent.ConcurrentHashMap; | ||
| 48 | import java.util.function.Function; | ||
| 49 | import java.util.function.Predicate; | ||
| 47 | import java.util.stream.Collectors; | 50 | import java.util.stream.Collectors; |
| 48 | 51 | ||
| 49 | /** | 52 | /** |
| ... | @@ -164,7 +167,7 @@ public class DgArchivesReplenishServiceImpl extends ServiceImpl<DgArchivesReplen | ... | @@ -164,7 +167,7 @@ public class DgArchivesReplenishServiceImpl extends ServiceImpl<DgArchivesReplen |
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | /** | 169 | /** |
| 167 | * 根据条件进行列表查询 | 170 | * 补录列表根据条件查询 |
| 168 | * | 171 | * |
| 169 | * @param request | 172 | * @param request |
| 170 | * @return | 173 | * @return |
| ... | @@ -173,7 +176,16 @@ public class DgArchivesReplenishServiceImpl extends ServiceImpl<DgArchivesReplen | ... | @@ -173,7 +176,16 @@ public class DgArchivesReplenishServiceImpl extends ServiceImpl<DgArchivesReplen |
| 173 | public IPage<DgArchivesReplenishListVO> searchDgArchivesReplenishList(DgArchivesReplenishSearchRequest request) { | 176 | public IPage<DgArchivesReplenishListVO> searchDgArchivesReplenishList(DgArchivesReplenishSearchRequest request) { |
| 174 | 177 | ||
| 175 | IPage<DgArchivesReplenishListVO> pageParam = new Page<>(request.getCurrentPage(), request.getPageSize()); | 178 | IPage<DgArchivesReplenishListVO> pageParam = new Page<>(request.getCurrentPage(), request.getPageSize()); |
| 176 | return dgarchivesreplenishMapper.search(pageParam, request); | 179 | IPage<DgArchivesReplenishListVO> result = dgarchivesreplenishMapper.search(pageParam, request); |
| 180 | List<DgArchivesReplenishListVO> records = result.getRecords(); | ||
| 181 | List<DgArchivesReplenishListVO> clean = records.stream().filter(distinctByKey(DgArchivesReplenishListVO::getBsmArchives)).collect(Collectors.toList()); | ||
| 182 | result.setTotal(clean.size()); | ||
| 183 | return result.setRecords(clean); | ||
| 184 | } | ||
| 185 | |||
| 186 | public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { | ||
| 187 | ConcurrentHashMap<Object, Boolean> hashMap = new ConcurrentHashMap<>(); | ||
| 188 | return t -> hashMap.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; | ||
| 177 | } | 189 | } |
| 178 | 190 | ||
| 179 | /** | 191 | /** | ... | ... |
| ... | @@ -54,7 +54,7 @@ | ... | @@ -54,7 +54,7 @@ |
| 54 | DM.CREATETIME, | 54 | DM.CREATETIME, |
| 55 | DM.CREATER, | 55 | DM.CREATER, |
| 56 | DM.STATE, | 56 | DM.STATE, |
| 57 | count(*) over (partition by BDCDY.bdcdyh) as bdcdyNum | 57 | count(1) over (partition by DM.BSM_MODIFY) as bdcdyNum |
| 58 | from DG_MODIFY DM | 58 | from DG_MODIFY DM |
| 59 | join DG_BUSINESS DB on DM.BSM_ARCHIVES = DB.BSM_ARCHIVES | 59 | join DG_BUSINESS DB on DM.BSM_ARCHIVES = DB.BSM_ARCHIVES |
| 60 | join DG_BDCDY BDCDY on DM.BSM_ARCHIVES = BDCDY.BSM_ARCHIVES | 60 | join DG_BDCDY BDCDY on DM.BSM_ARCHIVES = BDCDY.BSM_ARCHIVES | ... | ... |
| ... | @@ -25,7 +25,7 @@ | ... | @@ -25,7 +25,7 @@ |
| 25 | DGR.CREATETIME, | 25 | DGR.CREATETIME, |
| 26 | DGR.CREATER, | 26 | DGR.CREATER, |
| 27 | DGR.STATE, | 27 | DGR.STATE, |
| 28 | count(*) over (partition by BDCDY.bdcdyh) as bdcdyNum | 28 | count(1) over (partition by BDCDY.BSM_ARCHIVES) as bdcdyNum |
| 29 | from DG_REPLENISH DGR | 29 | from DG_REPLENISH DGR |
| 30 | join DG_ARCHIVES DA on DA.BSM_ARCHIVES = DGR.BSM_ARCHIVES | 30 | join DG_ARCHIVES DA on DA.BSM_ARCHIVES = DGR.BSM_ARCHIVES |
| 31 | join DG_BDCDY BDCDY on BDCDY.BSM_ARCHIVES = DGR.BSM_ARCHIVES | 31 | join DG_BDCDY BDCDY on BDCDY.BSM_ARCHIVES = DGR.BSM_ARCHIVES | ... | ... |
-
Please register or sign in to post a comment