|
@@ -1207,7 +1207,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R<Object> saveOrUpdateInfo(List<TableInfo> tableInfoList) {
|
|
|
+ public R<Object> saveOrUpdateInfo(List<TableInfo> tableInfoList,String sigType) {
|
|
|
+ List<TableInfo> tableInfoList2 = new ArrayList<>();
|
|
|
String fileName1="";
|
|
|
if (ListUtils.isNotEmpty(tableInfoList)) {
|
|
|
//施工资料填报
|
|
@@ -1221,6 +1222,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (wbsTreeContract == null) {
|
|
|
continue;
|
|
|
}
|
|
|
+ tableInfo.setIsTypePrivatePid(wbsTreeContract.getExcelId()+"");
|
|
|
+ tableInfoList2.add(tableInfo);
|
|
|
pkids += tableInfo.getPkeyId() + ",";
|
|
|
String tabName = wbsTreeContract.getInitTableName();
|
|
|
// 判读修改还是 添加
|
|
@@ -1276,9 +1279,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
sb.append(tableInfo.getPkeyId());sb.append(",");sb.append(user.getUserId());
|
|
|
sb.append(","); sb.append("SYSDATE()");sb.append(",\"");sb.append(sqlInfoNew);
|
|
|
sb.append("\")");
|
|
|
- jdbcTemplate.execute(delSql);
|
|
|
- jdbcTemplate.execute(sqlInfo);
|
|
|
- jdbcTemplate.execute(sb.toString());
|
|
|
+
|
|
|
+ if(sigType.equals("1") && wbsTreeContract.getProjectId().equals("1630011899725201410") && (tableInfo.getIsTypePrivatePid().equals("1559714325173080065") || tableInfo.getIsTypePrivatePid().equals("1559479719236702210") )){
|
|
|
+ System.out.println("123");
|
|
|
+ }else{
|
|
|
+ jdbcTemplate.execute(delSql);
|
|
|
+ jdbcTemplate.execute(sqlInfo);
|
|
|
+ jdbcTemplate.execute(sb.toString());
|
|
|
+ }
|
|
|
transactionManager1.commit(transactionStatus);
|
|
|
} catch (Exception e) {
|
|
|
transactionManager1.rollback(transactionStatus);
|
|
@@ -1327,7 +1335,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
return R.fail(reason(log.toString()));
|
|
|
}
|
|
|
}
|
|
|
- return R.success(fileName1);
|
|
|
+ return R.data(tableInfoList2);
|
|
|
+ // return R.success(fileName1);
|
|
|
}
|
|
|
|
|
|
public String reason(String log) {
|
|
@@ -1991,7 +2000,33 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
return reData;
|
|
|
}
|
|
|
+ public static String convertToYMD(String input) {
|
|
|
+ if (input == null || input.isEmpty()) return "";
|
|
|
|
|
|
+ try {
|
|
|
+ Date date;
|
|
|
+
|
|
|
+ // 尝试多种格式
|
|
|
+ if (input.matches("\\d{4}-\\d{2}-\\d{2}")) {
|
|
|
+ date = new SimpleDateFormat("yyyy-MM-dd").parse(input);
|
|
|
+ } else if (input.matches("\\d{4}/\\d{2}/\\d{2}")) {
|
|
|
+ date = new SimpleDateFormat("yyyy/MM/dd").parse(input);
|
|
|
+ } else if (input.matches("\\d{4}年\\d{1,2}月\\d{1,2}日")) {
|
|
|
+ date = new SimpleDateFormat("yyyy年MM月dd日").parse(input);
|
|
|
+ } else if (input.matches("\\d{8}")) {
|
|
|
+ date = new SimpleDateFormat("yyyyMMdd").parse(input);
|
|
|
+ } else if (input.contains("T") && input.contains(":")) {
|
|
|
+ date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").parse(input.replaceAll("Z$", "+0800"));
|
|
|
+ } else {
|
|
|
+ throw new IllegalArgumentException("Unsupported date format: " + input);
|
|
|
+ }
|
|
|
+
|
|
|
+ return new SimpleDateFormat("yyyy-MM-dd").format(date);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
@Override
|
|
|
public R getBussPdfInfo(Long pkeyId) throws Exception {
|
|
|
String file_path = FileUtils.getSysLocalFileUrl();
|
|
@@ -2101,6 +2136,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ Boolean dateFlag=true;
|
|
|
+ String firstDate="";
|
|
|
+ List<String>dateKeyNames=new ArrayList<>();
|
|
|
//数据不为空
|
|
|
if (StringUtils.isNotEmpty(wbsTreeContract.getHtmlUrl())) {
|
|
|
InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(wbsTreeContract.getHtmlUrl());
|
|
@@ -2110,12 +2148,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
Element table = doc.select("table").first();
|
|
|
//计算填报率
|
|
|
- List<String> keyList = table.getElementsByAttribute("v-model").stream()
|
|
|
+ List<String> keyList = table.getElementsByAttribute("keyname")
|
|
|
+ .stream().filter(k->k.attr("v-model").indexOf("\\.")>=0)
|
|
|
.map(l -> {
|
|
|
String attr = l.attr("v-model");
|
|
|
System.out.println(attr);
|
|
|
- String[] split = attr.split("\\.");
|
|
|
- return split[1];
|
|
|
+ String[] split = attr.split("\\.");
|
|
|
+ return split[1];
|
|
|
})
|
|
|
.collect(Collectors.toList());
|
|
|
Long sigSize = table.getElementsByAttribute(":readonly").stream().count();
|
|
@@ -2131,7 +2170,27 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
realFillRate = v.intValue();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ Elements dateElements = doc.select("el-date-picker");
|
|
|
+ if(!dateElements.isEmpty()){
|
|
|
+ for (Element element : dateElements) {
|
|
|
+ String keyname = element.attr("keyname");
|
|
|
+ dateKeyNames.add(keyname);
|
|
|
+ if(!DataInfo.containsKey(keyname)||(StringUtils.isEmpty(DataInfo.get(keyname).toString()))){
|
|
|
+ dateFlag=false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(dateFlag){
|
|
|
+ if(!dateKeyNames.isEmpty()){
|
|
|
+ for (int i = 0; i < dateKeyNames.size(); i++) {
|
|
|
+ firstDate=DataInfo.get(dateKeyNames.get(i)).toString();
|
|
|
+ firstDate=convertToYMD(firstDate);
|
|
|
+ if(StringUtils.isNotEmpty(firstDate)){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
Elements trs = table.select("tr");
|
|
|
if (ObjectUtil.isNotEmpty(DataInfo)) {
|
|
|
for (String val : DataInfo.keySet()) {
|
|
@@ -2140,7 +2199,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (datas.size() >= 1) {
|
|
|
data = datas.get(0);
|
|
|
}
|
|
|
-
|
|
|
if (data != null) {
|
|
|
if (data.hasAttr("x1") && data.hasAttr("y1")) {
|
|
|
int x1 = 0;
|
|
@@ -2288,10 +2346,36 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
// 组装电签设置
|
|
|
Elements dqids = table.getElementsByAttribute("dqid");
|
|
|
+ // 电签组装2
|
|
|
+ String tableName = wbsTreeContract.getInitTableName();
|
|
|
+ String dqSql = "select * from u_sign_key_role_info where tab_en_name='"+tableName+"'";
|
|
|
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(dqSql);
|
|
|
+
|
|
|
+ if(mapList!=null && mapList.size()>0){
|
|
|
+ for(Map<String, Object> map : mapList) {
|
|
|
+ Elements elementsBy = table.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "");
|
|
|
+ if(elementsBy!=null && elementsBy.size()>0){
|
|
|
+ for(Element element : elementsBy){
|
|
|
+ element.attr("sign_type", "✹"+map.get("id"));
|
|
|
+ dqids.add(element);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for (Element element : dqids) {
|
|
|
- String dqid = element.attr("dqid");
|
|
|
+ String dqid="";
|
|
|
+ if(element.hasAttr("sign_type")){
|
|
|
+ dqid = element.attr("sign_type");
|
|
|
+ }else{
|
|
|
+ dqid = element.attr("dqid");
|
|
|
+ }
|
|
|
+
|
|
|
Elements x11 = element.getElementsByAttribute("x1");
|
|
|
if (x11 != null && x11.size() >= 1) {
|
|
|
Element element1 = x11.get(x11.size() - 1);
|
|
@@ -2324,15 +2408,19 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
for (int i = 0; i < xssfRichTextString.numFormattingRuns(); i++) {
|
|
|
XSSFFont runFont = xssfRichTextString.getFontOfFormattingRun(i);
|
|
|
Font font = workbook.createFont();
|
|
|
- font.setColor(runFont.getXSSFColor().getIndexed());
|
|
|
- font.setFontHeightInPoints(runFont.getFontHeightInPoints());
|
|
|
- font.setBold(runFont.getBold());
|
|
|
- font.setItalic(runFont.getItalic());
|
|
|
- font.setUnderline(runFont.getUnderline());
|
|
|
- font.setTypeOffset(runFont.getTypeOffset());
|
|
|
- font.setCharSet(runFont.getCharSet());
|
|
|
- font.setStrikeout(runFont.getStrikeout());
|
|
|
- font.setFontName(runFont.getFontName());
|
|
|
+ if (runFont!=null&&font != null) {
|
|
|
+ if(runFont.getXSSFColor()!=null){
|
|
|
+ font.setColor(runFont.getXSSFColor().getIndexed());
|
|
|
+ }
|
|
|
+ font.setFontHeightInPoints(runFont.getFontHeightInPoints());
|
|
|
+ font.setBold(runFont.getBold());
|
|
|
+ font.setItalic(runFont.getItalic());
|
|
|
+ font.setUnderline(runFont.getUnderline());
|
|
|
+ font.setTypeOffset(runFont.getTypeOffset());
|
|
|
+ font.setCharSet(runFont.getCharSet());
|
|
|
+ font.setStrikeout(runFont.getStrikeout());
|
|
|
+ font.setFontName(runFont.getFontName());
|
|
|
+ }
|
|
|
int startIdx = xssfRichTextString.getIndexOfFormattingRun(i);
|
|
|
int endIdx = Math.min(startIdx + xssfRichTextString.getLengthOfFormattingRun(i), existingValue.length());
|
|
|
//根据原有值的长度,起始位置和结束位置设置成原有的文本格式
|
|
@@ -2355,6 +2443,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//输出流
|
|
@@ -2415,12 +2504,39 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
updateWrapper.in("p_key_id", pkeyId + "");
|
|
|
updateWrapper.set("pdf_url", fileUrl);
|
|
|
updateWrapper.set("real_fill_rate", realFillRate);
|
|
|
+ updateWrapper.set("date_is_complete", dateFlag?1:2);
|
|
|
wbsTreeContractService.update(updateWrapper);
|
|
|
+ //
|
|
|
+ String sql="SELECT parent.* FROM m_wbs_tree_contract child JOIN m_wbs_tree_contract parent ON child.p_id = parent.p_key_id WHERE child.p_key_id ="+pkeyId+" AND child.contract_id = parent.contract_id AND child.project_id = parent.project_id";
|
|
|
+ List<WbsTreeContract> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ if(!query.isEmpty()){
|
|
|
+ WbsTreeContract contract = query.get(0);
|
|
|
+ contract.setDateIsComplete(dateFlag?1:2);
|
|
|
+ String ancestorsPId = contract.getAncestorsPId();
|
|
|
+ if (ancestorsPId.startsWith("0,")) {
|
|
|
+ ancestorsPId = ancestorsPId.substring(2);
|
|
|
+ }
|
|
|
+ ancestorsPId=ancestorsPId+","+contract.getPKeyId();
|
|
|
+ List<Long> longList = Arrays.stream(ancestorsPId.split(","))
|
|
|
+ .map(Long::valueOf)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ UpdateWrapper<WbsTreeContract> updateWrapper1 = new UpdateWrapper<>();
|
|
|
+ updateWrapper1.in("p_key_id", longList);
|
|
|
+ updateWrapper1.set("date_is_complete",contract.getDateIsComplete());
|
|
|
+ wbsTreeContractService.update(updateWrapper1);
|
|
|
+ if(StringUtils.isNotEmpty(firstDate)){
|
|
|
+ Integer classify =
|
|
|
+ Arrays.asList("1", "2", "3").contains(contract.getTableOwner()) ? 1 :
|
|
|
+ Arrays.asList("4", "5", "6").contains(contract.getTableOwner()) ? 2 : 1;
|
|
|
+ String updateQuery="update u_information_query set business_time= '"+firstDate+"' where wbs_id="+contract.getPKeyId()+" and classify="+classify;
|
|
|
+ jdbcTemplate.update(updateQuery);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//关闭流
|
|
|
IoUtil.closeQuietly(outputStream);
|
|
|
IoUtil.closeQuietly(exceInp);
|
|
|
-
|
|
|
return R.data(fileUrl);
|
|
|
}
|
|
|
|
|
@@ -2460,7 +2576,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//资料填报原始pdf合并
|
|
|
FileUtils.mergePdfPublicMethods(data, listPdf);
|
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId + ".pdf", listPdf);
|
|
|
-
|
|
|
+ if(bladeFile == null){
|
|
|
+ System.out.println("Oss上传失败");
|
|
|
+ }
|
|
|
//获取当前填报节点sort
|
|
|
System.out.println("pdfs__"+listPdf+"___"+bladeFile);
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
|
|
@@ -5004,4 +5122,29 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void synPdfKeyInfo(String nodeId, String classify, String contractId, String projectId) throws Exception {
|
|
|
+ // 获取有权限的节点信息
|
|
|
+ List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId, null);
|
|
|
+ List<String> data = new ArrayList<>();
|
|
|
+ if (nodeId.indexOf(":") >= 0) {
|
|
|
+ nodeId = nodeId.split(":")[0];
|
|
|
+ }
|
|
|
+ if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
|
|
|
+ for (WbsTreeContract wbsInfo : wbsTreeContractList) {
|
|
|
+ // 隐藏的不生成pdf
|
|
|
+ if (StringUtils.isNotEmpty(wbsInfo.getPdfUrl())) {
|
|
|
+ data.add(wbsInfo.getPdfUrl());
|
|
|
+ } else {
|
|
|
+ R bussPdfInfo = this.getBussPdfInfo(wbsInfo.getPKeyId());
|
|
|
+ if (bussPdfInfo.getCode() == 200) {
|
|
|
+ if (StringUtils.isNotBlank(bussPdfInfo.getData() + "")) {
|
|
|
+ data.add(bussPdfInfo.getData() + "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //
|
|
|
+ }
|
|
|
}
|