|
@@ -1822,100 +1822,100 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParam(name = "contractId", value = "合同段Id", required = true)
|
|
|
})
|
|
|
public R getPdfS(String nodeId, String classify, String contractId) throws IOException {
|
|
|
- String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
- String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
|
|
|
- Boolean aBoolean = RedisTemplate.hasKey("pdf-" + nodeId + "-" + classify);
|
|
|
- if (aBoolean) {
|
|
|
- Long expire = RedisTemplate.getExpire("pdf-" + nodeId + "-" + classify);
|
|
|
- return R.fail("pdf正在生成,还有" + expire + "秒");
|
|
|
- }
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
|
|
|
+ Boolean aBoolean = RedisTemplate.hasKey("pdf-" + nodeId + "-" + classify);
|
|
|
+ if (aBoolean) {
|
|
|
+ Long expire = RedisTemplate.getExpire("pdf-" + nodeId + "-" + classify);
|
|
|
+ return R.fail("pdf正在生成,还有" + expire + "秒");
|
|
|
+ }
|
|
|
|
|
|
- //获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
|
|
|
- String sql = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
|
|
|
- List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
- if(maps.size() < 1){
|
|
|
- //判断当前合同段的类型
|
|
|
- ContractInfo contractInfo = contractInfoService.selectById(contractId);
|
|
|
- if(ObjectUtil.isNotEmpty(contractInfo)){
|
|
|
- Integer contractType = contractInfo.getContractType();
|
|
|
- if(contractType == 3 || contractType == 2 ){//业主和监理
|
|
|
- //当前业主合同段关联的施工合同段数据
|
|
|
- String sqlForSG = "select contract_id_sg from m_contract_relation_jlyz where contract_id_jlyz = " + contractId;
|
|
|
- List<ContractRelationJlyz> ContractRelationJlyzs = jdbcTemplate.query(sqlForSG, new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
|
|
|
- if(ObjectUtil.isNotEmpty(ContractRelationJlyzs)){
|
|
|
- List<Long> contractsIds = ContractRelationJlyzs.stream().map(ContractRelationJlyz::getContractIdSg).collect(Collectors.toList());
|
|
|
- String contractsIdsStr = StringUtils.join(contractsIds, ",");
|
|
|
- String sql1 = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id in('" + contractsIdsStr + "')";
|
|
|
- maps = jdbcTemplate.queryForList(sql1);
|
|
|
+ //获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
|
|
|
+ String sql = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
|
|
|
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
+ if(maps.size() < 1){
|
|
|
+ //判断当前合同段的类型
|
|
|
+ ContractInfo contractInfo = contractInfoService.selectById(contractId);
|
|
|
+ if(ObjectUtil.isNotEmpty(contractInfo)){
|
|
|
+ Integer contractType = contractInfo.getContractType();
|
|
|
+ if(contractType == 3 || contractType == 2 ){//业主和监理
|
|
|
+ //当前业主合同段关联的施工合同段数据
|
|
|
+ String sqlForSG = "select contract_id_sg from m_contract_relation_jlyz where contract_id_jlyz = " + contractId;
|
|
|
+ List<ContractRelationJlyz> ContractRelationJlyzs = jdbcTemplate.query(sqlForSG, new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
|
|
|
+ if(ObjectUtil.isNotEmpty(ContractRelationJlyzs)){
|
|
|
+ List<Long> contractsIds = ContractRelationJlyzs.stream().map(ContractRelationJlyz::getContractIdSg).collect(Collectors.toList());
|
|
|
+ String contractsIdsStr = StringUtils.join(contractsIds, ",");
|
|
|
+ String sql1 = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id in('" + contractsIdsStr + "')";
|
|
|
+ maps = jdbcTemplate.queryForList(sql1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- if (maps.size() >= 1) {
|
|
|
- Map<String, Object> stringObjectMap = maps.get(0);
|
|
|
- String pdfUrl = stringObjectMap.get("pdf_url") + "";
|
|
|
- if (Func.isNotEmpty(stringObjectMap.get("e_visa_pdf_url"))) {
|
|
|
- //优先使用电签的pdf
|
|
|
- pdfUrl = stringObjectMap.get("e_visa_pdf_url") + "";
|
|
|
- }
|
|
|
-
|
|
|
- if (stringObjectMap.get("pdf_trial_url") != null || stringObjectMap.get("pdf_trial_url_position") != null) {
|
|
|
- //合并试验关联文件、试验工程部位信息的pdf
|
|
|
- pdfUrl = this.mergePdfShow(pdfUrl, stringObjectMap) + "";
|
|
|
- }
|
|
|
+ if (maps.size() >= 1) {
|
|
|
+ Map<String, Object> stringObjectMap = maps.get(0);
|
|
|
+ String pdfUrl = stringObjectMap.get("pdf_url") + "";
|
|
|
+ if (Func.isNotEmpty(stringObjectMap.get("e_visa_pdf_url"))) {
|
|
|
+ //优先使用电签的pdf
|
|
|
+ pdfUrl = stringObjectMap.get("e_visa_pdf_url") + "";
|
|
|
+ }
|
|
|
|
|
|
- String nodeSql="SELECT node_class from m_wbs_tree_contract where p_key_id="+nodeId;
|
|
|
- Integer nodeClass = jdbcTemplate.queryForObject(nodeSql, Integer.class);
|
|
|
- if(ObjectUtil.isEmpty(nodeClass)){
|
|
|
- nodeClass=1;
|
|
|
- }
|
|
|
- if ((StringUtils.isEmpty(pdfUrl) || pdfUrl.equals("null")) && !nodeClass.equals(2)) {
|
|
|
- return R.fail("暂无PDF数据");
|
|
|
- } else {
|
|
|
- // 由于独立附件 需要追加最后
|
|
|
- List<TableFileVO> data = tableFileService.selectTableFileListByTen(Long.valueOf(nodeId + ""), Integer.valueOf(classify));
|
|
|
- List<String> datainfo = new ArrayList<>();
|
|
|
-
|
|
|
- datainfo.add(pdfUrl);
|
|
|
- if (data != null && data.size() >= 1) {
|
|
|
- for (TableFileVO tabsx : data) {
|
|
|
- datainfo.add(tabsx.getUrl());
|
|
|
+ if (stringObjectMap.get("pdf_trial_url") != null&&!stringObjectMap.get("pdf_trial_url").equals("") || stringObjectMap.get("pdf_trial_url_position") != null&&!stringObjectMap.get("pdf_trial_url_position").equals("")) {
|
|
|
+ //合并试验关联文件、试验工程部位信息的pdf
|
|
|
+ pdfUrl = this.mergePdfShow(pdfUrl, stringObjectMap) + "";
|
|
|
}
|
|
|
- String listPdf = file_path + "/nodePDF/" + nodeId + ".pdf";
|
|
|
- File tabpdf2 = ResourceUtil.getFile(listPdf);
|
|
|
- if (tabpdf2.exists()) {
|
|
|
- tabpdf2.delete();
|
|
|
+
|
|
|
+ String nodeSql="SELECT node_class from m_wbs_tree_contract where p_key_id="+nodeId;
|
|
|
+ Integer nodeClass = jdbcTemplate.queryForObject(nodeSql, Integer.class);
|
|
|
+ if(ObjectUtil.isEmpty(nodeClass)){
|
|
|
+ nodeClass=1;
|
|
|
}
|
|
|
- FileUtils.mergePdfPublicMethods(datainfo, listPdf);
|
|
|
- String netUrl = "";
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId + ".pdf", listPdf);
|
|
|
- if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
|
|
|
- netUrl = bladeFile.getLink();
|
|
|
- }
|
|
|
- //数字化节点附件处理
|
|
|
- String sqll="SELECT * FROM m_wbs_tree_contract WHERE p_key_id="+nodeId;
|
|
|
- WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject(sqll, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
- if(ObjectUtil.isNotEmpty(wbsTreeContract.getNodeClass())&&wbsTreeContract.getNodeClass().equals(2)){
|
|
|
- InformationQuery iq= informationQueryClient.getInfoByWbsId(wbsTreeContract.getPKeyId());
|
|
|
- if(iq.getNodePdfUrl()==null||iq.getEVisaPdfPage()==null||iq.getEVisaPdfPage()==0||iq.getEVisaPdfSize()==null||!iq.getNodePdfUrl().equals(netUrl)){
|
|
|
- String pdfPage = FileUtils.getPdfNum(netUrl);
|
|
|
- if(pdfPage!=null&&pdfPage.equals("")){
|
|
|
- pdfPage="0";
|
|
|
+ if ((StringUtils.isEmpty(pdfUrl) || pdfUrl.equals("null")) && !nodeClass.equals(2)) {
|
|
|
+ return R.fail("暂无PDF数据");
|
|
|
+ } else {
|
|
|
+ // 由于独立附件 需要追加最后
|
|
|
+ List<TableFileVO> data = tableFileService.selectTableFileListByTen(Long.valueOf(nodeId + ""), Integer.valueOf(classify));
|
|
|
+ List<String> datainfo = new ArrayList<>();
|
|
|
+
|
|
|
+ datainfo.add(pdfUrl);
|
|
|
+ if (data != null && data.size() >= 1) {
|
|
|
+ for (TableFileVO tabsx : data) {
|
|
|
+ datainfo.add(tabsx.getUrl());
|
|
|
+ }
|
|
|
+ String listPdf = file_path + "/nodePDF/" + nodeId + ".pdf";
|
|
|
+ File tabpdf2 = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabpdf2.exists()) {
|
|
|
+ tabpdf2.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(datainfo, listPdf);
|
|
|
+ String netUrl = "";
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
|
|
|
+ netUrl = bladeFile.getLink();
|
|
|
}
|
|
|
- Long pdfSize = CommonUtil.getResourceLength(netUrl);
|
|
|
- String sql1="update u_information_query set node_pdf_url='"+netUrl+"',e_visa_pdf_page="+pdfPage+" ,e_visa_pdf_size="+pdfSize+" where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
|
|
|
- jdbcTemplate.execute(sql1);
|
|
|
+ //数字化节点附件处理
|
|
|
+ String sqll="SELECT * FROM m_wbs_tree_contract WHERE p_key_id="+nodeId;
|
|
|
+ WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject(sqll, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ if(ObjectUtil.isNotEmpty(wbsTreeContract.getNodeClass())&&wbsTreeContract.getNodeClass().equals(2)){
|
|
|
+ InformationQuery iq= informationQueryClient.getInfoByWbsId(wbsTreeContract.getPKeyId());
|
|
|
+ if(iq.getNodePdfUrl()==null||iq.getEVisaPdfPage()==null||iq.getEVisaPdfPage()==0||iq.getEVisaPdfSize()==null||!iq.getNodePdfUrl().equals(netUrl)){
|
|
|
+ String pdfPage = FileUtils.getPdfNum(netUrl);
|
|
|
+ if(pdfPage!=null&&pdfPage.equals("")){
|
|
|
+ pdfPage="0";
|
|
|
+ }
|
|
|
+ Long pdfSize = CommonUtil.getResourceLength(netUrl);
|
|
|
+ String sql1="update u_information_query set node_pdf_url='"+netUrl+"',e_visa_pdf_page="+pdfPage+" ,e_visa_pdf_size="+pdfSize+" where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
|
|
|
+ jdbcTemplate.execute(sql1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(netUrl);
|
|
|
+ } else {
|
|
|
+ jdbcTemplate.execute(" update u_information_query set node_pdf_url='"+pdfUrl+"' where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'");
|
|
|
+ return R.data(pdfUrl);
|
|
|
}
|
|
|
}
|
|
|
- return R.data(netUrl);
|
|
|
} else {
|
|
|
- jdbcTemplate.execute(" update u_information_query set node_pdf_url='"+pdfUrl+"' where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'");
|
|
|
- return R.data(pdfUrl);
|
|
|
+ return R.fail("无历史数据预览,请保存数据");
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- return R.fail("无历史数据预览,请保存数据");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -4255,6 +4255,7 @@ public class ExcelTabController extends BladeController {
|
|
|
iq.setCreateTime(new Date());
|
|
|
iq.setUpdateUser(b.getUserId());
|
|
|
iq.setUpdateTime(new Date());
|
|
|
+ iq.setBusinessTime(wbsTreeContract.getDigitizeTime());
|
|
|
iq.setStatus(2);
|
|
|
iq.setIsDeleted(0);
|
|
|
informationQueryClient.insert(iq);
|
|
@@ -4262,6 +4263,7 @@ public class ExcelTabController extends BladeController {
|
|
|
iq.setEVisaPdfPage(pdfPage.equals("")?0:Integer.parseInt(pdfPage));
|
|
|
iq.setEVisaPdfSize(pdfSize);
|
|
|
iq.setNodePdfUrl(netUrl);
|
|
|
+ iq.setBusinessTime(wbsTreeContract.getDigitizeTime());
|
|
|
iq.setUpdateTime(new Date());
|
|
|
iq.setUpdateUser(b.getUserId());
|
|
|
informationQueryClient.update(iq);
|