|
@@ -4272,6 +4272,13 @@ public class TaskController extends BladeController {
|
|
|
/*如果数据没有变化,则各表的PDF可以不用更新*/
|
|
/*如果数据没有变化,则各表的PDF可以不用更新*/
|
|
|
ExecutionTime executionTime = new ExecutionTime();
|
|
ExecutionTime executionTime = new ExecutionTime();
|
|
|
List<ReportResult> reportResults;
|
|
List<ReportResult> reportResults;
|
|
|
|
|
+
|
|
|
|
|
+ // 获取原始数据信息
|
|
|
|
|
+ String[] REPORT = new String[]{"s_interim_pay_certificate", "s_material_start_statement", "s_material_start_statement"};
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> oldData= jdbcTemplate.queryForMap("select * from " + REPORT[report.getType()] + " where id=" + report.getId() + "");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//查询出当前项目使用的计量模板是否是万盛计量模板
|
|
//查询出当前项目使用的计量模板是否是万盛计量模板
|
|
|
boolean judge = false;
|
|
boolean judge = false;
|
|
|
if(ObjectUtil.isNotEmpty(report.getProjectId())){
|
|
if(ObjectUtil.isNotEmpty(report.getProjectId())){
|
|
@@ -4504,9 +4511,7 @@ public class TaskController extends BladeController {
|
|
|
//去掉表格虚线
|
|
//去掉表格虚线
|
|
|
sheet.setPrintGridlines(false);
|
|
sheet.setPrintGridlines(false);
|
|
|
//设置 整个工作表为一页
|
|
//设置 整个工作表为一页
|
|
|
- if(rs.getName().indexOf("400")>=0){
|
|
|
|
|
- System.out.println("123");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
sheet.setFitToPage(true);
|
|
sheet.setFitToPage(true);
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
workbook.write(out);
|
|
workbook.write(out);
|
|
@@ -4571,6 +4576,9 @@ public class TaskController extends BladeController {
|
|
|
|
|
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(rs.getName() + SnowFlakeUtil.getId() + ".pdf", local);
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(rs.getName() + SnowFlakeUtil.getId() + ".pdf", local);
|
|
|
url = bladeFile.getLink();
|
|
url = bladeFile.getLink();
|
|
|
|
|
+ // 删除原来oss上的pdf
|
|
|
|
|
+ String dataName = local.substring(local.indexOf("/upload"),local.length());
|
|
|
|
|
+ newIOSSClient.removeFile(dataName);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
@@ -4595,6 +4603,14 @@ public class TaskController extends BladeController {
|
|
|
addSignTaskBatch(report);
|
|
addSignTaskBatch(report);
|
|
|
interimPayCertificateService.taskMeterPdfInfo2("",report.getPeriodId()+"",report.getType());
|
|
interimPayCertificateService.taskMeterPdfInfo2("",report.getPeriodId()+"",report.getType());
|
|
|
}
|
|
}
|
|
|
|
|
+ // 删除以前oss文件上非结构文件
|
|
|
|
|
+ if(oldData!=null && Func.isNull(oldData)) {
|
|
|
|
|
+ if (report.getType() == 0) {
|
|
|
|
|
+ System.out.println("1111");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ System.out.println("2222");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return R.data(fileUrl);
|
|
return R.data(fileUrl);
|
|
@@ -4947,9 +4963,10 @@ public class TaskController extends BladeController {
|
|
|
|
|
|
|
|
//由于之前需求每400 进行分割,现在需求需要根据类型+页码 分页
|
|
//由于之前需求每400 进行分割,现在需求需要根据类型+页码 分页
|
|
|
if(this.type==0) {
|
|
if(this.type==0) {
|
|
|
- JSONArray jsonArray = new JSONArray();
|
|
|
|
|
|
|
+ jdbcTemplate.execute("delete from s_interim_task where task_id='"+id+"'");
|
|
|
|
|
+ String addTaskInfoSql = "";
|
|
|
for (Map.Entry<String, String> entry : fileListMap.entrySet()) {
|
|
for (Map.Entry<String, String> entry : fileListMap.entrySet()) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
|
+ long newPkId = SnowFlakeUtil.getId();
|
|
|
String pdfUrl = entry.getValue();
|
|
String pdfUrl = entry.getValue();
|
|
|
String result = commonFileClient.getPdfNum(pdfUrl);
|
|
String result = commonFileClient.getPdfNum(pdfUrl);
|
|
|
Integer pageNum=0;
|
|
Integer pageNum=0;
|
|
@@ -4957,14 +4974,11 @@ public class TaskController extends BladeController {
|
|
|
pageNum= Integer.parseInt(result);
|
|
pageNum= Integer.parseInt(result);
|
|
|
}
|
|
}
|
|
|
if(pageNum<=100){
|
|
if(pageNum<=100){
|
|
|
- jsonObject.put("title",entry.getKey());
|
|
|
|
|
- jsonObject.put("state",0); // 初始化
|
|
|
|
|
- jsonObject.put("url",pdfUrl); //路径
|
|
|
|
|
- jsonArray.add(jsonObject);
|
|
|
|
|
|
|
+ addTaskInfoSql +="insert into s_interim_task(id,task_id,status,pdf_url,pdf_e_url,name) VALUES("+newPkId+","+this.id+",0,'"+pdfUrl+"','','"+entry.getKey()+"');";
|
|
|
}else{
|
|
}else{
|
|
|
Double pdfPageNo = Math.ceil(pageNum / 100.00);
|
|
Double pdfPageNo = Math.ceil(pageNum / 100.00);
|
|
|
for (int i=0;i<pdfPageNo;i++){
|
|
for (int i=0;i<pdfPageNo;i++){
|
|
|
- jsonObject = new JSONObject();
|
|
|
|
|
|
|
+ newPkId = SnowFlakeUtil.getId();
|
|
|
Long id = SnowFlakeUtil.getId();
|
|
Long id = SnowFlakeUtil.getId();
|
|
|
String localPdf = FileUtils.getSysLocalFileUrl() + "/pdf/" + id + ".pdf";
|
|
String localPdf = FileUtils.getSysLocalFileUrl() + "/pdf/" + id + ".pdf";
|
|
|
int pageStart = 0 ;
|
|
int pageStart = 0 ;
|
|
@@ -4980,17 +4994,13 @@ public class TaskController extends BladeController {
|
|
|
if(pdfByPage==0){
|
|
if(pdfByPage==0){
|
|
|
BladeFile bladeFile1 = newIOSSClient.uploadFile( SnowFlakeUtil.get() + ".pdf", localPdf);
|
|
BladeFile bladeFile1 = newIOSSClient.uploadFile( SnowFlakeUtil.get() + ".pdf", localPdf);
|
|
|
String pagePdfUrl=bladeFile1.getLink();
|
|
String pagePdfUrl=bladeFile1.getLink();
|
|
|
- jsonObject.put("title",entry.getKey()+""+(i+1));
|
|
|
|
|
- jsonObject.put("state",0); // 初始化
|
|
|
|
|
- jsonObject.put("url",pagePdfUrl); //路径
|
|
|
|
|
- System.out.println("--"+jsonObject);
|
|
|
|
|
- jsonArray.add(jsonObject);
|
|
|
|
|
|
|
+ String titleName = entry.getKey()+""+(i+1);
|
|
|
|
|
+ addTaskInfoSql +="insert into s_interim_task(id,task_id,status,pdf_url,pdf_e_url,name) VALUES("+newPkId+","+this.id+",0,'"+pagePdfUrl+"','','"+titleName+"');";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- jdbcTemplate.update("update s_interim_pay_certificate set page_pdf_url=? where id=?", JSON.toJSONString(jsonArray), this.id);
|
|
|
|
|
- System.out.println("");
|
|
|
|
|
|
|
+ jdbcTemplate.batchUpdate(addTaskInfoSql);
|
|
|
}
|
|
}
|
|
|
return this.pdfUrl;
|
|
return this.pdfUrl;
|
|
|
}
|
|
}
|
|
@@ -5021,77 +5031,6 @@ public class TaskController extends BladeController {
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- /*if(this.type==0){
|
|
|
|
|
- Map<String,String>pageMap=new HashMap<>();
|
|
|
|
|
- List<String> currentBatch = new ArrayList<>();
|
|
|
|
|
- int currentPageCount = 0;
|
|
|
|
|
-
|
|
|
|
|
- for (Map.Entry<String, String> entry : fileListMap.entrySet()) {
|
|
|
|
|
- String pdfUrl = entry.getValue();
|
|
|
|
|
- String result = commonFileClient.getPdfNum(pdfUrl);
|
|
|
|
|
- Integer pageNum=0;
|
|
|
|
|
- if(StringUtils.isNotEmpty(result)){
|
|
|
|
|
- pageNum= Integer.parseInt(result);
|
|
|
|
|
- }
|
|
|
|
|
- //单份超过400直接加入
|
|
|
|
|
- if(pageNum>400){
|
|
|
|
|
- int sort=pageMap.size()+1;
|
|
|
|
|
- pageMap.put("第"+sort+"份"+pageNum+"页",pdfUrl);
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- //加起来超过400了就把已经存在了的合并了
|
|
|
|
|
- if(currentPageCount+pageNum>400){
|
|
|
|
|
- if (!currentBatch.isEmpty()) {
|
|
|
|
|
- Long id = SnowFlakeUtil.getId();
|
|
|
|
|
- String localPdf = FileUtils.getSysLocalFileUrl() + "/pdf/" + id + ".pdf";
|
|
|
|
|
- FileUtils.mergePdfPublicMethods(currentBatch,localPdf);
|
|
|
|
|
- BladeFile bladeFile1 = newIOSSClient.uploadFile( SnowFlakeUtil.get() + ".pdf", localPdf);
|
|
|
|
|
- int sort=pageMap.size()+1;
|
|
|
|
|
- pageMap.put("第"+sort+"份"+currentPageCount+"页",bladeFile1.getLink());
|
|
|
|
|
- currentBatch = new ArrayList<>();
|
|
|
|
|
- currentPageCount = 0;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- // 添加当前PDF到批次
|
|
|
|
|
- currentBatch.add(pdfUrl);
|
|
|
|
|
- currentPageCount += pageNum;
|
|
|
|
|
- }
|
|
|
|
|
- // 合并最后一批
|
|
|
|
|
- if (!currentBatch.isEmpty()) {
|
|
|
|
|
- String pdfUrl=this.pdfUrl;
|
|
|
|
|
- //如果等于0说明总共没有超过400页,就直接用上面已经合并好了的
|
|
|
|
|
- if(pageMap.size()!=0){
|
|
|
|
|
- Long id = SnowFlakeUtil.getId();
|
|
|
|
|
- String localPdf = FileUtils.getSysLocalFileUrl() + "/pdf/" + id + ".pdf";
|
|
|
|
|
- FileUtils.mergePdfPublicMethods(currentBatch,localPdf);
|
|
|
|
|
- BladeFile bladeFile1 = newIOSSClient.uploadFile( SnowFlakeUtil.get() + ".pdf", localPdf);
|
|
|
|
|
- pdfUrl=bladeFile1.getLink();
|
|
|
|
|
- }
|
|
|
|
|
- int sort=pageMap.size()+1;
|
|
|
|
|
- pageMap.put("第"+sort+"份"+currentPageCount+"页",pdfUrl);
|
|
|
|
|
- }
|
|
|
|
|
- Map<String, String> sortedMap = pageMap.entrySet().stream()
|
|
|
|
|
- // 提取 "第i份" 中的 i 并转为整数排序
|
|
|
|
|
- .sorted(Comparator.comparingInt(
|
|
|
|
|
- entry -> {
|
|
|
|
|
- String key = entry.getKey();
|
|
|
|
|
- // 匹配 "第i份" 中的 i
|
|
|
|
|
- String numStr = key.split("份")[0].replaceAll("[^0-9]", "");
|
|
|
|
|
- return Integer.parseInt(numStr);
|
|
|
|
|
- }
|
|
|
|
|
- ))
|
|
|
|
|
- // 存入 LinkedHashMap 保持顺序
|
|
|
|
|
- .collect(Collectors.toMap(
|
|
|
|
|
- Map.Entry::getKey,
|
|
|
|
|
- Map.Entry::getValue,
|
|
|
|
|
- (oldVal, newVal) -> oldVal,
|
|
|
|
|
- LinkedHashMap::new
|
|
|
|
|
- ));
|
|
|
|
|
- jdbcTemplate.update("update s_interim_pay_certificate set page_pdf_url=? where id=?", JSON.toJSONString(sortedMap), this.id);
|
|
|
|
|
- }
|
|
|
|
|
- return this.pdfUrl;
|
|
|
|
|
- }*/
|
|
|
|
|
-
|
|
|
|
|
public Report(Long id, Integer type) {
|
|
public Report(Long id, Integer type) {
|
|
|
this.id = id;
|
|
this.id = id;
|
|
|
this.type = type;
|
|
this.type = type;
|