刘力 3 years ago
parent
commit
adc329f14c
  1. 50
      archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java
  2. 14
      archives/src/main/java/com/storeroom/modules/archives/controller/ArrangeController.java
  3. 14
      archives/src/main/java/com/storeroom/modules/archives/controller/BorrowController.java
  4. 7
      archives/src/main/java/com/storeroom/modules/archives/controller/CaseController.java
  5. 8
      archives/src/main/java/com/storeroom/modules/archives/controller/RFIDController.java
  6. 14
      archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java
  7. 43
      archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesSearchLog.java
  8. 18
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java
  9. 4
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCheckBillDetailsRepository.java
  10. 13
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSearchLogRepository.java
  11. 67
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java
  12. 41
      archives/src/main/java/com/storeroom/modules/archives/repository/BorrowArchivesRepository.java
  13. 2
      archives/src/main/java/com/storeroom/modules/archives/repository/BorrowBillRepository.java
  14. 2
      archives/src/main/java/com/storeroom/modules/archives/repository/BorrowerRepository.java
  15. 8
      archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java
  16. 4
      archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java
  17. 13
      archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java
  18. 3
      archives/src/main/java/com/storeroom/modules/archives/service/ArrangeService.java
  19. 6
      archives/src/main/java/com/storeroom/modules/archives/service/BorrowService.java
  20. 2
      archives/src/main/java/com/storeroom/modules/archives/service/dto/ArrangeAddDTO.java
  21. 46
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java
  22. 101
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java
  23. 38
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArrangeServiceImpl.java
  24. 65
      archives/src/main/java/com/storeroom/modules/archives/service/impl/BorrowServiceImpl.java
  25. 4
      archives/src/main/java/com/storeroom/modules/common/ExcelUtil.java
  26. 3
      archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesTypeRepository.java
  27. 3
      archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesTypeService.java
  28. 29
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java
  29. 1
      storeroom/src/main/java/com/storeroom/modules/storeroom3d/domain/SecurityDoor.java

50
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<Object> 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<Object> initArchivesTypeNum(Integer type)
{
return ApiResponse.success(archivesService.initArchivesTypeNum(type));
}
@ApiOperation("档案类型统计")
@GetMapping("/initArchivesTypeStatistics")
public ApiResponse<Object> initArchivesTypeStatistics(Integer type)
{
return ApiResponse.success(archivesService.initArchivesTypeStatistics(type));
}
@ApiOperation("档案实际情况")
@GetMapping("/initAddArchivesStatistics")
public ApiResponse<Object> initAddArchivesStatistics(Integer type)
{
return ApiResponse.success(archivesService.initAddArchivesStatistics(type));
}
@ApiOperation("档案检索排名")
@GetMapping("/initArchivesSearchRanking")
public ApiResponse<Object> 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);
}
}

