huangjn пре 2 година
родитељ
комит
c18d68fcbf

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

@@ -2,7 +2,6 @@ package org.springblade.business.controller;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;

+ 65 - 33
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -31,7 +31,6 @@ import org.springblade.flow.core.feign.NewFlowClient;
 import org.springblade.flow.core.utils.FlowUtil;
 import org.springblade.flow.core.utils.TaskUtil;
 import org.springblade.flow.core.vo.FlowProcessVO;
-import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.feign.WbsTreeContractClient;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -69,8 +68,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 
     private final IContractLogService contractLogService;
 
-    private final WbsTreeContractClient wbsTreeContractClient;
-
     @Override
     public List<TaskParallel> queryApprovalUser(String formDataIds) {
         //返回结果
@@ -105,10 +102,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                  switch (taskApprovalVO.getApprovalType()){
                      case 1:
                          //填报数据
-                         return this.queryProcessSubmitBusinessData(taskApprovalVO.getFormDataId());
+                         return this.queryProcessSubmitBusinessData(taskApprovalVO.getFormDataId(), true);
                      case 2:
                          //工程文件
                          return this.queryArchiveFileBusinessData(taskApprovalVO.getFormDataId());
+                     case 3:
+                         //日志资料
+                         return this.queryTheLogFileBusinessData(taskApprovalVO.getFormDataId());
                      default:
                          //未找到数据,解锁
                          DistributedRedisLock.release(taskApprovalVO.getFormDataId());
@@ -130,42 +130,62 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         switch (taskApprovalVO.getApprovalType()){
             case 1:
                 //填报数据
-                return this.queryProcessSubmitBusinessData(taskApprovalVO.getFormDataId());
+                return this.queryProcessSubmitBusinessData(taskApprovalVO.getFormDataId(), false);
             case 2:
                 //工程文件
                 return this.queryArchiveFileBusinessData(taskApprovalVO.getFormDataId());
+            case 3:
+                //日志资料
+                return this.queryTheLogFileBusinessData(taskApprovalVO.getFormDataId());
             default:
                 return null;
         }
     }
 
+    /**
+     * 日志资料
+     */
+    private TaskApprovalVO queryTheLogFileBusinessData(String formDataId){
+        //查询对应的数据
+        TaskApprovalVO vo = new TaskApprovalVO();
+        ContractLog log = this.contractLogService.getById(formDataId);
+        if(log != null && (StringUtils.isNotEmpty(log.getPdfUrl()) || StringUtils.isNotEmpty(log.getEVisaPdfUrl()))){
+            vo.setApprovalFileList(log.getFileName(), StringUtils.isNotEmpty(log.getEVisaPdfUrl()) ? log.getEVisaPdfUrl() : log.getPdfUrl());
+        }
+
+        return vo;
+    }
+
     /**
      * 查询填报数据
      */
-    private TaskApprovalVO queryProcessSubmitBusinessData(String formDataId){
+    private TaskApprovalVO queryProcessSubmitBusinessData(String formDataId, boolean isTask){
+        //查询对应的数据
+        TaskApprovalVO vo = new TaskApprovalVO();
+
         InformationQuery query = this.informationQueryService.getById(formDataId);
         if(query != null){
-            //查询对应的数据
-            TaskApprovalVO vo = new TaskApprovalVO();
-
-            if(StringUtils.isEmpty(query.getEVisaPdfUrl()) && StringUtils.isEmpty(query.getPdfUrl())){
-                //两个都为空,需要去其它地方获取数据
-                List<WbsTreeContract> tableData = this.wbsTreeContractClient.queryProcessSubmitBusinessDataByPrimaKeyIdAndClassify(query.getWbsId().toString(), query.getClassify().toString());
-                if(tableData != null && tableData.size() > 0){
-                    //设置数据
-//                    List<String> pdfUrls = tableData.stream().map(WbsTreeContract::getPdfUrl).distinct().collect(Collectors.toList());
-                    //需要重新合并PDF
-//                    FileUtils.mergePdfPublicMethods();
-
-                    return vo;
+            if(new Integer("3").equals(query.getType())){
+                //首件,首件的资料由三个部分组成:封面、关联资料、总结报告
+                if(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) || StringUtils.isNotEmpty(query.getPdfUrl())){
+                    //封面
+                    vo.setApprovalFileList(query.getName(), StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
+                }
+                //不是审批时再查关联资料,因为关联资料都是审批好的pdf,存在关键字,不能再执行签 字/章
+                if(!isTask){
+                    //关联资料
+                    if(StringUtils.isNotEmpty(query.getLinkMergePdfUrl())){
+                        vo.setApprovalFileList("首件关联资料", query.getLinkMergePdfUrl());
+                    }
                 }
+
             } else {
-                //反之直接获取
-                vo.setApprovalFileList(query.getName(), StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
-                return vo;
+                if(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) || StringUtils.isNotEmpty(query.getPdfUrl())){
+                    vo.setApprovalFileList(query.getName(), StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl());
+                }
             }
         }
-        return null;
+        return vo;
     }
 
     /**
@@ -250,6 +270,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         if(currentLink == null){
             return false;
         }
+        //获取主流程
+        Task masterTask = this.getOne(Wrappers.<Task>lambdaQuery().eq(Task::getIsDeleted, 0).eq(Task::getProcessInstanceId, currentLink.getProcessInstanceId()));
 
         if("OK".equals(taskApprovalVO.getFlag())){
             //同意,执行签章
@@ -276,8 +298,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 
                 //获取状态为1(待审批)的分支流程
                 List<TaskParallel> otherLink = this.taskParallelService.list(Wrappers.<TaskParallel>lambdaQuery().eq(TaskParallel::getProcessInstanceId, currentLink.getProcessInstanceId()).eq(TaskParallel::getIsDeleted, 0).eq(TaskParallel::getStatus, 1));
-                //获取主流程
-                Task task = this.getOne(Wrappers.<Task>lambdaQuery().eq(Task::getIsDeleted, 0).eq(Task::getProcessInstanceId, currentLink.getProcessInstanceId()));
+
                 if(otherLink == null || otherLink.size() == 0){
                     //说明都审批完成,将主表状态更改为已完成
                     String finalPdfUrl = null;
@@ -288,18 +309,18 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 //                    finalPdfUrl = this.eVisaClient.eVisaContractSeal(JSONObject.parseObject(JSONObject.toJSONString(taskApprovalVO), EVisaTaskApprovalVO.class), finalPdfUrl);
 
                     //根据主表的业务ID(processInstanceId)获取主流程的taskId
-                    String masterTaskId = this.newFlowClient.queryTaskIdByProcessInstanceId(task.getProcessInstanceId());
+                    String masterTaskId = this.newFlowClient.queryTaskIdByProcessInstanceId(masterTask.getProcessInstanceId());
                     if(StringUtils.isNotEmpty(masterTaskId)){
                         //完成流程
-                        this.newFlowClient.completeApprovalTask(taskId, task.getProcessInstanceId(), "审批完成");
+                        this.newFlowClient.completeApprovalTask(taskId, masterTask.getProcessInstanceId(), "审批完成");
                         //修改主流程状态为已完成
-                        this.update(Wrappers.<Task>lambdaUpdate().set(Task::getStatus, 2).set(Task::getUpdateTime, new Date()).eq(Task::getId, task.getId()));
+                        this.update(Wrappers.<Task>lambdaUpdate().set(Task::getStatus, 2).set(Task::getUpdateTime, new Date()).eq(Task::getId, masterTask.getId()));
                         //修改对应的业务数据状态为已审批
-                        this.updateBusinessDataByFormDataId(task, 2, finalPdfUrl);
+                        this.updateBusinessDataByFormDataId(masterTask, 2, finalPdfUrl);
                     }
                 } else {
                     //只更新PDF路径
-                    this.updateBusinessDataByFormDataId(task, 1,  eVisaStatus.contains("@@@@") ? eVisaStatus.split("@@@@")[1] : null);
+                    this.updateBusinessDataByFormDataId(masterTask, 1,  eVisaStatus.contains("@@@@") ? eVisaStatus.split("@@@@")[1] : null);
                 }
             } else if("eVisaError".equals(eVisaStatus) || eVisaStatus.contains("eVisaError")){
                 //电签失败,将对应分支任务的电签状态修改为99并添加错误信息
@@ -315,6 +336,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         .eq(TaskParallel::getParallelProcessInstanceId, parallelProcessInstanceId)
                 );
 
+                //解锁
+                DistributedRedisLock.release(masterTask.getFormDataId());
+
             } else {
                 //notPfxOrFile,没有证书或证书文件过期等
                 //修改
@@ -324,6 +348,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                         .set(TaskParallel::getUpdateTime, new Date())
                         .eq(TaskParallel::getParallelProcessInstanceId, parallelProcessInstanceId)
                 );
+
+                //解锁
+                DistributedRedisLock.release(masterTask.getFormDataId());
+
                 return false;
             }
         } else {
@@ -475,7 +503,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 break;
             case 3:
                 //日志文件
-                this.updateContractLogBusinessDataStatus(task.getFormDataId(), status);
+                this.updateContractLogBusinessDataStatus(task.getFormDataId(), status, newFileUrl);
                 break;
             default:
                 break;
@@ -485,8 +513,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     /**
      * 施工日志等
      */
-    private void updateContractLogBusinessDataStatus(String formDataId, Integer status){
-        this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getStatus, status).in(ContractLog::getId, Arrays.asList(formDataId.split(","))));
+    private void updateContractLogBusinessDataStatus(String formDataId, Integer status, String newFileUrl){
+        this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getStatus, status).set(ContractLog::getEVisaPdfUrl, newFileUrl).in(ContractLog::getId, Arrays.asList(formDataId.split(","))));
+        //解锁
+        DistributedRedisLock.release(formDataId);
     }
 
     /**
@@ -506,6 +536,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         //更改状态,更改电签文件信息
         wrapper.set(ArchiveFile::getStatus, status).set(ArchiveFile::getEVisaFile, newFileUrl);
         this.archiveFileService.update(wrapper.in(ArchiveFile::getId, Arrays.asList(formDataId.split(","))));
+        //解锁
+        DistributedRedisLock.release(formDataId);
     }
 
 }

+ 0 - 282
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -2197,286 +2197,4 @@ public class ExcelTabController extends BladeController {
         return null;
     }
 
-    /**
-     * 获取首件填报记录
-     */
-    @GetMapping("/get-first-business-data")
-    @ApiOperationSupport(order = 28)
-    @ApiOperation(value = "获取首件填报记录")
-    @ApiImplicitParam(name = "firstId", value = "首件列表ID")
-    public R<List<Map<String, Object>>> getFirstBusinessData(String firstId){
-        if(StringUtils.isNotEmpty(firstId)){
-            List<Map<String, Object>> result = new ArrayList<>();
-
-            JSONObject json = this.informationQueryClient.queryFirstBusinessDataByFirstId(firstId);
-            if(json != null){
-                //获取数据所在表格
-                WbsTreeContract tableNode = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, json.getString("tableId")));
-                if(tableNode != null && StringUtils.isNotEmpty(tableNode.getInitTableName())){
-                    //获取填报数据
-                    List<Map<String, Object>> businessDataMapList = this.jdbcTemplate.queryForList("SELECT * FROM " + tableNode.getInitTableName() + " WHERE group_id = " + json.getString("id"));
-                    if(businessDataMapList.size() > 0){
-                        for(Map<String, Object> mysqlData : businessDataMapList){
-                            //数据结果
-                            Map<String, Object> reData = new HashMap<>();
-
-                            for (String key : mysqlData.keySet()) {
-                                String tabVal = mysqlData.get(key) + "";
-                                // 时间段处理
-                                if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
-                                    if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
-                                        String tabData[] = tabVal.split("_\\^_");
-
-                                        if (reData.containsKey("pickerKey")) {
-                                            String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
-                                            reData.put("pickerKey", pickerKey);
-                                        } else {
-                                            reData.put("pickerKey", key + "__" + tabData[1]);
-                                        }
-
-                                        String sql = tabData[0];
-                                        sql = sql.replaceAll("\\[", "['");
-                                        sql = sql.replaceAll("]", "\']");
-                                        sql = sql.replaceAll("000Z,", "000Z\',");
-                                        sql = sql.replaceAll(", 20", ", \'20");
-                                        sql = sql.replaceAll("'", "");
-                                        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]);
-
-                                    } else if (tabVal.indexOf("☆") >= 0) {
-                                        String mysql[] = tabVal.split("☆");
-                                        for (String data : mysql) {
-                                            String tabData[] = data.split("_\\^_");
-                                            reData.put(key + "__" + tabData[1], tabData[0]);
-                                        }
-                                    } else if (tabVal.indexOf("_^_") >= 0) {
-                                        String tabData[] = tabVal.split("_\\^_");
-                                        reData.put(key + "__" + tabData[1], tabData[0]);
-                                    } else {
-                                        reData.put(key, tabVal);
-                                    }
-                                }
-                            }
-
-                            reData.remove("p_key_id");
-                            reData.remove("classify");
-                            reData.remove("contractId");
-                            reData.remove("pkeyId");
-                            reData.remove("projectId");
-
-                            result.add(reData);
-                        }
-
-                        return R.data(result);
-                    }
-                }
-            }
-        }
-
-        return R.data(300, null, "未找到对应的业务数据");
-    }
-
-    /**
-     * 预览首件PDF
-     */
-    @GetMapping("/get-first-pdf-info")
-    @ApiOperationSupport(order = 28)
-    @ApiOperation(value = "获取首件填报记录")
-    @ApiImplicitParam(name = "firstId", value = "首件列表ID")
-    public R<String> getFirstPdfInfo(String firstId){
-        if(StringUtils.isNotEmpty(firstId)){
-            //PDF路径集合
-            List<String> pdfUrls = new ArrayList<>();
-
-            //获取配置的路径
-            String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-            //获取数据
-            JSONObject firstJson = this.informationQueryClient.queryFirstBusinessDataByFirstId(firstId);
-            if(firstJson != null){
-                if(StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) || StringUtils.isNotEmpty(firstJson.getString("pdfUrl"))){
-                    pdfUrls.add(StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) ? firstJson.getString("eVisaPdfUrl") : firstJson.getString("pdfUrl"));
-                } else {
-                    //没有生成拼接的记录,生成
-                    //获取html
-                    WbsTreeContract tableNode = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, firstJson.getString("tableId")));
-
-                    if(tableNode == null){
-                        return R.fail("该数据下无此节点!");
-                    }
-
-                    if(StringUtils.isEmpty(tableNode.getHtmlUrl())){
-                        return R.fail("请关联清表!");
-                    }
-
-                    // 获取清表信息
-                    ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
-                    if (excelTab == null) {
-                        return R.fail("失败");
-                    }
-
-                    List<Map<String, Object>> businessDataMapList = this.getFirstBusinessData(firstId).getData();
-
-                    try{
-                        //处理数据
-                        for(Map<String, Object> dataMap : businessDataMapList){
-                            // 获取excel流 和 html流
-                            Workbook wb = new Workbook();
-                            wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
-                            //获取工作表
-                            Worksheet sheet = wb.getWorksheets().get(0);
-
-                            // 数据不为空 &&
-                            if (StringUtils.isNotEmpty(tableNode.getHtmlUrl())) {
-                                File htmlFile = ResourceUtil.getFile(tableNode.getHtmlUrl());
-                                if (htmlFile.exists()) {
-                                    String htmlString = IoUtil.readToString(new FileInputStream(htmlFile));
-                                    Document doc = Jsoup.parse(htmlString);
-                                    Element table = doc.select("table").first();
-                                    Elements trs = table.select("tr");
-
-                                    if (ObjectUtil.isNotEmpty(dataMap)) {
-                                        for (String val : dataMap.keySet()) {
-                                            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) {
-                                                    int x1, y1;
-
-                                                    if (data.html().indexOf("el-tooltip") >= 0) {
-                                                        x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
-                                                        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 = dataMap.get(val) + "";
-                                                    if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
-                                                        if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
-                                                            myData = myData.replace("[", "").replace("]", "");
-                                                            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});
-
-                                                            String end_dataStr[] = dataVal[1].split("T")[0].split("-");
-                                                            String endDate = StringUtil.format("{}年{}月{}日", new Object[]{end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1});
-
-                                                            if (StartDate.equals(endDate)) {
-                                                                myData = StartDate;
-                                                            } else {
-                                                                myData = StartDate + "-" + endDate;
-                                                            }
-                                                        } else {
-                                                            String dataStr[] = myData.split("T")[0].split("-");
-                                                            myData = StringUtil.format("{}年{}月{}日", new Object[]{dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1});
-                                                        }
-                                                    }
-
-                                                    if (myData.indexOf("https") >= 0 && myData.indexOf("aliyuncs") >= 0) {
-                                                        Element element = trs.get(y1).select("td").get(x1);
-                                                        String styles[] = element.attr("style").split(";");
-                                                        int Height = 0;
-                                                        for (String sty : styles) {
-                                                            if (sty.indexOf("height:") >= 0) {
-                                                                Height = Integer.parseInt(sty.replace("height:", "").replace("px", ""));
-                                                            }
-                                                        }
-
-                                                        BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
-                                                        ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
-                                                        pic.setHeight(Height);
-                                                        sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
-
-                                                    } else {
-                                                        final CellRange cellRange = sheet.getCellRange(y1, x1);
-                                                        cellRange.setText(myData);
-                                                    }
-                                                }
-                                            }
-                                        }
-                                    }
-
-                                    // 组装电签设置
-                                    QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
-                                    queryWrapper.eq("type", 2);
-                                    queryWrapper.eq("tab_id", tableNode.getPKeyId());
-
-                                    final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
-                                    if (textdictInfos != null && !textdictInfos.isEmpty()) {
-                                        textdictInfos.forEach(e -> {
-                                            String key = e.getColKey();
-                                            String keys[] = key.split("__");
-                                            String[] trtd = keys[1].split("_");
-                                            Element data = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
-                                            int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
-                                            if (x1 == 0) {
-                                                x1 = 1;
-                                            }
-                                            int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
-
-                                            final CellRange cellRange = sheet.getCellRange(y1, x1);
-
-                                            cellRange.setText(e.getId() + "");
-                                            cellRange.getCellStyle().getFont().setColor(Color.white);
-
-                                        });
-                                    }
-                                }
-                            }
-
-                            Long fileName = SnowFlakeUtil.getId();
-                            String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
-
-                            sheet.saveToPdf(onePdfPath);
-
-                            BladeFile bladeFile = this.newIOSSClient.uploadFile( fileName + ".pdf", onePdfPath);
-
-                            pdfUrls.add(bladeFile.getLink());
-
-                            wb.dispose();
-                        }
-                    }catch (Exception e){
-                        e.printStackTrace();
-                    }
-                }
-
-                if(pdfUrls.size() > 0){
-                    try{
-                        //关联的数据
-                        if(StringUtils.isNotEmpty(firstJson.getString("linkMergePdfUrl"))){
-                            pdfUrls.add(firstJson.getString("linkMergePdfUrl"));
-                        }
-                        //总结报告,暂时无
-
-                        //上传
-                        String mergePdfPath = file_path + "/pdf//" + firstId + ".pdf";
-                        File oldMergePdf = ResourceUtil.getFile(mergePdfPath);
-                        if (oldMergePdf.exists()) {
-                            oldMergePdf.delete();
-                        }
-                        //合并
-                        FileUtils.mergePdfPublicMethods(pdfUrls, mergePdfPath);
-                        //上传
-                        BladeFile mergeFile = this.newIOSSClient.uploadFile(firstId + '-' + new Date().getTime() + ".pdf", mergePdfPath);
-
-                        //返回
-                        return R.data(mergeFile.getLink());
-
-                    }catch (Exception e){
-                        e.printStackTrace();
-                    }
-                }
-            }
-        }
-
-        return R.data(300, null, "未找到数据");
-    }
-
 }

