diff --git a/archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java b/archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java index ac4c4d1..7564f6c 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java +++ b/archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java @@ -7,11 +7,13 @@ import com.storeroom.modules.archives.service.dto.ArchivesFileDTO; import com.storeroom.modules.common.ArchivesTypeEnum; import com.storeroom.modules.common.ExcelUtil; import com.storeroom.modules.dictionary.domain.ArchivesDictionary; +import com.storeroom.modules.dictionary.domain.ArchivesType; import com.storeroom.modules.dictionary.service.ArchivesTypeService; import com.storeroom.modules.dictionary.service.dto.ArchivesTypeDTO; import com.storeroom.modules.dictionary.service.dto.FieldDTO; import com.storeroom.utils.ApiResponse; import com.storeroom.utils.SecurityUtils; +import com.storeroom.utils.StringUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -59,10 +61,28 @@ public class ArchivesController { String responsibleby,Integer archivesState,String archiveYear,String department,String retention,String securityClass, String organizationMatter,boolean isdel,Pageable page ){ + //获取检索门类信息 + ArchivesTypeDTO dto = archivesTypeService.findById(categoryId); + String query = ""; + if(dto.getIsType()==ArchivesTypeEnum.archives.getCode()){ + query = (StringUtils.isEmpty(queryTitle)?"":queryTitle)+(StringUtils.isEmpty(archiveNo)?"":archiveNo)+(StringUtils.isEmpty(archiveCtgNo)?"":archiveCtgNo); + }else if(dto.getIsType()==ArchivesTypeEnum.files.getCode()){ + query = (StringUtils.isEmpty(queryTitle)?"":queryTitle)+(StringUtils.isEmpty(archiveNo)?"":archiveNo)+(StringUtils.isEmpty(responsibleby)?"":responsibleby); + }else if(dto.getIsType()==ArchivesTypeEnum.inChive.getCode()){ + query = (StringUtils.isEmpty(queryTitle)?"":queryTitle)+(StringUtils.isEmpty(archiveNo)?"":archiveNo)+(StringUtils.isEmpty(responsibleby)?"":responsibleby); + } + archivesService.addArchivesSearchLog(categoryId,query); return ApiResponse.success(archivesService.initArchivesView(categoryId,parentsId,queryType,queryTitle,itemNo,archiveNo,archiveCtgNo,responsibleby, archivesState,archiveYear,department,retention,securityClass,organizationMatter,isdel,page)); } + @ApiOperation("获取档案总数") + @GetMapping("/getArchivesNum") + public ApiResponse getArchivesNum() + { + return ApiResponse.success(archivesService.getArchivesNum()); + } + @ApiOperation("档案列表外放接口") // @GetMapping("/getArchivesRelease") @AnonymousGetMapping("/getArchivesRelease") @@ -175,6 +195,34 @@ public class ArchivesController { return ApiResponse.success(archivesService.completelyDelete(dto)); } + @ApiOperation("档案类别数量统计") + @GetMapping("/initArchivesTypeNum") + public ApiResponse initArchivesTypeNum(Integer type) + { + return ApiResponse.success(archivesService.initArchivesTypeNum(type)); + } + + @ApiOperation("档案类型统计") + @GetMapping("/initArchivesTypeStatistics") + public ApiResponse initArchivesTypeStatistics(Integer type) + { + return ApiResponse.success(archivesService.initArchivesTypeStatistics(type)); + } + + @ApiOperation("档案实际情况") + @GetMapping("/initAddArchivesStatistics") + public ApiResponse initAddArchivesStatistics(Integer type) + { + return ApiResponse.success(archivesService.initAddArchivesStatistics(type)); + } + + @ApiOperation("档案检索排名") + @GetMapping("/initArchivesSearchRanking") + public ApiResponse initArchivesSearchRanking(Integer type) + { + return ApiResponse.success(archivesService.initArchivesSearchRanking(type)); + } + @ApiOperation("根据门类导出数据") // @GetMapping("/exportArchives") @AnonymousGetMapping("/exportArchives") @@ -249,4 +297,6 @@ public class ArchivesController { return ApiResponse.success("/"+path); } + + } diff --git a/archives/src/main/java/com/storeroom/modules/archives/controller/ArrangeController.java b/archives/src/main/java/com/storeroom/modules/archives/controller/ArrangeController.java index efe8c22..276bce7 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/controller/ArrangeController.java +++ b/archives/src/main/java/com/storeroom/modules/archives/controller/ArrangeController.java @@ -34,6 +34,16 @@ public class ArrangeController { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); private final ArrangeService arrangeService; + @ApiOperation("预览盘点信息") + @GetMapping("/previewArrange") + public ApiResponse previewArrange( + @RequestParam("deviceIds") List deviceIds, + @RequestParam("categoryIds") List categoryIds, + Pageable page + ){ + return ApiResponse.success(arrangeService.previewArrange(deviceIds,categoryIds,page)); + } + @ApiOperation("新增盘点") @PostMapping("/addArrange") public ApiResponse addArrange( @@ -69,9 +79,9 @@ public class ArrangeController { @ApiOperation("结算盘点") @PostMapping("/settlement") public ApiResponse settlement( - @Validated @RequestBody String orderId + @Validated @RequestBody ArrangeAddDTO dto ){ - return ApiResponse.success(arrangeService.settlement(orderId)); + return ApiResponse.success(arrangeService.settlement(dto.getOrderId())); } @ApiOperation("清空完结盘点缓存数据") diff --git a/archives/src/main/java/com/storeroom/modules/archives/controller/BorrowController.java b/archives/src/main/java/com/storeroom/modules/archives/controller/BorrowController.java index 354c881..679650f 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/controller/BorrowController.java +++ b/archives/src/main/java/com/storeroom/modules/archives/controller/BorrowController.java @@ -230,6 +230,20 @@ public class BorrowController { return ApiResponse.success(borrowService.delBorrower(borrowersId)); } + @ApiOperation("待办事项") + @GetMapping("/waitBorrower") + public ApiResponse waitBorrow() + { + return ApiResponse.success(borrowService.waitBorrow()); + } + + @ApiOperation("档案借阅数量统计") + @GetMapping("/initBorrowerNumStatistics") + public ApiResponse initBorrowerNumStatistics() + { + return ApiResponse.success(borrowService.initBorrowerNumStatistics()); + } + @ApiOperation("导出借阅信息") @AnonymousGetMapping("/exportBorrow") @ResponseBody diff --git a/archives/src/main/java/com/storeroom/modules/archives/controller/CaseController.java b/archives/src/main/java/com/storeroom/modules/archives/controller/CaseController.java index 38ec0eb..22fa4ef 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/controller/CaseController.java +++ b/archives/src/main/java/com/storeroom/modules/archives/controller/CaseController.java @@ -51,6 +51,13 @@ public class CaseController { return ApiResponse.success(caseService.initCaseAll(page)); } + @ApiOperation("获取档案盒总数") + @AnonymousGetMapping("/getCaseNum") + public ApiResponse getCaseNum() + { + return ApiResponse.success(caseService.getCaseNum()); + } + @ApiOperation("档案盒名称是否重复") @GetMapping("/caseNameIsRepeat") public ApiResponse caseNameIsRepeat( diff --git a/archives/src/main/java/com/storeroom/modules/archives/controller/RFIDController.java b/archives/src/main/java/com/storeroom/modules/archives/controller/RFIDController.java index e16873a..6ff243b 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/controller/RFIDController.java +++ b/archives/src/main/java/com/storeroom/modules/archives/controller/RFIDController.java @@ -303,6 +303,14 @@ public class RFIDController { return ApiResponse.success(borrowService.initBillDetailsByOrderNo(orderNo)); } + @ApiOperation("盘点列表") + @AnonymousGetMapping("/initArrangeList") + public ApiResponse initArrangeList( + Integer checkState, String region, String orderNo, Pageable page + ){ + return ApiResponse.success(arrangeService.initArrangeList(checkState,region,orderNo,page)); + } + @ApiOperation("根据盘点单号获取盘点基本信息") @AnonymousPostMapping("/findArrangeDetailsByOrderNo") public ApiResponse findArrangeDetailsByOrderNo( diff --git a/archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java b/archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java index 59db61d..d38854d 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java +++ b/archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java @@ -121,7 +121,7 @@ public class StorageController { DeviceInfoDto device = deviceService.findById(deviceId); //判断设备是否有回调 OperatingState callback = operatingStateService.findByDeviceIdAndStateType(deviceId,2); - boolean isCallback = callback == null ? false : callback.getInBound(); + boolean isCallback = callback == null ? false : callback.getInBound()==null?false:callback.getInBound(); List cases = caseService.collect(isCallback,dtos); //判断设备是否有联动 OperatingState linkage = operatingStateService.findByDeviceIdAndStateType(deviceId,1); @@ -176,12 +176,12 @@ public class StorageController { if(null != device){ //判断设备是否有回调 OperatingState callback = operatingStateService.findByDeviceIdAndStateType(device.getId(),2); - boolean isCallback = callback == null ? false : callback.getOutBound(); + boolean isCallback = callback == null ? false : callback.getOutBound() == null ? false:callback.getOutBound(); Integer deviceType = caseService.grant(isCallback,caseId); //判断设备是否有联动 OperatingState linkage = operatingStateService.findByDeviceIdAndStateType(device.getId(),1); - if(null != linkage && linkage.getOutBound()){ + if(null != linkage && isCallback){ try { if(deviceType==1){ String[] shelf = thisCase.getFolderLocation().split("-"); @@ -324,6 +324,14 @@ public class StorageController { return ApiResponse.success(caseService.initStorageLogDetailes(logId)); } + @ApiOperation("出入库月份统计") + @GetMapping("/storageStatistics") + public ApiResponse storageStatistics( + Integer type + ){ + return ApiResponse.success(caseService.storageStatistics(type)); + } + @ApiOperation("导出出入库记录") @AnonymousGetMapping("/exportStorageLogList") @ResponseBody diff --git a/archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesSearchLog.java b/archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesSearchLog.java new file mode 100644 index 0000000..0867986 --- /dev/null +++ b/archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesSearchLog.java @@ -0,0 +1,43 @@ +package com.storeroom.modules.archives.domain; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.annotations.CreationTimestamp; + +import javax.persistence.*; +import java.io.Serializable; +import java.sql.Timestamp; + +@Entity +@Getter +@Setter +@Table(name = "archives_search_log") +public class ArchivesSearchLog implements Serializable { + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + private Integer id; + + @Column(name = "category_id") + @ApiModelProperty(value = "门类id") + private String categoryId; + + @Column(name = "category_root_id") + @ApiModelProperty(value = "所属门类id") + private String categoryRootId; + + @Column(name = "search_key") + @ApiModelProperty(value = "查询关键字") + private String searchKey; + + @CreationTimestamp + @Column(name = "create_time", updatable = false) + @ApiModelProperty(value = "创建时间", hidden = true) + @JSONField(name="createTime") + @JsonProperty("create_time") + private Timestamp createTime; + +} diff --git a/archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java b/archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java index fdf952a..f996656 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java +++ b/archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java @@ -28,11 +28,14 @@ public interface ArchivesCaseRepository extends JpaRepository initCaseAll(Pageable page); + @Query("select count(id) from ArchivesCase") + Integer getCaseNum(); + @Query(nativeQuery = true, countQuery = "select count(1) from archives_case where storage_type in ?4 and deposit_num != 0 and if(?1 is null,1=1,case_name like ?1) and " + "if(?2 is null,1=1,tid like ?2) and if(?3 is null,1=1,barcode like ?3) ", value = "select id,case_name,case_type,tid,barcode,shelf_id,folder_location,deposit_num,storage_type,storage_time,create_by,update_by,create_time,update_time," + - "(SELECT group_concat(DISTINCT CONCAT( room.NAME, ' ', di.device_name, ' ', ace.folder_location_details)) FROM archives_case_cartoning acc INNER JOIN archives_case ace ON acc.case_id = ace.id INNER JOIN device_archives_tag dat ON ace.folder_location = dat.position INNER JOIN device_info di ON dat.device_info_id = di.id INNER JOIN storeroom room ON room.id = di.storeroom_id WHERE ace.id = t.id) as folder_location_details " + + "t.folder_location_details " + "from archives_case t where storage_type in ?4 and deposit_num != 0 and if(?1 is null,1=1,case_name like ?1) and " + "if(?2 is null,1=1,tid like ?2) and if(?3 is null,1=1,barcode like ?3) order by t.create_time desc ") Page readyIntoCase(String caseName, String tid,String barcode,List storageType, Pageable page); @@ -41,19 +44,16 @@ public interface ArchivesCaseRepository extends JpaRepository= 2 " + "AND if(?1 is null,1=1,ace.case_name like ?1) " + "AND if(?2 is null,1=1,asum.archive_no like ?2) " + "AND if(?3 is null,1=1,asum.maintitle like ?3) " + - "AND if(?4 is null,1=1,CONCAT(room.name ,'-' , di.device_name , '-' , dat.position_name) like ?4) order by storage_time desc") + "AND if(?4 is null,1=1,ace.folder_location_details like ?4) order by storage_time desc") Page> alReadyInto(String caseName, String archiveNo, String title, String location, Pageable page); @@ -133,6 +133,12 @@ public interface ArchivesCaseRepository extends JpaRepository{ + +} diff --git a/archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java b/archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java index 563486f..4203c9e 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java +++ b/archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java @@ -32,6 +32,17 @@ public interface ArchivesSummaryRepository extends JpaRepository> queryVagueArchives(String criteria, String query,Pageable page); + @Query(nativeQuery = true, + value = "select category_id " + + "from archives_summary " + + "where category_type in (3,5) and if(length(?2)=0,1=1,if(?1 = 'maintitle',maintitle regexp ?2,if(?1 = 'archive_no',archive_no regexp ?2,if(?1 = 'archive_year',archive_year regexp ?2,if(?1 = 'security_class',security_class regexp ?2,if(?1 = 'case_name',case_name regexp ?2,if(?1 = 'retention',retention regexp ?2,if(?1 = 'department',department regexp ?2,1=1)))))))) " + + "group by category_id") + List queryVagueArchivesGetCategoryIds(String criteria, String query); + + @Query(nativeQuery = true, + value = "select count(1) from archives_summary where category_type = 3 or category_type = 5") + Integer getArchivesNum(); + @Modifying @Transactional(rollbackFor = Exception.class) @Query(nativeQuery = true, @@ -147,4 +158,60 @@ public interface ArchivesSummaryRepository extends JpaRepository previewArrangeByDeviceIdsAndCategoryIds(List deviceIds,List categroyIds,Pageable page); + + @Query(nativeQuery = true, + countQuery = "select count(1) from archives_summary asy where (asy.category_type = 3 or asy.category_type = 5) and " + + "asy.archives_id in (select DISTINCT acc.parent_id from archives_case_cartoning acc " + + "inner join archives_case ace on acc.case_id = ace.id " + + "inner join device_archives_tag dat on ace.folder_location = dat.position where dat.device_info_id in ?1) ", + value = "select asy.* from archives_summary asy where (asy.category_type = 3 or asy.category_type = 5) and " + + "asy.archives_id in (select DISTINCT acc.parent_id from archives_case_cartoning acc " + + "inner join archives_case ace on acc.case_id = ace.id " + + "inner join device_archives_tag dat on ace.folder_location = dat.position where dat.device_info_id in ?1) " + + "order by create_time desc") + Page previewArrangeByDeviceIds(List deviceIds,Pageable page); + + @Query(nativeQuery = true, + countQuery = "select count(1) from archives_summary asy where category_id in ?1 ", + value = "select asy.* from archives_summary asy where category_id in ?1 order by create_time desc") + Page previewArrangeByCategoryIds(List categroyIds,Pageable page); + + @Query(nativeQuery = true, + countQuery = "select count(1) from archives_summary asy where (asy.category_type = 3 or asy.category_type = 5) ", + value = "select asy.* from archives_summary asy where (asy.category_type = 3 or asy.category_type = 5) order by create_time desc") + Page previewArrangeAll(Pageable page); + + @Query(nativeQuery = true, + value = "select count(1) from archives_summary where category_type = ?1 and if(?2 = 1,YEAR(create_time) = YEAR(NOW()),1=1)") + Integer getArchivesNumByTpye(Integer type,Integer timeType); + + @Query(nativeQuery = true, + value = "select count(1) from archives_summary where category_id = ?1 and if(?2 = 1,YEAR(create_time) = YEAR(NOW()),1=1)") + Integer getArchivesNumByCategoryIds(List categoryIds,Integer type); + + @Query(nativeQuery = true, + value = "SELECT date_format(create_time, '%c') as month,count(1) as num " + + "FROM archives_summary where (category_type = 3 or category_type = 5) " + + "AND if(?1 = 1,YEAR(create_time) = YEAR(NOW()),1=1) group by month") + List> initAddArchivesStatistics(Integer timeType); + + @Query(nativeQuery = true, + value = "select t2.id,t2.cn_name as cnName,t1.num from (select category_root_id,count(1) as num " + + "from archives_search_log where if(?1 = 1,YEAR(create_time) = YEAR(NOW()),1=1) group by category_root_id order by num desc limit 0,5) t1 " + + "inner join archives_type t2 on t1.category_root_id = t2.id order by num desc") + List> initArchivesSearchRanking(Integer timeType); + } diff --git a/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowArchivesRepository.java b/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowArchivesRepository.java index a914a4a..aee5df4 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowArchivesRepository.java +++ b/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowArchivesRepository.java @@ -86,7 +86,7 @@ public interface BorrowArchivesRepository extends JpaRepository=DATE(now()) then '待归还' else '未知' end as borrowType,bbl.create_by as createBy,bbl.create_time as createTime " + @@ -127,7 +127,8 @@ public interface BorrowArchivesRepository extends JpaRepository= DATE(now()) THEN '待归还' " + @@ -151,4 +152,40 @@ public interface BorrowArchivesRepository extends JpaRepository> initBorrowLog(String orderNo, String borrowerName, String phone, String archiveNo,String folderLocationDetails, String caseName, String barcode, String tid,Integer borrowType,String maintitle, Pageable page); + @Query(nativeQuery = true, + value = "select count(1) from borrow_bill_archives bba inner join borrow_archives ba on bba.ba_id = ba.id where bba.bill_id = ?1 and ba.borrow_type != -1 ") + Integer getNoAbnormalByOrderNo(String orderNo); + + @Query(nativeQuery = true, + value = "select concat(maintitle,'档案已加入待借申请,请及时处理') as title,update_time from borrow_archives where borrow_type = 1 order by update_time desc") + List> waitBorrow1(); + @Query(nativeQuery = true, + value = "select concat(br.borrower_name,'已登记,请及时处理') as title,ba.update_time from borrow_archives ba " + + "inner join borrow_bill_archives bba on ba.id = bba.ba_id inner join borrow_bill bbl on bba.bill_id = bbl.id " + + "inner join borrower br on bbl.borrower_id = br.id where ba.borrow_type = 2 order by ba.update_time desc") + List> waitBorrow2(); + @Query(nativeQuery = true, + value = "select concat(maintitle,'档案已逾期,请及时处理') as title,ba.update_time from borrow_archives ba inner join borrow_bill_archives bba on ba.id = bba.ba_id inner join borrow_bill bbl on bba.bill_id = bbl.id where ba.borrow_type = 3 and bbl.borrow_end <= now() order by ba.update_time desc") + List> waitBorrow4(); + @Query(nativeQuery = true, + value = "select concat(maintitle,'档案已到归还时间,请及时处理') as title,ba.update_time from borrow_archives ba inner join borrow_bill_archives bba on ba.id = bba.ba_id inner join borrow_bill bbl on bba.bill_id = bbl.id where ba.borrow_type = 3 and bbl.borrow_end >= now() and TIMESTAMPDIFF(hour,now(),bbl.borrow_end) <= 24 order by ba.update_time desc") + List> waitBorrow3(); + + + @Query(nativeQuery = true, + value = "select count(1) from archives_summary asy where asy.archives_id in (select DISTINCT acc.parent_id from archives_case ace inner join archives_case_cartoning acc on ace.id = acc.case_id where ace.shelf_id is not null)") + Integer getStorageTotal(); + @Query(nativeQuery = true, + value = "select count(1) from borrow_archives where borrow_type = 3") + Integer getBorrowNum(); + @Query(nativeQuery = true, + value = "select count(1) from borrow_archives where borrow_type = 1 or borrow_type = 2") + Integer getWaitBorrowNum(); + @Query(nativeQuery = true, + value = "select count(1) from borrow_archives ba inner join borrow_bill_archives bba on ba.id = bba.ba_id inner join borrow_bill bbl on bba.bill_id = bbl.id where ba.borrow_type = 3 and bbl.borrow_end <= now()") + Integer getOverdueNum(); + @Query(nativeQuery = true, + value = "select count(1) from borrow_archives t1 inner join (select ba.archives_id,max(ba.update_time) as update_time from borrow_archives ba group by ba.archives_id) t2 on t1.archives_id = t2.archives_id and t1.update_time = t2.update_time where t1.borrow_type = -1") + Integer getAbnormalNum(); + } diff --git a/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowBillRepository.java b/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowBillRepository.java index f4ae742..809a083 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowBillRepository.java +++ b/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowBillRepository.java @@ -67,7 +67,7 @@ public interface BorrowBillRepository extends JpaRepository List findOrderIdsByRbId(List rbIds); @Query(nativeQuery = true, - value = "select count(1) from borrow_bill_archives bba inner join borrow_archives ba on bba.ba_id = ba.id where ba.borrow_type != 4 and bill_id = ?1 limit 0,1") + value = "select count(1) from borrow_bill_archives bba inner join borrow_archives ba on bba.ba_id = ba.id where ba.borrow_type != 4 and ba.borrow_type!=-1 and bill_id = ?1 limit 0,1") Integer getNotReturnedNum(String orderNo); } diff --git a/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowerRepository.java b/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowerRepository.java index 4b071e1..bec6581 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowerRepository.java +++ b/archives/src/main/java/com/storeroom/modules/archives/repository/BorrowerRepository.java @@ -8,6 +8,7 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import java.util.List; +import java.util.Map; public interface BorrowerRepository extends JpaRepository { @@ -30,5 +31,4 @@ public interface BorrowerRepository extends JpaRepository { @Modifying @Query("update Borrower set isDelete = true where id in ?1 ") void delAllByIds(List borrowerIds); - } diff --git a/archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java b/archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java index 061e0bf..c065843 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java +++ b/archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java @@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; +import java.util.Map; public interface StorageLogRepository extends JpaRepository{ @@ -17,4 +18,11 @@ public interface StorageLogRepository extends JpaRepository "and if(?4 is null,1=1,barcode like ?4) ") Page initStorageLogList(Integer storageType, String caseName, String tid, String barcode, Pageable page); + @Query(nativeQuery = true, + value = "select t.month,max(if(t.storage_type=1,num,0)) as doInStorage,max(if(t.storage_type=2,num,0)) as inStorage," + + "max(if(t.storage_type=3,num,0)) as doOutStorage,max(if(t.storage_type=4,num,0)) as outStorage " + + "from (select storage_type,date_format(create_time, '%c') as month,count(1) as num from storage_log " + + "where if(?1 = 1,YEAR(create_time) = YEAR(NOW()),1=1) group by storage_type,month) t group by t.month") + List> storageStatistics(Integer timeType); + } diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java b/archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java index 6d440b9..49ce081 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java @@ -16,6 +16,8 @@ public interface ArchivesCaseService { //初始化档案盒列表 Object initCaseList(Integer storageType,String tid, String caseName,String barcode, Pageable page); Object initCaseAll(Pageable page); + //获取档案盒总数 + Integer getCaseNum(); //判断档案盒名称是否重复 Object caseNameIsRepeat(String caseId,String caseName); //判断档案盒条形码是否重复 @@ -84,4 +86,6 @@ public interface ArchivesCaseService { List initCaseLogList(List logs); //第三方回调 Integer externalCallback(String caseId); + //出入库统计 + Object storageStatistics(Integer type); } diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java b/archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java index 17ecd88..1652aaa 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java @@ -10,6 +10,7 @@ import com.storeroom.utils.ApiResponse; import org.springframework.data.domain.Pageable; import java.util.List; +import java.util.Map; public interface ArchivesService { //根据档案id获取档案详细数据 @@ -20,6 +21,10 @@ public interface ArchivesService { Object initArchivesView(String categoryId,String parentsId,Integer queryType, String queryTitle,String itemNo,String archiveNo,String archiveCtgNo, String responsibleby,Integer archivesState,String archiveYear,String department,String retention,String securityClass, String organizationMatter,boolean isdel,Pageable page); + //添加档案检索日志 + void addArchivesSearchLog(String categoryId,String query); + //获取档案总数 + Integer getArchivesNum(); //档案列表外放接口 Object getArchivesRelease(Pageable page); //档案模糊查询 @@ -56,6 +61,14 @@ public interface ArchivesService { boolean isShelfOccupy(String shelfId); //根据标签id获取档案基本信息 ArchivesSummary findArchivesByTid(String tid); + //档案类别数量统计 + Map initArchivesTypeNum(Integer type); + //档案类型统计 + Object initArchivesTypeStatistics(Integer type); + //档案实际情况 + Object initAddArchivesStatistics(Integer type); + //档案检索排名 + Object initArchivesSearchRanking(Integer type); diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/ArrangeService.java b/archives/src/main/java/com/storeroom/modules/archives/service/ArrangeService.java index bb277bd..75eb22b 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/ArrangeService.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/ArrangeService.java @@ -9,7 +9,8 @@ import org.springframework.data.domain.Pageable; import java.util.List; public interface ArrangeService { - + //预览盘点单 + Object previewArrange(List deviceIds,List categoryIds,Pageable page); //新增盘点 Object addArrange(ArrangeAddDTO dto); //初始化盘点列表 diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/BorrowService.java b/archives/src/main/java/com/storeroom/modules/archives/service/BorrowService.java index 3f7b7ea..00df396 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/BorrowService.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/BorrowService.java @@ -7,6 +7,7 @@ import org.springframework.data.domain.Pageable; import java.sql.Timestamp; import java.util.List; +import java.util.Map; public interface BorrowService { @@ -63,4 +64,9 @@ public interface BorrowService { //批量删除借阅者 Object delBorrower(List borrowerIds); + //待办事项 + List waitBorrow(); + //档案借阅数量统计 + Map initBorrowerNumStatistics(); + } diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/dto/ArrangeAddDTO.java b/archives/src/main/java/com/storeroom/modules/archives/service/dto/ArrangeAddDTO.java index 7272898..c996ef5 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/dto/ArrangeAddDTO.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/dto/ArrangeAddDTO.java @@ -15,5 +15,7 @@ public class ArrangeAddDTO { private List categoryIds; //所属区域 private String region; + //盘点清单号 + private String orderId; } diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java b/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java index 21a4be3..d329adf 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java @@ -1,6 +1,7 @@ package com.storeroom.modules.archives.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.storeroom.modules.archives.domain.*; import com.storeroom.modules.archives.domain.vo.StorageDetailesVO; @@ -76,6 +77,11 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { return PageUtil.toPage(caseRepository.initCaseAll(page)); } + @Override + public Integer getCaseNum() { + return caseRepository.getCaseNum(); + } + @Override public Object caseNameIsRepeat(String caseId, String caseName) { List caseList = caseRepository.findAllByCaseName(caseName); @@ -514,7 +520,7 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { ArchivesCase thisCase = caseRepository.findById(dto.getCaseId()).get(); thisCase.setShelfId(dto.getShelfId()); thisCase.setFolderLocation(dto.getPosition()); - thisCase.setFolderLocationDetails(caseRepository.findLocationDetailsByCaseId(thisCase.getId())); + thisCase.setFolderLocationDetails(caseRepository.findLocationDetailsBySheId(dto.getShelfId())); thisCase.setStorageType(isCallback ? 1:2); cases.add(thisCase); @@ -529,7 +535,7 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { if(caseId.equals(dto1.getCaseId())){ newShelfId += dto1.getShelfId() + ","; newLocation += dto1.getPosition() + ","; - newLocationName += caseRepository.findLocationDetailsByCaseId(dto1.getCaseId()) +","; + newLocationName += caseRepository.findLocationDetailsBySheId(dto1.getShelfId()) +","; resultOk++; } } @@ -805,6 +811,42 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { return null; } + @Override + public Object storageStatistics(Integer type) { + List monthList = new ArrayList<>(); + List doInStorage = new ArrayList<>(); + List inStorage = new ArrayList<>(); + List doOutStorage = new ArrayList<>(); + List outStorage = new ArrayList<>(); + + List> listMap = storageLogRepository.storageStatistics(type); + Map> dataMap = new HashMap<>(); + for(Map map:listMap){ + dataMap.put(map.get("month")+"",map); + } + for(int i = 1;i<=12;i++){ + monthList.add(i); + Map map = dataMap.get(i+""); + if(map!=null){ + doInStorage.add(map.get("doInStorage")); + inStorage.add(map.get("inStorage")); + doOutStorage.add(map.get("doOutStorage")); + outStorage.add(map.get("outStorage")); + }else{ + doInStorage.add(0); + inStorage.add(0); + doOutStorage.add(0); + outStorage.add(0); + } + } + JSONObject json = new JSONObject(); + json.put("months",monthList); + json.put("doInStorage",doInStorage); + json.put("inStorage",inStorage); + json.put("doOutStorage",doOutStorage); + json.put("outStorage",outStorage); + return json; + } //添加出入库日志 diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java b/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java index bddd899..a47a3c6 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java @@ -2,8 +2,10 @@ package com.storeroom.modules.archives.service.impl; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; +import com.storeroom.modules.archives.domain.ArchivesSearchLog; import com.storeroom.modules.archives.domain.ArchivesSummary; import com.storeroom.modules.archives.domain.vo.ArchivesDetailsVO; +import com.storeroom.modules.archives.repository.ArchivesSearchLogRepository; import com.storeroom.modules.archives.repository.ArchivesSummaryRepository; import com.storeroom.modules.archives.service.ArchivesService; import com.storeroom.modules.archives.service.dto.ArchivesDTO; @@ -14,6 +16,8 @@ import com.storeroom.modules.dictionary.domain.ArchivesDictionary; import com.storeroom.modules.dictionary.domain.ArchivesType; import com.storeroom.modules.dictionary.repository.ArchivesDictionaryRepository; import com.storeroom.modules.dictionary.repository.ArchivesTypeRepository; +import com.storeroom.modules.dictionary.service.ArchivesTypeService; +import com.storeroom.modules.dictionary.service.dto.ArchivesTypeDTO; import com.storeroom.utils.ApiResponse; import com.storeroom.utils.NanoIdUtils; import com.storeroom.utils.PageUtil; @@ -43,6 +47,8 @@ public class ArchivesServiceImpl implements ArchivesService { private final ArchivesSummaryRepository archivesSummaryRepository; private final ArchivesTypeRepository archivesTypeRepository; private final ArchivesDictionaryRepository archivesDictionaryRepository; + private final ArchivesTypeService archivesTypeService; + private final ArchivesSearchLogRepository archivesSearchLogRepository; @Value("${file.windows.path}") // @Value("${file.linux.path}") @@ -96,7 +102,7 @@ public class ArchivesServiceImpl implements ArchivesService { if(archivesType.getIsType() == ArchivesTypeEnum.archives.getCode() || archivesType.getIsType() == ArchivesTypeEnum.files.getCode()){ queryFields.add("is_borrow"); isStorageQuery = ",(select ace.storage_type from archives_case_cartoning acc inner join archives_case ace on acc.case_id = ace.id where acc.parent_id = t.id limit 0,1) as is_storage "; - isBorrowQuery = ",(select ba.borrow_type from borrow_archives ba where ba.borrow_type != 4 and ba.archives_id = t.id) as is_borrow "; + isBorrowQuery = ",(select ba.borrow_type from borrow_archives ba where ba.borrow_type != 4 and ba.archives_id = t.id limit 0,1) as is_borrow "; } if(archivesType.getIsType() == ArchivesTypeEnum.inChive.getCode()){ isStorageQuery = ",(select ace.storage_type from archives_case_cartoning acc inner join archives_case ace on acc.case_id = ace.id where acc.archives_id = t.id) as is_storage "; @@ -147,6 +153,24 @@ public class ArchivesServiceImpl implements ArchivesService { return object; } + @Override + @Transactional + public void addArchivesSearchLog(String categoryId, String query) { + ArchivesTypeDTO beLong = archivesTypeService.findBelongById(categoryId); + if(null != beLong){ + ArchivesSearchLog log = new ArchivesSearchLog(); + log.setCategoryId(categoryId); + log.setCategoryRootId(beLong.getId()); + log.setSearchKey(query); + archivesSearchLogRepository.save(log); + } + } + + @Override + public Integer getArchivesNum() { + return archivesSummaryRepository.getArchivesNum(); + } + @Override public Object getArchivesRelease(Pageable pageable) { Page> page = archivesSummaryRepository.getArchivesRelease(pageable); @@ -154,8 +178,13 @@ public class ArchivesServiceImpl implements ArchivesService { } @Override + @Transactional public Object queryVagueArchives(String criteria, String query,Pageable pageable) { query = query==null?"":query.trim().replaceAll(" ","|"); + List categoryIds = archivesSummaryRepository.queryVagueArchivesGetCategoryIds(criteria,query); + for(String categoryId:categoryIds){ + this.addArchivesSearchLog(categoryId,query); + } Page> page = archivesSummaryRepository.queryVagueArchives(criteria,query,pageable); return PageUtil.toPage(page); } @@ -178,11 +207,12 @@ public class ArchivesServiceImpl implements ArchivesService { String queryField = queryFields.stream().map(String::valueOf).collect(Collectors.joining(",")); String queryTable = archivesType.getEnName(); String appendQuery = "tid,(select group_concat(case_name) from archives_case t where find_in_set(t.id,z.case_no)),"; - if(archivesType.getIsType()==ArchivesTypeEnum.inChive.getCode()){ - appendQuery = appendQuery + "(SELECT group_concat(DISTINCT CONCAT( room.NAME, ' ', di.device_name, ' ', ace.folder_location_details)) FROM archives_summary asy INNER JOIN archives_case_cartoning acc ON asy.archives_id = acc.archives_id INNER JOIN archives_case ace ON acc.case_id = ace.id INNER JOIN device_archives_tag dat ON ace.folder_location = dat.position INNER JOIN device_info di ON dat.device_info_id = di.id INNER JOIN storeroom room ON room.id = di.storeroom_id WHERE asy.archives_id = z.id),"; - }else{ - appendQuery = appendQuery + "(SELECT group_concat(DISTINCT CONCAT( room.NAME, ' ', di.device_name, ' ', ace.folder_location_details)) FROM archives_summary asy INNER JOIN archives_case_cartoning acc ON asy.archives_id = acc.parent_id INNER JOIN archives_case ace ON acc.case_id = ace.id INNER JOIN device_archives_tag dat ON ace.folder_location = dat.position INNER JOIN device_info di ON dat.device_info_id = di.id INNER JOIN storeroom room ON room.id = di.storeroom_id WHERE asy.archives_id = z.id),"; - } + appendQuery = appendQuery + "(SELECT asy.folder_location_details FROM archives_summary asy WHERE asy.archives_id = z.id),"; +// if(archivesType.getIsType()==ArchivesTypeEnum.inChive.getCode()){ +// appendQuery = appendQuery + "(SELECT group_concat(DISTINCT CONCAT( room.NAME, ' ', di.device_name, ' ', ace.folder_location_details)) FROM archives_summary asy INNER JOIN archives_case_cartoning acc ON asy.archives_id = acc.archives_id INNER JOIN archives_case ace ON acc.case_id = ace.id INNER JOIN device_archives_tag dat ON ace.folder_location = dat.position INNER JOIN device_info di ON dat.device_info_id = di.id INNER JOIN storeroom room ON room.id = di.storeroom_id WHERE asy.archives_id = z.id),"; +// }else{ +// appendQuery = appendQuery + "(SELECT group_concat(DISTINCT CONCAT( room.NAME, ' ', di.device_name, ' ', ace.folder_location_details)) FROM archives_summary asy INNER JOIN archives_case_cartoning acc ON asy.archives_id = acc.parent_id INNER JOIN archives_case ace ON acc.case_id = ace.id INNER JOIN device_archives_tag dat ON ace.folder_location = dat.position INNER JOIN device_info di ON dat.device_info_id = di.id INNER JOIN storeroom room ON room.id = di.storeroom_id WHERE asy.archives_id = z.id),"; +// } appendQuery = appendQuery + "(select borrow_type from borrow_archives where archives_id = z.id order by create_time desc limit 0,1),barcode "; appendQuery = queryField.length() == 0 ? appendQuery : ","+appendQuery; List list = entityManager.createNativeQuery("select "+queryField+appendQuery+" from "+queryTable + " z where z.id = '"+archivesId+"'").getResultList(); @@ -970,9 +1000,68 @@ public class ArchivesServiceImpl implements ArchivesService { return archivesSummaryRepository.findByTagNo(tid); } + @Override + public Map initArchivesTypeNum(Integer type) { + Map map = new HashMap<>(); + Integer archivesNum = archivesSummaryRepository.getArchivesNumByTpye(ArchivesTypeEnum.archives.getCode(),type); + Integer filesNum = archivesSummaryRepository.getArchivesNumByTpye(ArchivesTypeEnum.files.getCode(),type); + map.put("archivesNum",archivesNum); + map.put("filesNum",filesNum); + return map; + } + @Override + public Object initArchivesTypeStatistics(Integer type) { + List> list = new ArrayList<>(); + //获得根目录门类 + ArchivesType root = archivesTypeRepository.findByPid("0"); + List folders = archivesTypeRepository.findFolderAllByPid(root.getId()); + for(ArchivesType archivesType:folders){ + List querys = new ArrayList<>(); + querys.add(archivesType.getId()); + //根据门类id获取旗下所有文件集、案卷级档案 + Set dtos = archivesTypeService.findArchivesTypeByIds(querys); + List categoryIds = new ArrayList<>(); + for(ArchivesTypeDTO archivesTypeDTO : dtos){ + if(archivesTypeDTO.getIsType()== ArchivesTypeEnum.archives.getCode() || archivesTypeDTO.getIsType()== ArchivesTypeEnum.files.getCode()) + categoryIds.add(archivesTypeDTO.getId()); + } + Map map = new HashMap<>(); + map.put("archivesType",archivesType.getCnName()); + map.put("archivesNum",archivesSummaryRepository.getArchivesNumByCategoryIds(categoryIds,type)); + list.add(map); + } + return list; + } + @Override + public Object initAddArchivesStatistics(Integer type) { + List monthList = new ArrayList<>(); + List addNum = new ArrayList<>(); + List> listMap = archivesSummaryRepository.initAddArchivesStatistics(type); + Map> dataMap = new HashMap<>(); + for(Map map:listMap){ + dataMap.put(map.get("month")+"",map); + } + for(int i = 1;i<=12;i++){ + monthList.add(i); + Map map = dataMap.get(i+""); + if(map!=null){ + addNum.add(map.get("num")); + }else{ + addNum.add(0); + } + } + JSONObject json = new JSONObject(); + json.put("months",monthList); + json.put("nums",addNum); + return json; + } + @Override + public Object initArchivesSearchRanking(Integer type) { + return archivesSummaryRepository.initArchivesSearchRanking(type); + } @Override diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArrangeServiceImpl.java b/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArrangeServiceImpl.java index 546bbc1..cb9a484 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArrangeServiceImpl.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/impl/ArrangeServiceImpl.java @@ -1,11 +1,14 @@ package com.storeroom.modules.archives.service.impl; +import cn.hutool.json.JSONObject; import com.storeroom.modules.archives.domain.ArchivesCheckBill; import com.storeroom.modules.archives.domain.ArchivesCheckBillData; import com.storeroom.modules.archives.domain.ArchivesCheckBillDetails; +import com.storeroom.modules.archives.domain.ArchivesSummary; import com.storeroom.modules.archives.repository.ArchivesCheckBillDataRepository; import com.storeroom.modules.archives.repository.ArchivesCheckBillDetailsRepository; import com.storeroom.modules.archives.repository.ArchivesCheckBillRepository; +import com.storeroom.modules.archives.repository.ArchivesSummaryRepository; import com.storeroom.modules.archives.service.ArrangeService; import com.storeroom.modules.archives.service.dto.ArrangeAddDTO; import com.storeroom.modules.common.ArchivesTypeEnum; @@ -14,7 +17,9 @@ import com.storeroom.modules.dictionary.service.dto.ArchivesTypeDTO; import com.storeroom.utils.PageUtil; import com.storeroom.utils.StringUtils; import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.security.core.parameters.P; import org.springframework.stereotype.Service; import javax.transaction.Transactional; @@ -28,6 +33,32 @@ public class ArrangeServiceImpl implements ArrangeService { private final ArchivesCheckBillRepository archivesCheckBillRepository; private final ArchivesCheckBillDetailsRepository archivesCheckBillDetailsRepository; private final ArchivesCheckBillDataRepository archivesCheckBillDataRepository; + private final ArchivesSummaryRepository archivesSummaryRepository; + + @Override + public Object previewArrange(List deviceIds,List cIds,Pageable page) { + List categoryIds = new ArrayList<>(); + if(null!= cIds && cIds.size()!=0){ + //根据门类id获取旗下所有文件集、案卷级档案 + Set dtos = archivesTypeService.findArchivesTypeByIds(cIds); + for(ArchivesTypeDTO archivesTypeDTO : dtos){ + if(archivesTypeDTO.getIsType()== ArchivesTypeEnum.archives.getCode() || archivesTypeDTO.getIsType()== ArchivesTypeEnum.files.getCode()) + categoryIds.add(archivesTypeDTO.getId()); + } + } + //获取相关在库档案信息 + Page detaills = null; + if(null != deviceIds && deviceIds.size() !=0 && categoryIds.size() !=0){ + detaills = archivesSummaryRepository.previewArrangeByDeviceIdsAndCategoryIds(deviceIds,categoryIds,page); + }else if(null != deviceIds && deviceIds.size() != 0){ + detaills = archivesSummaryRepository.previewArrangeByDeviceIds(deviceIds,page); + }else if(categoryIds.size() != 0){ + detaills = archivesSummaryRepository.previewArrangeByCategoryIds(categoryIds,page); + }else{ + detaills = archivesSummaryRepository.previewArrangeAll(page); + } + return PageUtil.toPage(detaills); + } @Override @Transactional @@ -79,8 +110,11 @@ public class ArrangeServiceImpl implements ArrangeService { } saveDetaills = archivesCheckBillDetailsRepository.saveAll(saveDetaills); bill.setBorrowed(archivesCheckBillDetailsRepository.findResultCountByOrderId(bill.getId(),4)); - archivesCheckBillRepository.saveAndFlush(bill); - return bill; + bill = archivesCheckBillRepository.saveAndFlush(bill); + JSONObject json = new JSONObject(); + json.put("bill",bill); + json.put("detaills",saveDetaills); + return json; } @Override diff --git a/archives/src/main/java/com/storeroom/modules/archives/service/impl/BorrowServiceImpl.java b/archives/src/main/java/com/storeroom/modules/archives/service/impl/BorrowServiceImpl.java index fbdc5e2..cb47a89 100644 --- a/archives/src/main/java/com/storeroom/modules/archives/service/impl/BorrowServiceImpl.java +++ b/archives/src/main/java/com/storeroom/modules/archives/service/impl/BorrowServiceImpl.java @@ -21,10 +21,7 @@ import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.beans.Transient; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Service @RequiredArgsConstructor @@ -192,10 +189,22 @@ public class BorrowServiceImpl implements BorrowService { @Override @Transactional public Object billBorrowConfirm(List orderNos) { - //更改清单内档案状态 - borrowArchivesRepository.billBorrowConfirm(orderNos,3); - //更改清单状态 - borrowBillRepository.updateBorrowTypeByOrderNos(orderNos,3); + List del = new ArrayList(); + //根据清单号检查是否全是异常档案 + for(String orderNo:orderNos){ + Integer noAbnormal = borrowArchivesRepository.getNoAbnormalByOrderNo(orderNo); + if(noAbnormal==0){ + borrowBillRepository.updateBorrowTypeByOrderNo(orderNo,-1); + del.add(orderNo); + } + } + orderNos.removeAll(del); + if(orderNos.size()!=0){ + //更改清单内档案状态 + borrowArchivesRepository.billBorrowConfirm(orderNos,3); + //更改清单状态 + borrowBillRepository.updateBorrowTypeByOrderNos(orderNos,3); + } return orderNos.size(); } @@ -286,6 +295,46 @@ public class BorrowServiceImpl implements BorrowService { return borrowerIds.size(); } + @Override + public List waitBorrow() { + List> returnList = new ArrayList<>(); + //待借 + returnList.addAll(borrowArchivesRepository.waitBorrow1()); + //借出确认 + returnList.addAll(borrowArchivesRepository.waitBorrow2()); + //逾期 + returnList.addAll(borrowArchivesRepository.waitBorrow4()); + //即将到期 + returnList.addAll(borrowArchivesRepository.waitBorrow3()); + //删除所有null元素 + returnList.removeAll(Collections.singleton(null)); + return returnList; + } + + @Override + public Map initBorrowerNumStatistics() { + Map map = new HashMap<>(); + //获取入库档案总数 + Integer total = borrowArchivesRepository.getStorageTotal(); + //借出档案数量 + Integer borrow = borrowArchivesRepository.getBorrowNum(); + //在库档案数量 + Integer inStorage = total-borrow; + //待借档案数量 + Integer waitBorrow = borrowArchivesRepository.getWaitBorrowNum(); + //逾期档案数量 + Integer overdue = borrowArchivesRepository.getOverdueNum(); + //异常档案数量 + Integer abnormal = borrowArchivesRepository.getAbnormalNum(); + map.put("total",total); + map.put("borrow",borrow); + map.put("inStorage",inStorage); + map.put("waitBorrow",waitBorrow); + map.put("overdue",overdue); + map.put("abnormal",abnormal); + return map; + } + //生成清单 public BorrowBill createBill(Integer borrowNum,String borrowerId,Timestamp startTime,Timestamp endTime,String purpose,Integer loop){ diff --git a/archives/src/main/java/com/storeroom/modules/common/ExcelUtil.java b/archives/src/main/java/com/storeroom/modules/common/ExcelUtil.java index 289ed6b..6e807af 100644 --- a/archives/src/main/java/com/storeroom/modules/common/ExcelUtil.java +++ b/archives/src/main/java/com/storeroom/modules/common/ExcelUtil.java @@ -187,7 +187,9 @@ public class ExcelUtil { XSSFCell baValueCell8 = archivesValueRow.createCell(8);baValueCell8.setCellStyle(textStyle); Integer borrowArchiType = borrowArchive.getBorrowType(); String showBorrowArchiType = ""; - if(borrowArchiType==2){ + if(borrowArchiType==-1){ + showBorrowArchiType = "异常"; + }else if(borrowArchiType==2){ showBorrowArchiType = "待借阅"; }else if(borrowArchiType==3 && vo.getBorrowEnd().getTime() >= new Timestamp(System.currentTimeMillis()).getTime()){ showBorrowArchiType = "待归还"; diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesTypeRepository.java b/archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesTypeRepository.java index 935acee..eb7863d 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesTypeRepository.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesTypeRepository.java @@ -18,6 +18,9 @@ public interface ArchivesTypeRepository extends JpaRepository findAllByPid(String pid); + @Query("from ArchivesType where pid = ?1 and isType = 1 ") + List findFolderAllByPid(String pid); + @Query("select pid from ArchivesType where id = ?1") String findPidById(String id); diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesTypeService.java b/archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesTypeService.java index 9ca71ed..53f3a55 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesTypeService.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesTypeService.java @@ -55,4 +55,7 @@ public interface ArchivesTypeService { //根据门类id获取旗下所有文件集、档案级门类 Set findArchivesTypeByIds(List ids); + //根据门类id获取所属类别(根目录下文件夹) + ArchivesTypeDTO findBelongById(String id); + } diff --git a/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java b/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java index 15e03e4..e798ba1 100644 --- a/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java +++ b/archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java @@ -147,6 +147,35 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService { return dtos; } + @Override + public ArchivesTypeDTO findBelongById(String id) { + //获取根目录 + ArchivesType root = archivesTypeRepository.findByPid("0"); + //获取门类信息 + Optional optional = archivesTypeRepository.findById(id); + if(!optional.isPresent()) + return null; + ArchivesType archivesType = optional.get(); + if(root.getId().equals(archivesType.getPid())){ + return archivesTypeMapper.toDto(archivesType); + }else{ + return this.findBelongById(archivesType.getPid(),root.getId()); + } + } + + public ArchivesTypeDTO findBelongById(String id,String rootId) { + //获取门类信息 + Optional optional = archivesTypeRepository.findById(id); + if(!optional.isPresent()) + return null; + ArchivesType archivesType = optional.get(); + if(rootId.equals(archivesType.getPid())){ + return archivesTypeMapper.toDto(archivesType); + }else{ + return this.findBelongById(archivesType.getPid(),rootId); + } + } + public Set findThisArchivesFileAllChild(String categoryId,Set dtos){ if(dtos == null) dtos = new HashSet<>(); diff --git a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/domain/SecurityDoor.java b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/domain/SecurityDoor.java index c572974..13223ca 100644 --- a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/domain/SecurityDoor.java +++ b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/domain/SecurityDoor.java @@ -27,7 +27,6 @@ public class SecurityDoor extends BaseEntity implements Serializable { @ApiModelProperty(value = "id", hidden = true) private String id; - @Column(name = "device_id") @ApiModelProperty(value = "设备id") private String deviceId;