14
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<Object> previewArrange(
@RequestParam("deviceIds") List<String> deviceIds,
@RequestParam("categoryIds") List<String> categoryIds,
Pageable page
){
return ApiResponse.success(arrangeService.previewArrange(deviceIds,categoryIds,page));
}
@ApiOperation("新增盘点")
@PostMapping("/addArrange")
public ApiResponse<Object> addArrange(
@ -69,9 +79,9 @@ public class ArrangeController {
@ApiOperation("结算盘点")
@PostMapping("/settlement")
public ApiResponse<Object> settlement(
@Validated @RequestBody String orderId
@Validated @RequestBody ArrangeAddDTO dto
){
return ApiResponse.success(arrangeService.settlement(orderId));
return ApiResponse.success(arrangeService.settlement(dto.getOrderId()));
}
@ApiOperation("清空完结盘点缓存数据")

14
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<Object> waitBorrow()
{
return ApiResponse.success(borrowService.waitBorrow());
}
@ApiOperation("档案借阅数量统计")
@GetMapping("/initBorrowerNumStatistics")
public ApiResponse<Object> initBorrowerNumStatistics()
{
return ApiResponse.success(borrowService.initBorrowerNumStatistics());
}
@ApiOperation("导出借阅信息")
@AnonymousGetMapping("/exportBorrow")
@ResponseBody

7
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<Object> getCaseNum()
{
return ApiResponse.success(caseService.getCaseNum());
}
@ApiOperation("档案盒名称是否重复")
@GetMapping("/caseNameIsRepeat")
public ApiResponse<Object> caseNameIsRepeat(

8
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<Object> initArrangeList(
Integer checkState, String region, String orderNo, Pageable page
){
return ApiResponse.success(arrangeService.initArrangeList(checkState,region,orderNo,page));
}
@ApiOperation("根据盘点单号获取盘点基本信息")
@AnonymousPostMapping("/findArrangeDetailsByOrderNo")
public ApiResponse<Object> findArrangeDetailsByOrderNo(

14
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<ArchivesCase> 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<Object> storageStatistics(
Integer type
){
return ApiResponse.success(caseService.storageStatistics(type));
}
@ApiOperation("导出出入库记录")
@AnonymousGetMapping("/exportStorageLogList")
@ResponseBody

43
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;
}

18
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java

@ -28,11 +28,14 @@ public interface ArchivesCaseRepository extends JpaRepository<ArchivesCase, Stri
value = "select * from archives_case order by create_time desc ")
Page<ArchivesCase> 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<ArchivesCase> readyIntoCase(String caseName, String tid,String barcode,List storageType, Pageable page);
@ -41,19 +44,16 @@ public interface ArchivesCaseRepository extends JpaRepository<ArchivesCase, Stri
value = "SELECT distinct asum.archives_id as archivesId,ace.storage_type as storageType,asum.child as child,asum.category_type as categoryType," +
"asum.category_name as categoryName,asum.fonds_no as fondsNo,asum.archive_no as archiveNo,asum.archive_year as archiveYear," +
"asum.maintitle as maintitle,asum.security_class as securityClass,asum.department as department,ace.case_name as caseName," +
"CONCAT(room.name ,'-' , di.device_name , '-' , dat.position_name) as seat,ace.storage_time as storageTime" +
"ace.folder_location_details as seat,ace.storage_time as storageTime" +
// ",(select borrow_type from borrow_archives ba where ba.archives_id = asum.archives_id order by create_time desc limit 0,1) as borrowType " +
"FROM archives_case ace " +
"INNER JOIN archives_case_cartoning acc ON ace.id = acc.case_id " +
"INNER JOIN archives_summary asum ON acc.parent_id = asum.archives_id " +
"INNER JOIN device_archives_tag dat on asum.shelf_id = dat.id " +
"INNER JOIN device_info di ON dat.device_info_id = di.id " +
"INNER JOIN storeroom room ON di.storeroom_id = room.id " +
"WHERE ace.storage_type >= 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<Map<String,Object>> alReadyInto(String caseName, String archiveNo, String title, String location, Pageable page);
@ -133,6 +133,12 @@ public interface ArchivesCaseRepository extends JpaRepository<ArchivesCase, Stri
"INNER JOIN storeroom room ON room.id = di.storeroom_id WHERE ace.id = ?1 ")
String findLocationDetailsByCaseId(String caseId);
@Query(nativeQuery = true,
value = "SELECT group_concat(DISTINCT CONCAT( room.NAME, ' ', di.device_name, ' ', dat.position_name )) " +
"FROM device_archives_tag dat INNER JOIN device_info di ON dat.device_info_id = di.id " +
"INNER JOIN storeroom room ON room.id = di.storeroom_id WHERE dat.id = ?1")
String findLocationDetailsBySheId(String sheId);
@Query(nativeQuery = true,
value = "select borrow_type from borrow_archives ba where ba.archives_id in (select parent_id " +
"from archives_case_cartoning acc where acc.case_id = ?1) order by create_time desc limit 0,1 ")

4
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCheckBillDetailsRepository.java

@ -17,7 +17,7 @@ public interface ArchivesCheckBillDetailsRepository extends JpaRepository<Archiv
"asy.child,asy.category_type,asy.category_name,asy.shelf_id,asy.fonds_no,asy.archives_id," +
"asy.archive_no,asy.archive_year,asy.maintitle,asy.security_class," +
"asy.department,asy.case_name,asy.folder_location_details,asy.create_time " +
"from archives_summary asy where " +
"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) ")
@ -28,7 +28,7 @@ public interface ArchivesCheckBillDetailsRepository extends JpaRepository<Archiv
"asy.child,asy.category_type,asy.category_name,asy.shelf_id,asy.fonds_no,asy.archives_id," +
"asy.archive_no,asy.archive_year,asy.maintitle,asy.security_class," +
"asy.department,asy.case_name,asy.folder_location_details,asy.create_time " +
"from archives_summary asy where " +
"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) " +

13
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSearchLogRepository.java

@ -0,0 +1,13 @@
package com.storeroom.modules.archives.repository;
import com.storeroom.modules.archives.domain.ArchivesSearchLog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface ArchivesSearchLogRepository extends JpaRepository<ArchivesSearchLog, Integer>{
}

67
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java