+ 261 - 180
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FirstController.java

@@ -1,9 +1,11 @@
 package org.springblade.manager.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.spire.xls.CellRange;
 import com.spire.xls.ExcelPicture;
 import com.spire.xls.Workbook;
 import com.spire.xls.Worksheet;
@@ -15,7 +17,10 @@ import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
+import org.springblade.business.feign.InformationQueryClient;
+import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
@@ -27,20 +32,20 @@ import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.IOSSClient;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.resource.vo.NewBladeFile;
+import org.springblade.system.cache.ParamCache;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.imageio.ImageIO;
+import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.util.Comparator;
-import java.util.HashMap;
+import java.util.*;
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
 
 
@@ -70,6 +75,11 @@ public class FirstController extends BladeController {
 
     private final JdbcTemplate jdbcTemplate;
 
+    private final InformationQueryClient informationQueryClient;
+
+    private final ITextdictInfoService textdictInfoService;
+
+
     /**
      * 首件表单获取 html页面
      */
@@ -79,7 +89,7 @@ public class FirstController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "contractId", value = "contractId", required = true)
     })
-    public R getFirstExcelHtml(Long contractId) throws IOException, InterruptedException {
+    public R getFirstExcelHtml(Long contractId) throws IOException {
 
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getContractId,contractId).eq(WbsTreeContract::getTableType,"111"));
@@ -159,213 +169,284 @@ public class FirstController extends BladeController {
 
     @GetMapping("/get-first-buss-pdfInfo")
     @ApiOperationSupport(order = 3)
-    @ApiOperation(value = "首件-pdf预览", notes = "首件-单pdf预览")
-    @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true),
-            @ApiImplicitParam(name = "liunkIds", value = "liunkIds", required = true)
-    })
-    public R getBussPdfInfo(Long pkeyId,String liunkIds) throws Exception {
-
-        WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
-                .eq(WbsTreeContract::getPKeyId, pkeyId));
+    @ApiOperation(value = "首件-pdf预览", notes = "首件列表ID")
+    @ApiImplicitParam(name = "firstId", value = "pkeyId", required = true)
+    public R<String> getBussPdfInfo(String firstId) throws Exception {
+        if(StringUtils.isNotEmpty(firstId)){
+            //PDF路径集合
+            List<String> pdfUrls = new ArrayList<>();
+
+            //获取配置的路径
+            String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+            //获取数据
+            JSONObject firstJson = this.informationQueryClient.queryFirstBusinessDataByFirstId(firstId);
+            if(firstJson != null){
+                if(StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) || StringUtils.isNotEmpty(firstJson.getString("pdfUrl"))){
+                    pdfUrls.add(StringUtils.isNotEmpty(firstJson.getString("eVisaPdfUrl")) ? firstJson.getString("eVisaPdfUrl") : firstJson.getString("pdfUrl"));
+                } else {
+                    //没有生成拼接的记录,生成
+                    //获取html
+                    WbsTreeContract tableNode = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, firstJson.getString("tableId")));
+
+                    if(tableNode == null){
+                        return R.fail("该数据下无此节点!");
+                    }
 
-        if(wbsTreeContract ==null ){
-            return R.fail("该数据下无此节点!");
-        }
-        if(wbsTreeContract.getHtmlUrl()==null){
-            return R.fail("请关联清表!");
-        }
+                    if(StringUtils.isEmpty(tableNode.getHtmlUrl())){
+                        return R.fail("请关联清表!");
+                    }
 
-        String pdfPath="/Users/hongchuangyanfa/Desktop/pdf//"+pkeyId+".pdf";
-        File tabpdf = ResourceUtil.getFile(pdfPath);
-        if(tabpdf.exists()){
-            tabpdf.delete();
-        }
+                    // 获取清表信息
+                    ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
+                    if (excelTab == null) {
+                        return R.fail("失败");
+                    }
 
-        // 获取清表信息
-        ExcelTab excelTab = excelTabService.getById(wbsTreeContract.getExcelId());
-
-        Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId).getData();
-
-        // 获取excel流 和 html流
-        Workbook wb = new Workbook();
-        wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
-        //获取工作表
-        Worksheet sheet = wb.getWorksheets().get(0);
-
-        if (DataInfo != null && DataInfo.size() >= 1) {
-            File htmlFile = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
-            String htmlString =  IoUtil.readToString(new FileInputStream(htmlFile));
-            Document doc = Jsoup.parse(htmlString);
-            Element table = doc.select("table").first();
-            Elements trs = table.select("tr");
-            for(String val : DataInfo.keySet()){
-                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){
-                        int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
-                        if(x1==0){
-                            x1=1;
-                        }
-                        int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
-                        String myData = DataInfo.get(val)+"";
-                        if(myData.indexOf("T")>=0 && myData.indexOf("-")>=0){
-                            if(myData.indexOf(",")>=0 && myData.indexOf("]")>=0){
-                                myData = myData.replace("[","").replace("]","");
-                                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});
-
-                                String end_dataStr[] = dataVal[1].split("T")[0].split("-");
-                                String endDate = StringUtil.format("{}年{}月{}日", new Object[]{end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2])+1});
-
-                                if(StartDate.equals(endDate)){
-                                    myData = StartDate;
-                                }else{
-                                    myData = StartDate +"-" +endDate;
+                    List<Map<String, Object>> businessDataMapList = this.getFirstBusinessData(firstId).getData();
+
+                    try{
+                        //处理数据
+                        for(Map<String, Object> dataMap : businessDataMapList){
+                            // 获取excel流 和 html流
+                            Workbook wb = new Workbook();
+                            wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
+                            //获取工作表
+                            Worksheet sheet = wb.getWorksheets().get(0);
+
+                            // 数据不为空 &&
+                            if (StringUtils.isNotEmpty(tableNode.getHtmlUrl())) {
+                                File htmlFile = ResourceUtil.getFile(tableNode.getHtmlUrl());
+                                if (htmlFile.exists()) {
+                                    String htmlString = IoUtil.readToString(new FileInputStream(htmlFile));
+                                    Document doc = Jsoup.parse(htmlString);
+                                    Element table = doc.select("table").first();
+                                    Elements trs = table.select("tr");
+
+                                    if (ObjectUtil.isNotEmpty(dataMap)) {
+                                        for (String val : dataMap.keySet()) {
+                                            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) {
+                                                    int x1, y1;
+
+                                                    if (data.html().indexOf("el-tooltip") >= 0) {
+                                                        x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
+                                                        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 = dataMap.get(val) + "";
+                                                    if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
+                                                        if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
+                                                            myData = myData.replace("[", "").replace("]", "");
+                                                            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});
+
+                                                            String end_dataStr[] = dataVal[1].split("T")[0].split("-");
+                                                            String endDate = StringUtil.format("{}年{}月{}日", new Object[]{end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1});
+
+                                                            if (StartDate.equals(endDate)) {
+                                                                myData = StartDate;
+                                                            } else {
+                                                                myData = StartDate + "-" + endDate;
+                                                            }
+                                                        } else {
+                                                            String dataStr[] = myData.split("T")[0].split("-");
+                                                            myData = StringUtil.format("{}年{}月{}日", new Object[]{dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1});
+                                                        }
+                                                    }
+
+                                                    if (myData.indexOf("https") >= 0 && myData.indexOf("aliyuncs") >= 0) {
+                                                        Element element = trs.get(y1).select("td").get(x1);
+                                                        String styles[] = element.attr("style").split(";");
+                                                        int Height = 0;
+                                                        for (String sty : styles) {
+                                                            if (sty.indexOf("height:") >= 0) {
+                                                                Height = Integer.parseInt(sty.replace("height:", "").replace("px", ""));
+                                                            }
+                                                        }
+
+                                                        BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
+                                                        ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
+                                                        pic.setHeight(Height);
+                                                        sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
+
+                                                    } else {
+                                                        final CellRange cellRange = sheet.getCellRange(y1, x1);
+                                                        cellRange.setText(myData);
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+
+                                    // 组装电签设置
+                                    QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
+                                    queryWrapper.eq("type", 2);
+                                    queryWrapper.eq("tab_id", tableNode.getPKeyId());
+
+                                    final List<TextdictInfo> textdictInfos = this.textdictInfoService.getBaseMapper().selectList(queryWrapper);
+                                    if (textdictInfos != null && !textdictInfos.isEmpty()) {
+                                        textdictInfos.forEach(e -> {
+                                            String key = e.getColKey();
+                                            String keys[] = key.split("__");
+                                            String[] trtd = keys[1].split("_");
+                                            Element data = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
+                                            int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
+                                            if (x1 == 0) {
+                                                x1 = 1;
+                                            }
+                                            int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
+
+                                            final CellRange cellRange = sheet.getCellRange(y1, x1);
+
+                                            cellRange.setText(e.getId() + "");
+                                            cellRange.getCellStyle().getFont().setColor(Color.white);
+
+                                        });
+                                    }
                                 }
-                            }else {
-                                String dataStr[] = myData.split("T")[0].split("-");
-                                myData = StringUtil.format("{}年{}月{}日", new Object[]{dataStr[0], dataStr[1], Integer.parseInt(dataStr[2])+1});
                             }
-                        }
-                        https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
-                        if(myData.indexOf("https")>=0 && myData.indexOf("aliyuncs")>=0){
-                            System.out.println(myData);
 
-                            BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData) );
-                            ExcelPicture pic = sheet.getPictures().add(y1, x1,image);
+                            Long fileName = SnowFlakeUtil.getId();
+                            String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
 
-                            sheet.getCellRange(y1,x1).getStyle().setShrinkToFit(true);
+                            sheet.saveToPdf(onePdfPath);
 
-                        }else{
-                            sheet.getCellRange(y1,x1).setText(myData);
-                        }
-                    }
-                }
-            }
-        }
+                            BladeFile bladeFile = this.newIOSSClient.uploadFile( fileName + ".pdf", onePdfPath);
 
