|
|
@ -10,6 +10,7 @@ import com.storeroom.modules.archives.service.ArchivesCaseService; |
|
|
|
import com.storeroom.modules.archives.service.dto.ArchivesCaseCartoningDTO; |
|
|
|
import com.storeroom.modules.archives.domain.vo.ArchivesCaseVO; |
|
|
|
import com.storeroom.modules.archives.service.dto.CaseDTO; |
|
|
|
import com.storeroom.modules.archives.service.dto.CollectDTO; |
|
|
|
import com.storeroom.modules.common.ArchivesTypeEnum; |
|
|
|
import com.storeroom.modules.dictionary.domain.ArchivesType; |
|
|
|
import com.storeroom.modules.dictionary.repository.ArchivesTypeRepository; |
|
|
@ -62,7 +63,7 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { |
|
|
|
return true; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(!caseId.equals(caseList.get(0).getId())){ |
|
|
|
if(caseList.size()!=0 && !caseId.equals(caseList.get(0).getId())){ |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -200,6 +201,7 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { |
|
|
|
caseIds.add(archivesCaseCartoning.getCaseId()); |
|
|
|
caseNames.add(archivesCaseCartoning.getCaseName()); |
|
|
|
BeanUtils.copyProperties(archivesCaseCartoning,Cartoning); |
|
|
|
Cartoning.setParentId(archivesCaseCartoning.getArchivesParentsId()); |
|
|
|
return Cartoning; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
archivesCaseCartonings = archivesCaseCartoningRepository.saveAllAndFlush(archivesCaseCartonings); |
|
|
@ -285,21 +287,24 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { |
|
|
|
ArchivesCase archivesCase = caseRepository.findById(caseId).get(); |
|
|
|
List<ArchivesSummary> editArchivesSummaries = new ArrayList<>(); |
|
|
|
List<String> archivesIds = new ArrayList<>(); |
|
|
|
List<String> oneCaseIds = new ArrayList<>(); |
|
|
|
Set<String> caseIds = new HashSet<>(); |
|
|
|
String categoryId = ""; |
|
|
|
String caseIdLike = "%"+caseId+"%"; |
|
|
|
//文件类型档案盒 |
|
|
|
if(archivesCase.getCaseType()==1){ |
|
|
|
List<ArchivesSummary> archivesSummaries = archivesSummaryRepository.findAllByCaseNoAndCategoryType(caseId, ArchivesTypeEnum.files.getCode()); |
|
|
|
List<ArchivesSummary> archivesSummaries = archivesSummaryRepository.findAllByCaseNoLikeAndCategoryType(caseIdLike, ArchivesTypeEnum.files.getCode()); |
|
|
|
for(ArchivesSummary archivesSummary:archivesSummaries){ |
|
|
|
categoryId = archivesSummary.getCategoryId(); |
|
|
|
archivesIds.add(archivesSummary.getArchivesId()); |
|
|
|
archivesSummary.setCaseNo(null); |
|
|
|
archivesSummary.setCaseName(null); |
|
|
|
editArchivesSummaries.add(archivesSummary); |
|
|
|
} |
|
|
|
caseIds.add(archivesCase.getId()); |
|
|
|
//案卷类型盒 |
|
|
|
}else if(archivesCase.getCaseType()==2){ |
|
|
|
List<ArchivesSummary> archivesSummaries = archivesSummaryRepository.findAllByCaseNoAndCategoryType(caseId,ArchivesTypeEnum.inChive.getCode()); |
|
|
|
List<ArchivesSummary> archivesSummaries = archivesSummaryRepository.findAllByCaseNoLikeAndCategoryType(caseIdLike,ArchivesTypeEnum.inChive.getCode()); |
|
|
|
for(ArchivesSummary archivesSummary:archivesSummaries){ |
|
|
|
categoryId = archivesSummary.getCategoryId(); |
|
|
|
archivesIds.add(archivesSummary.getArchivesId()); |
|
|
@ -309,10 +314,25 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { |
|
|
|
archivesSummary.setUpdateTime(new Timestamp(System.currentTimeMillis())); |
|
|
|
editArchivesSummaries.add(archivesSummary); |
|
|
|
} |
|
|
|
|
|
|
|
List<ArchivesSummary> archivesSummariesP = archivesSummaryRepository.findAllByCaseNoLikeAndCategoryType(caseIdLike,ArchivesTypeEnum.archives.getCode()); |
|
|
|
for(ArchivesSummary archivesSummary:archivesSummariesP){ |
|
|
|
String caseNos = archivesSummary.getCaseNo(); |
|
|
|
String[] caseNoss = caseNos.split(","); |
|
|
|
for(String cn : caseNoss){ |
|
|
|
caseIds.add(cn); |
|
|
|
} |
|
|
|
archivesSummary.setCaseNo(null); |
|
|
|
archivesSummary.setCaseName(null); |
|
|
|
archivesSummary.setUpdateTime(new Timestamp(System.currentTimeMillis())); |
|
|
|
editArchivesSummaries.add(archivesSummary); |
|
|
|
} |
|
|
|
|
|
|
|
if(caseIds.size()>1) { |
|
|
|
for (String thisCaseId : caseIds) { |
|
|
|
if(!caseId.equals(thisCaseId)){ |
|
|
|
for (ArchivesSummary thisSummary : archivesSummaries) { |
|
|
|
List<ArchivesSummary> additional = archivesSummaryRepository.findAllByCaseNoAndCategoryType(thisCaseId,ArchivesTypeEnum.inChive.getCode()); |
|
|
|
for (ArchivesSummary thisSummary : additional) { |
|
|
|
if (thisCaseId.equals(thisSummary.getCaseNo())) { |
|
|
|
thisSummary.setCaseNo(null); |
|
|
|
thisSummary.setCaseName(null); |
|
|
@ -322,6 +342,7 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { |
|
|
|
} |
|
|
|
} |
|
|
|
caseRepository.cartoning(thisCaseId,0,0); |
|
|
|
oneCaseIds.add(thisCaseId); |
|
|
|
result = result+1; |
|
|
|
} |
|
|
|
} |
|
|
@ -336,13 +357,20 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { |
|
|
|
//清空具体档案表盒信息 |
|
|
|
for(String archivesId:archivesIds){ |
|
|
|
//若为案卷 |
|
|
|
if(archivesType.getIsType() == 2){ |
|
|
|
if(archivesType.getIsType() == 4){ |
|
|
|
ArchivesType archivesTypeP = archivesTypeRepository.findById(archivesType.getPid()).get(); |
|
|
|
String sonsql = "update " +archivesTypeP.getEnName() + " set case_no = null where parent_id = '"+archivesId+"'"; |
|
|
|
String sonsql = "update " +archivesTypeP.getEnName() + " set case_no = null where id = (select parent_id from "+archivesType.getEnName() |
|
|
|
+" where id = '"+archivesId+"')"; |
|
|
|
entityManager.createNativeQuery(sonsql).executeUpdate(); |
|
|
|
} |
|
|
|
String sql = "update " +archivesType.getEnName() + " set case_no = null where id = '"+archivesId+"'"; |
|
|
|
entityManager.createNativeQuery(sql).executeUpdate(); |
|
|
|
|
|
|
|
if(oneCaseIds.size()!=0){ |
|
|
|
String oneCase = oneCaseIds.size()==1?oneCaseIds.get(0) : oneCaseIds.stream().map(String::valueOf).collect(Collectors.joining("','")); |
|
|
|
String onesql = "update " +archivesType.getEnName() + " set case_no = null where case_no in ('"+oneCase+"')"; |
|
|
|
entityManager.createNativeQuery(onesql).executeUpdate(); |
|
|
|
} |
|
|
|
} |
|
|
|
archivesCaseCartoningRepository.deleteByCaseId(Arrays.asList(caseIds.toArray())); |
|
|
|
caseRepository.cartoning(caseId,0,0); |
|
|
@ -385,4 +413,53 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService { |
|
|
|
Page<Map<String,Object>> pageCase = caseRepository.alReadyInto(caseName,archiveNo,title,location,page); |
|
|
|
return PageUtil.toPage(pageCase); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object initCaseByArchives(String archivesId) { |
|
|
|
return caseRepository.initCaseByArchives(archivesId); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer collect(boolean isCallback, List<CollectDTO> dtos) { |
|
|
|
List<ArchivesCase> cases = new ArrayList<>(); |
|
|
|
Set<ArchivesSummary> archices = new HashSet<>(); |
|
|
|
for (CollectDTO dto : dtos){ |
|
|
|
ArchivesCase thisCase = caseRepository.findById(dto.getCaseId()).get(); |
|
|
|
thisCase.setShelfId(dto.getShelfId()); |
|
|
|
thisCase.setFolderLocation(dto.getPosition()); |
|
|
|
thisCase.setFolderLocationDetails(dto.getPositionName()); |
|
|
|
thisCase.setStorageType(isCallback ? 1:2); |
|
|
|
cases.add(thisCase); |
|
|
|
|
|
|
|
List<ArchivesSummary> thisSummarys = archivesSummaryRepository.findAllByCaseNoLike(dto.getCaseId()); |
|
|
|
for(ArchivesSummary summary : thisSummarys){ |
|
|
|
String summaryCaseIds = summary.getCaseNo(); |
|
|
|
String[] caseIds = summaryCaseIds.split(","); |
|
|
|
String newShelfId = "";String newLocation = "";String newLocationName=""; |
|
|
|
Integer resultOk = 0; |
|
|
|
for (String caseId : caseIds){ |
|
|
|
for(CollectDTO dto1 : dtos){ |
|
|
|
if(caseId.equals(dto1.getCaseId())){ |
|
|
|
newShelfId += dto1.getShelfId() + ","; |
|
|
|
newLocation += dto1.getPosition() + ","; |
|
|
|
newLocationName += dto1.getPositionName()+","; |
|
|
|
resultOk++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(resultOk>1){ |
|
|
|
newShelfId = newShelfId.substring(0,newShelfId.length()-1); |
|
|
|
newLocation = newLocation.substring(0,newLocation.length()-1); |
|
|
|
newLocationName = newLocationName.substring(0,newLocationName.length()-1); |
|
|
|
} |
|
|
|
summary.setShelfId(newShelfId); |
|
|
|
summary.setFolderLocation(newLocation); |
|
|
|
summary.setFolderLocationDetails(newLocationName); |
|
|
|
archices.add(summary); |
|
|
|
} |
|
|
|
} |
|
|
|
caseRepository.saveAllAndFlush(cases); |
|
|
|
archivesSummaryRepository.saveAllAndFlush(archices); |
|
|
|
return cases.size(); |
|
|
|
} |
|
|
|
} |