Browse Source

质检日志重签

DengLinLang 4 months ago
parent
commit
356121cc0e

+ 2 - 2
blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/OssBuilder.java

@@ -84,8 +84,8 @@ public class OssBuilder {
     public OssTemplateRe template(String code) {
         String tenantId = AuthUtil.getTenantId();
         Oss oss = getOss(tenantId, code);
-        oss.setEndpoint("http://183.247.216.148:9000/");
-       //oss.setEndpoint("https://oss-cn-shenzhen.aliyuncs.com/");
+        //oss.setEndpoint("http://183.247.216.148:9000/");
+       oss.setEndpoint("https://oss-cn-shenzhen.aliyuncs.com/");
         Oss ossCached = ossPool.get(tenantId);
         OssTemplateRe template = templatePool.get(tenantId);
         // 若为空或者不一致,则重新加载

+ 6 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/reSigningEVisaDTO.java

@@ -19,4 +19,10 @@ public class reSigningEVisaDTO {
     private String projectId;
 
     private Integer type;
+    //日志重签-日志id
+    private String logIds;
+    //日志重签-父节点p_key_id
+    private Long nodePrimaryKeyId;
+    //日志重签-表单p_key_id
+    private Long logPkeyId;
 }

+ 4 - 4
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ExcelTabClient.java

@@ -5,10 +5,7 @@ import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.core.tool.api.R;
 import org.springblade.manager.entity.ExcelTab;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -64,4 +61,7 @@ public interface ExcelTabClient {
     // 保存
     @PostMapping(API_PREFIX + "/saveEntrustTabData")
     String saveEntrustTabData(@RequestBody JSONObject table) throws RuntimeException;
+    // 获取质检日志的pdf数据
+    @GetMapping(  API_PREFIX + "/get-the-log-pdfInfo")
+    R<String> getTheContractLogBusinessData(@RequestParam String pkeyId, @RequestParam String nodePrimaryKeyId,@RequestParam String recordTime,@RequestParam String contractId) throws Exception;
 }

+ 5 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ExcelTabClientFallBack.java

@@ -57,4 +57,9 @@ public class ExcelTabClientFallBack implements ExcelTabClient {
         return null;
     }
 
+    @Override
+    public R<String> getTheContractLogBusinessData(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId) {
+        return null;
+    }
+
 }

+ 15 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -1623,6 +1623,21 @@ public class TaskController extends BladeController {
         return R.success("任务已经成功提交重签,请耐心等待!");
     }
 
+    /**
+     * 质检-日志-一键重签
+     */
+    @PostMapping("/logReSigningEVisa")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "质检-日志-一键重签", notes = "传入taskIds、下拉框的contractId、projectId")
+    public R<Object> logReSigningEVisa(@RequestBody reSigningEVisaDTO dto, HttpServletRequest request) {
+        if (StringUtils.isBlank(dto.getLogIds())) {
+            return R.fail("请选择一条记录");
+        }
+        String header = request.getHeader("Blade-Auth");
+        taskService.logReSigningEVisa(dto.getLogIds(),dto.getLogPkeyId(),dto.getNodePrimaryKeyId(), dto.getContractId(),request,dto.getType());
+        return R.success("任务已经成功提交重签,请耐心等待!");
+    }
+
     /**
      * 任务超时提示信息
      */

+ 6 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java

@@ -113,4 +113,10 @@ public interface ITaskService extends BaseService<Task> {
      * 试验自检任务业务相关
      */
     void trialSelfTaskRelated(TaskApprovalVO taskApprovalVO, String pdfUrlEVisa, String batchId) throws FileNotFoundException;
+
+    /**
+     * 质检-日志重签
+     */
+    @Async
+    void logReSigningEVisa(String logIds,Long logPkeyId,Long nodePrimaryKeyId, String contractId,HttpServletRequest request, Integer type);
 }

+ 118 - 13
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -209,7 +209,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         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;
     }
 
@@ -954,6 +953,112 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         }
     }
 
