|
@@ -18,21 +18,23 @@ package org.springblade.manager.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.StopWatch;
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.mixsmart.utils.ListUtils;
|
|
|
import com.spire.xls.*;
|
|
|
-import io.swagger.models.auth.In;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
-import org.springblade.business.entity.TrialSelfInspectionRecord;
|
|
|
+import org.springblade.business.entity.InformationQuery;
|
|
|
import org.springblade.business.feign.ContractLogClient;
|
|
|
import org.springblade.business.feign.InformationQueryClient;
|
|
|
import org.springblade.business.feign.OperationLogClient;
|
|
@@ -42,6 +44,7 @@ import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
+import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
@@ -51,28 +54,27 @@ import org.springblade.manager.bean.TableInfo;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.formula.KeyMapper;
|
|
|
import org.springblade.manager.formula.impl.TableElementConverter;
|
|
|
+import org.springblade.manager.mapper.ExcelTabMapper;
|
|
|
import org.springblade.manager.service.*;
|
|
|
import org.springblade.manager.utils.FileUtils;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
-import org.springblade.manager.mapper.ExcelTabMapper;
|
|
|
-import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.awt.*;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.FileNotFoundException;
|
|
|
-import java.sql.SQLException;
|
|
|
+import java.io.*;
|
|
|
+import java.net.URL;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -504,6 +506,78 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线excel 编辑回调
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void callbackSave(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
|
+ PrintWriter writer = response.getWriter();
|
|
|
+ String body = "";
|
|
|
+ try {
|
|
|
+ Scanner scanner = new Scanner(request.getInputStream());
|
|
|
+ scanner.useDelimiter("\\A");
|
|
|
+ body = scanner.hasNext() ? scanner.next() : "";
|
|
|
+ scanner.close();
|
|
|
+ } catch (Exception ex) {
|
|
|
+ writer.write("get request.getInputStream error:" + ex.getMessage());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (body.isEmpty()) {
|
|
|
+ writer.write("empty request.getInputStream");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject jsonObj = JSON.parseObject(body);
|
|
|
+ System.out.println("回调参数对象 =====》》》 " + jsonObj);
|
|
|
+ int status = (Integer) jsonObj.get("status");
|
|
|
+ int saved = 0;
|
|
|
+ //status=6,表示点击保存按钮 2 关闭保存
|
|
|
+ if (status == 3 || status == 6) //MustSave, Corrupted
|
|
|
+ {
|
|
|
+ //获取url
|
|
|
+ String downloadUri = (String) jsonObj.get("url");
|
|
|
+ downloadUri = downloadUri.replaceAll("amp;","");
|
|
|
+ try {
|
|
|
+ //获取onlyOffice缓存中的文件流
|
|
|
+ String fileName = request.getParameter("fileName");
|
|
|
+ System.out.println("====下载的文件名:" + fileName);
|
|
|
+ URL url = new URL(downloadUri);
|
|
|
+ java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
|
|
|
+ InputStream stream = connection.getInputStream();
|
|
|
+ if (stream == null) {
|
|
|
+ throw new Exception("Stream is null");
|
|
|
+ }
|
|
|
+ Long tabId = jsonObj.getLong("key");
|
|
|
+ if (tabId == null) {
|
|
|
+ throw new Exception("key不能为空");
|
|
|
+ }
|
|
|
+ //获取数据库信息
|
|
|
+ ExcelTab excelTab = baseMapper.selectById(tabId);
|
|
|
+
|
|
|
+ //上传新文件到文件服务器
|
|
|
+ byte[] officeByte = IoUtil.readToByteArray(stream);
|
|
|
+ BladeFile bladeFile = newIOSSClient.updateFile(officeByte, excelTab.getName());
|
|
|
+
|
|
|
+ //修改本地数据信息
|
|
|
+ excelTab.setHtmlUrl(bladeFile.getLink());
|
|
|
+ //获取文件大小
|
|
|
+ int size= connection.getContentLength()/1024/1024; //单位M
|
|
|
+ excelTab.setAttachSize(Long.parseLong(size+""));
|
|
|
+ baseMapper.updateById(excelTab);
|
|
|
+ connection.disconnect();
|
|
|
+ //根据文件编号删除文件服务器的文件
|
|
|
+
|
|
|
+ } catch (Exception ex) {
|
|
|
+ saved = 1;
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ writer.write("{\"error\":" + saved + "}");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 保存首件
|
|
|
*/
|
|
@@ -823,7 +897,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
// 时间段处理
|
|
|
if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
|
|
|
if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
|
|
|
- String tabData[] = tabVal.split("_\\^_");
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
|
|
|
if (reData.containsKey("pickerKey")) {
|
|
|
String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
|
|
@@ -834,9 +908,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
String sql = tabData[0];
|
|
|
sql = sql.replaceAll("\\[", "['");
|
|
|
- sql = sql.replaceAll("]", "\']");
|
|
|
- sql = sql.replaceAll("000Z,", "000Z\',");
|
|
|
- sql = sql.replaceAll(", 20", ", \'20");
|
|
|
+ sql = sql.replaceAll("]", "']");
|
|
|
+ sql = sql.replaceAll("000Z,", "000Z',");
|
|
|
+ sql = sql.replaceAll(", 20", ", '20");
|
|
|
// sql = sql.replaceAll("'", "");
|
|
|
if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
reData.put(key + "__" + tabData[1], sql);
|
|
@@ -844,29 +918,29 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
} else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) { //时间
|
|
|
// 时间和字符串合作
|
|
|
if (tabVal.indexOf("☆") >= 0) {
|
|
|
- String mysql[] = tabVal.split("☆");
|
|
|
+ String[] mysql = tabVal.split("☆");
|
|
|
for (String data : mysql) {
|
|
|
- String tabData[] = data.split("_\\^_");
|
|
|
+ String[] tabData = data.split("_\\^_");
|
|
|
if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- String tabData[] = tabVal.split("_\\^_");
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
}
|
|
|
}
|
|
|
} else if (tabVal.indexOf("☆") >= 0) {
|
|
|
- String mysql[] = tabVal.split("☆");
|
|
|
+ String[] mysql = tabVal.split("☆");
|
|
|
for (String data : mysql) {
|
|
|
- String tabData[] = data.split("_\\^_");
|
|
|
+ String[] tabData = data.split("_\\^_");
|
|
|
if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
}
|
|
|
}
|
|
|
} else if (tabVal.indexOf("_^_") >= 0) {
|
|
|
- String tabData[] = tabVal.split("_\\^_");
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
}
|
|
@@ -964,7 +1038,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (ObjectUtil.isNotEmpty(DataInfo)) {
|
|
|
for (String val : DataInfo.keySet()) {
|
|
|
if (val.indexOf("__") >= 0) {
|
|
|
- String DataVal[] = val.split("__");
|
|
|
+ String[] DataVal = val.split("__");
|
|
|
String[] xy = DataVal[1].split("_");
|
|
|
|
|
|
Element data = trs.get(Integer.parseInt(xy[0])).select("td").get(Integer.parseInt(xy[1]));
|
|
@@ -1003,8 +1077,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
myData = StartDate + "-" + endDate;
|
|
|
}
|
|
|
} else {
|
|
|
- String dataStr[] = myData.split("T")[0].split("-");
|
|
|
- myData = StringUtil.format("{}年{}月{}日", new Object[]{dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1});
|
|
|
+ String[] dataStr = myData.split("T")[0].split("-");
|
|
|
+ myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1);
|
|
|
}
|
|
|
}
|
|
|
//https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
|
|
@@ -1021,7 +1095,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
String dataInfo = trs.get(y1).attr("height");
|
|
|
if (StringUtils.isEmpty(dataInfo)) {
|
|
|
Element firstTd = trs.get(y1 - 1).children().get(0);
|
|
|
- String heg[] = firstTd.attr("style").split(";");
|
|
|
+ String[] heg = firstTd.attr("style").split(";");
|
|
|
for (String str : heg) {
|
|
|
if (str.indexOf("height:") >= 0) {
|
|
|
picHeight = Integer.parseInt(str.split(":")[1].replaceAll("px", ""));
|
|
@@ -1061,7 +1135,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
cellRange.getCellStyle().getExcelFont().setFontName("EUDC");
|
|
|
cellRange.setText(myData);
|
|
|
System.out.println(cellRange.getStyle().getFont().getFontName());
|
|
|
- ;
|
|
|
System.out.println("后" + cellRange.getText());
|
|
|
}
|
|
|
}
|
|
@@ -1078,7 +1151,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (textdictInfos != null && !textdictInfos.isEmpty()) {
|
|
|
for (TextdictInfo e : textdictInfos) {
|
|
|
String key = e.getColKey();
|
|
|
- String keys[] = key.split("__");
|
|
|
+ String[] keys = key.split("__");
|
|
|
String[] trtd = keys[1].split("_");
|
|
|
Element data = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
|
|
|
int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
@@ -1092,7 +1165,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
cellRange.getCellStyle().getFont().setColor(Color.white);
|
|
|
|
|
|
}
|
|
|
- ;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1233,9 +1305,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
String sql = tabData[0];
|
|
|
sql = sql.replaceAll("\\[", "['");
|
|
|
- sql = sql.replaceAll("]", "\']");
|
|
|
- sql = sql.replaceAll("000Z,", "000Z\',");
|
|
|
- sql = sql.replaceAll(", 20", ", \'20");
|
|
|
+ sql = sql.replaceAll("]", "']");
|
|
|
+ sql = sql.replaceAll("000Z,", "000Z',");
|
|
|
+ sql = sql.replaceAll(", 20", ", '20");
|
|
|
// sql = sql.replaceAll("'", "");
|
|
|
if (StringUtils.isNotEmpty(tabData[0])) {
|
|
|
reData.put(key + "__" + tabData[1], sql);
|
|
@@ -1305,7 +1377,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
* 试验 单pdf
|
|
|
*/
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
public String getBussPDFTrial(Long pkeyId, String contractId, Long id) throws Exception {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
@@ -1494,7 +1565,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
FileUtils.excelToPdf(excelPath, pdfPath);
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
|
TableFile tableFile1 = tableFileService.getBaseMapper().selectOne(Wrappers.<TableFile>query().lambda()
|
|
|
- .eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1));
|
|
|
+ .eq(TableFile::getTabId, pkeyId + "")
|
|
|
+ .eq(TableFile::getType, 1)
|
|
|
+ .eq(TableFile::getTrialRecordId, id));
|
|
|
+
|
|
|
if (tableFile1 != null) {
|
|
|
tableFile1.setDomainPdfUrl(bladeFile.getLink());
|
|
|
tableFileService.saveOrUpdate(tableFile1);
|
|
@@ -1508,58 +1582,70 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
tableFile.setIsDeleted(0);
|
|
|
tableFile.setExtension(fileExtension);
|
|
|
tableFile.setDomainPdfUrl(bladeFile.getLink());
|
|
|
+
|
|
|
+ tableFile.setTrialRecordId(id);
|
|
|
+
|
|
|
tableFileService.saveOrUpdate(tableFile);
|
|
|
}
|
|
|
|
|
|
- List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getIsDeleted, 0));
|
|
|
- tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
|
+ //获取当前试验记录的中的元素表的附件文件
|
|
|
+ List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda()
|
|
|
+ .eq(TableFile::getTabId, pkeyId + "")
|
|
|
+ .eq(TableFile::getTrialRecordId, id)
|
|
|
+ );
|
|
|
|
|
|
- List<String> dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl() != null && (tableFile.getType() == 1 || tableFile.getType() == 2)).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
+ if (tableFileList.size() > 0) {
|
|
|
|
|
|
- String pdfPath2 = file_path + "/pdf//" + pkeyId + "_2.pdf";
|
|
|
+ tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
|
|
|
|
- File tabPdf2 = ResourceUtil.getFile(pdfPath2);
|
|
|
- if (tabPdf2.exists()) {
|
|
|
- tabPdf2.delete();
|
|
|
- }
|
|
|
- FileUtils.mergePdfPublicMethods(dataListPdf, pdfPath2);
|
|
|
+ List<String> dataListPdf = tableFileList.stream().filter(tableFile ->
|
|
|
+ tableFile.getDomainPdfUrl() != null
|
|
|
+ && (tableFile.getType() == 1 || tableFile.getType() == 2)
|
|
|
+ ).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
- BladeFile bladeFile2 = newIOSSClient.uploadFile(pkeyId + "2.pdf", pdfPath2);
|
|
|
+ String pdfPath2 = file_path + "/pdf//" + pkeyId + "_2.pdf";
|
|
|
|
|
|
- UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.in("p_key_id", pkeyId + "");
|
|
|
- updateWrapper.set("pdf_url", bladeFile2.getLink());
|
|
|
- wbsTreePrivateService.update(updateWrapper);
|
|
|
- wb.dispose();
|
|
|
- return bladeFile2.getLink();
|
|
|
+ File tabPdf2 = ResourceUtil.getFile(pdfPath2);
|
|
|
+ if (tabPdf2.exists()) {
|
|
|
+ tabPdf2.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(dataListPdf, pdfPath2);
|
|
|
+
|
|
|
+ BladeFile bladeFile2 = newIOSSClient.uploadFile(pkeyId + "2.pdf", pdfPath2);
|
|
|
+
|
|
|
+ //删除关系
|
|
|
+ String delSql = "delete from u_trial_self_data_record where record_id = " + id + " and tab_id = " + pkeyId;
|
|
|
+ jdbcTemplate.execute(delSql);
|
|
|
+
|
|
|
+ //新增关系
|
|
|
+ String sql = "insert into u_trial_self_data_record(id,record_id,tab_id,is_buss_show,is_tab_pdf,is_tab_file_type,pdf_url) values" +
|
|
|
+ "(" + SnowFlakeUtil.getId() + "," + id + "," + pkeyId + "," + 1 + "," + 2 + "," + 1 + ",'" + bladeFile2.getLink() + "')";
|
|
|
+ jdbcTemplate.execute(sql);
|
|
|
+
|
|
|
+ wb.dispose();
|
|
|
+ return bladeFile2.getLink();
|
|
|
+ }
|
|
|
+
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 试验 多pdf
|
|
|
*/
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public String getBussPDFSTrial(String nodeId, Integer tableType, String classify, String contractId, String projectId, Long id) throws Exception {
|
|
|
+ public String getBussPDFSTrial(String nodeId, Integer tableType, String classify, String contractId, String projectId, Long id, String tabIds) throws Exception {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
//获取有权限的节点信息
|
|
|
- List<WbsTreePrivate> wbsTreePrivateList = wbsTreePrivateService.searchNodeAllTable(nodeId, classify, String.valueOf(tableType), contractId, projectId);
|
|
|
-
|
|
|
- List<String> data = new ArrayList<>();
|
|
|
- if (wbsTreePrivateList != null && wbsTreePrivateList.size() >= 1) {
|
|
|
- for (WbsTreePrivate wbsInfo : wbsTreePrivateList) {
|
|
|
- //隐藏的不生成pdf
|
|
|
- if (wbsInfo.getIsBussShow() == null || wbsInfo.getIsBussShow() != 2) { //
|
|
|
- /*if (StringUtils.isNotEmpty(wbsInfo.getPdfUrl())) {
|
|
|
- data.add(wbsInfo.getPdfUrl());
|
|
|
- } else {*/
|
|
|
-
|
|
|
- //重新生成pdf
|
|
|
- String bussPdfInfo = this.getBussPDFTrial(wbsInfo.getPKeyId(), contractId, id);
|
|
|
- if (StringUtils.isNotEmpty(bussPdfInfo)) {
|
|
|
- data.add(bussPdfInfo);
|
|
|
- }
|
|
|
- //}
|
|
|
-
|
|
|
+ String sql = "select * from m_wbs_tree_private where is_deleted = 0 and p_key_id in (" + tabIds + ")";
|
|
|
+ List<WbsTreePrivate> queryList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
+
|
|
|
+ List<String> dataPdfUrls = new ArrayList<>();
|
|
|
+ if (queryList.size() > 0) {
|
|
|
+ for (WbsTreePrivate record : queryList) {
|
|
|
+ //生成pdf
|
|
|
+ String bussPdfInfo = this.getBussPDFTrial(record.getPKeyId(), contractId, id);
|
|
|
+ if (StringUtils.isNotEmpty(bussPdfInfo)) {
|
|
|
+ dataPdfUrls.add(bussPdfInfo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1569,22 +1655,22 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (tabPdf2.exists()) {
|
|
|
tabPdf2.delete();
|
|
|
}
|
|
|
- FileUtils.mergePdfPublicMethods(data, listPdf);
|
|
|
+ FileUtils.mergePdfPublicMethods(dataPdfUrls, listPdf);
|
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId + ".pdf", listPdf);
|
|
|
|
|
|
//获取试验记录id的试验项目名称
|
|
|
String trialProjectName = baseMapper.selectTrialRecordOne(id);
|
|
|
|
|
|
//合并PDF集合
|
|
|
- String querySql = "select * from u_information_query where classify='" + classify + "' and wbs_id='" + id + "' and contract_id ='" + contractId + "'";
|
|
|
- List<Map<String, Object>> resultSQL = jdbcTemplate.queryForList(querySql);
|
|
|
- if (resultSQL.size() > 0) {
|
|
|
- String updateSql = "update u_information_query set pdf_url = '" + bladeFile.getLink() + "', name = '" + trialProjectName + "' where classify='" + classify + "' and wbs_id='" + id + "' and contract_id ='" + contractId + "'";
|
|
|
+ String querySql = "select * from u_information_query where classify ='" + classify + "' and wbs_id ='" + id + "' and contract_id ='" + contractId + "'";
|
|
|
+ List<InformationQuery> query = jdbcTemplate.query(querySql, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
+ if (query.size() > 0) {
|
|
|
+ String updateSql = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "', name ='" + trialProjectName + "' where classify='" + classify + "' and wbs_id='" + id + "' and contract_id ='" + contractId + "'";
|
|
|
jdbcTemplate.execute(updateSql);
|
|
|
- //informationQueryClient.updateInformationQuery(bladeFile.getLink(), classify, id.toString(), contractId);
|
|
|
} else {
|
|
|
informationQueryClient.saveData(id.toString(), projectId, contractId, classify, bladeFile.getLink(), trialProjectName);
|
|
|
}
|
|
|
+
|
|
|
return bladeFile.getLink();
|
|
|
}
|
|
|
|
|
@@ -1592,8 +1678,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
* 试验 保存修改信息
|
|
|
*/
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
- public void saveOrUpdateInfoTrial(List<TableInfo> tableInfoList, Long groupId) throws SQLException {
|
|
|
+ public void saveOrUpdateInfoTrial(List<TableInfo> tableInfoList, Long groupId) {
|
|
|
//试验填报
|
|
|
if (ListUtils.isNotEmpty(tableInfoList)) {
|
|
|
try {
|
|
@@ -1605,8 +1690,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
String tabName = wbsTreePrivate.getInitTableName();
|
|
|
- // 判读修改还是 添加
|
|
|
- String delSql = "delete from " + tabName + " where p_key_id=" + tableInfo.getPkeyId() + " and group_id = " + groupId;
|
|
|
+ //判读修改还是添加
|
|
|
+ String delSql = "delete from " + tabName + " where p_key_id='" + tableInfo.getPkeyId() + "' and group_id = '" + groupId + "'";
|
|
|
jdbcTemplate.execute(delSql);
|
|
|
|
|
|
String sqlInfo = "";
|
|
@@ -1622,13 +1707,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
valStr = valStr.substring(0, valStr.lastIndexOf(","));
|
|
|
sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
|
|
|
|
|
|
- UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.in("p_key_id", tableInfo.getPkeyId());
|
|
|
- updateWrapper.set("is_tab_pdf", 2);
|
|
|
- wbsTreePrivateService.update(updateWrapper);
|
|
|
jdbcTemplate.execute(sqlInfo);
|
|
|
}
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|