|
@@ -298,7 +298,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
String lastStr = dataInfo2.getString(ziduan[0]) + "_^_" + ziduan[0].split("__")[1];
|
|
|
for (int i = 1; i < ziduan.length; i++) {
|
|
|
String keyData = dataInfo2.getString(ziduan[i]);
|
|
|
- if (StringUtils.isNotEmpty(keyData)&&!keyData.equals("")) {
|
|
|
+ if (StringUtils.isNotEmpty(keyData) && !keyData.equals("")) {
|
|
|
lastStr += "☆" + dataInfo2.getString(ziduan[i]) + "_^_" + ziduan[i].split("__")[1];
|
|
|
}
|
|
|
|
|
@@ -959,6 +959,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
transactionManager1.rollback(transactionStatus);
|
|
|
log.append(e.getMessage()).append("@@");
|
|
|
e.printStackTrace();
|
|
|
+ return R.fail(wbsTreeContract.getNodeName());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1320,7 +1321,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
//获取清表信息
|
|
|
ExcelTab excelTab = this.getById(wbsTreeContract.getExcelId());
|
|
|
-
|
|
|
if (excelTab == null) {
|
|
|
return R.fail("失败");
|
|
|
}
|
|
@@ -1377,6 +1377,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(pkeyId == 1644218999589830668L){
|
|
|
+ // System.out.println("12321");
|
|
|
+ }
|
|
|
//数据不为空
|
|
|
if (StringUtils.isNotEmpty(wbsTreeContract.getHtmlUrl())) {
|
|
|
InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(wbsTreeContract.getHtmlUrl());
|
|
@@ -1389,115 +1392,122 @@ 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[] xy = DataVal[1].split("_");
|
|
|
- if (Integer.parseInt(xy[0]) < trs.size()) {
|
|
|
- Element ytzData = trs.get(Integer.parseInt(xy[0]));
|
|
|
- if (ytzData != null) {
|
|
|
- Elements tdsx = ytzData.select("td");
|
|
|
- if (Integer.parseInt(xy[1]) < tdsx.size()) {
|
|
|
- Element data= ytzData.getElementById(val);
|
|
|
- //Element data = ytzData.select("td").get(Integer.parseInt(xy[1]));
|
|
|
- if (data != null) {
|
|
|
- if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 0) {
|
|
|
- int x1 = 0;
|
|
|
- int x2 = 0;
|
|
|
- int y1 = 0;
|
|
|
- int y2 = 0;
|
|
|
-
|
|
|
- if (data.html().indexOf("el-tooltip") >= 0) {
|
|
|
- x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
|
|
|
- x2 = Integer.parseInt(data.children().get(0).children().get(0).attr("x2"));
|
|
|
- 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 = DataInfo.get(val) + "";
|
|
|
- if ((myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) || (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0)) {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
|
- sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
|
|
|
- SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
- if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
|
|
|
-
|
|
|
- myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
|
|
|
- String[] dataVal = myData.split(",");
|
|
|
-
|
|
|
- Date Start_dataStr = sdf.parse(dataVal[0]);
|
|
|
- Date end_dataStr = sdf.parse(dataVal[1]);
|
|
|
- String StartDate = formatStr.format(Start_dataStr);
|
|
|
- String endDate = formatStr.format(end_dataStr);
|
|
|
- if (StartDate.equals(endDate)) {
|
|
|
- myData = StartDate;
|
|
|
- } else {
|
|
|
- myData = StartDate + "-" + endDate;
|
|
|
- }
|
|
|
- } else {
|
|
|
- String[] dataStr = myData.split("T")[0].split("-");
|
|
|
- if (dataStr.length == 3) {
|
|
|
- myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ Elements datas = doc.getElementsByAttributeValue("keyname", val);
|
|
|
+ Element data = null;
|
|
|
+ if(val.equals("key_12__25_0")){
|
|
|
+ //System.out.println("1231");
|
|
|
+ }
|
|
|
+ if (datas.size() >= 1) {
|
|
|
+ data = datas.get(0);
|
|
|
+ }
|
|
|
|
|
|
- if (myData.indexOf("lang.String") >= 0) {
|
|
|
- Object obj = DataInfo.get(val);
|
|
|
- if (obj instanceof String[]) {
|
|
|
- String[] dataDate = (String[]) obj;
|
|
|
- myData = dataDate[0] + "-" + dataDate[1].trim();
|
|
|
- }
|
|
|
- }
|
|
|
+ if (data != null) {
|
|
|
+ if (data.hasAttr("x1") && data.hasAttr("y1")) {
|
|
|
+ int x1 = 0;
|
|
|
+ int x2 = 0;
|
|
|
+ int y1 = 0;
|
|
|
+ int y2 = 0;
|
|
|
|
|
|
- //https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
|
|
|
- if ((myData.indexOf("https") >= 0 || myData.indexOf("http") >= 0) && myData.indexOf("aliyuncs") >= 0) {
|
|
|
-
|
|
|
- InputStream imageIn = CommonUtil.getOSSInputStream(myData);
|
|
|
- byte[] byteNew = IOUtils.toByteArray(imageIn);
|
|
|
- byte[] bytes = CommonUtil.compressImage(byteNew);
|
|
|
- // 这里根据实际需求选择图片类型
|
|
|
- int pictureIdx = workbook.addPicture(bytes, 6);
|
|
|
- CreationHelper helper = workbook.getCreationHelper();
|
|
|
- ClientAnchor anchor = helper.createClientAnchor();
|
|
|
- anchor.setCol1(x1); // param1是列号
|
|
|
- anchor.setCol2(x2);
|
|
|
- anchor.setRow1(y1); // param2是行号
|
|
|
- anchor.setRow2(y2); // param2是行号
|
|
|
- //
|
|
|
- Drawing drawing = sheet.createDrawingPatriarch();
|
|
|
- anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
|
|
|
- // 插入图片
|
|
|
- Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
|
|
|
- pict.resize(1, 1);
|
|
|
- FileUtils.imageOrientation(sheet, anchor, new DataVO(x1 - 1, y1 - 1));
|
|
|
-
|
|
|
- } else if (myData.equals("1") && data.html().indexOf("hc-form-checkbox-group") >= 0) {
|
|
|
- Row row = sheet.getRow(y1 - 1);
|
|
|
- if (row != null) {
|
|
|
- Cell cell = row.getCell(x1 - 1);
|
|
|
- if (cell != null || ObjectUtils.isNotEmpty(cell)) {
|
|
|
- String exceVal = cell.getStringCellValue().replaceAll(" ", "");
|
|
|
- short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
- Font fontAt = workbook.getFontAt(fontIndex);
|
|
|
- fontAt.setFontName("EUDC");
|
|
|
- cell.setCellValue(exceVal.replace("□", "\u2611"));
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- Row row = sheet.getRow(y1 - 1);
|
|
|
- if (row != null) {
|
|
|
- Cell cell = row.getCell(x1 - 1);
|
|
|
- if (cell != null || ObjectUtils.isNotEmpty(cell)) {
|
|
|
- cell.setCellValue(myData);
|
|
|
- }
|
|
|
+ x1 = Integer.parseInt(data.attr("x1"));
|
|
|
+ y1 = Integer.parseInt(data.attr("y1"));
|
|
|
+
|
|
|
+ if (x1 == 0) {
|
|
|
+ x1 = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ String myData = DataInfo.get(val) + "";
|
|
|
+ if ((myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) || (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0)) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
|
+ sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
|
|
|
+ SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
+ if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
|
|
|
+
|
|
|
+ myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
|
|
|
+ String[] dataVal = myData.split(",");
|
|
|
+
|
|
|
+ Date Start_dataStr = sdf.parse(dataVal[0]);
|
|
|
+ Date end_dataStr = sdf.parse(dataVal[1]);
|
|
|
+ String StartDate = formatStr.format(Start_dataStr);
|
|
|
+ String endDate = formatStr.format(end_dataStr);
|
|
|
+ if (StartDate.equals(endDate)) {
|
|
|
+ myData = StartDate;
|
|
|
+ } else {
|
|
|
+ myData = StartDate + "-" + endDate;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String[] dataStr = myData.split("T")[0].split("-");
|
|
|
+ if (dataStr.length == 3) {
|
|
|
+ myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (myData.indexOf("lang.String") >= 0) {
|
|
|
+ Object obj = DataInfo.get(val);
|
|
|
+ if (obj instanceof String[]) {
|
|
|
+ String[] dataDate = (String[]) obj;
|
|
|
+ myData = dataDate[0] + "-" + dataDate[1].trim();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
|
|
|
+ if ((myData.indexOf("https") >= 0 || myData.indexOf("http") >= 0) && myData.indexOf("aliyuncs") >= 0) {
|
|
|
+
|
|
|
+ InputStream imageIn = CommonUtil.getOSSInputStream(myData);
|
|
|
+ byte[] byteNew = IOUtils.toByteArray(imageIn);
|
|
|
+ byte[] bytes = CommonUtil.compressImage(byteNew);
|
|
|
+ // 这里根据实际需求选择图片类型
|
|
|
+ int pictureIdx = workbook.addPicture(bytes, 6);
|
|
|
+ CreationHelper helper = workbook.getCreationHelper();
|
|
|
+ ClientAnchor anchor = helper.createClientAnchor();
|
|
|
+ anchor.setCol1(x1); // param1是列号
|
|
|
+ anchor.setCol2(x2);
|
|
|
+ anchor.setRow1(y1); // param2是行号
|
|
|
+ anchor.setRow2(y2); // param2是行号
|
|
|
+ //
|
|
|
+ Drawing drawing = sheet.createDrawingPatriarch();
|
|
|
+ anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
|
|
|
+ // 插入图片
|
|
|
+ Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
|
|
|
+ pict.resize(1, 1);
|
|
|
+ FileUtils.imageOrientation(sheet, anchor, new DataVO(x1 - 1, y1 - 1));
|
|
|
+
|
|
|
+ } else if (data.tagName().equals("hc-form-checkbox-group")) {
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = row.getCell(x1 - 1);
|
|
|
+ if (cell != null || ObjectUtils.isNotEmpty(cell)) {
|
|
|
+ String exceVal = cell.getStringCellValue().replaceAll(" ", "");
|
|
|
+ //如果有□ 代表 自动生成 如果没有 代表后期添加 需要显示html 中的值
|
|
|
+ if(exceVal.indexOf("□")>=0 ){
|
|
|
+ if(myData.equals("1")){
|
|
|
+ short fontIndex = cell.getCellStyle().getFontIndex();
|
|
|
+ Font fontAt = workbook.getFontAt(fontIndex);
|
|
|
+ fontAt.setFontName("EUDC");
|
|
|
+ cell.setCellValue(exceVal.replace("□", "\u2611"));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ String dataJson = data.attr(":objs");
|
|
|
+ if(StringUtils.isNotEmpty(dataJson)){
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(dataJson);
|
|
|
+ List<Integer> idList = Func.toIntList(myData);
|
|
|
+ String dataInfo = jsonArray.getJSONObject(0).getString("name");
|
|
|
+ for(int inx=1 ; inx<idList.size() ; inx++){
|
|
|
+ dataInfo = dataInfo+","+jsonArray.getJSONObject(inx).getString("name");
|
|
|
}
|
|
|
+ cell.setCellValue(dataInfo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ Row row = sheet.getRow(y1 - 1);
|
|
|
+ if (row != null) {
|
|
|
+ Cell cell = row.getCell(x1 - 1);
|
|
|
+ if (cell != null || ObjectUtils.isNotEmpty(cell)) {
|
|
|
+ cell.setCellValue(myData);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1521,6 +1531,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Elements tdsx = ytzData.select("td");
|
|
|
if (Integer.parseInt(trtd[1]) < tdsx.size()) {
|
|
|
Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
|
|
|
+
|
|
|
if (data.html().indexOf("el-tooltip") >= 0) {
|
|
|
data = data.children().get(0);
|
|
|
}
|
|
@@ -1561,6 +1572,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
|
workbook.write(outputStream);
|
|
|
FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
|
|
|
+
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
|
|
|
|
//附件
|
|
@@ -1607,8 +1619,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (exceInp != null) {
|
|
|
IoUtil.closeQuietly(exceInp);
|
|
|
}
|
|
|
+ return R.data(bladeFile2.getLink());
|
|
|
|
|
|
- return R.data(bladeFile2.getLink());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1979,38 +1991,39 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
reData.remove("contractId");
|
|
|
reData.remove("pkeyId");
|
|
|
reData.remove("projectId");
|
|
|
- chart(reData,wbsTreePrivate);
|
|
|
+ chart(reData, wbsTreePrivate);
|
|
|
list.add(reData);
|
|
|
return list;
|
|
|
}
|
|
|
- private void chart(Map<String,Object> reData,WbsTreePrivate wtp){
|
|
|
+
|
|
|
+ private void chart(Map<String, Object> reData, WbsTreePrivate wtp) {
|
|
|
try {
|
|
|
- if(reData.size()>0&&wtp!=null) {
|
|
|
+ if (reData.size() > 0 && wtp != null) {
|
|
|
List<Map<String, Object>> configList = this.jdbcTemplate.queryForList("select d.rely ,b.e_key ekey from m_wbs_tree_private a join m_wbs_form_element b on a.init_table_id=b.f_id join m_element_formula_mapping c on b.id=c.element_id join m_formula d on c.formula_id=d.id where p_key_id=" + wtp.getPKeyId() + " and b.is_deleted=0 and d.formula like 'FC.chart%' limit 1");
|
|
|
if (Func.isNotEmpty(configList)) {
|
|
|
Map<String, Object> config = configList.get(0);
|
|
|
String[] rely = Func.toStr(config.get("rely")).split(",");
|
|
|
String ky = rely[0].split(":")[1];
|
|
|
String kx = rely[1].split(":")[1];
|
|
|
- Map<String,String> coordsMap = FormulaUtils.getElementCell(wtp.getHtmlUrl());
|
|
|
- List<String> ly= Arrays.stream((coordsMap.get(ky)).split(";")).filter(Func::isNotBlank).map(k->ky+"__"+k).collect(Collectors.toList());
|
|
|
- List<String> lx= Arrays.stream((coordsMap.get(kx)).split(";")).filter(Func::isNotBlank).map(k->kx+"__"+k).collect(Collectors.toList());
|
|
|
- List<String> fct= new ArrayList<>();
|
|
|
- if(ly.size()>0){
|
|
|
+ Map<String, String> coordsMap = FormulaUtils.getElementCell(wtp.getHtmlUrl());
|
|
|
+ List<String> ly = Arrays.stream((coordsMap.get(ky)).split(";")).filter(Func::isNotBlank).map(k -> ky + "__" + k).collect(Collectors.toList());
|
|
|
+ List<String> lx = Arrays.stream((coordsMap.get(kx)).split(";")).filter(Func::isNotBlank).map(k -> kx + "__" + k).collect(Collectors.toList());
|
|
|
+ List<String> fct = new ArrayList<>();
|
|
|
+ if (ly.size() > 0) {
|
|
|
fct.addAll(ly);
|
|
|
}
|
|
|
- if(lx.size()>0){
|
|
|
+ if (lx.size() > 0) {
|
|
|
fct.addAll(lx);
|
|
|
}
|
|
|
- String formChartKey= String.join(",", fct);
|
|
|
- if(Func.isNotEmpty(formChartKey)){
|
|
|
- reData.put("formChartKey",formChartKey);
|
|
|
- String key=Func.toStr(config.get("ekey"));
|
|
|
- reData.put("formchartKeyShow",key+"__"+coordsMap.get(key).split(";")[0]);
|
|
|
+ String formChartKey = String.join(",", fct);
|
|
|
+ if (Func.isNotEmpty(formChartKey)) {
|
|
|
+ reData.put("formChartKey", formChartKey);
|
|
|
+ String key = Func.toStr(config.get("ekey"));
|
|
|
+ reData.put("formchartKeyShow", key + "__" + coordsMap.get(key).split(";")[0]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|