chenr 6 luni în urmă
părinte
comite
164f6aeba7

+ 14 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -61,6 +61,7 @@ import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.SingleColumnRowMapper;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.*;
 
@@ -2730,7 +2731,16 @@ public class InformationWriteQueryController extends BladeController {
                 }
             }
         }
+        Boolean timeFlag=false;
         if(ObjectUtil.isNotEmpty(digitizeTime)){
+            try {
+                String time = jdbcTemplate.queryForObject("Select digitize_time from m_wbs_tree_contract where p_key_id=" + pKeyId, String.class);
+                if(time!=null&&!time.equals(digitizeTime)){
+                    timeFlag=true;
+                }
+            } catch (EmptyResultDataAccessException e) {
+                e.printStackTrace();
+            }
             node.setDigitizeTime(digitizeTime);
         }
         if (ObjectUtil.isNotEmpty(unitName) && ObjectUtil.isNotEmpty(className)) {
@@ -2760,7 +2770,10 @@ public class InformationWriteQueryController extends BladeController {
             e.printStackTrace();
         }
         Boolean aBoolean = this.wbsTreeContractClient.updateContractNodeParameter(node);
-
+        if(aBoolean&&timeFlag){
+            String update="update u_information_query set business_time='"+digitizeTime+"' where wbs_id="+pKeyId;
+            jdbcTemplate.execute(update);
+        }
         //获取父节点信息
         informationQueryService.AsyncWbsTree(queries.getParentId() + "", queries.getParentId() + "", queries.getContractId(), "", "1");
 

+ 85 - 83
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -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);