-        sheet.saveToPdf(pdfPath);
-
-        BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
-        //
-        TableFile tableFile1 = tableFileService.getBaseMapper().selectOne(Wrappers.<TableFile>query().lambda()
-                .eq(TableFile::getTabId, pkeyId).eq(TableFile::getType,1));
-        if(tableFile1!=null){
-            tableFile1.setDomainPdfUrl(bladeFile.getLink());
-            tableFileService.saveOrUpdate(tableFile1);
-        }else{
-            TableFile tableFile = new TableFile();
-            String fileExtension = FileUtil.getFileExtension(wbsTreeContract.getFullName()+".pdf");
-            tableFile.setTabId(pkeyId+"");
-            tableFile.setName(wbsTreeContract.getFullName()+".pdf");
-            tableFile.setType(1);
-            tableFile.setDomainUrl(bladeFile.getLink());
-            tableFile.setIsDeleted(0);
-            tableFile.setExtension(fileExtension);
-            tableFile.setDomainPdfUrl(bladeFile.getLink());
-            tableFileService.saveOrUpdate(tableFile);
-        }
+                            pdfUrls.add(bladeFile.getLink());
 
-        List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId).eq(TableFile::getIsDeleted,0));
-        tableFileList.sort(Comparator.comparing(TableFile::getType));
+                            //将封面的pdf修改
+                            String updatePdfUrl = "UPDATE u_information_query SET pdf_url = " + bladeFile.getLink() + " WHERE id = " + firstId;
+                            this.jdbcTemplate.execute(updatePdfUrl);
 