@ -32,6 +32,17 @@ public interface ArchivesSummaryRepository extends JpaRepository<ArchivesSummary
"order by create_time asc,archives_id asc")
Page<Map<String,Object>> 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<String> 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<ArchivesSummary
@Query(nativeQuery = true,value = "update archives_summary set folder_location = null,folder_location_details=null where case_no like ?1")
void cleanLocationByCaseId(String caseId);
@Query(nativeQuery = true,
countQuery = "select count(1) from archives_summary asy where category_id in ?2 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 category_id in ?2 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<ArchivesSummary> previewArrangeByDeviceIdsAndCategoryIds(List<String> deviceIds,List<String> 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<ArchivesSummary> previewArrangeByDeviceIds(List<String> 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<ArchivesSummary> previewArrangeByCategoryIds(List<String> 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<ArchivesSummary> 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<Map<String,Integer>> 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<Map<String,Integer>> initArchivesSearchRanking(Integer timeType);
}

41
archives/src/main/java/com/storeroom/modules/archives/repository/BorrowArchivesRepository.java

@ -86,7 +86,7 @@ public interface BorrowArchivesRepository extends JpaRepository<BorrowArchives,
"and if(?6 is null,1=1,ba.case_name like ?6) " +
"and if(?7 is null,1=1,ba.barcode like ?7) " +
"and if(?8 is null,1=1,ba.tid like ?8) ",
value = "select ba.id as id,bbl.id as orderNo,ba.category_name as categoryName,ba.archive_no as archiveNo,ba.maintitle," +
value = "select ba.id as id,bbl.id as orderNo,ba.category_name as categoryName,ba.archive_no as archiveNo,ba.maintitle,ba.archives_id as archivesId," +
"ba.case_name as caseName,ba.folder_location_details as folderLocationDetails,br.borrower_name as borrowerName," +
"bbl.borrow_start as borrowStart,bbl.borrow_end as borrowEnd,bbl.purpose,case when bbl.borrow_end<DATE(now()) then '逾期' " +
"when bbl.borrow_end>=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<BorrowArchives,
"ba.case_name as caseName,ba.folder_location_details as folderLocationDetails,br.borrower_name as borrowerName," +
"bbl.borrow_start as borrowStart,bbl.borrow_end as borrowEnd,bbl.purpose,bbl.create_by as createBy,bbl.create_time as createTime," +
"ba.start_time as startTime,ba.end_time as endTime," +
"CASE WHEN ba.borrow_type = 1 then '待登记' " +
"CASE WHEN ba.borrow_type = -1 then '异常'" +
"WHEN ba.borrow_type = 1 then '待登记' " +
"WHEN ba.borrow_type = 2 then '待借阅' " +
"WHEN ba.borrow_type = 3 && bbl.borrow_end < DATE(now()) THEN '逾期' " +
"WHEN ba.borrow_type = 3 && bbl.borrow_end >= DATE(now()) THEN '待归还' " +
@ -151,4 +152,40 @@ public interface BorrowArchivesRepository extends JpaRepository<BorrowArchives,
Page<Map<String,Object>> 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<Map<String,Object>> 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<Map<String,Object>> 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<Map<String,Object>> 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<Map<String,Object>> 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();
}

2
archives/src/main/java/com/storeroom/modules/archives/repository/BorrowBillRepository.java

@ -67,7 +67,7 @@ public interface BorrowBillRepository extends JpaRepository<BorrowBill, String>
List<String> findOrderIdsByRbId(List<String> 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);
}

2
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<Borrower, String> {
@ -30,5 +31,4 @@ public interface BorrowerRepository extends JpaRepository<Borrower, String> {
@Modifying
@Query("update Borrower set isDelete = true where id in ?1 ")
void delAllByIds(List<String> borrowerIds);
}

8
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<StorageLog, Integer>{
@ -17,4 +18,11 @@ public interface StorageLogRepository extends JpaRepository<StorageLog, Integer>
"and if(?4 is null,1=1,barcode like ?4) ")
Page<StorageLog> 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<Map<String,Integer>> storageStatistics(Integer timeType);
}

4
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<ArchivesCaseLog> initCaseLogList(List<Integer> logs);
//第三方回调
Integer externalCallback(String caseId);
//出入库统计
Object storageStatistics(Integer type);
}

13
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<String,Integer> initArchivesTypeNum(Integer type);
//档案类型统计
Object initArchivesTypeStatistics(Integer type);
//档案实际情况
Object initAddArchivesStatistics(Integer type);
//档案检索排名
Object initArchivesSearchRanking(Integer type);

3
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<String> deviceIds,List<String> categoryIds,Pageable page);
//新增盘点
Object addArrange(ArrangeAddDTO dto);
//初始化盘点列表

6
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<String> borrowerIds);
//待办事项
List waitBorrow();
//档案借阅数量统计
Map<String,Integer> initBorrowerNumStatistics();
}

2
archives/src/main/java/com/storeroom/modules/archives/service/dto/ArrangeAddDTO.java

