|
@@ -88,7 +88,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
private final InformationQueryClient informationQueryClient;
|
|
|
// 元素信息表-
|
|
|
private final IWbsTreeContractService wbsTreeContractService;
|
|
|
- private final IWbsTreeService wbsTreeService;
|
|
|
+
|
|
|
private final IFormulaService formulaService;
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
|
|
@@ -109,6 +109,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
// 合同端信息
|
|
|
private final IContractInfoService contractInfoService;
|
|
|
|
|
|
+ private final IProjectInfoService projectInfoService;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<ExcelTabVO> selectExcelTabPage(IPage<ExcelTabVO> page, ExcelTabVO excelTab) {
|
|
|
return page.setRecords(baseMapper.selectExcelTabPage(page, excelTab));
|
|
@@ -668,7 +671,17 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
|
|
|
//获取工作表
|
|
|
Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
-
|
|
|
+ // 标题添加
|
|
|
+ ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
|
|
|
+ CellRange[] columns = sheet.getMergedCells();
|
|
|
+ for (int i = 0; i< columns.length; i++){
|
|
|
+ CellRange cellRange = columns[i];
|
|
|
+ if(cellRange.getStyle().getFont().getSize()>=17){
|
|
|
+ cellRange.setText(projectInfo.getProjectName());
|
|
|
+ cellRange.getStyle().getFont().setSize(20);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 数据不为空 &&
|
|
|
if (StringUtils.isNotEmpty(wbsTreeContract.getHtmlUrl())) {
|
|
@@ -685,6 +698,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (val.indexOf("__") >= 0) {
|
|
|
String DataVal[] = val.split("__");
|
|
|
String[] xy = DataVal[1].split("_");
|
|
|
+
|
|
|
Element data = trs.get(Integer.parseInt(xy[0])).select("td").get(Integer.parseInt(xy[1]));
|
|
|
|
|
|
if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 0) {
|
|
@@ -702,9 +716,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
x1 = 1;
|
|
|
}
|
|
|
String myData = DataInfo.get(val) + "";
|
|
|
+
|
|
|
+ if(myData.equals("30.72")){
|
|
|
+ System.out.println("");
|
|
|
+ }
|
|
|
+
|
|
|
if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
|
|
|
if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
|
|
|
- myData = myData.replace("[", "").replace("]", "");
|
|
|
+ myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
|
|
|
String[] dataVal = myData.split(",");
|
|
|
String Start_dataStr[] = dataVal[0].split("T")[0].split("-");
|
|
|
String StartDate = StringUtil.format("{}年{}月{}日", new Object[]{Start_dataStr[0], Start_dataStr[1], Integer.parseInt(Start_dataStr[2]) + 1});
|
|
@@ -727,18 +746,34 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
|
|
|
BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
|
|
|
|
|
|
- int colspan = Integer.parseInt(data.attr("colspan"));
|
|
|
- int rowspan = Integer.parseInt(data.attr("rowspan"));
|
|
|
+ int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
|
|
|
+ int rowspan = data.attr("ROWSPAN").equals("") ? 0 : Integer.parseInt(data.attr("ROWSPAN"));
|
|
|
int picHeight = 0;
|
|
|
int picWidth = 0;
|
|
|
- for (int i = y1; i <= (y1 + rowspan); i++) { // 跨列处理
|
|
|
- String dataInfo = trs.get(i).attr("height");
|
|
|
- if (StringUtils.isNotEmpty(dataInfo)) {
|
|
|
- picHeight += Integer.parseInt(dataInfo);
|
|
|
+
|
|
|
+ if(rowspan==0){
|
|
|
+ String dataInfo = trs.get(y1).attr("height");
|
|
|
+ if(StringUtils.isEmpty(dataInfo)){
|
|
|
+ Element firstTd = trs.get(y1).children().get(0);
|
|
|
+ String heg[] =firstTd.attr("style").split(";");
|
|
|
+ for (String str:heg){
|
|
|
+ if(str.indexOf("height:")>=0){
|
|
|
+ picHeight = Integer.parseInt(str.split(":")[1].replaceAll("px",""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ picHeight = Integer.parseInt(dataInfo);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for (int i = y1; i <= (y1 + rowspan); i++) { // 跨列处理
|
|
|
+ String dataInfo = trs.get(i).attr("height");
|
|
|
+ if (StringUtils.isNotEmpty(dataInfo)) {
|
|
|
+ picHeight += Integer.parseInt(dataInfo);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (colspan >= 1) { //框行处理
|
|
|
+ if (colspan >=1) {
|
|
|
for (int i = x1 - 1; i < x1 + colspan - 1; i++) {
|
|
|
String dataInfo = cols.get(i).attr("width").replaceAll("px", "");
|
|
|
if (StringUtils.isNotEmpty(dataInfo)) {
|
|
@@ -752,7 +787,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
pic.setHeight(picHeight);
|
|
|
pic.setLeft(5);
|
|
|
} else {
|
|
|
- final CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
+ CellRange cellRange = sheet.getCellRange(y1, x1);
|
|
|
+ System.out.println(cellRange.getText());
|
|
|
cellRange.setText(myData);
|
|
|
}
|
|
|
}
|
|
@@ -765,9 +801,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
queryWrapper.eq("type", 2);
|
|
|
queryWrapper.eq("tab_id", wbsTreeContract.getIsTypePrivatePid());
|
|
|
|
|
|
- final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
+ List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
|
|
|
if (textdictInfos != null && !textdictInfos.isEmpty()) {
|
|
|
- textdictInfos.forEach(e -> {
|
|
|
+ for(TextdictInfo e : textdictInfos){
|
|
|
String key = e.getColKey();
|
|
|
String keys[] = key.split("__");
|
|
|
String[] trtd = keys[1].split("_");
|
|
@@ -782,12 +818,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
cellRange.setText(e.getId() + "");
|
|
|
cellRange.getCellStyle().getFont().setColor(Color.white);
|
|
|
|
|
|
- });
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
sheet.saveToPdf(pdfPath);
|
|
|
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
@@ -843,7 +880,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
|
|
|
for (WbsTreeContract wbsInfo : wbsTreeContractList) {
|
|
|
// 隐藏的不生成pdf
|
|
|
- if (wbsInfo.getIsBussShow() != 2) { //
|
|
|
+ if ( wbsInfo.getIsBussShow()==null || wbsInfo.getIsBussShow() != 2 ) { //
|
|
|
if (StringUtils.isNotEmpty(wbsInfo.getPdfUrl())) {
|
|
|
data.add(wbsInfo.getPdfUrl());
|
|
|
} else {
|
|
@@ -907,16 +944,40 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
//解析
|
|
|
Elements dwtitle = doc.select("el-input[placeholder~=^承包单位]");
|
|
|
+ Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
|
|
|
Elements htdtitle = doc.select("el-input[placeholder~=^合同段]");
|
|
|
Elements jltitle = doc.select("el-input[placeholder~=^监理单位]");
|
|
|
Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
|
|
|
+
|
|
|
+ Elements title = doc.select("el-input[placeholder~=^编号]");
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 承包单位、施工单位:引用施工单位名称
|
|
|
+ * 监理单位:引用监理单位名称
|
|
|
+ * 合同段、所属建设项目(合同段):引用合同段编号
|
|
|
+ */
|
|
|
+
|
|
|
ContractInfo contractInfo = contractInfoService.getById(wbsTreeContract.getContractId());
|
|
|
- //
|
|
|
- reData.put(dwtitle.attr("keyName"),contractInfo.getConstructionUnitName());
|
|
|
- reData.put(htdtitle.attr("keyName"),contractInfo.getContractName());
|
|
|
- reData.put(jltitle.attr("keyName"),contractInfo.getSupervisionUnitName());
|
|
|
- reData.put(bhtitle.attr("keyName"),contractInfo.getContractNumber());
|
|
|
+ // 施工单位名称
|
|
|
+ if(dwtitle.size()>=1 ){
|
|
|
+ reData.put(dwtitle.attr("keyName"),contractInfo.getConstructionUnitName());
|
|
|
+ }
|
|
|
+ if(sgtitle.size()>=1){
|
|
|
+ reData.put(sgtitle.attr("keyName"),contractInfo.getConstructionUnitName());
|
|
|
+ }
|
|
|
|
|
|
+ // 合同段编号
|
|
|
+ if(htdtitle.size()>=1){
|
|
|
+ reData.put(htdtitle.attr("keyName"),contractInfo.getContractNumber());
|
|
|
+ }
|
|
|
+ // 监理单位名称
|
|
|
+ if(jltitle.size()>=1) {
|
|
|
+ reData.put(jltitle.attr("keyName"), contractInfo.getSupervisionUnitName());
|
|
|
+ }
|
|
|
+ // 编号
|
|
|
+ if(bhtitle.size()>=1 && contractInfo.getIsReferenceNumber()==1) {
|
|
|
+ reData.put(bhtitle.attr("keyName"), contractInfo.getConstructionUnitName());
|
|
|
+ }
|
|
|
|
|
|
} catch (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|
|
@@ -944,22 +1005,31 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
sql = sql.replaceAll("]", "\']");
|
|
|
sql = sql.replaceAll("000Z,", "000Z\',");
|
|
|
sql = sql.replaceAll(", 20", ", \'20");
|
|
|
- sql = sql.replaceAll("'", "");
|
|
|
- reData.put(key + "__" + tabData[1], sql);
|
|
|
+ // sql = sql.replaceAll("'", "");
|
|
|
+ if(StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ 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]);
|
|
|
+ if(StringUtils.isNotEmpty(tabData[0])) {
|
|
|
+ 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]);
|
|
|
+ if(StringUtils.isNotEmpty(tabData[0])){
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ }
|
|
|
}
|
|
|
} else if (tabVal.indexOf("_^_") >= 0) {
|
|
|
String tabData[] = tabVal.split("_\\^_");
|
|
|
- reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ if(StringUtils.isNotEmpty(tabData[0])){
|
|
|
+ reData.put(key + "__" + tabData[1], tabData[0]);
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
reData.put(key, tabVal);
|
|
|
}
|