+                            wb.dispose();
+                        }
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
+                }
 
-        List<String> dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl()!=null).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
+                if(pdfUrls.size() > 0){
+                    try{
+                        //关联的数据
+                        if(StringUtils.isNotEmpty(firstJson.getString("linkMergePdfUrl"))){
+                            pdfUrls.add(firstJson.getString("linkMergePdfUrl"));
+                        }
+                        //总结报告,暂时无
 
-        String pdfPath2 = "/Users/hongchuangyanfa/Desktop/pdf//"+pkeyId+"_2.pdf";
+                        //上传
+                        String mergePdfPath = file_path + "/pdf//" + firstId + ".pdf";
+                        File oldMergePdf = ResourceUtil.getFile(mergePdfPath);
+                        if (oldMergePdf.exists()) {
+                            oldMergePdf.delete();
+                        }
+                        //合并
+                        FileUtils.mergePdfPublicMethods(pdfUrls, mergePdfPath);
+                        //上传
+                        BladeFile mergeFile = this.newIOSSClient.uploadFile(firstId + '-' + new Date().getTime() + ".pdf", mergePdfPath);
 
-        FileUtils.mergePdfPublicMethods(dataListPdf,pdfPath2);
+                        //返回
+                        return R.data(mergeFile.getLink());
 
-        BladeFile bladeFile2 = newIOSSClient.uploadFile(pkeyId + "2.pdf", pdfPath2);
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
 
-        UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.in("p_key_id",pkeyId);
-        updateWrapper.set("pdf_url",bladeFile2.getLink());
-        wbsTreeContractService.update(updateWrapper);
-        wb.dispose();
-        return R.data(bladeFile2.getLink());
+        return R.data(300, null, "未找到数据");
     }
 
     @GetMapping("/get-first-buss-dataInfo")
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "获取首件用户保存数据", notes = "获取首件用户保存数据")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
+            @ApiImplicitParam(name = "firstId", value = "pkeyId", required = true)
     })
