Browse Source

1.更新优化档案模块

2.更新优化档案盒模块
3.更新优化标签模块
4.新增标签日志
master
xia 3 years ago
parent
commit
27b6cb41cf
  1. 23
      archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java
  2. 62
      archives/src/main/java/com/storeroom/modules/archives/controller/CaseController.java
  3. 39
      archives/src/main/java/com/storeroom/modules/archives/controller/TagController.java
  4. 10
      archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesCaseCartoning.java
  5. 38
      archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesTagLog.java
  6. 71
      archives/src/main/java/com/storeroom/modules/archives/domain/vo/ArchivesSummaryVO.java
  7. 5
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseCartoningRepository.java
  8. 16
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java
  9. 11
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java
  10. 19
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesTagLogRepository.java
  11. 8
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesTagRepository.java
  12. 4
      archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java
  13. 4
      archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java
  14. 13
      archives/src/main/java/com/storeroom/modules/archives/service/ArchivesTagService.java
  15. 143
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java
  16. 24
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java
  17. 154
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesTagServiceImpl.java
  18. 3
      system/src/main/resources/application.yml

23
archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java

@ -44,7 +44,7 @@ public class ArchivesController {
private final ArchivesService archivesService;
private final ArchivesTypeService archivesTypeService;
@ApiOperation("档案列表")
@ApiOperation("档案列表")
@GetMapping("/initArchivesViewTable")
public ApiResponse<Object> initArchivesViewTable(
String categoryId
@ -55,13 +55,20 @@ public class ArchivesController {
@ApiOperation("档案列表")
@GetMapping("/initArchivesView")
public ApiResponse<Object> initArchivesView(
String categoryId,String parentsId,String query,Integer archivesState,String archiveYear,String department,
String categoryId,String parentsId,Integer queryType,String queryTitle,String archiveNo,Integer archivesState,String archiveYear,String department,
String retention,String securityClass,String organizationMatter,boolean isdel,Pageable page
){
return ApiResponse.success(archivesService.initArchivesView(categoryId,parentsId,query,archivesState,
return ApiResponse.success(archivesService.initArchivesView(categoryId,parentsId,queryType,queryTitle,archiveNo,archivesState,
archiveYear,department,retention,securityClass,organizationMatter,isdel,page));
}
@ApiOperation("档案列表外放接口")
// @GetMapping("/getArchivesRelease")
@AnonymousGetMapping("/getArchivesRelease")
public ApiResponse<Object> getArchivesRelease(Pageable page){
return ApiResponse.success(archivesService.getArchivesRelease(page));
}
@ApiOperation("档案详情")
@GetMapping("/archivesDetails")
public ApiResponse<Object> archivesDetails(
@ -118,7 +125,7 @@ public class ArchivesController {
return ApiResponse.success(archivesService.editFile(dto));
}
@ApiOperation("删除档案附件")
@ApiOperation("档案附件排序")
@PostMapping("/fileSort")
public ApiResponse<Object> fileSort(
@Validated @RequestBody ArchivesFileDTO dto
@ -233,12 +240,4 @@ public class ArchivesController {
return ApiResponse.success("/"+path);
}
@ApiOperation("标签管理")
@GetMapping("/initTagView")
public ApiResponse<Object> initTagView(
String query,Integer tagType,Pageable page
){
return ApiResponse.success(null);
}
}

62
archives/src/main/java/com/storeroom/modules/archives/controller/CaseController.java

@ -54,28 +54,28 @@ public class CaseController {
return ApiResponse.success(caseService.edit(dto));
}
@ApiOperation("绑定标签")
@PostMapping("/bingdingLabel")
public ApiResponse<Object> bingdingLabel(
@Validated @RequestBody CaseDTO dto
){
String binding = caseService.findIsBingdingLabel(dto.getTid());
String[] bindings = binding.split(",");
boolean coverLabel = null == dto.getCoverLabel() ? false : dto.getCoverLabel();
if("0".equals(bindings[1]) || coverLabel){
return ApiResponse.success(caseService.addCaseTag(dto.getId(),dto.getTid(),dto.getLabelType(),bindings[1],bindings[0]));
}else{
return ApiResponse.success(ResponseStatus.LABEL_BOUND.getMessage());
}
}
@ApiOperation("解绑标签")
@PostMapping("/unbindTag")
public ApiResponse<Object> unbindTag(
@Validated @RequestBody CaseDTO dto
){
return ApiResponse.success(caseService.unbindTag(dto.getTid(),dto.getLabelType()));
}
// @ApiOperation("绑定标签")
// @PostMapping("/bingdingLabel")
// public ApiResponse<Object> bingdingLabel(
// @Validated @RequestBody CaseDTO dto
// ){
// String binding = caseService.findIsBingdingLabel(dto.getTid());
// String[] bindings = binding.split(",");
// boolean coverLabel = null == dto.getCoverLabel() ? false : dto.getCoverLabel();
// if("0".equals(bindings[1]) || coverLabel){
// return ApiResponse.success(caseService.addCaseTag(dto.getId(),dto.getTid(),dto.getLabelType(),bindings[1],bindings[0]));
// }else{
// return ApiResponse.success(ResponseStatus.LABEL_BOUND.getMessage());
// }
// }
//
// @ApiOperation("解绑标签")
// @PostMapping("/unbindTag")
// public ApiResponse<Object> unbindTag(
// @Validated @RequestBody CaseDTO dto
// ){
// return ApiResponse.success(caseService.unbindTag(dto.getTid(),dto.getLabelType()));
// }
@ApiOperation("档案盒装盒列表")
@GetMapping("/initCartoningList")
@ -93,20 +93,20 @@ public class CaseController {
return ApiResponse.success(caseService.cartoning(dtos));
}
@ApiOperation("预备拆盒")
@GetMapping("/doUnpacking")
public ApiResponse<Object> doUnpacking(
String caseId
){
return ApiResponse.success(caseService.doUnpacking(caseId));
}
// @ApiOperation("预备拆盒")
// @GetMapping("/doUnpacking")
// public ApiResponse<Object> doUnpacking(
// String caseId
// ){
// return ApiResponse.success(caseService.doUnpacking(caseId));
// }
@ApiOperation("拆盒")
@PostMapping("/unpacking")
public ApiResponse<Object> unpacking(
@Validated @RequestBody List<ArchivesCaseCartoningDTO> dtos
@Validated @RequestBody String caseId
){
return ApiResponse.success(caseService.cartoning(dtos));
return ApiResponse.success(caseService.unpacking(caseId));
}
@ApiOperation("查看盒内详情")

39
archives/src/main/java/com/storeroom/modules/archives/controller/TagController.java

@ -1,14 +1,17 @@
package com.storeroom.modules.archives.controller;
import com.storeroom.modules.archives.service.ArchivesTagService;
import com.storeroom.modules.archives.service.dto.CaseDTO;
import com.storeroom.utils.ApiResponse;
import com.storeroom.utils.enums.ResponseStatus;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequiredArgsConstructor
@ -26,4 +29,34 @@ public class TagController {
return ApiResponse.success(archivesTagService.initTagList(tid,query,isType,page));
}
@ApiOperation("绑定标签")
@PostMapping("/bingdingLabel")
public ApiResponse<Object> bingdingLabel(
@Validated @RequestBody CaseDTO dto
){
Integer tagType = archivesTagService.findIsBingdingLabel(dto.getTid());
boolean coverLabel = null == dto.getCoverLabel() ? false : dto.getCoverLabel();
if(0 == tagType || coverLabel){
return ApiResponse.success(archivesTagService.addTag(dto.getId(),dto.getTid(),dto.getLabelType(),tagType));
}else{
return ApiResponse.success(ResponseStatus.LABEL_BOUND.getMessage());
}
}
@ApiOperation("解绑标签")
@PostMapping("/unbindTag")
public ApiResponse<Object> unbindTag(
@Validated @RequestBody List<CaseDTO> dtos
){
return ApiResponse.success(archivesTagService.unbindTag(dtos));
}
@ApiOperation("标签使用列表")
@GetMapping("/initTagLogList")
public ApiResponse<Object> initTagLogList(
String tid, String title,Integer operType,Integer bindingType, Pageable page
){
return ApiResponse.success(archivesTagService.initTagLogList(tid,title,operType,bindingType,page));
}
}

10
archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesCaseCartoning.java

@ -4,11 +4,9 @@ import com.storeroom.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ -20,8 +18,8 @@ public class ArchivesCaseCartoning extends BaseEntity implements Serializable {
@Id
@Column(name = "id")
@NotNull(groups = BaseEntity.Update.class)
@ApiModelProperty(value = "ID", hidden = true)
@GeneratedValue(generator = "idGenerator")
@GenericGenerator(name = "idGenerator", strategy = "uuid")
private String id;
@ApiModelProperty(value = "档案id")

38
archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesTagLog.java

@ -0,0 +1,38 @@
package com.storeroom.modules.archives.domain;
import com.storeroom.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Getter
@Setter
@Table(name = "archives_tag_log")
public class ArchivesTagLog extends BaseEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID_SEQ")
@Column(name="id")
private Integer id;
@Column(name = "tid")
@ApiModelProperty(value = "标签id")
private String tid;
@Column(name = "oper_type")
@ApiModelProperty(value = "操作类型 1.绑定 2.解绑")
private Integer operType;
@Column(name = "binding_type")
@ApiModelProperty(value = "绑定类别 1.档案 2.档案盒 3.层架位")
private Integer bindingType;
@Column(name = "title")
@ApiModelProperty(value = "标签标题")
private String title;
}

71
archives/src/main/java/com/storeroom/modules/archives/domain/vo/ArchivesSummaryVO.java

@ -0,0 +1,71 @@
package com.storeroom.modules.archives.domain.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import java.sql.Timestamp;
@Getter
@Setter
public class ArchivesSummaryVO {
@JSONField(name="archivesId")
@JsonProperty("archives_id")
private String archivesId;
@JSONField(name="categoryId")
@JsonProperty("category_id")
private String categoryId;
@JSONField(name="categoryName")
@JsonProperty("category_name")
private String categoryName;
@JSONField(name="categoryType")
@JsonProperty("category_type")
private Integer categoryType;
@JSONField(name="tid")
@JsonProperty("tid")
private String tid;
@JSONField(name="fondsNo")
@JsonProperty("fonds_no")
private String fondsNo;
@JSONField(name="archiveNo")
@JsonProperty("archive_no")
private String archiveNo;
@JSONField(name="department")
@JsonProperty("department")
private String department;
@JSONField(name="archiveYear")
@JsonProperty("archive_year")
private Integer archiveYear;
@JSONField(name="maintitle")
@JsonProperty("maintitle")
private String maintitle;
@JSONField(name="retention")
@JsonProperty("retention")
private String retention;
@JSONField(name="securityClass")
@JsonProperty("security_class")
private String securityClass;
// @JSONField(name="createTime")
// @JsonProperty("create_time")
// private Timestamp create_time;
//
// @JSONField(name="updateTime")
// @JsonProperty("update_time")
// private Timestamp update_time;
}

5
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseCartoningRepository.java

@ -5,6 +5,7 @@ import com.storeroom.modules.archives.domain.ArchivesCaseCartoning;
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.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
@ -13,4 +14,8 @@ public interface ArchivesCaseCartoningRepository extends JpaRepository<ArchivesC
List<ArchivesCaseCartoning> findAllByCaseId(String caseId);
@Modifying
@Query("delete from ArchivesCaseCartoning where caseId in ?1 ")
void deleteByCaseId(List caseIds);
}

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

@ -12,12 +12,16 @@ import java.util.List;
public interface ArchivesCaseRepository extends JpaRepository<ArchivesCase, String>{
@Query(countQuery = "select count(id) from ArchivesCase where caseName like concat('%',?1,'%') and tid like concat('%',?2,'%') and barcode like concat('%',?3,'%') ",
value = "from ArchivesCase where caseName like concat('%',?1,'%') and tid like concat('%',?2,'%') and barcode like concat('%',?3,'%')")
Page<Object> findAllByCaseNameLikeAndTidLikeAndBarcodeLike(String caseName, String tid,String barcode, Pageable page);
@Query(nativeQuery = true,
value = "select * from archives_case where 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) ")
Page<ArchivesCase> initCaseList(String caseName, String tid,String barcode, Pageable page);
@Query(countQuery = "select count(id) from ArchivesCase where caseType in (0,?4) and caseName like concat('%',?1,'%') and tid like concat('%',?2,'%') and barcode like concat('%',?3,'%')",
value = "from ArchivesCase where caseType in (0,?4) and caseName like concat('%',?1,'%') and tid like concat('%',?2,'%') and barcode like concat('%',?3,'%')")
@Query(nativeQuery = true,
value = "select * from archives_case where case_type in (0,?4) 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) ")
Page<ArchivesCase> initCartoningList(String caseName, String tid,String barcode,Integer caseType, Pageable page);
Integer countAllByTid(String tid);
@ -26,7 +30,7 @@ public interface ArchivesCaseRepository extends JpaRepository<ArchivesCase, Stri
List<String> findCaseName(List caseIds);
@Modifying
@Query(value = "update ArchivesCase set tid = '' where tid = ?1")
@Query(value = "update ArchivesCase set tid = null where tid = ?1")
void unbindTag(String tid);
@Modifying

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

@ -1,6 +1,9 @@
package com.storeroom.modules.archives.repository;
import com.storeroom.modules.archives.domain.ArchivesSummary;
import com.storeroom.modules.archives.domain.vo.ArchivesSummaryVO;
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.Modifying;
import org.springframework.data.jpa.repository.Query;
@ -13,6 +16,14 @@ public interface ArchivesSummaryRepository extends JpaRepository<ArchivesSummary
Integer countAllByTagNo(String tid);
ArchivesSummary findByArchivesId(String archivesId);
@Query(nativeQuery = true,
countQuery = "select count(1) from archives_summary1",
value = "select archives_id,category_id,category_name,category_type,fonds_no,archive_no,department,archive_year,maintitle," +
"retention,security_class,tag_no,case_no,create_time,update_time from archives_summary1 order by create_time asc,archives_id asc ")
Page<Map<String,Object>> getArchivesRelease(Pageable page);
@Modifying
@Transactional(rollbackFor = Exception.class)
@Query(nativeQuery = true,

19
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesTagLogRepository.java

@ -0,0 +1,19 @@
package com.storeroom.modules.archives.repository;
import com.storeroom.modules.archives.domain.ArchivesTagLog;
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.Modifying;
import org.springframework.data.jpa.repository.Query;
public interface ArchivesTagLogRepository extends JpaRepository<ArchivesTagLog, String>{
@Query(nativeQuery = true,
value = "select * from archives_tag_log where if(?1 is null,1=1,tid like ?1) " +
"and if(?2 is null,1=1,title like ?2) " +
"and if(?3 is null,1=1,oper_type = ?3) " +
"and if(?4 is null,1=1,binding_type = ?4) ")
Page<ArchivesTagLog> initTagLogList(String tid, String title, Integer operType, Integer bindingType, Pageable page);
}

8
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesTagRepository.java

@ -13,8 +13,12 @@ import java.util.List;
public interface ArchivesTagRepository extends JpaRepository<ArchivesTag, String>{
@Query(nativeQuery = true,
value = "select * from archives_tag where if(?1 is null,1=1,tid like ?1) and if(?2 is null,1=1,title like ?2) and if(?3 is null,1=1,is_type = ?3)")
// @Query("")
value = "select * from archives_tag where title is not null and " +
"if(?1 is null,1=1,tid like ?1) and if(?2 is null,1=1,title like ?2) and if(?3 is null,1=1,is_type = ?3)")
Page<ArchivesTag> initTagList(String tid, String query,Integer isType, Pageable page);
@Modifying
@Query("update ArchivesTag set parentsId = null,isType = 0,title = null where tid = ?1")
void unbindTag(String tid);
}

4
archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java

@ -27,9 +27,9 @@ public interface ArchivesCaseService {
//装盒
Object cartoning(List<ArchivesCaseCartoningDTO> dtos);
//预拆盒
Object doUnpacking(String caseId);
// Object doUnpacking(String caseId);
//拆盒
Object unpacking(List<ArchivesCaseCartoningDTO> dtos);
Object unpacking(String caseId);
//查看盒内详情
Object findInCase(String caseId);

4
archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java

@ -12,8 +12,10 @@ public interface ArchivesService {
//初始化档案列表标题
Object initArchivesViewTable(String categoryId);
//初始化档案列表
Object initArchivesView(String categoryId,String parentsId, String query,Integer archivesState,String archiveYear,String department,
Object initArchivesView(String categoryId,String parentsId,Integer queryType, String queryTitle,String archiveNo,Integer archivesState,String archiveYear,String department,
String retention,String securityClass,String organizationMatter, boolean isdel,Pageable page);
//档案列表外放接口
Object getArchivesRelease(Pageable page);
//根据门类id 档案id 获取显示档案详情信息
List<ArchivesDetailsVO> archiveDetails(String categoryId,String archivesId);
//根据门类id 档案id 获取元数据

13
archives/src/main/java/com/storeroom/modules/archives/service/ArchivesTagService.java

@ -1,10 +1,21 @@
package com.storeroom.modules.archives.service;
import com.storeroom.modules.archives.service.dto.CaseDTO;
import org.springframework.data.domain.Pageable;
public interface ArchivesTagService {
import java.util.List;
public interface ArchivesTagService {
//初始化标签列表
Object initTagList(String tid, String query,Integer isType, Pageable page);
//初始化标签日志列表
Object initTagLogList(String tid, String title,Integer operType,Integer bindingType, Pageable page);
//查看标签是否绑定
Integer findIsBingdingLabel(String label);
//绑定标签
Object addTag(String caseId,String tid,Integer labelType,Integer tagType);
//解绑标签
Object unbindTag(List<CaseDTO> dtos);
}

143
archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java

@ -43,10 +43,10 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
@Override
public Object initCaseList(String tid, String caseName,String barcode, Pageable page) {
tid = StringUtils.isEmpty(tid) ? "" : tid;
caseName = StringUtils.isEmpty(caseName) ? "" : caseName;
barcode = StringUtils.isEmpty(barcode) ? "" : barcode;
Page<Object> pageCase = caseRepository.findAllByCaseNameLikeAndTidLikeAndBarcodeLike(caseName,tid,barcode,page);
tid = StringUtils.isEmpty(tid) ? null : "%"+ tid +"%";
caseName = StringUtils.isEmpty(caseName) ? null : "%"+ caseName +"%";
barcode = StringUtils.isEmpty(barcode) ? null : "%"+ barcode +"%";
Page<ArchivesCase> pageCase = caseRepository.initCaseList(caseName,tid,barcode,page);
return PageUtil.toPage(pageCase);
}
@ -97,10 +97,6 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
archivesCase.setId(NanoIdUtils.randomNanoId());
archivesCase.setCaseType(0);
archivesCase.setDepositNum(0);
archivesCase.setTid("");
archivesCase.setBarcode("");
archivesCase.setFolderLocation("");
archivesCase.setFolderLocationDetails("");
}
archivesCase.setCaseName(dto.getCaseName());
archivesCase.setBarcode(dto.getBarcode());
@ -185,9 +181,9 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
@Override
public Object initCartoningList(String tid, String caseName, String barcode, Integer caseType, Pageable page) {
tid = StringUtils.isEmpty(tid) ? "" : tid;
caseName = StringUtils.isEmpty(caseName) ? "" : caseName;
barcode = StringUtils.isEmpty(barcode) ? "" : barcode;
tid = StringUtils.isEmpty(tid) ? null : "%"+ tid +"%";
caseName = StringUtils.isEmpty(caseName) ? null : "%"+ caseName +"%";
barcode = StringUtils.isEmpty(barcode) ? null : "%"+ barcode +"%";
Page<ArchivesCase> pageCase = caseRepository.initCartoningList(caseName,tid,barcode,caseType,page);
return PageUtil.toPage(pageCase);
}
@ -201,7 +197,7 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
ArchivesCaseCartoning Cartoning = new ArchivesCaseCartoning();
caseIds.add(archivesCaseCartoning.getCaseId());
caseNames.add(archivesCaseCartoning.getCaseName());
BeanUtils.copyProperties(Cartoning,archivesCaseCartoning);
BeanUtils.copyProperties(archivesCaseCartoning,Cartoning);
return Cartoning;
}).collect(Collectors.toList());
archivesCaseCartonings = archivesCaseCartoningRepository.saveAllAndFlush(archivesCaseCartonings);
@ -234,76 +230,111 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
entityManager.createNativeQuery(psql).executeUpdate();
archivesSummaryRepository.cartoning(dtos.get(0).getArchivesParentsId(),caseIdArr,caseNames.stream().collect(Collectors.joining(",")));
}
return null;
return archivesCaseCartonings.size();
}
// @Override
// public Object doUnpacking(String caseId) {
// ArchivesCase archivesCase = caseRepository.findById(caseId).get();
// List returnList = new ArrayList();
// //文件类型档案盒
// if(archivesCase.getCaseType()==1){
// ArchivesCaseVO vo = new ArchivesCaseVO();
// BeanUtils.copyProperties(vo,archivesCase);
// List<ArchivesSummary> archivesSummaries = archivesSummaryRepository.findAllByCaseNoAndCategoryType(caseId, ArchivesTypeEnum.files.getCode());
// vo.setArchives(archivesSummaries);
// returnList.add(vo);
// //案卷类型盒
// }else if(archivesCase.getCaseType()==2){
// List<ArchivesSummary> archivesSummaries = archivesSummaryRepository.findAllByCaseNoAndCategoryType(caseId,ArchivesTypeEnum.inChive.getCode());
// Set<String> caseIds = new HashSet<>();
// for(ArchivesSummary archivesSummary:archivesSummaries){
// caseIds.add(archivesSummary.getCaseNo());
// }
// if(caseIds.size()==1){
// ArchivesCaseVO vo = new ArchivesCaseVO();
// BeanUtils.copyProperties(vo,archivesCase);
// vo.setArchives(archivesSummaries);
// returnList.add(vo);
// }else{
// for (String thisCaseId:caseIds){
// ArchivesCase newCase = caseRepository.findById(thisCaseId).get();
// ArchivesCaseVO thisVo = new ArchivesCaseVO();
// BeanUtils.copyProperties(thisVo,newCase);
// List<ArchivesSummary> newSummary = new ArrayList<>();
// for(ArchivesSummary thisSummary:archivesSummaries){
// if(thisCaseId.equals(thisSummary.getCaseNo())){
// newSummary.add(thisSummary);
// }
// }
// returnList.add(thisVo);
// }
// }
//
// }
// return returnList;
// }
@Override
public Object doUnpacking(String caseId) {
@Transactional(rollbackFor = Exception.class)
public Object unpacking(String caseId) {
ArchivesCase archivesCase = caseRepository.findById(caseId).get();
List returnList = new ArrayList();
List<ArchivesSummary> editArchivesSummaries = new ArrayList<>();
List<String> archivesIds = new ArrayList<>();
Set<String> caseIds = new HashSet<>();
String categoryId = "";
//文件类型档案盒
if(archivesCase.getCaseType()==1){
ArchivesCaseVO vo = new ArchivesCaseVO();
BeanUtils.copyProperties(vo,archivesCase);
List<ArchivesSummary> archivesSummaries = archivesSummaryRepository.findAllByCaseNoAndCategoryType(caseId, ArchivesTypeEnum.files.getCode());
vo.setArchives(archivesSummaries);
returnList.add(vo);
for(ArchivesSummary archivesSummary:archivesSummaries){
categoryId = archivesSummary.getCategoryId();
archivesIds.add(archivesSummary.getArchivesId());
archivesSummary.setCaseNo(null);
editArchivesSummaries.add(archivesSummary);
}
caseIds.add(archivesCase.getId());
//案卷类型盒
}else if(archivesCase.getCaseType()==2){
List<ArchivesSummary> archivesSummaries = archivesSummaryRepository.findAllByCaseNoAndCategoryType(caseId,ArchivesTypeEnum.inChive.getCode());
Set<String> caseIds = new HashSet<>();
for(ArchivesSummary archivesSummary:archivesSummaries){
categoryId = archivesSummary.getCategoryId();
archivesIds.add(archivesSummary.getArchivesId());
caseIds.add(archivesSummary.getCaseNo());
archivesSummary.setCaseNo(null);
editArchivesSummaries.add(archivesSummary);
}
if(caseIds.size()==1){
ArchivesCaseVO vo = new ArchivesCaseVO();
BeanUtils.copyProperties(vo,archivesCase);
vo.setArchives(archivesSummaries);
returnList.add(vo);
}else{
if(caseIds.size()>1) {
for (String thisCaseId : caseIds) {
ArchivesCase newCase = caseRepository.findById(thisCaseId).get();
ArchivesCaseVO thisVo = new ArchivesCaseVO();
BeanUtils.copyProperties(thisVo,newCase);
List<ArchivesSummary> newSummary = new ArrayList<>();
if(!caseId.equals(thisCaseId)){
for (ArchivesSummary thisSummary : archivesSummaries) {
if (thisCaseId.equals(thisSummary.getCaseNo())) {
newSummary.add(thisSummary);
thisSummary.setCaseNo(null);
archivesIds.add(thisSummary.getArchivesId());
editArchivesSummaries.add(thisSummary);
}
}
returnList.add(thisVo);
}
}
}
return returnList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Object unpacking(List<ArchivesCaseCartoningDTO> dtos) {
ArchivesType archivesType = archivesTypeRepository.findById(dtos.get(0).getCategoryId()).get();
Set<String> caseIds = new HashSet<>();
List<String> accIds = new ArrayList<>();
for(ArchivesCaseCartoningDTO dto:dtos){
accIds.add(dto.getId());
caseIds.add(dto.getCaseId());
String sql = "update "+archivesType.getEnName()+" set case_no = null where id = '"+dto.getArchivesId()+"'";
entityManager.createNativeQuery(sql).executeUpdate();
archivesSummaryRepository.unpacking(dto.getArchivesId());
}
if(null != archivesType.getPid()){
ArchivesType archivesType = archivesTypeRepository.findById(categoryId).get();
//清空总表盒关联
archivesSummaryRepository.saveAllAndFlush(editArchivesSummaries);
Integer result = 0;
//清空具体档案表盒信息
for(String archivesId:archivesIds){
//若为案卷
if(archivesType.getIsType() == 2){
ArchivesType archivesTypeP = archivesTypeRepository.findById(archivesType.getPid()).get();
String sql = "update "+archivesTypeP.getEnName()+" set case_no = null where id = '"+dtos.get(0).getArchivesParentsId()+"'";
entityManager.createNativeQuery(sql).executeUpdate();
archivesSummaryRepository.unpacking(dtos.get(0).getArchivesParentsId());
String sonsql = "update " +archivesTypeP.getEnName() + " set case_no = null where parent_id = '"+archivesId+"'";
entityManager.createNativeQuery(sonsql).executeUpdate();
}
archivesCaseCartoningRepository.deleteAllById(accIds);
for(String caseId:caseIds){
caseRepository.cartoning(caseId,0,0);
String sql = "update " +archivesType.getEnName() + " set case_no = null where id = '"+archivesId+"'";
result = entityManager.createNativeQuery(sql).executeUpdate();
}
return null;
archivesCaseCartoningRepository.deleteByCaseId(Arrays.asList(caseIds.toArray()));
return result;
}
@Override

24
archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java

@ -18,6 +18,7 @@ import com.storeroom.utils.NanoIdUtils;
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.data.domain.Sort;
import org.springframework.stereotype.Service;
@ -49,7 +50,7 @@ public class ArchivesServiceImpl implements ArchivesService {
}
@Override
public Object initArchivesView(String categoryId,String parentsId, String query,Integer archivesState,
public Object initArchivesView(String categoryId,String parentsId,Integer queryType, String queryTitle,String archiveNo,Integer archivesState,
String archiveYear,String department,String retention,String securityClass,String organizationMatter,
boolean isdel,Pageable page) {
Optional<ArchivesType> optional = archivesTypeRepository.findById(categoryId);
@ -67,7 +68,7 @@ public class ArchivesServiceImpl implements ArchivesService {
queryFields.add("children_num");
if(archivesType.getIsType() == ArchivesTypeEnum.project.getCode() || archivesType.getIsType() == ArchivesTypeEnum.archives.getCode()){
String childrenTable = archivesTypeRepository.findEnNameByPid(archivesType.getId());
appendQuery = StringUtils.isEmpty(childrenTable) ? ",0 " :",(select count(1) from "+childrenTable+" c where c.parent_id = t.id) ";
appendQuery = StringUtils.isEmpty(childrenTable) ? ",0 " :",(select count(1) from "+childrenTable+" c where c.parent_id = t.id and is_delete_time is null) ";
}else{
appendQuery = ",(select count(1) from file_"+queryTable+" c where c.archive_id = t.id) ";
}
@ -87,8 +88,8 @@ public class ArchivesServiceImpl implements ArchivesService {
additional = StringUtils.isEmpty(retention) ? additional : additional + " and retention = '"+retention+"'";
additional = StringUtils.isEmpty(securityClass) ? additional : additional + " and security_class = '"+securityClass+"'";
additional = StringUtils.isEmpty(organizationMatter) ? additional : additional + " and organization_matter = '"+organizationMatter+"'";
additional = StringUtils.isEmpty(query) ? additional : additional
+ " and (maintitle like '%"+query+"%' or archive_no like '%"+query+"%' or archive_year like '%"+query+"%') ";
additional = StringUtils.isEmpty(queryTitle) ? additional : additional + " and maintitle like '%"+queryTitle+"%' ";
additional = StringUtils.isEmpty(archiveNo) ? additional : additional + " and archive_no like '%"+archiveNo+"%' ";
if(objects.length > 0)
quertOrder = " order by " + quertOrder.substring(0,quertOrder.length()-1);
@ -113,6 +114,12 @@ public class ArchivesServiceImpl implements ArchivesService {
return object;
}
@Override
public Object getArchivesRelease(Pageable pageable) {
Page<Map<String,Object>> page = archivesSummaryRepository.getArchivesRelease(pageable);
return PageUtil.toPage(page);
}
@Override
public List<ArchivesDetailsVO> archiveDetails(String categoryId, String archivesId) {
List<ArchivesDetailsVO> returnVo = new ArrayList<>();
@ -128,12 +135,11 @@ public class ArchivesServiceImpl implements ArchivesService {
queryEditLength.add(archivesDictionary.getEditLength());
queryisLine.add(archivesDictionary.getIsLine());
}
// archivesDictionaryRepository.findDisPlayField(categoryId);
// archivesDictionaryRepository.findDisPlayCnField(categoryId);
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 inner join archives_case_cartoning t1 on t.id = t1.case_id where archives_id = z.id)," +
String appendQuery = "tid,(select group_concat(case_name) from archives_case t inner join archives_case_cartoning t1 on t.id = t1.case_id where archives_id = z.id)," +
"folder_location,borrow_type,barcode ";
appendQuery = queryField.length() == 0 ? appendQuery : ","+appendQuery;
List<Object[]> list = entityManager.createNativeQuery("select "+queryField+appendQuery+" from "+queryTable + " z where z.id = '"+archivesId+"'").getResultList();
queryFields.add("tid");queryCnFields.add("TID");queryEditLength.add(null);queryisLine.add(null);
queryFields.add("case_name");queryCnFields.add("盒名称");queryEditLength.add(null);queryisLine.add(null);
@ -417,7 +423,7 @@ public class ArchivesServiceImpl implements ArchivesService {
}).collect(Collectors.toList());
fields.add("id");
String queryFields = fields.stream().map(String::valueOf).collect(Collectors.joining(","));
String sql = "select "+queryFields+" from file_"+archivesType.getEnName()+" where archive_id = '"+archiveId+"'";
String sql = "select "+queryFields+" from file_"+archivesType.getEnName()+" where archive_id = '"+archiveId+"' order by sequence asc ";
List<Object[]> list = entityManager.createNativeQuery(sql).getResultList();
List<Map> returnlist = new ArrayList<>();
for(Object[] objs:list){
@ -551,7 +557,7 @@ public class ArchivesServiceImpl implements ArchivesService {
int result = entityManager.createNativeQuery(sql).executeUpdate();
int result1 = 0;
if(ArchivesTypeEnum.inChive.getCode() == archivesType.getIsType() || ArchivesTypeEnum.files.getCode() == archivesType.getIsType()){
String sql1 = "delete from file_" +queryTable+" where parents_id in ('"+ids.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')";
String sql1 = "delete from file_" +queryTable+" where archive_id in ('"+ids.stream().map(String::valueOf).collect(Collectors.joining("','"))+"')";
result1 = entityManager.createNativeQuery(sql1).executeUpdate();
}
return result+","+result1;

154
archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesTagServiceImpl.java

@ -1,22 +1,174 @@
package com.storeroom.modules.archives.service.impl;
import com.storeroom.modules.archives.domain.ArchivesCase;
import com.storeroom.modules.archives.domain.ArchivesSummary;
import com.storeroom.modules.archives.domain.ArchivesTag;
import com.storeroom.modules.archives.domain.ArchivesTagLog;
import com.storeroom.modules.archives.repository.ArchivesCaseRepository;
import com.storeroom.modules.archives.repository.ArchivesSummaryRepository;
import com.storeroom.modules.archives.repository.ArchivesTagLogRepository;
import com.storeroom.modules.archives.repository.ArchivesTagRepository;
import com.storeroom.modules.archives.service.ArchivesTagService;
import com.storeroom.modules.archives.service.dto.CaseDTO;
import com.storeroom.utils.PageUtil;
import com.storeroom.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;
import java.util.Optional;
@Service
@RequiredArgsConstructor
public class ArchivesTagServiceImpl implements ArchivesTagService {
private final ArchivesTagRepository archivesTagRepository;
private final ArchivesTagLogRepository archivesTagLogRepository;
private final ArchivesSummaryRepository archivesSummaryRepository;
private final ArchivesCaseRepository caseRepository;
@PersistenceContext
EntityManager entityManager;
@Override
public Object initTagList(String tid, String query, Integer isType, Pageable page) {
tid = null != tid ? "%"+tid+"%" : null;
query = null != query ? "%"+query+"%" : null;
return archivesTagRepository.initTagList(tid,query,isType,page);
return PageUtil.toPage(archivesTagRepository.initTagList(tid,query,isType,page));
}
@Override
public Object initTagLogList(String tid, String title, Integer operType, Integer bindingType, Pageable page) {
tid = null != tid ? "%"+tid+"%" : null;
title = null != title ? "%"+title+"%" : null;
return PageUtil.toPage(archivesTagLogRepository.initTagLogList(tid,title,operType,bindingType,page));
}
@Override
public Integer findIsBingdingLabel(String label) {
Optional<ArchivesTag> optional = archivesTagRepository.findById(label);
if(!optional.isPresent()){
return 0;
}else{
ArchivesTag tag = optional.get();
return tag.getIsType() == null ? 0 : tag.getIsType();
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public Object addTag(String parentId, String tid, Integer labelType, Integer tagType) {
String archivesTable = "";
String oldTid = "";
Integer returnCount = 0;
//若原标签有绑定 先解绑
switch (tagType){
case 1:
ArchivesSummary archivesSummary = archivesSummaryRepository.findFirstByTagNo(tid);
archivesSummaryRepository.unbindTag(tid);
archivesTable = archivesSummary.getArchivesTableName();
String sql = "update "+archivesTable+" set tid = null where id = '"+archivesSummary.getArchivesId()+"'";
entityManager.createNativeQuery(sql).executeUpdate();
break;
case 2:
caseRepository.unbindTag(tid);
break;
default:
break;
}
Object title = "";
//绑定标签
switch (labelType){
case 1:
oldTid = archivesSummaryRepository.findByArchivesId(parentId).getTagNo();
archivesSummaryRepository.bindTag(tid,parentId);
String sql = "update "+archivesTable+" set tid = null where id = '"+parentId+"'";
returnCount = entityManager.createNativeQuery(sql).executeUpdate();
title = entityManager.createNativeQuery("select maintitle from "+archivesTable+" where id = '"+parentId+"'").getResultList().get(0);
break;
case 2:
ArchivesCase archivesCase = caseRepository.findById(parentId).get();
title = archivesCase.getCaseName();
oldTid = archivesCase.getTid();
returnCount = caseRepository.bindTag(tid,parentId);
break;
case 3:
break;
default:
break;
}
//清空原本tid
if(!StringUtils.isEmpty(oldTid)){
archivesTagRepository.unbindTag(oldTid);
}
Optional<ArchivesTag> optional = archivesTagRepository.findById(tid);
ArchivesTag tag = optional.isPresent() ? optional.get() : new ArchivesTag();
if(tagType==1||tagType==2||tagType==3){
ArchivesTagLog unbingLog = new ArchivesTagLog();
unbingLog.setTid(tid);
unbingLog.setOperType(2);
unbingLog.setBindingType(tagType);
unbingLog.setTitle(tag.getTitle());
archivesTagLogRepository.save(unbingLog);
}
tag.setTid(tid);
tag.setParentsId(parentId);
tag.setIsType(labelType);
tag.setTitle(title==null?"":title+"");
tag = archivesTagRepository.saveAndFlush(tag);
ArchivesTagLog bingLog = new ArchivesTagLog();
bingLog.setTid(tid);
bingLog.setOperType(1);
bingLog.setBindingType(labelType);
bingLog.setTitle(tag.getTitle());
archivesTagLogRepository.save(bingLog);
return returnCount;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Object unbindTag(List<CaseDTO> dtos) {
Integer result = 0;
for(CaseDTO dto:dtos){
String tid = dto.getTid();
Integer labelType = dto.getLabelType();
ArchivesTag tag = archivesTagRepository.findById(tid).get();
ArchivesTagLog unbingLog = new ArchivesTagLog();
unbingLog.setTid(tid);
unbingLog.setOperType(2);
unbingLog.setBindingType(labelType);
unbingLog.setTitle(tag.getTitle());
switch (labelType){
case 1:
ArchivesSummary archivesSummary = archivesSummaryRepository.findFirstByTagNo(tid);
archivesSummaryRepository.unbindTag(tid);
String archivesTable = archivesSummary.getArchivesTableName();
String sql = "update "+archivesTable+" set tid = null where id = '"+archivesSummary.getArchivesId()+"'";
result = entityManager.createNativeQuery(sql).executeUpdate();
archivesTagLogRepository.save(unbingLog);
break;
case 2:
caseRepository.unbindTag(tid);
archivesTagLogRepository.save(unbingLog);
result = 1;
break;
default:
break;
}
archivesTagRepository.unbindTag(tid);
result++;
}
return result;
}
}

3
system/src/main/resources/application.yml

@ -15,6 +15,9 @@ spring:
enabled: false
main:
allow-bean-definition-overriding: true
servlet:
multipart:
max-file-size: 5MB
#配置 Jpa
jpa:

Loading…
Cancel
Save