+    /**
+     * 质检-日志重签
+     */
+    @Override
+    public void logReSigningEVisa( String logids,Long logPkeyId, Long nodePrimaryKeyId, String contractId ,HttpServletRequest request, Integer type) {
+        List<Task> taskList = jdbcTemplate.query("select * from u_task where form_data_id in(" + logids + ")", new BeanPropertyRowMapper<>(Task.class));
+        if (taskList.size() > 0) {
+            //获取任务详情信息Map
+            Set<String> processInstanceIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toSet());
+            Map<String, List<TaskParallel>> taskParallelGroupMap = new HashMap<>();
+            if (processInstanceIds.size() > 0) {
+                String resultIds = processInstanceIds.stream()
+                        .map(id -> "'" + id + "'")
+                        .collect(Collectors.joining(","));
+                taskParallelGroupMap = jdbcTemplate.query("select parallel_process_instance_id,process_instance_id,e_visa_status,task_user,task_user_name,status from u_task_parallel where process_instance_id in(" + resultIds + ") order by id", new BeanPropertyRowMapper<>(TaskParallel.class)).stream().collect(Collectors.groupingBy(TaskParallel::getProcessInstanceId));
+            }
+            Map<String, List<TaskParallel>> finalTaskParallelGroupMap = taskParallelGroupMap;
+            //获取所有日志数据 生成map
+            List<String> formDataIdList = taskList.stream().map(Task::getFormDataId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
+            String formDataIds = String.join(",", formDataIdList);
+            List<ContractLog> contractLogList = jdbcTemplate.query("select * from u_contract_log where id in (" + formDataIds + ")", new BeanPropertyRowMapper<>(ContractLog.class));
+            Map<Long, ContractLog> contractLogMap = contractLogList.stream().collect(Collectors.toMap(ContractLog::getId, ContractLog -> ContractLog));
+            try {
+                for (Task task : taskList) {
+                    ContractLog contractLog = contractLogMap.get(Long.valueOf(task.getFormDataId()));
+                    R result = new R();
+                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%"+task.getId()+"%'");
+                    boolean b = false;
+                    if(type == 1){
+                         b = contractLogService.update(new LambdaUpdateWrapper<ContractLog>().eq(ContractLog::getId, contractLog.getId())
+                                .set(ContractLog::getEVisaPdfUrl, null)
+                                .set(ContractLog::getPdfUrl, null));
+                    }else {
+                         b = contractLogService.update(new LambdaUpdateWrapper<ContractLog>().eq(ContractLog::getId, contractLog.getId())
+                                .set(ContractLog::getEVisaPdfUrl, null));
+                    }
+
+
+                    if (type == 1) {
+                        //重新保存
+                        long startTime_1 = System.currentTimeMillis();
+                        //获取详细的日志数据
+
+                        result = excelTabClient.getTheContractLogBusinessData(logPkeyId.toString(), nodePrimaryKeyId.toString(), contractLog.getRecordTime(), contractId);
+                        long endTime_1 = System.currentTimeMillis();
+                        long executionTime_1 = endTime_1 - startTime_1;
+                        log.info("saveNodePdf执行时间:" + executionTime_1 + " 毫秒");
+                    }else{
+                        if (!b){
+                            throw new ServiceException("清空电签PDF失败");
+                        }
+                        result.setData("成功");
+                    }
+                    //重新电签
+                    if (result != null && "成功".equals(result.getData())) {
+                        List<TaskApprovalVO> taskApprovalVOS = new ArrayList<>();
+                        List<TaskParallel> taskParallelList = finalTaskParallelGroupMap.get(task.getProcessInstanceId());
+                        for (TaskParallel taskParallel : taskParallelList) {
+                            //待审批的不进行重签, 存在待审批,但是电签状态是失败的
+                            if (!(new Integer(1)).equals(taskParallel.getStatus()) || (taskParallel.getEVisaStatus() != null && taskParallel.getEVisaStatus() == 99)) {
+                                TaskApprovalVO approvalVO = new TaskApprovalVO();
+                                approvalVO.setTaskId(task.getId().toString());
+                                approvalVO.setFlag("OK");
+                                approvalVO.setComment("重新发起电签");
+                                approvalVO.setApprovalType(3);
+                                approvalVO.setFormDataId(task.getFormDataId());
+                                approvalVO.setParallelProcessInstanceId(taskParallel.getParallelProcessInstanceId());
+                                approvalVO.setYsNickName(taskParallel.getTaskUserName());
+                                approvalVO.setUserId(Long.parseLong(taskParallel.getTaskUser()));
+                                taskApprovalVOS.add(approvalVO);
+                            }
+                        }
+                        long startTime_2 = System.currentTimeMillis();
+                        if(taskApprovalVOS!=null && taskApprovalVOS.size()>=1){
+                            this.batchCompleteApprovalTask(taskApprovalVOS);
+                        }
+                        long endTime_2 = System.currentTimeMillis();
+                        long executionTime_2 = endTime_2 - startTime_2;
+                        log.info("batchCompleteApprovalTask执行时间:" + executionTime_2 + " 毫秒");
+                        /*//修改记录人
+                        if(ObjectUtil.isNotEmpty(contractLog.getCreateUser())){
+                            Long userId = AuthUtil.getUserId(request);
+                            String userName = AuthUtil.getNickName(request);
+                            if(userId == contractLog.getCreateUser()){
+                                    contractLog.setCreateUser(userId);
+                                    contractLog.setCreateUserName(userName);
+                                    jdbcTemplate.execute("update u_contract_log set create_user = "+userId+",create_user_name = '"+userName+"' where id = "+contractLog.getId());
+                            }
+                        }*/
+                    } else {
+                        //修改重签状态为保存PDF失败
+                        this.taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
+                                .set(TaskParallel::getEVisaContent, "重新保存PDF失败")
+                                .eq(TaskParallel::getProcessInstanceId, task.getProcessInstanceId()));
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());
+            }
+
+        }else {
+            throw new ServiceException("未获取到任务信息,操作失败!");
+        }
+    }
+
     @Override
     public Boolean startApproval(TaskVO vo) {
         if (ObjectUtil.isEmpty(vo.getReportUserId()) || ObjectUtil.isEmpty(vo.getReportUserName())) {
@@ -1473,12 +1578,20 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 for (Task task : taskList) {
                     R result = new R();
                     jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%"+task.getId()+"%'");
-                    boolean b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
-                            .eq(InformationQuery::getId, task.getFormDataId())
-                            .set(InformationQuery::getEVisaPdfUrl, null)
-                            .set(InformationQuery::getPdfUrl, null));
+                    boolean b = false;
+                    if(type == 1){
+                         b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                .eq(InformationQuery::getId, task.getFormDataId())
+                                .set(InformationQuery::getEVisaPdfUrl, null)
+                                .set(InformationQuery::getPdfUrl, null));
+                    }else {
+                        b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
+                                .eq(InformationQuery::getId, task.getFormDataId())
+                                .set(InformationQuery::getEVisaPdfUrl, null));
+                    }
 
                     if (type == 1) {
+
                         //重新保存
                         long startTime_1 = System.currentTimeMillis();
                         result = this.saveNodePdf(typeMap.get(task.getFormDataId()), queryMap.get(task.getFormDataId()), contractId, projectId, header);
@@ -1524,14 +1637,6 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                                 .eq(TaskParallel::getProcessInstanceId, task.getProcessInstanceId()));
                     }
                 }