@ -15,5 +15,7 @@ public class ArrangeAddDTO {
private List<String> categoryIds;
//所属区域
private String region;
//盘点清单号
private String orderId;
}

46
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<ArchivesCase> 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<Integer> monthList = new ArrayList<>();
List<Object> doInStorage = new ArrayList<>();
List<Object> inStorage = new ArrayList<>();
List<Object> doOutStorage = new ArrayList<>();
List<Object> outStorage = new ArrayList<>();
List<Map<String,Integer>> listMap = storageLogRepository.storageStatistics(type);
Map<String,Map<String,Integer>> dataMap = new HashMap<>();
for(Map<String,Integer> map:listMap){
dataMap.put(map.get("month")+"",map);
}
for(int i = 1;i<=12;i++){
monthList.add(i);
Map<String,Integer> 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;
}
//添加出入库日志

101
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<Map<String,Object>> 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<String> categoryIds = archivesSummaryRepository.queryVagueArchivesGetCategoryIds(criteria,query);
for(String categoryId:categoryIds){
this.addArchivesSearchLog(categoryId,query);
}
Page<Map<String,Object>> 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<Object[]> 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<String, Integer> initArchivesTypeNum(Integer type) {
Map<String,Integer> 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<Map<String,Object>> list = new ArrayList<>();
//获得根目录门类
ArchivesType root = archivesTypeRepository.findByPid("0");
List<ArchivesType> folders = archivesTypeRepository.findFolderAllByPid(root.getId());
for(ArchivesType archivesType:folders){
List<String> querys = new ArrayList<>();
querys.add(archivesType.getId());
//根据门类id获取旗下所有文件集案卷级档案
Set<ArchivesTypeDTO> dtos = archivesTypeService.findArchivesTypeByIds(querys);
List<String> categoryIds = new ArrayList<>();
for(ArchivesTypeDTO archivesTypeDTO : dtos){
if(archivesTypeDTO.getIsType()== ArchivesTypeEnum.archives.getCode() || archivesTypeDTO.getIsType()== ArchivesTypeEnum.files.getCode())
categoryIds.add(archivesTypeDTO.getId());
}
Map<String,Object> 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<Integer> monthList = new ArrayList<>();
List<Object> addNum = new ArrayList<>();
List<Map<String,Integer>> listMap = archivesSummaryRepository.initAddArchivesStatistics(type);
Map<String,Map<String,Integer>> dataMap = new HashMap<>();
for(Map<String,Integer> map:listMap){
dataMap.put(map.get("month")+"",map);
}
for(int i = 1;i<=12;i++){
monthList.add(i);
Map<String,Integer> 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

38
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<String> deviceIds,List<String> cIds,Pageable page) {
List<String> categoryIds = new ArrayList<>();
if(null!= cIds && cIds.size()!=0){
//根据门类id获取旗下所有文件集案卷级档案
Set<ArchivesTypeDTO> dtos = archivesTypeService.findArchivesTypeByIds(cIds);
for(ArchivesTypeDTO archivesTypeDTO : dtos){
if(archivesTypeDTO.getIsType()== ArchivesTypeEnum.archives.getCode() || archivesTypeDTO.getIsType()== ArchivesTypeEnum.files.getCode())
categoryIds.add(archivesTypeDTO.getId());
}
}
//获取相关在库档案信息
Page<ArchivesSummary> 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

65
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<String> 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<Map<String,Object>> 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<String, Integer> initBorrowerNumStatistics() {
Map<String,Integer> 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){

4
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 = "待归还";

3
archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesTypeRepository.java

@ -18,6 +18,9 @@ public interface ArchivesTypeRepository extends JpaRepository<ArchivesType, Stri
@Query("from ArchivesType where pid = ?1")
List<ArchivesType> findAllByPid(String pid);
@Query("from ArchivesType where pid = ?1 and isType = 1 ")
List<ArchivesType> findFolderAllByPid(String pid);
@Query("select pid from ArchivesType where id = ?1")
String findPidById(String id);

3
archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesTypeService.java

@ -55,4 +55,7 @@ public interface ArchivesTypeService {
//根据门类id获取旗下所有文件集档案级门类
Set<ArchivesTypeDTO> findArchivesTypeByIds(List<String> ids);
//根据门类id获取所属类别根目录下文件夹
ArchivesTypeDTO findBelongById(String id);
}

29
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<ArchivesType> 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<ArchivesType> 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<ArchivesTypeDTO> findThisArchivesFileAllChild(String categoryId,Set<ArchivesTypeDTO> dtos){
if(dtos == null)
dtos = new HashSet<>();

1
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;

Loading…
Cancel
Save