|
|
@@ -1,15 +1,18 @@
|
|
|
package me.zhengjie.archives.service.impl;
|
|
|
|
|
|
import java.io.File;
|
|
|
-
|
|
|
+import java.io.IOException;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
@@ -33,12 +36,14 @@ import me.zhengjie.archives.plus.AbstractServiceImpl;
|
|
|
import me.zhengjie.archives.plus.QueryMap;
|
|
|
import me.zhengjie.archives.service.ArchivesService;
|
|
|
import me.zhengjie.archives.service.FileInfoService;
|
|
|
+import me.zhengjie.archives.util.ExcelUtils;
|
|
|
import me.zhengjie.archives.util.HtmlConvertToPdf;
|
|
|
import me.zhengjie.archives.util.HtmlToImage;
|
|
|
import me.zhengjie.archives.util.PdfUtils;
|
|
|
import me.zhengjie.archives.vo.ArchivesVo;
|
|
|
import me.zhengjie.archives.vo.CasePortraitVo;
|
|
|
import me.zhengjie.config.FileProperties;
|
|
|
+import me.zhengjie.modules.mnt.service.dto.AppDto;
|
|
|
import me.zhengjie.modules.system.service.DictDetailService;
|
|
|
import me.zhengjie.utils.BeanCopyUtils;
|
|
|
import me.zhengjie.utils.DateUtil;
|
|
|
@@ -66,18 +71,25 @@ public class ArchivesServiceImpl extends AbstractServiceImpl<IArchivesDao, Archi
|
|
|
// }
|
|
|
|
|
|
public Map<String, Object> page(ArchivesVo req) {
|
|
|
- IPage<ArchivesEntity> page = new Page<>(req.getIndex()+1, req.getSize());
|
|
|
+ IPage<ArchivesEntity> page = new Page<>(req.getIndex() + 1, req.getSize());
|
|
|
ArchivesEntity entity = BeanCopyUtils.convertObj(req, ArchivesEntity.class);
|
|
|
entity.setIsDelete("1");
|
|
|
QueryMap queryMap = new QueryMap();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
List<String> accept = req.getAcceptDate();
|
|
|
if (CollectionUtils.isNotEmpty(accept)) {
|
|
|
- map.put("startTime", accept.get(0).replaceAll("-", ""));
|
|
|
- map.put("endTime", accept.get(1).replaceAll("-", ""));
|
|
|
+ String stringDate = accept.get(0).replaceAll("-", "");
|
|
|
+ map.put("startTime", stringDate.split(" ")[0]);
|
|
|
+ String endDate=accept.get(1).replaceAll("-", "");
|
|
|
+ map.put("endTime",endDate.split(" ")[0]);
|
|
|
+ queryMap.setMap(map);
|
|
|
+ }
|
|
|
+ List<String> submitTime = req.getSubmitTime();
|
|
|
+ if (CollectionUtils.isNotEmpty(submitTime)) {
|
|
|
+ map.put("submitStartTime", submitTime.get(0));
|
|
|
+ map.put("submitEndTime", submitTime.get(1));
|
|
|
queryMap.setMap(map);
|
|
|
}
|
|
|
-
|
|
|
page = page(page, entity, queryMap);
|
|
|
String previewPath = dictDetailService.getValueByName("file_path").get("preview_path");
|
|
|
|
|
|
@@ -278,6 +290,8 @@ public class ArchivesServiceImpl extends AbstractServiceImpl<IArchivesDao, Archi
|
|
|
archiveEntity.setId(archives.getId());
|
|
|
archiveEntity.setPdfPath(fileRelatePath + fileName);
|
|
|
archiveEntity.setImageJson(JSON.toJSONString(archives));
|
|
|
+ String submitTime = DateUtil.localDateTimeFormatyMdHms(LocalDateTime.now());
|
|
|
+ archiveEntity.setSubmitTime(submitTime);
|
|
|
if (StringUtils.isNotBlank(archives.getIsRedo()) && archives.getIsRedo().equals("1")) {
|
|
|
int redoCount = entity.getRedoCount() == null ? 0 : entity.getRedoCount() + 1;
|
|
|
archiveEntity.setRedoCount(redoCount);
|
|
|
@@ -335,6 +349,44 @@ public class ArchivesServiceImpl extends AbstractServiceImpl<IArchivesDao, Archi
|
|
|
image(archives);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void download(ArchivesVo req, HttpServletResponse response) throws IOException {
|
|
|
+
|
|
|
+ List<String> accept = req.getAcceptDate();
|
|
|
+ QueryMap queryMap = new QueryMap();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(accept)) {
|
|
|
+ String stringDate = accept.get(0).replaceAll("-", "");
|
|
|
+ map.put("startTime", stringDate.split(" ")[0]);
|
|
|
+ String endDate=accept.get(1).replaceAll("-", "");
|
|
|
+ map.put("endTime",endDate.split(" ")[0]);
|
|
|
+ queryMap.setMap(map);
|
|
|
+ }
|
|
|
+ List<String> submitTime = req.getSubmitTime();
|
|
|
+ if (CollectionUtils.isNotEmpty(submitTime)) {
|
|
|
+ map.put("submitStartTime", submitTime.get(0));
|
|
|
+ map.put("submitEndTime", submitTime.get(1));
|
|
|
+ queryMap.setMap(map);
|
|
|
+ }
|
|
|
+ ArchivesEntity entity = BeanCopyUtils.convertObj(req, ArchivesEntity.class);
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ List<ArchivesEntity> queryAll = list(entity, queryMap);
|
|
|
+ if (queryAll != null && queryAll.size() > 0) {
|
|
|
+ // 受理号、当事人姓名、公证书编号、公证员、公证事项
|
|
|
+ for (ArchivesEntity archives : queryAll) {
|
|
|
+ Map<String, Object> export = new LinkedHashMap<>();
|
|
|
+ export.put("受理号", archives.getAcceptNum());
|
|
|
+ export.put("当事人姓名", archives.getPartyName());
|
|
|
+ export.put("公证书编号", archives.getNotarialNum());
|
|
|
+ export.put("公证员", archives.getNotary());
|
|
|
+ export.put("公证事项", archives.getNotarizedItem());
|
|
|
+ list.add(export);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ExcelUtils.downloadExcel(list, response);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 删除没有用到的图片,
|
|
|
*/
|
|
|
@@ -345,16 +397,15 @@ public class ArchivesServiceImpl extends AbstractServiceImpl<IArchivesDao, Archi
|
|
|
qw.eq("is_clean", 0);
|
|
|
qw.apply("redo_count != clean_count");
|
|
|
int i = 0;
|
|
|
- int j=10;
|
|
|
+ int j = 10;
|
|
|
while (true) {
|
|
|
-
|
|
|
qw.last("limit " + i + "," + j);
|
|
|
List<ArchivesEntity> archives = this.list(qw);
|
|
|
if (CollectionUtils.isEmpty(archives)) {
|
|
|
break;
|
|
|
}
|
|
|
- i = j;
|
|
|
- j+=10;
|
|
|
+ i = j;
|
|
|
+ j += 10;
|
|
|
for (ArchivesEntity a : archives) {
|
|
|
ArchivesEntity deleteImagePre = new ArchivesEntity();
|
|
|
deleteImagePre.setId(a.getId());
|
|
|
@@ -367,7 +418,7 @@ public class ArchivesServiceImpl extends AbstractServiceImpl<IArchivesDao, Archi
|
|
|
List<String> imageIds = casePort.getImageIds();
|
|
|
// 查询id的值
|
|
|
FileInfoEntity fileInfo = new FileInfoEntity();
|
|
|
- fileInfo.setLoanNo(String.valueOf(a.getId()));
|
|
|
+ fileInfo.setLoanNo(String.valueOf(a.getId()));
|
|
|
// Map<String, FileInfoEntity> allFileIds = fileInfoService.list(fileInfo).stream()
|
|
|
// .collect(Collectors.toMap(obj -> obj.getId(), obj -> obj));
|
|
|
List<FileInfoEntity> fileInfos = fileInfoService.list(fileInfo);
|
|
|
@@ -399,5 +450,7 @@ public class ArchivesServiceImpl extends AbstractServiceImpl<IArchivesDao, Archi
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ public static void main(String[] args) {
|
|
|
+ System.out.println("20200101 00:00:00".split(" ")[0].length());
|
|
|
+ }
|
|
|
}
|