-                //获取当前操作人
-                Long userId = AuthUtil.getUserId(request);
-                String userName = AuthUtil.getNickName(request);
-                //判断是否是超级管理员并且是泓创智诚下的部门
-                if(judgeRoleIdAndDeptId(userId)){
-                    //满足去除当前填报人的条件 去除当前任务的填报人中当前操作人的信息
-                    removeUserAndName(taskIds, userId, userName);
-                }
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new ServiceException("重新保存PDF信息失败,原因:" + e.getMessage());

+ 4 - 4
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/EVisaController.java

@@ -9,8 +9,6 @@ import org.apache.commons.lang.StringUtils;
 import org.springblade.business.entity.Task;
 import org.springblade.business.feign.TaskClient;
 import org.springblade.business.vo.TaskApprovalVO;
-import org.springblade.common.utils.CommonUtil;
-import org.springblade.common.utils.SystemUtils;
 import org.springblade.evisa.service.EVisaService;
 import org.springblade.evisa.vo.EVisaTaskApprovalVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -61,13 +59,15 @@ public class EVisaController {
 
     // 电签主类
 
-    @Scheduled(cron = "0/10 * * * * ?")
+    //@Scheduled(cron = "0/10 * * * * ?")
+    @Scheduled(cron = "0/1 * * * * ?")
     public void SignInfo() {
         //执行代码
 
         log.info("扫描开始");
        // String sql = "SELECT * from u_task_batch where json_data like '%1840658122872455168%' and is_deleted<>5  LIMIT 10";
-        String sql = "SELECT * from u_task_batch where is_deleted<>5 and nick_name='王龙' LIMIT 10";
+        //String sql = "SELECT * from u_task_batch where is_deleted<>5 and nick_name='王龙' LIMIT 10";
+        String sql = "SELECT * from u_task_batch where is_deleted<>5 and nick_name='邓淋浪' LIMIT 1";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
         if (maps != null && maps.size() >= 1 ) {//&& SystemUtils.isLinux()
             for (Map<String, Object> dataInfo : maps) {

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TextdictInfoController.java

@@ -519,7 +519,7 @@ public class TextdictInfoController extends BladeController {
             }
         }
         File writeFile = new File(wbsTreePrivate.getHtmlUrl());
-//        File writeFile = new File("D:\\file\\downfile\\1792757075013533696.html");
+        //File writeFile = new File("D:\\file\\downfile\\1792757075013533696.html");
         FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
 
         String str1 = wbsTreePrivate.getHtmlUrl().replace("Desktop//privateUrl", "Desktop/privateUrl");

+ 613 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java

@@ -2,24 +2,35 @@ package org.springblade.manager.feign;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.spire.xls.*;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.nodes.Node;
+import org.jsoup.select.Elements;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
+import org.springblade.business.entity.ContractLog;
 import org.springblade.business.entity.InformationQuery;
+import org.springblade.business.feign.ContractLogClient;
 import org.springblade.business.feign.InformationQueryClient;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.core.tool.utils.ResourceUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.controller.ExcelTabController;
-import org.springblade.manager.entity.ExcelTab;
-import org.springblade.manager.entity.TrialSelfDataRecord;
+import org.springblade.manager.entity.*;
 import org.springblade.manager.enums.ExecuteType;
+import org.springblade.manager.mapper.WbsTreePrivateMapper;
+import org.springblade.manager.service.IContractInfoService;
 import org.springblade.manager.service.IExcelTabService;
+import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.manager.service.IWbsTreePrivateService;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.resource.feign.NewIOSSClient;
@@ -27,8 +38,14 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
 import java.io.File;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
 import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @RestController
@@ -41,6 +58,10 @@ public class ExcelTabClientImpl implements ExcelTabClient {
     private final InformationQueryClient informationQueryClient;
     private final ExcelTabController excelTabController;
     private final IWbsTreePrivateService wbsTreePrivateService;
+    private final ContractLogClient contractLogClient;
+    private final WbsTreePrivateMapper wbsTreePrivateMapper;
+    private final IProjectInfoService projectInfoService;
+    private final IContractInfoService contractInfoService;
     private static final Logger logger = LoggerFactory.getLogger(ExcelTabClientImpl.class);
 
     @Override
@@ -171,4 +192,591 @@ public class ExcelTabClientImpl implements ExcelTabClient {
         return pdfUrl;
     }
 
+    @Override
+    public R<String> getTheContractLogBusinessData(String pkeyId, String nodePrimaryKeyId, String recordTime, String contractId) throws Exception {
+        //获取配置的路径
+        String file_path = FileUtils.getSysLocalFileUrl();
+        if (StringUtils.isEmpty(recordTime)) {
+            recordTime = DateUtil.format(DateUtil.now(), "yyyy-MM-dd");
+        }
+        List<ContractLog> contractLogList = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTimeList(nodePrimaryKeyId, recordTime, contractId);
+        List<String> ids = contractLogList.stream().map(ContractLog::getId).map(String::valueOf).collect(Collectors.toList());
+        if (ids.size() > 0) {
+            //PDF路径
+            List<String> pdfUrls = new ArrayList<>();
+            for (String dataId : ids) {
+                //查询对应的html
+                WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, pkeyId));
+
+                if (tableNode == null) {
+                    return R.fail("该数据下无此节点!");
+                }
+
+                String htmlString = this.getHtmlString(pkeyId);
+
+                if (StringUtils.isEmpty(tableNode.getHtmlUrl()) || StringUtils.isEmpty(htmlString)) {
+                    return R.fail("未获取到元素表信息!");
+                }
+
+                // 获取清表信息
+                ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
+                if (excelTab == null) {
+                    return R.fail("失败");
+                }
+
+                //获取数据
+                List<Map<String, Object>> businessDataMapList = this.getTheLogBusinessData(dataId, nodePrimaryKeyId, recordTime, contractId).getData();
+                ProjectInfo projectInfo = projectInfoService.getById(tableNode.getProjectId());
+                //处理数据
+                for (Map<String, Object> dataMap : businessDataMapList) {
+                    // 获取excel流 和 html流
+                    Workbook wb = new Workbook();
+                    wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
+                    //获取工作表
+                    Worksheet sheet = wb.getWorksheets().get(0);
+                    Document doc = Jsoup.parse(htmlString);
+                    Element table = doc.select("table").first();
+                    Elements trs = table.select("tr");
+                    //添加标题
+                    CellRange[] columns = sheet.getMergedCells();
+                    for (int i = 0; i < columns.length; i++) {
+                        CellRange cellRange = columns[i];
+                        System.out.println(cellRange.getText());
+                        if (cellRange.getStyle().getFont().getSize() >= 12 && Func.isNotEmpty(cellRange.getText())) {
+                            String title = projectInfo.getProjectName();
+                            if (title.length() >= 30) {
+                                cellRange.setRowHeight(40);
+                                cellRange.getStyle().setWrapText(true);
+                            }
+                            cellRange.getStyle().getFont().setSize(18);
+                            cellRange.getStyle().setHorizontalAlignment(HorizontalAlignType.Center);
+                            cellRange.setText(projectInfo.getProjectName());
+                            break;
+                        }
+                    }
+
+                    if (ObjectUtil.isNotEmpty(dataMap)) {
+                        for (String val : dataMap.keySet()) {
+                            boolean flag=false;
+                            if (val.indexOf("__") >= 0) {
+                                String[] DataVal = val.split("__");
+                                String[] xy = DataVal[1].split("_");
+                                if (trs.size() > Integer.parseInt(xy[0])) {
+                                    Element trData = trs.get(Integer.parseInt(xy[0]));
+                                    Elements tdDatas = trData.select("td");
+                                    if (tdDatas.size() > Integer.parseInt(xy[1])) {
+                                        Element data = tdDatas.get(Integer.parseInt(xy[1]));
+                                        if(data.html().indexOf("date")>=0){
+                                            flag=true;
+                                        }
+                                        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) || (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0))&&flag) {
+                                                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+                                                sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
+                                                SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
+                                                if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
+                                                    myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
+                                                    String[] dataVal = myData.split(",");
+                                                    Date Start_dataStr = sdf.parse(dataVal[0]);
+                                                    Date end_dataStr = sdf.parse(dataVal[1]);
+                                                    String StartDate = formatStr.format(Start_dataStr);
+                                                    String endDate = formatStr.format(end_dataStr);
+                                                    if (StartDate.equals(endDate)) {
+                                                        myData = StartDate;
+                                                    } else {
+                                                        myData = StartDate + "-" + endDate;
+                                                    }
+                                                } else {
+                                                    String[] dataStr = myData.split("T")[0].split("-");
+                                                    if (dataStr.length == 3) {
+                                                        myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
+                                                    }
+                                                }
+                                            }
+
+                                            if (myData.indexOf("http") >= 0 && (myData.indexOf("aliyuncs") >= 0 ||myData.indexOf("183.247.216.148") >= 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 if (data.html().indexOf("hc-form-checkbox-group") >= 0) {
+                                                CellRange cellRange = sheet.getCellRange(y1, x1);
+                                                String exceVal = cellRange.getValue().replaceAll(" ", "");
+                                                //如果有□ 代表 自动生成  如果没有 代表后期添加 需要显示html 中的值
+                                                if (exceVal.indexOf("□") >= 0) {
+                                                    if (myData.equals("1")) {
+                                                        cellRange.setValue(exceVal.replace("□", "\u2611"));
+                                                    }
+                                                } else {
+                                                    List<Node> nodes = data.childNodes();
+                                                    Node node = nodes.get(nodes.size() - 1);
+                                                    String dataJson = node.attr(":objs");
+                                                    if (StringUtils.isNotEmpty(dataJson)) {
+                                                        JSONArray jsonArray = JSONArray.parseArray(dataJson);
+                                                        List<Integer> idList = Func.toIntList(myData);
+                                                        int indexx = 0;
+                                                        if (idList.get(0) >= 1) {
+                                                            indexx = idList.get(0) - 1;
+                                                        }
+
+                                                        String dataInfo = jsonArray.getJSONObject(indexx).getString("name");
+                                                        for (int inx = 1; inx < idList.size(); inx++) {
+                                                            int valIndex = idList.get(inx) - 1;
+                                                            dataInfo = dataInfo + "," + jsonArray.getJSONObject(valIndex).getString("name");
+                                                        }
+                                                        cellRange.setValue(dataInfo);
+                                                    }
+
+                                                }
+                                            } else {
+                                                final CellRange cellRange = sheet.getCellRange(y1, x1);
+                                                cellRange.setText(myData);
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    // 组装电签设置
+                    Elements dqids = table.getElementsByAttribute("dqid");
+                    for (Element element : dqids) {
+                        String dqid = element.attr("dqid");
+                        Elements x11 = element.getElementsByAttribute("x1");
+                        if (x11 != null && x11.size() >= 1) {
+                            Element element1 = x11.get(x11.size() - 1);
+                            int x1 = Func.toInt(element1.attr("x1"));
+                            int y1 = Func.toInt(element1.attr("y1"));
+
+                            CellRange cellRange = sheet.getCellRange(y1, x1);
+                            if (cellRange != null) {
+                                // 创建字体
+                                cellRange.setText(dqid);
+                                cellRange.getCellStyle().getExcelFont().setSize(1);
+                                cellRange.getCellStyle().getExcelFont().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();
+                }
+            }
+            if (pdfUrls.size() > 0) {
+                try {
+                    String mergePdfPath = file_path + "/pdf//" + SnowFlakeUtil.getId() + ".pdf";
+                    File oldMergePdf = ResourceUtil.getFile(mergePdfPath);
+                    if (oldMergePdf.exists()) {
+                        oldMergePdf.delete();
+                    }
+                    FileUtils.mergePdfPublicMethods(pdfUrls, mergePdfPath);
+                    BladeFile mergeFile = this.newIOSSClient.uploadFile(SnowFlakeUtil.getId() + new Date().getTime() + ".pdf", mergePdfPath);
+
+                    //修改记录,当天的日志所有表的合并pdf都一样,即ids都修改成一样的
+                    this.contractLogClient.updateTheLogPdfUrlByIds(StringUtils.join(ids, ","), mergeFile.getLink());
+
+                    return R.data("成功");
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    return R.fail("数据异常");
+                }
+            }
+        }
+        return R.data("成功");
+    }
+
+    private String getHtmlString(String pkeyId) throws Exception {
+        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
+                .select(WbsTreePrivate::getHtmlUrl)
+                .eq(WbsTreePrivate::getPKeyId, pkeyId));
+        if (wbsTreePrivate == null || wbsTreePrivate.getHtmlUrl() == null) {
+            return "";
+        }
+        String fileUrl = wbsTreePrivate.getHtmlUrl();
+        InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+        String htmlString = IoUtil.readToString(fileInputStream);
+        htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+        Document doc = Jsoup.parse(htmlString);
+        return doc.select("table").first() + "";
+    }
+    public R<List<Map<String, Object>>> getTheLogBusinessData(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId) {
+        List<Map<String, Object>> resultMapList = new ArrayList<>();
+        //数据结果
+        String logId2 = "";
+
+        //获取对应的记录
+        String dataIds;
+        if (StringUtils.isNotEmpty(theLogId)) {
+            String[] split = theLogId.split(",");
+            List<String> ids = new LinkedList<>();
+            for (String logId : split) {
+                ContractLog contractLog = contractLogClient.queryContractLogByIdToObj(logId);
+                ids.add(contractLog.getDataId().toString());
+            }
+            dataIds = ids.stream().filter(Objects::nonNull).collect(Collectors.joining(","));
+        } else {
+            List<ContractLog> contractLogs = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTimeList(nodePrimaryKeyId, recordTime, contractId);
+            if (contractLogs.size() == 0){
+                logId2="";
+            }else {
+                logId2=contractLogs.get(0).getId()+"";
+            }
+            dataIds = contractLogs.stream().map(ContractLog::getDataId).filter(Objects::nonNull).map(String::valueOf).collect(Collectors.joining(","));
+        }
+
+        WbsTreePrivate node = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, nodePrimaryKeyId));
+        WbsTreePrivate tableNode2 = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery()
+                .eq(WbsTreePrivate::getParentId, node.getId()).eq(WbsTreePrivate::getProjectId, node.getProjectId()));
+
+
+        if (StringUtils.isNotEmpty(dataIds)) {
+            for (String dataId : dataIds.split(",")) {
+                Map<String, Object> reData = new HashMap<>();
+                reData.put("",logId2);
+                //检查实体表是否存在
+                String tabName = tableNode2.getInitTableName();
+                String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
+
+                List<Map<String, Object>> tabList = this.jdbcTemplate.queryForList(isExitSql);
+                if (tabList.size() <= 0) {
+                    return R.fail("无实体表对应");
+                }
+
+                //查询数据
+                String querySql = "SELECT * FROM " + tabName + " WHERE id = " + dataId + " and group_id = " + tableNode2.getPKeyId();
+
+                List<Map<String, Object>> businessDataMap = this.jdbcTemplate.queryForList(querySql);
+
+                if (businessDataMap.size() > 0) {
+                    // 匹配关联
+                    try {
+                        if (tableNode2.getHtmlUrl()!=null) {
+                            InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(tableNode2.getHtmlUrl());
+                            String htmlString = IoUtil.readToString(inputStreamByUrl);
+                            Document doc = Jsoup.parse(htmlString);
+
+                            // 模糊匹配
+                            Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
+                            Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
+                            Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
+                            sgtitle.addAll(sgtitle1);
+
+                            Elements htdtitle = doc.select("el-input[placeholder~=.*合同号.*]");
+                            Elements htdtitle1 = doc.select("el-input[placeholder~=合同段.*]");
+                            htdtitle.addAll(htdtitle1);
+
+                            Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
+
+                            Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
+                            Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
+                            bhtitle.addAll(bhtitle1);
+
+
+                            Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
+
+
+                            /**
+                             * 承包单位 承包单位、施工单位:引用施工单位名称 ,
+                             * 监理单位:引用监理单位名称
+                             * 合同段、所属建设项目(合同段):引用合同段编号
+                             *
+                             * 施工单位:施工单位 和 安装单位
+                             *
+                             */
+                            ContractInfo contractInfo = contractInfoService.getById(contractId);
+                            // 施工单位名称
+                            if (dwtitle.size() >= 1) {
+                                int y = Integer.parseInt(dwtitle.attr("trindex"));
+                                if (y <= 10) {
+                                    reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
+                                }
+
+                            }
+                            if (sgtitle.size() >= 1) {
+                                int y = Integer.parseInt(sgtitle.attr("trindex"));
+                                if (y <= 10) {
+                                    reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
+                                }
+                            }
+
+                            // 合同段名称
+                            if (htdtitle.size() >= 1) {
+                                for (Element element : htdtitle) {
+                                    int trindex = Integer.parseInt(element.attr("trindex"));
+                                    if (trindex <= 8) {
+                                        reData.put(element.attr("keyName"), contractInfo.getContractNumber());
+                                    }
+                                }
+                            }
+                            // 监理单位名称
+                            if (jltitle.size() >= 1) {
+                                for (Element element : jltitle) {
+                                    int trindex = Integer.parseInt(element.attr("trindex"));
+                                    if (trindex <= 10) {
+                                        reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
+                                    }
+                                }
+                            }
+
+                            // 项目名称
+                            if (xmtitle.size() >= 1) {
+                                for (Element element : xmtitle) {
+                                    int trindex = Integer.parseInt(element.attr("trindex"));
+                                    if (trindex <= 6) {
+                                        ProjectInfo projectInfo = projectInfoService.getById(tableNode2.getProjectId());
+                                        reData.put(element.attr("keyName"), projectInfo.getProjectName());
+
+                                    }
+                                }
+                            }
+
+                            // 日期默认值
+                            Elements dateTitle = doc.select("el-date-picker[placeholder~=日期]");
+                            //日期默认
+                            if (dateTitle.size() >= 1) {
+                                for (Element element : dateTitle) {
+                                    int trindex = Integer.parseInt(element.attr("trindex"));
+                                    if (trindex <= 10) {
+                                        reData.put(element.attr("keyName"), recordTime);
+                                    }
+                                }
+                            }
+
+                            // 添加默认值
+                            Elements elements = doc.getElementsByAttribute("defText");
+                            if(Func.isNotEmpty(elements) && elements.size()>=1){
+                                for(Element eleme: elements){
+                                    String id = Func.isNull(eleme.attr("id"))?eleme.attr("keyname"):eleme.attr("id");
+                                    if(Func.isNotEmpty(id)){
+                                        reData.put(id, eleme.attr("defText"));
+                                    }
+                                }
+                            }
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    for (Map<String, Object> mysqlData : businessDataMap) {
+
+                        String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where  business_id ='" + dataId + "' and is_deleted = 0";
+                        List<Map<String, Object>> businessDat = this.jdbcTemplate.queryForList(querySqlx);
+                        reData.put("linkTabIds", businessDat);
+                        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("_\\^_");
+                                    if (StringUtils.isNotEmpty(tabData[0])) {
+                                        if (tabVal.contains("[") && tabVal.contains("年")) {
+                                            String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
+                                            reData.put(key + "__" + tabData[1], strings);
+                                        }
+                                        if (tabVal.contains("[") && tabVal.contains("]") && tabVal.indexOf(",") >= 0) {
+                                            String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
+                                            reData.put(key + "__" + tabData[1], strings);
+                                        }
+                                        if(tabVal.contains("[")&&tabVal.contains("]")&&tabVal.indexOf(",")==-1){
+                                            String[]strings= new String[]{StringUtils.strip(tabData[0],"[]")};
+                                            reData.put(key+"__"+tabData[1],strings);
+                                        }
+                                        else {
+                                            reData.put(key + "__" + tabData[1], tabData[0]);
+                                        }
+                                    }
+                                } else {
+                                    reData.put(key, tabVal);
+                                }
+                            }
+                        }
+
+                        //移除id和p_key_id
+                        reData.remove("p_key_id");
+                        reData.remove("classify");
+                        reData.remove("contractId");
+                        reData.remove("pkeyId");
+                        reData.remove("projectId");
+
+                    }
+                    if (reData.size() > 0) {
+                        resultMapList.add(reData);
+                    }
+                } else {
+                    Map<String, Object> reData2 = new HashMap<>();
+                    //获取默认值
+
+                }
+            }
+        }else{
+            // 匹配关联
+            Map<String, Object> reData = new HashMap<>();
+            try {
+                if (tableNode2.getHtmlUrl()!=null) {
+                    InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(tableNode2.getHtmlUrl());
+                    String htmlString = IoUtil.readToString(inputStreamByUrl);
+                    Document doc = Jsoup.parse(htmlString);
+
+                    // 模糊匹配
+                    Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
+                    Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
+                    Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
+                    sgtitle.addAll(sgtitle1);
+
+                    Elements htdtitle = doc.select("el-input[placeholder~=.*合同号.*]");
+                    Elements htdtitle1 = doc.select("el-input[placeholder~=合同段.*]");
+                    htdtitle.addAll(htdtitle1);
+
+                    Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
+                    Elements jltit = doc.select("el-input[placeholder~=监理机构.*]");
+                    jltitle.addAll(jltit);
+
+                    Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
+                    Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
+                    bhtitle.addAll(bhtitle1);
+
+
+                    Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
+
+                    // 日期默认值
+                    Elements dateTitle = doc.select("el-date-picker[placeholder~=日期]");
+
+
+                    /**
+                     * 承包单位 承包单位、施工单位:引用施工单位名称 ,
+                     * 监理单位:引用监理单位名称
+                     * 合同段、所属建设项目(合同段):引用合同段编号
+                     *
+                     * 施工单位:施工单位 和 安装单位
+                     *
+                     */
+                    ContractInfo contractInfo = contractInfoService.getById(contractId);
+                    // 施工单位名称
+                    if (dwtitle.size() >= 1) {
+                        int y = Integer.parseInt(dwtitle.attr("trindex"));
+                        if (y <= 10) {
+                            reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
+                        }
+
+                    }
+                    if (sgtitle.size() >= 1) {
+                        int y = Integer.parseInt(sgtitle.attr("trindex"));
+                        if (y <= 10) {
+                            reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
+                        }
+                    }
+
+                    // 合同段名称
+                    if (htdtitle.size() >= 1) {
+                        for (Element element : htdtitle) {
+                            int trindex = Integer.parseInt(element.attr("trindex"));
+                            if (trindex <= 8) {
+                                reData.put(element.attr("keyName"), contractInfo.getContractNumber());
+                            }
+                        }
+                    }
+                    // 监理单位名称
+                    if (jltitle.size() >= 1) {
+                        for (Element element : jltitle) {
+                            int trindex = Integer.parseInt(element.attr("trindex"));
+                            if (trindex <= 10) {
+
+                                reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
+                            }
+                        }
+                    }
+
+                    // 项目名称
+                    if (xmtitle.size() >= 1) {
+                        for (Element element : xmtitle) {
+                            int trindex = Integer.parseInt(element.attr("trindex"));
+                            if (trindex <= 6) {
+                                ProjectInfo projectInfo = projectInfoService.getById(tableNode2.getProjectId());
+                                reData.put(element.attr("keyName"), projectInfo.getProjectName());
+                            }
+                        }
+                    }
+
+                    //日期默认
+                    if (dateTitle.size() >= 1) {
+                        for (Element element : dateTitle) {
+                            int trindex = Integer.parseInt(element.attr("trindex"));
+                            if (trindex <= 10) {
+                                reData.put(element.attr("keyName"), recordTime);
+                            }
+                        }
+                    }
+
+
+                    // 添加默认值
+                    Elements elements = doc.getElementsByAttribute("defText");
+                    if(Func.isNotEmpty(elements) && elements.size()>=1){
+                        for(Element eleme: elements){
+                            String id = Func.isNull(eleme.attr("id"))?eleme.attr("keyname"):eleme.attr("id");
+                            if(Func.isNotEmpty(id)){
+                                reData.put(id, eleme.attr("defText"));
+                            }
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            if (reData.size() > 0) {
+                resultMapList.add(reData);
+            }
+        }
+        return R.data(resultMapList);
+    }
+
 }

+ 20 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -658,7 +658,26 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                         wbsPrivate.setProjectId(projectId);
                         listPrivate.add(wbsPrivate);
                     }
-                    for (Long id : contractInfosIds) {
+                    //todo 注释内容准备修改  等待验证
+//                    //获取当前私有节点或表单对应的合同段节点或表单
+//                    String sqlForWbsTreeContract = "select * from m_wbs_tree_contract where is_type_private_pid = "+wbsPrivate.getPKeyId();
+//                    List<WbsTreeContract> wbsTreeContracts = jdbcTemplate.query(sqlForWbsTreeContract, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+//                    for (WbsTreeContract wbsTreeContract : wbsTreeContracts) {
+//                        wbsTreeContract.setNodeName(wbsPrivate.getNodeName());
+//                        wbsTreeContract.setNodeType(wbsPrivate.getNodeType());
+//                        wbsTreeContract.setMajorDataType(wbsPrivate.getMajorDataType());
+//                        wbsTreeContract.setTableType(wbsPrivate.getTableType());
+//                        wbsTreeContract.setTableOwner(wbsPrivate.getTableOwner());
+//                        wbsTreeContract.setImportMatchingInfo(wbsPrivate.getImportMatchingInfo());
+//                        wbsTreeContract.setMixRatioTestIds(wbsPrivate.getMixRatioTestIds());
+//                        wbsTreeContract.setInitTableName(wbsPrivate.getInitTableName());
+//                        wbsTreeContract.setHtmlUrl(wbsPrivate.getHtmlUrl());
+//                        wbsTreeContract.setExcelId(wbsPrivate.getExcelId());
+//                        wbsTreeContract.setSort(wbsPrivate.getSort());
+//                        listContract.add(wbsTreeContract);
+//                    }
+
+                   for (Long id : contractInfosIds) {
                         //修改合同段wbs信息
                         WbsTreeContract wbsContract = BeanUtil.copyProperties(wbsTreePrivate, WbsTreeContract.class);
                         if (wbsContract != null) {