|
@@ -24,6 +24,7 @@ import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
+import org.springblade.business.entity.ContractLog;
|
|
|
import org.springblade.business.feign.ContractLogClient;
|
|
|
import org.springblade.business.feign.InformationQueryClient;
|
|
|
import org.springblade.business.vo.SaveContractLogVO;
|
|
@@ -48,6 +49,7 @@ import org.springblade.manager.enums.ExecuteType;
|
|
|
import org.springblade.manager.mapper.ExcelTabMapper;
|
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
import org.springblade.manager.service.*;
|
|
|
+import org.springblade.manager.service.impl.WbsTreeContractServiceImpl;
|
|
|
import org.springblade.manager.utils.ExcelInfoUtils;
|
|
|
import org.springblade.manager.utils.FileUtils;
|
|
|
import org.springblade.manager.utils.RegularExpressionUtil;
|
|
@@ -109,6 +111,8 @@ public class ExcelTabController extends BladeController {
|
|
|
// 元素信息表-
|
|
|
private final IWbsTreeContractService wbsTreeContractService;
|
|
|
|
|
|
+ private final WbsTreeContractServiceImpl wbsTreeContractServiceImpl;
|
|
|
+
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
@@ -297,7 +301,7 @@ public class ExcelTabController extends BladeController {
|
|
|
String exceUrl = file_path + filecode + "123.xlsx";
|
|
|
//ExcelInfoUtils.excelInfo(file.getInputStream(),exceUrl,thmlUrl,"1");
|
|
|
// 上传excel文件
|
|
|
- // BladeFile bladeFile = newIOSSClient.uploadFile(file.getOriginalFilename(),exceUrl);
|
|
|
+ // BladeFile bladeFile = newIOSSClient.uploadFile(file.getOriginalFilename(),exceUrl);
|
|
|
// 解析原始excel
|
|
|
Workbook wb = new Workbook();
|
|
|
wb.loadFromMHtml(file.getInputStream());
|
|
@@ -797,7 +801,7 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
|
})
|
|
|
- public R getExcelHtmlTwo(Long pkeyId) throws IOException, InterruptedException {
|
|
|
+ public R getExcelHtmlTwo(Long pkeyId) throws Exception {
|
|
|
|
|
|
Thread.sleep(200);
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(pkeyId);
|
|
@@ -808,10 +812,16 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.fail("请上传清表!");
|
|
|
}
|
|
|
|
|
|
- File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
-// File file1 = ResourceUtil.getFile("D:\\develop\\1633344465559093248.html");
|
|
|
+ String htmlString = this.getHtmlString(pkeyId.toString());
|
|
|
+ if (StringUtils.isEmpty(htmlString)) {
|
|
|
+ return R.fail("未获取到表单信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ /*File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
+ File file1 = ResourceUtil.getFile("D:\\develop\\1633344465559093248.html");
|
|
|
FileInputStream fileInputStream = new FileInputStream(file1);
|
|
|
- String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);*/
|
|
|
+
|
|
|
// 解析 style
|
|
|
htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
htmlString = htmlString.replaceAll("title", "titlexx");
|
|
@@ -819,7 +829,9 @@ public class ExcelTabController extends BladeController {
|
|
|
// 远程搜索配置
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
Element table = doc.select("table").first();
|
|
|
- Elements col = doc.select("Col");
|
|
|
+
|
|
|
+ //Elements col = doc.select("Col");
|
|
|
+
|
|
|
doc.select("Col").remove();
|
|
|
ProjectInfo projectInfo = projectInfoService.getById(wbsTreePrivate.getProjectId());
|
|
|
// 添加标题显示
|
|
@@ -829,9 +841,9 @@ public class ExcelTabController extends BladeController {
|
|
|
Elements tds = tr.select("td");
|
|
|
for (int j = 0; j < tds.size(); j++) {
|
|
|
Element data = tds.get(j);
|
|
|
- int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
+ //int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
String style = data.attr("style");
|
|
|
- if (style.indexOf("font-size") >= 0) {
|
|
|
+ if (style.contains("font-size")) {
|
|
|
int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
|
|
|
if (StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
|
|
|
trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
|
|
@@ -840,10 +852,35 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- fileInputStream.close();
|
|
|
+
|
|
|
+ //fileInputStream.close();
|
|
|
+
|
|
|
return R.data(table + "");
|
|
|
}
|
|
|
|
|
|
+ private String getHtmlString(String pkeyId) throws Exception {
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
|
|
|
+ .select(WbsTreePrivate::getHtmlUrl)
|
|
|
+ .eq(WbsTreePrivate::getPKeyId, pkeyId));
|
|
|
+ if (wbsTreePrivate == null || wbsTreePrivate.getHtmlUrl() == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ String fileUrl = wbsTreePrivate.getHtmlUrl();
|
|
|
+ File file1 = ResourceUtil.getFile(fileUrl);
|
|
|
+ InputStream fileInputStream;
|
|
|
+ if (file1.exists()) {
|
|
|
+ fileInputStream = new FileInputStream(file1);
|
|
|
+ } else {
|
|
|
+ String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
|
|
|
+ fileInputStream = CommonUtil.getOSSInputStream(path);
|
|
|
+ }
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
+ htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ return doc.select("table").first() + "";
|
|
|
+ }
|
|
|
|
|
|
// 上传解析 html
|
|
|
public void expailHtmlInfo12231(String thmlUrl, Long excelId) throws Exception {
|
|
@@ -904,12 +941,15 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
// 计算
|
|
|
int x1 = Integer.parseInt(data.attr("x1"));
|
|
|
- int x2 = Integer.parseInt(data.attr("x2"));;
|
|
|
- int y1 = Integer.parseInt(data.attr("y1"));;
|
|
|
- int y2 = Integer.parseInt(data.attr("y2"));;
|
|
|
+ int x2 = Integer.parseInt(data.attr("x2"));
|
|
|
+ ;
|
|
|
+ int y1 = Integer.parseInt(data.attr("y1"));
|
|
|
+ ;
|
|
|
+ int y2 = Integer.parseInt(data.attr("y2"));
|
|
|
+ ;
|
|
|
|
|
|
String textInfo = data.text().trim().replaceAll(" ", "");
|
|
|
- System.out.println("-------=="+textInfo);
|
|
|
+ System.out.println("-------==" + textInfo);
|
|
|
|
|
|
data.text(textInfo.replaceAll(" ", ""));
|
|
|
if (textInfo.indexOf("□") < 0 && !textInfo.isEmpty() && !(textInfo.equals("/") && textInfo.length() < 2) && !(textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) && !textInfo.equals("—") && !textInfo.equals("-")) { // 标题区域
|
|
@@ -1120,7 +1160,7 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
//对excel 的图片进行操作
|
|
|
ExcelTab exceltab = excelTabService.getById(excelId);
|
|
|
- if(exceltab!=null){
|
|
|
+ if (exceltab != null) {
|
|
|
// 获取excle 的数据
|
|
|
String fileUrl = exceltab.getFileUrl();
|
|
|
InputStream ossInputStream = CommonUtil.getOSSInputStream(fileUrl);
|
|
@@ -1128,14 +1168,14 @@ public class ExcelTabController extends BladeController {
|
|
|
wb.loadFromMHtml(ossInputStream);
|
|
|
Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
PicturesCollection pictures = sheet.getPictures();
|
|
|
- if(pictures!=null && pictures.size()>=1){
|
|
|
- for (int i=0 ; i<pictures.size() ; i++){
|
|
|
+ if (pictures != null && pictures.size() >= 1) {
|
|
|
+ for (int i = 0; i < pictures.size(); i++) {
|
|
|
ExcelPicture pic = pictures.get(i);
|
|
|
int x = pic.getLeftColumn();
|
|
|
int y = pic.getBottomRow();
|
|
|
Elements select = doc.select("el-input[x1=" + x + "][y1=" + y + "]");
|
|
|
|
|
|
- if(select!=null && select.size()>=1){
|
|
|
+ if (select != null && select.size() >= 1) {
|
|
|
Element element = select.get(0);
|
|
|
Element elementP = element.parent();
|
|
|
element.remove();
|
|
@@ -1218,10 +1258,10 @@ public class ExcelTabController extends BladeController {
|
|
|
Boolean isText = false;
|
|
|
//判断高度
|
|
|
String style = data.attr("style");
|
|
|
- if (StringUtils.isNotBlank(style)){
|
|
|
+ if (StringUtils.isNotBlank(style)) {
|
|
|
String substring = style.substring(style.lastIndexOf(":") + 1);
|
|
|
String height = substring.substring(0, substring.length() - 3);
|
|
|
- if (Integer.parseInt(height) > 90){
|
|
|
+ if (Integer.parseInt(height) > 90) {
|
|
|
isText = true;
|
|
|
}
|
|
|
}
|
|
@@ -2174,210 +2214,191 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiOperationSupport(order = 25)
|
|
|
@ApiOperation(value = "日志预览")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "theLogId", value = "日志记录的id,可能为空"),
|
|
|
@ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志类型ID,即左侧列表的节点primaryKeyId"),
|
|
|
+ @ApiImplicitParam(name = "String pkeyId", value = "当前表pKeyId"),
|
|
|
@ApiImplicitParam(name = "recordTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd")
|
|
|
})
|
|
|
- public R<String> getTheLogPdInfo(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId) throws Exception {
|
|
|
+ public R<String> getTheLogPdInfo(String pkeyId, String nodePrimaryKeyId, String recordTime, String contractId) throws Exception {
|
|
|
//获取配置的路径
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
-
|
|
|
- //获取对应的日志
|
|
|
- JSONObject theLogJson;
|
|
|
- if (StringUtils.isNotEmpty(theLogId)) {
|
|
|
- theLogJson = this.contractLogClient.queryContractLogById(theLogId);
|
|
|
- } else {
|
|
|
- if (StringUtils.isEmpty(recordTime)) {
|
|
|
- recordTime = DateUtil.format(DateUtil.now(), "yyyy-MM-dd");
|
|
|
- }
|
|
|
- theLogJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(nodePrimaryKeyId, recordTime, contractId);
|
|
|
+ if (StringUtils.isEmpty(recordTime)) {
|
|
|
+ recordTime = DateUtil.format(DateUtil.now(), "yyyy-MM-dd");
|
|
|
}
|
|
|
+ List<ContractLog> contractLogList = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTimeList(nodePrimaryKeyId, recordTime, contractId);
|
|
|
+ List<String> ids = contractLogList.stream().map(ContractLog::getId).map(String::valueOf).collect(Collectors.toList());
|
|
|
+ if (ids.size() > 0) {
|
|
|
+ //PDF路径
|
|
|
+ List<String> pdfUrls = new ArrayList<>();
|
|
|
+ for (String dataId : ids) {
|
|
|
+ //查询对应的html
|
|
|
+ WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, pkeyId));
|
|
|
|
|
|
- if (theLogJson != null) {
|
|
|
-// String evPdf = theLogJson.getString("eVisaPdfUrl");
|
|
|
-// if(StringUtils.isNotEmpty(evPdf)){
|
|
|
-// return R.data(evPdf);
|
|
|
-// }
|
|
|
-
|
|
|
- theLogId = theLogJson.getString("id");
|
|
|
- //查询对应的html
|
|
|
- WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, theLogJson.getString("tableId")));
|
|
|
+ if (tableNode == null) {
|
|
|
+ return R.fail("该数据下无此节点!");
|
|
|
+ }
|
|
|
|
|
|
- if (tableNode == null) {
|
|
|
- return R.fail("该数据下无此节点!");
|
|
|
- }
|
|
|
+ String htmlString = this.getHtmlString(pkeyId);
|
|
|
|
|
|
- if (StringUtils.isEmpty(tableNode.getHtmlUrl())) {
|
|
|
- return R.fail("请关联清表!");
|
|
|
- }
|
|
|
+ if (StringUtils.isEmpty(tableNode.getHtmlUrl()) || StringUtils.isEmpty(htmlString)) {
|
|
|
+ return R.fail("未获取到元素表信息!");
|
|
|
+ }
|
|
|
|
|
|
- // 获取清表信息
|
|
|
- ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
|
|
|
- if (excelTab == null) {
|
|
|
- return R.fail("失败");
|
|
|
- }
|
|
|
+ // 获取清表信息
|
|
|
+ ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
|
|
|
+ if (excelTab == null) {
|
|
|
+ return R.fail("失败");
|
|
|
+ }
|
|
|
|
|
|
- //获取数据
|
|
|
- List<Map<String, Object>> businessDataMapList = this.getTheLogBusinessData(theLogId, nodePrimaryKeyId, recordTime, contractId).getData();
|
|
|
- //PDF路径
|
|
|
- List<String> pdfUrls = new ArrayList<>();
|
|
|
- ProjectInfo projectInfo = projectInfoService.getById(tableNode.getProjectId());
|
|
|
- //处理数据
|
|
|
- for (Map<String, Object> dataMap : businessDataMapList) {
|
|
|
- // 获取excel流 和 html流
|
|
|
- Workbook wb = new Workbook();
|
|
|
- wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
|
|
|
- //获取工作表
|
|
|
- Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
- // 数据不为空 &&
|
|
|
- if (StringUtils.isNotEmpty(tableNode.getHtmlUrl())) {
|
|
|
- File htmlFile = ResourceUtil.getFile(tableNode.getHtmlUrl());
|
|
|
-// File htmlFile = ResourceUtil.getFile("D:\\develop\\1633344465559093248.html");
|
|
|
- if (htmlFile.exists()) {
|
|
|
- String htmlString = IoUtil.readToString(new FileInputStream(htmlFile));
|
|
|
- Document doc = Jsoup.parse(htmlString);
|
|
|
- Element table = doc.select("table").first();
|
|
|
- Elements trs = table.select("tr");
|
|
|
- //添加标题
|
|
|
- CellRange[] columns = sheet.getMergedCells();
|
|
|
- for (int i = 0; i < columns.length; i++) {
|
|
|
- CellRange cellRange = columns[i];
|
|
|
- System.out.println(cellRange.getStyle().getFont().getSize());
|
|
|
- if (cellRange.getStyle().getFont().getSize() >= 12) {
|
|
|
- String title = projectInfo.getProjectName();
|
|
|
- if (title.length() >= 30) {
|
|
|
- cellRange.setRowHeight(40);
|
|
|
- cellRange.getStyle().setWrapText(true);
|
|
|
- }
|
|
|
- cellRange.getStyle().getFont().setSize(18);
|
|
|
- cellRange.getStyle().setHorizontalAlignment(HorizontalAlignType.Center);
|
|
|
- cellRange.setText(projectInfo.getProjectName());
|
|
|
- break;
|
|
|
+ //获取数据
|
|
|
+ List<Map<String, Object>> businessDataMapList = this.getTheLogBusinessData(dataId, nodePrimaryKeyId, recordTime, contractId).getData();
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(tableNode.getProjectId());
|
|
|
+ //处理数据
|
|
|
+ for (Map<String, Object> dataMap : businessDataMapList) {
|
|
|
+ // 获取excel流 和 html流
|
|
|
+ Workbook wb = new Workbook();
|
|
|
+ wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
|
|
|
+ //获取工作表
|
|
|
+ Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+ Element table = doc.select("table").first();
|
|
|
+ Elements trs = table.select("tr");
|
|
|
+ //添加标题
|
|
|
+ CellRange[] columns = sheet.getMergedCells();
|
|
|
+ for (int i = 0; i < columns.length; i++) {
|
|
|
+ CellRange cellRange = columns[i];
|
|
|
+ System.out.println(cellRange.getStyle().getFont().getSize());
|
|
|
+ if (cellRange.getStyle().getFont().getSize() >= 12) {
|
|
|
+ String title = projectInfo.getProjectName();
|
|
|
+ if (title.length() >= 30) {
|
|
|
+ cellRange.setRowHeight(40);
|
|
|
+ cellRange.getStyle().setWrapText(true);
|
|
|
}
|
|
|
+ cellRange.getStyle().getFont().setSize(18);
|
|
|
+ cellRange.getStyle().setHorizontalAlignment(HorizontalAlignType.Center);
|
|
|
+ cellRange.setText(projectInfo.getProjectName());
|
|
|
+ break;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(dataMap)) {
|
|
|
- for (String val : dataMap.keySet()) {
|
|
|
- if (val.indexOf("__") >= 0) {
|
|
|
- String[] DataVal = val.split("__");
|
|
|
- String[] xy = DataVal[1].split("_");
|
|
|
- if (trs.size() > Integer.parseInt(xy[0])) {
|
|
|
- Element trData = trs.get(Integer.parseInt(xy[0]));
|
|
|
- Elements tdDatas = trData.select("td");
|
|
|
- if (tdDatas.size() > Integer.parseInt(xy[1])) {
|
|
|
- Element data = tdDatas.get(Integer.parseInt(xy[1]));
|
|
|
-
|
|
|
- if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 0) {
|
|
|
- int x1, y1;
|
|
|
-
|
|
|
- if (data.html().indexOf("el-tooltip") >= 0) {
|
|
|
- x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
|
|
|
- y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
|
|
|
- } else {
|
|
|
- x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
|
- y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
- }
|
|
|
- if (x1 == 0) {
|
|
|
- x1 = 1;
|
|
|
- }
|
|
|
- String myData = dataMap.get(val) + "";
|
|
|
- if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
|
|
|
- if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
|
|
|
- myData = myData.replace("[", "").replace("]", "");
|
|
|
- String[] dataVal = myData.split(",");
|
|
|
- String[] Start_dataStr = dataVal[0].split("T")[0].split("-");
|
|
|
- String StartDate = StringUtil.format("{}年{}月{}日", Start_dataStr[0], Start_dataStr[1], Integer.parseInt(Start_dataStr[2]) + 1);
|
|
|
-
|
|
|
- String[] end_dataStr = dataVal[1].split("T")[0].split("-");
|
|
|
- String endDate = StringUtil.format("{}年{}月{}日", end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1);
|
|
|
-
|
|
|
- if (StartDate.equals(endDate)) {
|
|
|
- myData = StartDate;
|
|
|
- } else {
|
|
|
- myData = StartDate + "-" + endDate;
|
|
|
- }
|
|
|
+ if (ObjectUtil.isNotEmpty(dataMap)) {
|
|
|
+ for (String val : dataMap.keySet()) {
|
|
|
+ if (val.indexOf("__") >= 0) {
|
|
|
+ String[] DataVal = val.split("__");
|
|
|
+ String[] xy = DataVal[1].split("_");
|
|
|
+ if (trs.size() > Integer.parseInt(xy[0])) {
|
|
|
+ Element trData = trs.get(Integer.parseInt(xy[0]));
|
|
|
+ Elements tdDatas = trData.select("td");
|
|
|
+ if (tdDatas.size() > Integer.parseInt(xy[1])) {
|
|
|
+ Element data = tdDatas.get(Integer.parseInt(xy[1]));
|
|
|
+
|
|
|
+ if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 0) {
|
|
|
+ int x1, y1;
|
|
|
+
|
|
|
+ if (data.html().indexOf("el-tooltip") >= 0) {
|
|
|
+ x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
|
|
|
+ y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
|
|
|
+ } else {
|
|
|
+ x1 = Integer.parseInt(data.children().get(0).attr("x1"));
|
|
|
+ y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
+ }
|
|
|
+ if (x1 == 0) {
|
|
|
+ x1 = 1;
|
|
|
+ }
|
|
|
+ String myData = dataMap.get(val) + "";
|
|
|
+ if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
|
|
|
+ if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
|
|
|
+ myData = myData.replace("[", "").replace("]", "");
|
|
|
+ String[] dataVal = myData.split(",");
|
|
|
+ String[] Start_dataStr = dataVal[0].split("T")[0].split("-");
|
|
|
+ String StartDate = StringUtil.format("{}年{}月{}日", Start_dataStr[0], Start_dataStr[1], Integer.parseInt(Start_dataStr[2]) + 1);
|
|
|
+
|
|
|
+ String[] end_dataStr = dataVal[1].split("T")[0].split("-");
|
|
|
+ String endDate = StringUtil.format("{}年{}月{}日", end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1);
|
|
|
+
|
|
|
+ if (StartDate.equals(endDate)) {
|
|
|
+ myData = StartDate;
|
|
|
} else {
|
|
|
- String[] dataStr = myData.split("T")[0].split("-");
|
|
|
- myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
|
|
|
+ myData = StartDate + "-" + endDate;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ String[] dataStr = myData.split("T")[0].split("-");
|
|
|
+ myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- if (myData.indexOf("https") >= 0 && myData.indexOf("aliyuncs") >= 0) {
|
|
|
- Element element = trs.get(y1).select("td").get(x1);
|
|
|
- String[] styles = element.attr("style").split(";");
|
|
|
- int Height = 0;
|
|
|
- for (String sty : styles) {
|
|
|
- if (sty.indexOf("height:") >= 0) {
|
|
|
- Height = Integer.parseInt(sty.replace("height:", "").replace("px", ""));
|
|
|
- }
|
|
|
+ if (myData.indexOf("https") >= 0 && myData.indexOf("aliyuncs") >= 0) {
|
|
|
+ Element element = trs.get(y1).select("td").get(x1);
|
|
|
+ String[] styles = element.attr("style").split(";");
|
|
|
+ int Height = 0;
|
|
|
+ for (String sty : styles) {
|
|
|
+ if (sty.indexOf("height:") >= 0) {
|
|
|
+ Height = Integer.parseInt(sty.replace("height:", "").replace("px", ""));
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
|
|
|
- ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
|
|
|
- pic.setHeight(Height);
|
|
|
- sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
|
|
|
+ BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
|
|
|
+ ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
|
|
|
+ pic.setHeight(Height);
|
|
|
+ sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
|
|
|
|
|
|
- } else {
|
|
|
- final CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
- cellRange.setText(myData);
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ final CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
+ cellRange.setText(myData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // 组装电签设置
|
|
|
- QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("type", 2);
|
|
|
- queryWrapper.eq("tab_id", tableNode.getPKeyId());
|
|
|
-
|
|
|
- final List<TextdictInfo> textdictInfos = this.textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
- if (textdictInfos != null && !textdictInfos.isEmpty()) {
|
|
|
- textdictInfos.forEach(e -> {
|
|
|
- String key = e.getColKey();
|
|
|
- String[] keys = key.split("__");
|
|
|
- String[] trtd = keys[1].split("_");
|
|
|
- if (trs.size() > (Integer.parseInt(trtd[0]))) {
|
|
|
- Element trData = trs.get(Integer.parseInt(trtd[0]));
|
|
|
- Elements tdDatas = trData.select("td");
|
|
|
- if (tdDatas.size() > Integer.parseInt(trtd[1])) {
|
|
|
- Element data = tdDatas.get(Integer.parseInt(trtd[1]));
|
|
|
-// 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"));
|
|
|
- if (x1 == 0) {
|
|
|
- x1 = 1;
|
|
|
- }
|
|
|
- int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
-
|
|
|
- final CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
+ }
|
|
|
+ // 组装电签设置
|
|
|
+ QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("type", 2);
|
|
|
+ queryWrapper.eq("tab_id", tableNode.getPKeyId());
|
|
|
|
|
|
- cellRange.setText(e.getId() + "");
|
|
|
- cellRange.getCellStyle().getFont().setColor(Color.white);
|
|
|
+ final List<TextdictInfo> textdictInfos = this.textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
+ if (textdictInfos != null && !textdictInfos.isEmpty()) {
|
|
|
+ textdictInfos.forEach(e -> {
|
|
|
+ String key = e.getColKey();
|
|
|
+ String[] keys = key.split("__");
|
|
|
+ String[] trtd = keys[1].split("_");
|
|
|
+ if (trs.size() > (Integer.parseInt(trtd[0]))) {
|
|
|
+ Element trData = trs.get(Integer.parseInt(trtd[0]));
|
|
|
+ Elements tdDatas = trData.select("td");
|
|
|
+ if (tdDatas.size() > Integer.parseInt(trtd[1])) {
|
|
|
+ Element data = tdDatas.get(Integer.parseInt(trtd[1]));
|
|
|
+ //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"));
|
|
|
+ if (x1 == 0) {
|
|
|
+ x1 = 1;
|
|
|
}
|
|
|
+ int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
|
|
|
|
|
|
+ final CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
+
|
|
|
+ cellRange.setText(e.getId() + "");
|
|
|
+ cellRange.getCellStyle().getFont().setColor(Color.white);
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- Long fileName = SnowFlakeUtil.getId();
|
|
|
- String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
|
|
|
-// wb.saveToFile("d://777.xls", ExcelVersion.Version2010);
|
|
|
- sheet.saveToPdf(onePdfPath);
|
|
|
+ Long fileName = SnowFlakeUtil.getId();
|
|
|
+ String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
|
|
|
+ sheet.saveToPdf(onePdfPath);
|
|
|
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", onePdfPath);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", onePdfPath);
|
|
|
|
|
|
- pdfUrls.add(bladeFile.getLink());
|
|
|
+ pdfUrls.add(bladeFile.getLink());
|
|
|
|
|
|
- wb.dispose();
|
|
|
+ wb.dispose();
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
if (pdfUrls.size() > 0) {
|
|
|
try {
|
|
|
- String mergePdfPath = file_path + "/pdf//" + theLogId + ".pdf";
|
|
|
+ String mergePdfPath = file_path + "/pdf//" + SnowFlakeUtil.getId() + ".pdf";
|
|
|
File oldMergePdf = ResourceUtil.getFile(mergePdfPath);
|
|
|
if (oldMergePdf.exists()) {
|
|
|
oldMergePdf.delete();
|
|
@@ -2385,10 +2406,10 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
FileUtils.mergePdfPublicMethods(pdfUrls, mergePdfPath);
|
|
|
|
|
|
- BladeFile mergeFile = this.newIOSSClient.uploadFile(theLogId + new Date().getTime() + ".pdf", mergePdfPath);
|
|
|
+ BladeFile mergeFile = this.newIOSSClient.uploadFile(SnowFlakeUtil.getId() + new Date().getTime() + ".pdf", mergePdfPath);
|
|
|
|
|
|
- //修改记录
|
|
|
- this.contractLogClient.updateTheLogPdfUrl(theLogJson.getString("id"), mergeFile.getLink());
|
|
|
+ //修改记录,当天的日志所有表的合并pdf都一样,即ids都修改成一样的
|
|
|
+ this.contractLogClient.updateTheLogPdfUrlByIds(StringUtils.join(ids, ","), mergeFile.getLink());
|
|
|
|
|
|
return R.data(mergeFile.getLink());
|
|
|
} catch (Exception e) {
|
|
@@ -2396,7 +2417,6 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.fail("数据异常");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
return R.data(null);
|
|
@@ -2410,229 +2430,228 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiOperationSupport(order = 26)
|
|
|
@ApiOperation(value = "获取当前用户当前日期的填报记录")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "theLogId", value = "日志记录的id,可能为空"),
|
|
|
+ @ApiImplicitParam(name = "theLogId", value = "日志记录的ids,可能为空(多张表)"),
|
|
|
@ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志类型ID,即左侧列表的节点primaryKeyId"),
|
|
|
@ApiImplicitParam(name = "recordTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd")
|
|
|
})
|
|
|
public R<List<Map<String, Object>>> getTheLogBusinessData(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId) {
|
|
|
List<Map<String, Object>> resultMapList = new ArrayList<>();
|
|
|
- //数据结果
|
|
|
- Map<String, Object> reData = new HashMap<>();
|
|
|
//获取对应的记录
|
|
|
- JSONObject theLogJson;
|
|
|
+ String dataIds;
|
|
|
if (StringUtils.isNotEmpty(theLogId)) {
|
|
|
- //
|
|
|
- theLogJson = this.contractLogClient.queryContractLogById(theLogId);
|
|
|
+ String[] split = theLogId.split(",");
|
|
|
+ List<String> ids = new LinkedList<>();
|
|
|
+ for (String logId : split) {
|
|
|
+ ContractLog contractLog = this.contractLogClient.queryContractLogByIdToObj(logId);
|
|
|
+ ids.add(contractLog.getDataId().toString());
|
|
|
+ }
|
|
|
+ dataIds = ids.stream().filter(Objects::nonNull).collect(Collectors.joining(","));
|
|
|
} else {
|
|
|
- theLogJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(nodePrimaryKeyId, recordTime, contractId);
|
|
|
+ List<ContractLog> contractLogs = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTimeList(nodePrimaryKeyId, recordTime, contractId);
|
|
|
+ dataIds = contractLogs.stream().map(ContractLog::getDataId).filter(Objects::nonNull).map(String::valueOf).collect(Collectors.joining(","));
|
|
|
}
|
|
|
|
|
|
WbsTreePrivate node = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, nodePrimaryKeyId));
|
|
|
WbsTreePrivate tableNode2 = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
.eq(WbsTreePrivate::getParentId, node.getId()).eq(WbsTreePrivate::getProjectId, node.getProjectId()));
|
|
|
|
|
|
- // 匹配关联
|
|
|
- try {
|
|
|
-// File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
|
|
|
- File file1 = ResourceUtil.getFile(tableNode2.getHtmlUrl());
|
|
|
-// File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1633285246067671040.html");
|
|
|
- if (file1.exists()) {
|
|
|
-
|
|
|
- String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
- Document doc = Jsoup.parse(htmlString);
|
|
|
-
|
|
|
- // 解析
|
|
|
- // 模糊匹配
|
|
|
- Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
|
|
|
- Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
|
|
|
- Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
|
|
|
- sgtitle.addAll(sgtitle1);
|
|
|
-
|
|
|
- Elements htdtitle = doc.select("el-input[placeholder~=.*合同号.*]");
|
|
|
- Elements htdtitle1 = doc.select("el-input[placeholder~=合同段.*]");
|
|
|
- htdtitle.addAll(htdtitle1);
|
|
|
-
|
|
|
- Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
|
|
|
-
|
|
|
- Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
|
|
|
- Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
|
|
|
- bhtitle.addAll(bhtitle1);
|
|
|
-
|
|
|
-
|
|
|
- Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
|
|
|
-
|
|
|
-
|
|
|
- // Elements title = doc.select("el-input[placeholder~=^编号]");
|
|
|
-
|
|
|
- /**
|
|
|
- * 承包单位 承包单位、施工单位:引用施工单位名称 ,
|
|
|
- * 监理单位:引用监理单位名称
|
|
|
- * 合同段、所属建设项目(合同段):引用合同段编号
|
|
|
- *
|
|
|
- * 施工单位:施工单位 和 安装单位
|
|
|
- *
|
|
|
- */
|
|
|
- ContractInfo contractInfo = contractInfoService.getById(contractId);
|
|
|
- // 施工单位名称
|
|
|
- if (dwtitle.size() >= 1) {
|
|
|
- int y = Integer.parseInt(dwtitle.attr("trindex"));
|
|
|
- if (y <= 10) {
|
|
|
- reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if (sgtitle.size() >= 1) {
|
|
|
- int y = Integer.parseInt(sgtitle.attr("trindex"));
|
|
|
- if (y <= 10) {
|
|
|
- reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
- }
|
|
|
+ if (StringUtils.isNotEmpty(dataIds)) {
|
|
|
+ for (String dataId : dataIds.split(",")) {
|
|
|
+ //检查实体表是否存在
|
|
|
+ String tabName = tableNode2.getInitTableName();
|
|
|
+ String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
|
+ List<Map<String, Object>> tabList = this.jdbcTemplate.queryForList(isExitSql);
|
|
|
+ if (tabList.size() <= 0) {
|
|
|
+ return R.fail("无实体表对应");
|
|
|
}
|
|
|
|
|
|
- // 合同段名称
|
|
|
- if (htdtitle.size() >= 1) {
|
|
|
- for (Element element : htdtitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 8) {
|
|
|
- reData.put(element.attr("keyName"), contractInfo.getContractNumber());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 监理单位名称
|
|
|
- if (jltitle.size() >= 1) {
|
|
|
+ //查询数据
|
|
|
+ String querySql = "SELECT * FROM " + tabName + " WHERE id = " + dataId + " and group_id = " + tableNode2.getPKeyId();
|
|
|
+ List<Map<String, Object>> businessDataMap = this.jdbcTemplate.queryForList(querySql);
|
|
|
|
|
|
- for (Element element : jltitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 10) {
|
|
|
- reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ //数据结果
|
|
|
+ Map<String, Object> reData = new HashMap<>();
|
|
|
|
|
|
- // 项目名称
|
|
|
- if (xmtitle.size() >= 1) {
|
|
|
- for (Element element : xmtitle) {
|
|
|
- int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
- if (trindex <= 6) {
|
|
|
- ProjectInfo projectInfo = projectInfoService.getById(tableNode2.getProjectId());
|
|
|
- reData.put(element.attr("keyName"), projectInfo.getProjectName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ if (businessDataMap.size() > 0) {
|
|
|
+ // 匹配关联
|
|
|
+ try {
|
|
|
+ //File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
|
|
|
+ File file1 = ResourceUtil.getFile(tableNode2.getHtmlUrl());
|
|
|
+ //File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1633285246067671040.html");
|
|
|
+ if (file1.exists()) {
|
|
|
+
|
|
|
+ String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
+
|
|
|
+ // 解析
|
|
|
+ // 模糊匹配
|
|
|
+ Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
|
|
|
+ Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
|
|
|
+ Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
|
|
|
+ sgtitle.addAll(sgtitle1);
|
|
|
+
|
|
|
+ Elements htdtitle = doc.select("el-input[placeholder~=.*合同号.*]");
|
|
|
+ Elements htdtitle1 = doc.select("el-input[placeholder~=合同段.*]");
|
|
|
+ htdtitle.addAll(htdtitle1);
|
|
|
+
|
|
|
+ Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
|
|
|
+
|
|
|
+ Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
|
|
|
+ Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
|
|
|
+ bhtitle.addAll(bhtitle1);
|
|
|
+
|
|
|
+
|
|
|
+ Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
|
|
|
+
|
|
|
+
|
|
|
+ // Elements title = doc.select("el-input[placeholder~=^编号]");
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 承包单位 承包单位、施工单位:引用施工单位名称 ,
|
|
|
+ * 监理单位:引用监理单位名称
|
|
|
+ * 合同段、所属建设项目(合同段):引用合同段编号
|
|
|
+ *
|
|
|
+ * 施工单位:施工单位 和 安装单位
|
|
|
+ *
|
|
|
+ */
|
|
|
+ ContractInfo contractInfo = contractInfoService.getById(contractId);
|
|
|
+ // 施工单位名称
|
|
|
+ if (dwtitle.size() >= 1) {
|
|
|
+ int y = Integer.parseInt(dwtitle.attr("trindex"));
|
|
|
+ if (y <= 10) {
|
|
|
+ reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
+ }
|
|
|
|
|
|
- if (theLogJson != null) {
|
|
|
- //查询对应的html
|
|
|
- WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, theLogJson.getString("tableId")));
|
|
|
+ }
|
|
|
+ if (sgtitle.size() >= 1) {
|
|
|
+ int y = Integer.parseInt(sgtitle.attr("trindex"));
|
|
|
+ if (y <= 10) {
|
|
|
+ reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //检查实体表是否存在
|
|
|
- String tabName = tableNode.getInitTableName();
|
|
|
- String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
|
- List<Map<String, Object>> tabList = this.jdbcTemplate.queryForList(isExitSql);
|
|
|
- if (tabList.size() <= 0) {
|
|
|
- return R.fail("无实体表对应");
|
|
|
- }
|
|
|
+ // 合同段名称
|
|
|
+ if (htdtitle.size() >= 1) {
|
|
|
+ for (Element element : htdtitle) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 8) {
|
|
|
+ reData.put(element.attr("keyName"), contractInfo.getContractNumber());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 监理单位名称
|
|
|
+ if (jltitle.size() >= 1) {
|
|
|
+
|
|
|
+ for (Element element : jltitle) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 10) {
|
|
|
+ reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //查询数据
|
|
|
- String querySql = "SELECT * FROM " + tabName + " WHERE group_id = " + theLogJson.get("dataId");
|
|
|
- List<Map<String, Object>> businessDataMap = this.jdbcTemplate.queryForList(querySql);
|
|
|
+ // 项目名称
|
|
|
+ if (xmtitle.size() >= 1) {
|
|
|
+ for (Element element : xmtitle) {
|
|
|
+ int trindex = Integer.parseInt(element.attr("trindex"));
|
|
|
+ if (trindex <= 6) {
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(tableNode2.getProjectId());
|
|
|
+ reData.put(element.attr("keyName"), projectInfo.getProjectName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ for (Map<String, Object> mysqlData : businessDataMap) {
|
|
|
|
|
|
- if (businessDataMap.size() > 0) {
|
|
|
+ String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where business_id ='" + dataId + "' and is_deleted = 0";
|
|
|
+ List<Map<String, Object>> businessDat = this.jdbcTemplate.queryForList(querySqlx);
|
|
|
+ reData.put("linkTabIds", businessDat);
|
|
|
|
|
|
- for (Map<String, Object> mysqlData : businessDataMap) {
|
|
|
+ for (String key : mysqlData.keySet()) {
|
|
|
+ String tabVal = mysqlData.get(key) + "";
|
|
|
+ // 时间段处理
|
|
|
+ if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
|
|
|
+ if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
|
|
|
+ if (reData.containsKey("pickerKey")) {
|
|
|
+ String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
|
|
|
+ reData.put("pickerKey", pickerKey);
|
|
|
+ } else {
|
|
|
+ reData.put("pickerKey", key + "__" + tabData[1]);
|
|
|
+ }
|
|
|
|
|
|
- String id = mysqlData.get("id") + "";
|
|
|
- String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where business_id ='" + id + "' and is_deleted=0";
|
|
|
- List<Map<String, Object>> businessDat = this.jdbcTemplate.queryForList(querySqlx);
|
|
|
- if (businessDat != null) {
|
|
|
- reData.put("linkTabIds", businessDat);
|
|
|
- }
|
|
|
+ String sql = tabData[0];
|
|
|
+ sql = sql.replaceAll("\\[", "['");
|
|
|
+ sql = sql.replaceAll("]", "']");
|
|
|
+ sql = sql.replaceAll("000Z,", "000Z',");
|
|
|
+ sql = sql.replaceAll(", 20", ", '20");
|
|
|
+ sql = sql.replaceAll("'", "");
|
|
|
+ reData.put(key + "__" + tabData[1], sql);
|
|
|
+ } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) { //时间
|
|
|
|
|
|
- for (String key : mysqlData.keySet()) {
|
|
|
- String tabVal = mysqlData.get(key) + "";
|
|
|
- // 时间段处理
|
|
|
- if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
|
|
|
- if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
|
|
|
- String[] tabData = tabVal.split("_\\^_");
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
|
|
|
- if (reData.containsKey("pickerKey")) {
|
|
|
- String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
|
|
|
- reData.put("pickerKey", pickerKey);
|
|
|
+ } else if (tabVal.indexOf("☆") >= 0) {
|
|
|
+ String[] mysql = tabVal.split("☆");
|
|
|
+ for (String data : mysql) {
|
|
|
+ String[] tabData = data.split("_\\^_");
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ }
|
|
|
+ } else if (tabVal.indexOf("_^_") >= 0) {
|
|
|
+ String[] tabData = tabVal.split("_\\^_");
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
} else {
|
|
|
- reData.put("pickerKey", key + "__" + tabData[1]);
|
|
|
+ reData.put(key, tabVal);
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- String sql = tabData[0];
|
|
|
- sql = sql.replaceAll("\\[", "['");
|
|
|
- sql = sql.replaceAll("]", "']");
|
|
|
- sql = sql.replaceAll("000Z,", "000Z',");
|
|
|
- sql = sql.replaceAll(", 20", ", '20");
|
|
|
- sql = sql.replaceAll("'", "");
|
|
|
- reData.put(key + "__" + tabData[1], sql);
|
|
|
- } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) { //时间
|
|
|
-
|
|
|
- String[] tabData = tabVal.split("_\\^_");
|
|
|
- reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
-
|
|
|
- } else if (tabVal.indexOf("☆") >= 0) {
|
|
|
- String[] mysql = tabVal.split("☆");
|
|
|
- for (String data : mysql) {
|
|
|
- String[] tabData = data.split("_\\^_");
|
|
|
- reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ // 获取默认值
|
|
|
+ QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("type", 4);
|
|
|
+ queryWrapper.eq("tab_id", node.getPKeyId());
|
|
|
+ final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
+ if (!textdictInfos.isEmpty()) {
|
|
|
+ for (TextdictInfo textdictInfo : textdictInfos) {
|
|
|
+ if (reData.containsKey(textdictInfo.getColKey())) {
|
|
|
+ String keyVal = reData.get(textdictInfo.getColKey()) + "";
|
|
|
+ } else {
|
|
|
+ reData.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
|
|
|
}
|
|
|
- } else if (tabVal.indexOf("_^_") >= 0) {
|
|
|
- String[] tabData = tabVal.split("_\\^_");
|
|
|
- reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
- } else {
|
|
|
- reData.put(key, tabVal);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ // 移除Id 和 p_key_id
|
|
|
+ reData.remove("p_key_id");
|
|
|
+ reData.remove("classify");
|
|
|
+ reData.remove("contractId");
|
|
|
+ reData.remove("pkeyId");
|
|
|
+ reData.remove("projectId");
|
|
|
+ resultMapList.add(reData);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resultMapList.add(reData);
|
|
|
+ Map<String, Object> reData2 = new HashMap<>();
|
|
|
// 获取默认值
|
|
|
QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("type", 4);
|
|
|
- queryWrapper.eq("tab_id", tableNode.getPKeyId());
|
|
|
+ queryWrapper.eq("tab_id", tableNode2.getPKeyId());
|
|
|
final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
if (!textdictInfos.isEmpty()) {
|
|
|
for (TextdictInfo textdictInfo : textdictInfos) {
|
|
|
- if (reData.containsKey(textdictInfo.getColKey())) {
|
|
|
- String keyVal = reData.get(textdictInfo.getColKey()) + "";
|
|
|
- } else {
|
|
|
- reData.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
|
|
|
- }
|
|
|
+ reData2.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
|
|
|
}
|
|
|
+ resultMapList.add(reData2);
|
|
|
}
|
|
|
-
|
|
|
- // 移除Id 和 p_key_id
|
|
|
- reData.remove("p_key_id");
|
|
|
- reData.remove("classify");
|
|
|
- reData.remove("contractId");
|
|
|
- reData.remove("pkeyId");
|
|
|
- reData.remove("projectId");
|
|
|
- resultMapList.add(reData);
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- resultMapList.add(reData);
|
|
|
- Map<String, Object> reData2 = new HashMap<>();
|
|
|
- // 获取默认值
|
|
|
- QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("type", 4);
|
|
|
- queryWrapper.eq("tab_id", tableNode2.getPKeyId());
|
|
|
- final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
- if (!textdictInfos.isEmpty()) {
|
|
|
- for (TextdictInfo textdictInfo : textdictInfos) {
|
|
|
- reData2.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
|
|
|
- }
|
|
|
- resultMapList.add(reData2);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return R.data(resultMapList);
|
|
|
}
|
|
|
|
|
@@ -3588,7 +3607,7 @@ public class ExcelTabController extends BladeController {
|
|
|
if (maxSort.isPresent()) {
|
|
|
maxValue = maxSort.get();
|
|
|
}
|
|
|
- for (MultipartFile fileDTO : file){
|
|
|
+ for (MultipartFile fileDTO : file) {
|
|
|
//创建节点,并上传excel文件到节点上
|
|
|
ExcelTab excelTabNode = new ExcelTab();
|
|
|
Long aLong = SnowFlakeUtil.getId();
|
|
@@ -3606,7 +3625,7 @@ public class ExcelTabController extends BladeController {
|
|
|
excelTabNode.setUpdateUser(SecureUtil.getUserId());
|
|
|
excelTabNode.setStatus(1);
|
|
|
excelTabService.save(excelTabNode);
|
|
|
- this.putFileAttach(fileDTO,aLong);
|
|
|
+ this.putFileAttach(fileDTO, aLong);
|
|
|
}
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
@@ -3639,8 +3658,8 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParam(name = "pkeyId", value = "WBS私有库的pkeyId", required = true),
|
|
|
@ApiImplicitParam(name = "tabId", value = "表信息id", required = true)
|
|
|
})
|
|
|
- public R<List<WbsFormElement>> getUnMatchField(Long pkeyId,Long tabId) throws Exception {
|
|
|
- return R.data(excelTabService.getUnMatchField(pkeyId,tabId));
|
|
|
+ public R<List<WbsFormElement>> getUnMatchField(Long pkeyId, Long tabId) throws Exception {
|
|
|
+ return R.data(excelTabService.getUnMatchField(pkeyId, tabId));
|
|
|
}
|
|
|
|
|
|
}
|