-    public R getBussDataInfo(Long pkeyId) throws FileNotFoundException {
-
-        Map<String, Object> reData = new HashMap<>();
-
-        WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
-                .eq(WbsTreeContract::getPKeyId, pkeyId));
-
-        if(wbsTreeContract ==null ){
-            return R.data(reData);
-        }
-        if(wbsTreeContract.getHtmlUrl()==null){
-            return R.data(reData);
-        }
-        //表单是否存储在
-        String tabName = wbsTreeContract.getInitTableName();
-        String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='"+tabName+"'";
-        List<Map<String, Object>> tablist = jdbcTemplate.queryForList(isExitSql);
-        if(tablist==null || tablist.size()<=0){
-            return R.fail("无实体表对应");
-        }
+    public R<List<Map<String, Object>>> getFirstBusinessData(String firstId) {
+        if(StringUtils.isNotEmpty(firstId)){
+            List<Map<String, Object>> result = new ArrayList<>();
+
+            JSONObject json = this.informationQueryClient.queryFirstBusinessDataByFirstId(firstId);
+            if(json != null){
+                //获取数据所在表格
+                WbsTreeContract tableNode = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, json.getString("tableId")));
+                if(tableNode != null && StringUtils.isNotEmpty(tableNode.getInitTableName())){
+                    //获取填报数据
+                    List<Map<String, Object>> businessDataMapList = this.jdbcTemplate.queryForList("SELECT * FROM " + tableNode.getInitTableName() + " WHERE group_id = " + json.getString("id"));
+                    if(businessDataMapList.size() > 0){
+                        for(Map<String, Object> mysqlData : businessDataMapList){
+                            //数据结果
+                            Map<String, Object> reData = new HashMap<>();
+
+                            for (String key : mysqlData.keySet()) {
+                                String tabVal = mysqlData.get(key) + "";
+                                // 时间段处理
+                                if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
+                                    if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
+                                        String tabData[] = tabVal.split("_\\^_");
+
+                                        if (reData.containsKey("pickerKey")) {
+                                            String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
+                                            reData.put("pickerKey", pickerKey);
+                                        } else {
+                                            reData.put("pickerKey", key + "__" + tabData[1]);
+                                        }
+
+                                        String sql = tabData[0];
+                                        sql = sql.replaceAll("\\[", "['");
+                                        sql = sql.replaceAll("]", "\']");
+                                        sql = sql.replaceAll("000Z,", "000Z\',");
+                                        sql = sql.replaceAll(", 20", ", \'20");
+                                        sql = sql.replaceAll("'", "");
+                                        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]);
+
+                                    } else if (tabVal.indexOf("☆") >= 0) {
+                                        String mysql[] = tabVal.split("☆");
+                                        for (String data : mysql) {
+                                            String tabData[] = data.split("_\\^_");
+                                            reData.put(key + "__" + tabData[1], tabData[0]);
+                                        }
+                                    } else if (tabVal.indexOf("_^_") >= 0) {
+                                        String tabData[] = tabVal.split("_\\^_");
+                                        reData.put(key + "__" + tabData[1], tabData[0]);
+                                    } else {
+                                        reData.put(key, tabVal);
+                                    }
+                                }
+                            }
 
