|
|
@@ -278,17 +278,22 @@ public class ArchiveServiceImpl implements IArchiveService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void downloadCenterZipFiles(String year, DownloadTask task) {
|
|
|
+ public void downloadCenterZipFiles(DownloadTask task) {
|
|
|
+ String year = task.getYearAndMonth();
|
|
|
if (Func.isBlank(year)) {
|
|
|
throw new ServiceException("参数year不能为空");
|
|
|
}
|
|
|
String dir;
|
|
|
+ List<Integer> types = null;
|
|
|
if (task.getType() == 0) {
|
|
|
dir = "全部档案资料";
|
|
|
+ types = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28);
|
|
|
} else if (task.getType() == 1) {
|
|
|
dir = "高新备查资料";
|
|
|
+ types = Arrays.asList(1, 2, 4, 5, 7, 9, 11, 14, 21, 22, 23, 25, 27);
|
|
|
} else {
|
|
|
dir = "加计扣除备查资料";
|
|
|
+ types = Arrays.asList(3, 4, 6, 8, 10, 13, 15, 19, 20, 26, 28);
|
|
|
}
|
|
|
Date date = new Date();
|
|
|
|
|
|
@@ -304,63 +309,80 @@ public class ArchiveServiceImpl implements IArchiveService {
|
|
|
List<CompletableFuture<Void>> futureList = new ArrayList<>();
|
|
|
|
|
|
ArchiveAttachEntity finalArchiveAttach = archiveAttach;
|
|
|
+ List<Integer> finalTypes = types;
|
|
|
futureList.add(CompletableFuture.runAsync(() -> {
|
|
|
RequestContextHolder.setRequestAttributes(requestAttributes);
|
|
|
- //1 高新技术企业资格证书:基础资源管理-企业基本信息-高企证书上传(按年度)。未上传则为空
|
|
|
- generateD1(Paths.get(basePath.toString(), "1.高新技术企业资格证书"), year);
|
|
|
- //2 高新技术企业认定资料:附件补充
|
|
|
- Path path2 = FileUtil.mkdir(Paths.get(basePath.toString(), "2.高新技术企业认定资料"));
|
|
|
- this.downloadAttachFiles(path2, Collections.singletonList(finalArchiveAttach.getD3()));
|
|
|
- //3 加计扣除情况说明:附件补充
|
|
|
- Path path3 = FileUtil.mkdir(Paths.get(basePath.toString(), "3.加计扣除情况说明"));
|
|
|
- this.downloadAttachFiles(path3, Collections.singletonList(finalArchiveAttach.getD10()));
|
|
|
- //4 研发立项决议文件:附件补充
|
|
|
- Path path4 = FileUtil.mkdir(Paths.get(basePath.toString(), "4.研发立项决议文件"));
|
|
|
- this.downloadAttachFiles(path4, Collections.singletonList(finalArchiveAttach.getD13()));
|
|
|
-
|
|
|
- //5 高新研发项目汇总表:对外报表-高新口径研发费用报表-高新-研发项目清单表
|
|
|
- generateD5(Paths.get(basePath.toString(), "5.高新研发项目汇总表"), year, 2);
|
|
|
- //6 加计扣除研发项目汇总表:对外报表-加计扣除口径研发费用报表-加计扣除-研发项目清单表
|
|
|
- generateD5(Paths.get(basePath.toString(), "6.加计扣除研发项目汇总表"), year, 3);
|
|
|
+ if(finalTypes.contains(1)){
|
|
|
+ //1 高新技术企业资格证书:基础资源管理-企业基本信息-高企证书上传(按年度)。未上传则为空
|
|
|
+ generateD1(Paths.get(basePath.toString(), "1.高新技术企业资格证书"), year);
|
|
|
+ }
|
|
|
+ if(finalTypes.contains(2)) {
|
|
|
+ //2 高新技术企业认定资料:附件补充
|
|
|
+ Path path2 = FileUtil.mkdir(Paths.get(basePath.toString(), "2.高新技术企业认定资料"));
|
|
|
+ this.downloadAttachFiles(path2, Collections.singletonList(finalArchiveAttach.getD3()));
|
|
|
+ }
|
|
|
+ if(finalTypes.contains(2)){
|
|
|
+ //3 加计扣除情况说明:附件补充
|
|
|
+ Path path3 = FileUtil.mkdir(Paths.get(basePath.toString(), "3.加计扣除情况说明"));
|
|
|
+ this.downloadAttachFiles(path3, Collections.singletonList(finalArchiveAttach.getD10()));
|
|
|
+ }
|
|
|
+ if(finalTypes.contains(2)){
|
|
|
+ //4 研发立项决议文件:附件补充
|
|
|
+ Path path4 = FileUtil.mkdir(Paths.get(basePath.toString(), "4.研发立项决议文件"));
|
|
|
+ this.downloadAttachFiles(path4, Collections.singletonList(finalArchiveAttach.getD13()));
|
|
|
+ }
|
|
|
+ if(finalTypes.contains(2)){
|
|
|
+ //5 高新研发项目汇总表:对外报表-高新口径研发费用报表-高新-研发项目清单表
|
|
|
+ generateD5(Paths.get(basePath.toString(), "5.高新研发项目汇总表"), year, 2);
|
|
|
+ }
|
|
|
+ if(finalTypes.contains(2)){
|
|
|
+ //6 加计扣除研发项目汇总表:对外报表-加计扣除口径研发费用报表-加计扣除-研发项目清单表
|
|
|
+ generateD5(Paths.get(basePath.toString(), "6.加计扣除研发项目汇总表"), year, 3);
|
|
|
+ }
|
|
|
}));
|
|
|
|
|
|
- Path path7 = FileUtil.mkdir(Paths.get(basePath.toString(), "7.高新研发项目全套技术资料"));
|
|
|
- XmFinanceEntity dto = new XmFinanceEntity();
|
|
|
- dto.setYearAndMonth(year);
|
|
|
- dto.setType(2);
|
|
|
- List<XmFinanceEntity> list = xmFinanceService.selectXmFinanceList(dto);
|
|
|
- AtomicInteger index = new AtomicInteger(1);
|
|
|
- for (XmFinanceEntity xm : list) {
|
|
|
- AtomicInteger finalIndex = index;
|
|
|
- futureList.add(CompletableFuture.runAsync(() -> {
|
|
|
- RequestContextHolder.setRequestAttributes(requestAttributes);
|
|
|
- generateD7(path7, finalIndex.get(), xm);
|
|
|
- finalIndex.incrementAndGet();
|
|
|
- }));
|
|
|
+ if(types.contains(7)){
|
|
|
+ Path path7 = FileUtil.mkdir(Paths.get(basePath.toString(), "7.高新研发项目全套技术资料"));
|
|
|
+ XmFinanceEntity dto = new XmFinanceEntity();
|
|
|
+ dto.setYearAndMonth(year);
|
|
|
+ dto.setType(2);
|
|
|
+ List<XmFinanceEntity> list = xmFinanceService.selectXmFinanceList(dto);
|
|
|
+ AtomicInteger index = new AtomicInteger(1);
|
|
|
+ for (XmFinanceEntity xm : list) {
|
|
|
+ futureList.add(CompletableFuture.runAsync(() -> {
|
|
|
+ RequestContextHolder.setRequestAttributes(requestAttributes);
|
|
|
+ generateD7(path7, index.get(), xm);
|
|
|
+ index.incrementAndGet();
|
|
|
+ }));
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- Path path8 = FileUtil.mkdir(Paths.get(basePath.toString(), "8.加计扣除研发项目全套技术资料"));
|
|
|
- dto = new XmFinanceEntity();
|
|
|
- dto.setYearAndMonth(year);
|
|
|
- dto.setType(3);
|
|
|
- list = xmFinanceService.selectXmFinanceList(dto);
|
|
|
- index = new AtomicInteger(1);
|
|
|
- for (XmFinanceEntity xm : list) {
|
|
|
- AtomicInteger finalIndex = index;
|
|
|
- futureList.add(CompletableFuture.runAsync(() -> {
|
|
|
- RequestContextHolder.setRequestAttributes(requestAttributes);
|
|
|
- generateD7(path8, finalIndex.get(), xm);
|
|
|
- finalIndex.incrementAndGet();
|
|
|
- }));
|
|
|
- index.incrementAndGet();
|
|
|
+ if(types.contains(8)){
|
|
|
+ Path path8 = FileUtil.mkdir(Paths.get(basePath.toString(), "8.加计扣除研发项目全套技术资料"));
|
|
|
+ XmFinanceEntity dto = new XmFinanceEntity();
|
|
|
+ dto.setYearAndMonth(year);
|
|
|
+ dto.setType(3);
|
|
|
+ List<XmFinanceEntity> list = xmFinanceService.selectXmFinanceList(dto);
|
|
|
+ AtomicInteger index = new AtomicInteger(1);
|
|
|
+ for (XmFinanceEntity xm : list) {
|
|
|
+ futureList.add(CompletableFuture.runAsync(() -> {
|
|
|
+ RequestContextHolder.setRequestAttributes(requestAttributes);
|
|
|
+ generateD7(path8, index.get(), xm);
|
|
|
+ index.incrementAndGet();
|
|
|
+ }));
|
|
|
+ index.incrementAndGet();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
futureList.add(CompletableFuture.runAsync(() -> {
|
|
|
RequestContextHolder.setRequestAttributes(requestAttributes);
|
|
|
- //9 高新研发人员与科技人员资料:改成高新科技人员资料:即科技人员管理-年高新科技人员汇总表资料表,选出:对外报表-高新口径研发费用报表-高新-研发项目清单中项目人员汇总
|
|
|
- generateD9(Paths.get(basePath.toString(), "9.高新科技人员资料"), year, finalArchiveAttach.getD6());
|
|
|
- //10 加计扣除研发人员与科技人员资料:改成加计扣除项目科研人员资料:即科技人员管理-项目人员汇总表,选出:对外报表-加计扣除口径研发费用报表-加计扣除-研发项目清单中项目人员汇总
|
|
|
- generateD10(Paths.get(basePath.toString(), "10.加计扣除项目科研人员资料"), year);
|
|
|
+ if(finalTypes.contains(9)){
|
|
|
+ //9 高新研发人员与科技人员资料:改成高新科技人员资料:即科技人员管理-年高新科技人员汇总表资料表,选出:对外报表-高新口径研发费用报表-高新-研发项目清单中项目人员汇总
|
|
|
+ generateD9(Paths.get(basePath.toString(), "9.高新科技人员资料"), year, finalArchiveAttach.getD6());
|
|
|
+ }
|
|
|
+ if(finalTypes.contains(10)){
|
|
|
+ //10 加计扣除研发人员与科技人员资料:改成加计扣除项目科研人员资料:即科技人员管理-项目人员汇总表,选出:对外报表-加计扣除口径研发费用报表-加计扣除-研发项目清单中项目人员汇总
|
|
|
+ generateD10(Paths.get(basePath.toString(), "10.加计扣除项目科研人员资料"), year);
|
|
|
+ }
|
|
|
}));
|
|
|
|
|
|
futureList.add(CompletableFuture.runAsync(() -> {
|
|
|
@@ -406,7 +428,7 @@ public class ArchiveServiceImpl implements IArchiveService {
|
|
|
|
|
|
//18.高新研发费用附件凭证资料及相关说明:对外报表-高新口径研发费用报表-高新-研发项目(见列表详细)
|
|
|
Path path18 = FileUtil.mkdir(Paths.get(basePath.toString(), "18.高新研发费用附件支持资料及相关说明"));
|
|
|
- try {
|
|
|
+ try {
|
|
|
XmFinanceEntity dto2 = new XmFinanceEntity();
|
|
|
dto2.setYearAndMonth(year);
|
|
|
dto2.setType(2);
|
|
|
@@ -417,7 +439,7 @@ public class ArchiveServiceImpl implements IArchiveService {
|
|
|
|
|
|
//19.加计扣除研发费用附件凭证资料及相关说明:对外报表-加计扣除口径研发费用报表-加计扣除-研发项目(见列表详细)
|
|
|
Path path19 = FileUtil.mkdir(Paths.get(basePath.toString(), "19.加计扣除研发费用附件支撑资料及相关说明"));
|
|
|
- try {
|
|
|
+ try {
|
|
|
XmFinanceEntity dto2 = new XmFinanceEntity();
|
|
|
dto2.setYearAndMonth(year);
|
|
|
dto2.setType(3);
|
|
|
@@ -457,12 +479,21 @@ public class ArchiveServiceImpl implements IArchiveService {
|
|
|
Path path28 = FileUtil.mkdir(Paths.get(basePath.toString(), "28.其他加计扣除备查资料"));
|
|
|
this.downloadAttachFiles(path28, Collections.singletonList(finalArchiveAttach.getD12()));
|
|
|
}));
|
|
|
- CompletableFuture.allOf(futureList.toArray(new CompletableFuture[futureList.size()])).join();
|
|
|
+ CompletableFuture.allOf(futureList.toArray(new CompletableFuture[futureList.size()])).join();
|
|
|
+ log.info("一键导出耗时:{}", (new Date().getTime() - date.getTime()) / 1000 + "秒");
|
|
|
//设置任务状态为 已完成
|
|
|
task.setStatus(2);
|
|
|
+ task.setDoneTime(new Date());
|
|
|
task.setExpireTime(DateUtil.plusDays(new Date(), 1));
|
|
|
downloadTaskMapper.updateById(task);
|
|
|
- System.out.println("一键导出耗时:" + (new Date().getTime() - date.getTime()) / 1000 + "秒");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void downloadHighTechZipFiles(DownloadTask task) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void downloadDeductionZipFiles(DownloadTask task) {
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void generateD17(Path path, List<XmFinanceEntity> list, String year, List<CompletableFuture<Void>> futureList) {
|
|
|
@@ -514,7 +545,7 @@ public class ArchiveServiceImpl implements IArchiveService {
|
|
|
Path path17_2_1_2 = FileUtil.mkdir(Paths.get(path17_2_1.toString(), "2.研发领料单"));
|
|
|
futureList.add(CompletableFuture.runAsync(() -> {
|
|
|
RequestContextHolder.setRequestAttributes(requestAttributes);
|
|
|
- generateD17_2_1_2(year, path17_2_1_2, xm.getXmId(), "材料");
|
|
|
+ generateD17_2_1_2(year, path17_2_1_2, xm.getXmId(), "材料");
|
|
|
}));
|
|
|
|
|
|
//2-1-3.研发燃料耗用单
|
|
|
@@ -1377,14 +1408,4 @@ public class ArchiveServiceImpl implements IArchiveService {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void downloadHighTechZipFiles(HttpServletRequest request, HttpServletResponse response, String year) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void downloadDeductionZipFiles(HttpServletRequest request, HttpServletResponse response, String year) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
}
|