-        String querySql = "select * from "+wbsTreeContract.getInitTableName()+" where p_key_id="+pkeyId ;
-        List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
+                            reData.remove("p_key_id");
+                            reData.remove("classify");
+                            reData.remove("contractId");
+                            reData.remove("pkeyId");
+                            reData.remove("projectId");
 
-        if(dataIn==null||dataIn.size()<=0){
-            return R.data(reData);
-        }
-        Map<String, Object> mysqlData = dataIn.get(0);
-
-        //
-        for(String key:mysqlData.keySet()) {
-            String tabVal = mysqlData.get(key) + "";
-            // 时间段处理
-            if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
-                if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
-                    String tabData[] = tabVal.split("__");
-                    if (reData.containsKey("pickerKey")) {
-                        String pickerKey = reData.get("pickerKey") + "," + tabData[1];
-                        reData.put("pickerKey", pickerKey);
-                    } else {
-                        reData.put("pickerKey", key + "__" + tabData[1]);
-                    }
+                            result.add(reData);
+                        }
 
-                    String sql = tabData[0];
-                    sql = sql.replaceAll("\\[", "['");
-                    sql = sql.replaceAll("]", "\']");
-                    sql = sql.replaceAll("000Z,", "000Z\',");
-                    sql = sql.replaceAll(", 20", ", \'20");
-                    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]);
-
-                } else if (tabVal.indexOf(",") >= 0) {
-                    String mysql[] = tabVal.split(",");
-                    for (String data : mysql) {
-                        String tabData[] = data.split("__");
-                        reData.put(key + "__" + tabData[1], tabData[0]);
+                        return R.data(result);
                     }
-                } else if(tabVal.indexOf("__")>=0){
-                    String tabData[] = tabVal.split("__");
-                    reData.put(key + "__" + tabData[1], tabData[0]);
-                }else{
-                    reData.put(key, tabVal);
                 }
             }
         }
 
-        return R.data(reData);
+        return R.data(300, null, "未找到对应的业务数据");
     }
 
 }