Procházet zdrojové kódy

服务计划需求开发

chenr před 1 měsícem
rodič
revize
ebcd7e9f70

+ 34 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/ServicePlanDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.dto;
+
+import org.springblade.manager.entity.ServicePlan;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ServicePlanDTO extends ServicePlan {
+	private static final long serialVersionUID = 1L;
+
+}

+ 71 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ServicePlan.java

@@ -0,0 +1,71 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDate;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@Data
+@TableName("m_service_plan")
+@EqualsAndHashCode(callSuper = true)
+public class ServicePlan extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 填写类型 1月度服务计划 2服务完成确认单
+	*/
+		private Integer fileInType;
+    /**
+     * 项目Id
+     */
+        private Long projectId;
+    /**
+     * 合同段Id
+     */
+        private Long contractId;
+	/**
+	* 计划开始时间
+	*/
+		private LocalDate planStartTime;
+	/**
+	* 计划结束时间
+	*/
+		private LocalDate planEndTime;
+    /**
+     * 编写人
+     */
+        private String writeUser;
+	/**
+	* 发送人员
+	*/
+		private String sendUser;
+
+
+
+
+}

+ 44 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ServicePlanVO.java

@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.vo;
+
+import org.springblade.manager.entity.ServicePlan;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ServicePlanVO extends ServicePlan {
+	private static final long serialVersionUID = 1L;
+   //1计划中  2协同中-甲方  3协同中-系统  4已计划
+    private String statusValue;
+    //是否可编辑
+   private Boolean isEdit;
+    //计划开始时间
+   private String startTime;
+   //计划结束时间
+   private String endTime;
+   //发送人
+   private String sendUserName;
+
+}

+ 332 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ServicePlanController.java

@@ -0,0 +1,332 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import io.swagger.annotations.*;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.models.auth.In;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.IOUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+import org.springblade.business.entity.InformationQuery;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.vo.DataVO;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.*;
+import org.springblade.manager.bean.TableInfo;
+import org.springblade.manager.dto.ServicePlanDTO;
+import org.springblade.manager.entity.*;
+import org.springblade.manager.utils.FileUtils;
+import org.springblade.system.cache.ParamCache;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.manager.vo.ServicePlanVO;
+import org.springblade.manager.wrapper.ServicePlanWrapper;
+import org.springblade.manager.service.IServicePlanService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/serviceplan")
+@Api(value = "", tags = "接口")
+public class ServicePlanController extends BladeController {
+
+	private final IServicePlanService servicePlanService;
+
+    private final JdbcTemplate jdbcTemplate;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入servicePlan")
+	public R<ServicePlanVO> detail(ServicePlan servicePlan) {
+		ServicePlan detail = servicePlanService.getOne(Condition.getQueryWrapper(servicePlan));
+		return R.data(ServicePlanWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入servicePlan")
+	public R<IPage<ServicePlanVO>> list(ServicePlan servicePlan, Query query) {
+		IPage<ServicePlan> pages = servicePlanService.page(Condition.getPage(query), Condition.getQueryWrapper(servicePlan));
+		return R.data(ServicePlanWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入servicePlan")
+	public R<IPage<ServicePlanVO>> page(ServicePlanDTO servicePlan, Query query) {
+		IPage<ServicePlanVO> pages = servicePlanService.selectServicePlanPage(Condition.getPage(query), servicePlan);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入servicePlan")
+	public R save(@Valid @RequestBody ServicePlan servicePlan) {
+		return R.status(servicePlanService.save(servicePlan));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入servicePlan")
+	public R update(@Valid @RequestBody ServicePlan servicePlan) {
+		return R.status(servicePlanService.updateById(servicePlan));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入servicePlan")
+	public R submit(@Valid @RequestBody ServicePlan servicePlan) {
+		return R.status(servicePlanService.saveOrUpdate(servicePlan));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(servicePlanService.deleteLogic(Func.toLongList(ids)));
+	}
+
+    @GetMapping("/getServiceHtml")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "获取服务计划html", notes = "传入pKeyId,id")
+    public R<String> getServiceHtml(Long projectId, Long contractId,Integer type){
+        return R.data(servicePlanService.getServiceHtml(projectId,contractId,type));
+    }
+
+    @GetMapping("/get-html-buss-cols")
+    @ApiOperationSupport(order = 36)
+    @ApiOperation(value = "获取坐标位置", notes = "获取坐标位置")
+    @ApiImplicitParams(value = {
+        @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
+    })
+    public R getHtmlBussCols(Integer type) {
+        Long pkeyId = 0L;
+        if(type==1){
+            pkeyId=1937773223861026820L;
+        }else {
+            pkeyId=1937773223861026822L;
+        }
+        String sql="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject( sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            throw new ServiceException("暂无表单");
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            throw new ServiceException("暂无表单");
+        }
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        try {
+            String fileUrl = wbsTreeContract.getHtmlUrl();
+            File file1 = ResourceUtil.getFile(fileUrl);
+            InputStream fileInputStream = null;
+            if (file1.exists()) {
+                fileInputStream = new FileInputStream(file1);
+            } else {
+                String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
+                fileInputStream = CommonUtil.getOSSInputStream(path);
+            }
+
+
+            String htmlString = IoUtil.readToString(fileInputStream);
+            // 解析 style
+            Document doc = Jsoup.parse(htmlString);
+            Element table = doc.select("table").first();
+            Elements trs = table.select("tr");
+
+            List<List<String>> redata = new ArrayList<>();
+            for (int i = 0; i < trs.size(); i++) {
+                Element tr = trs.get(i);
+                Elements tds = tr.select("td");
+                List<String> tdList = new ArrayList<>();
+                for (int j = 0; j < tds.size(); j++) {
+                    Element element = tds.get(j);
+                    if (element.html().indexOf("el-tooltip") >= 0) {
+                        element = element.children().get(0);
+                    }
+                    if (element.children().size() >= 1) {
+                        String keyname = element.children().get(0).attr("keyname");
+                        if (StringUtils.isNotEmpty(keyname)) {
+                            tdList.add(keyname);
+                        }
+                    }
+                }
+                if (tdList != null && tdList.size() >= 1) {
+                    redata.add(tdList);
+                }
+            }
+
+            String[][] res = new String[redata.size()][]; // 存放转换结果的 二维数组
+            for (int i = 0; i < res.length; i++) { // 转换方法
+                res[i] = redata.get(i).toArray(new String[redata.get(i).size()]);
+            }
+            return R.data(res);
+        } catch (Exception e) {
+            return R.fail("暂无表单!");
+        }
+    }
+
+    @PostMapping("/saveServiceData")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "保存服务计划数据", notes = "传入dataInfo")
+    public R saveServiceData(@Valid @RequestBody JSONObject dataInfo) throws Exception {
+        JSONArray dataArray = new JSONArray();
+        String groupId = dataInfo.getString("groupId");
+        String type = dataInfo.getString("type");
+        dataArray.add(dataInfo);
+        List<TableInfo> tableInfoList=getServiceData(dataArray);
+        servicePlanService.saveServiceData(tableInfoList,Func.toLong(groupId),Func.toInt(type));
+        servicePlanService.saveServicePlanPdf(Func.toInt(type),Func.toLong(groupId));
+        return R.status( true);
+    }
+
+
+    private List<TableInfo> getServiceData(JSONArray dataInfo) {
+        if (dataInfo != null && !dataInfo.isEmpty()) {
+            List<TableInfo> result = new ArrayList<>();
+            for (int m = 0; m < dataInfo.size(); m++) {
+                TableInfo tableInfo = new TableInfo();
+                JSONObject dataInfo2 = dataInfo.getJSONObject(m);
+                tableInfo.setPkeyId(dataInfo2.getString("pkeyId"));
+                tableInfo.setTestGroupId(dataInfo2.getString("group_id"));
+                tableInfo.setToBeUpdated(true);
+                tableInfo.setContractId(dataInfo2.getString("contractId"));
+                dataInfo2.fluentRemove("contractId")
+                    .fluentRemove("pkeyId")
+                    .fluentRemove("p_key_id")
+                    .fluentRemove("projectId")
+                    .fluentRemove("classify")
+                    .fluentRemove("pickerKey")
+                    .fluentRemove("id")
+                    .fluentRemove("isFirst")
+                    .fluentRemove("firstNodeId")
+                    .fluentRemove("isTheLog")
+                    .fluentRemove("theLogId")
+                    .fluentRemove("linkTabIds")
+                    .fluentRemove("recordTime")
+                    .fluentRemove("businessId")
+                    .fluentRemove("sourceUrl")
+                    .fluentRemove("pdfUrl")
+                    .fluentRemove("firstFileName")
+                    .fluentRemove("");
+                //计算数据
+                LinkedHashMap<String, List<String>> dataMap = dataInfo2.keySet().stream().filter(e -> e.contains("__")).collect(Collectors.groupingBy(e -> e.split("__")[0], LinkedHashMap<String, List<String>>::new, Collectors.toList()));
+                LinkedHashMap<String, String> dataMap2 = new LinkedHashMap<>();
+
+                //字段组合
+                for (String k : dataMap.keySet()) {
+                    if (dataMap.get(k).size() > 1 && !dataMap.get(k).contains("000Z")) {
+                        String[] ziduan = dataMap.get(k).toArray(new String[]{});
+                        String temp = "";
+                        for (int i = 0; i < ziduan.length - 1; i++) {
+                            for (int j = 0; j < ziduan.length - i - 1; j++) {
+                                int tr = Integer.parseInt((ziduan[j].split("__")[1]).split("_")[0]);
+                                int td = Integer.parseInt(ziduan[j].split("__")[1].split("_")[1]);
+                                int tr_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[0]);
+                                int td_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[1]);
+                                if (tr > tr_1 && td == td_1) { //纵向排序
+                                    temp = ziduan[j];
+                                    ziduan[j] = ziduan[j + 1];
+                                    ziduan[j + 1] = temp;
+                                }
+                            }
+                        }
+                        StringBuilder lastStr = new StringBuilder(dataInfo2.getString(ziduan[0]) + "_^_" + ziduan[0].split("__")[1]);
+                        for (int i = 1; i < ziduan.length; i++) {
+                            String keyData = dataInfo2.getString(ziduan[i]);
+                            if (keyData!=null && Func.isNotEmpty(keyData)) {
+                                lastStr.append("☆").append(dataInfo2.getString(ziduan[i])).append("_^_").append(ziduan[i].split("__")[1]);
+                            }
+
+                        }
+                        dataMap2.put(k, lastStr.toString());
+                    } else {
+                        String dataVal = dataInfo2.getString(dataMap.get(k).get(0));
+                        if(StringUtils.isNotEmpty(dataVal)){
+                            dataMap2.put(k, dataVal + "_^_" + dataMap.get(k).get(0).split("__")[1]);
+                        }
+                    }
+                }
+                dataMap2.put("p_key_id", tableInfo.getPkeyId());
+                tableInfo.setDataMap(dataMap2);
+                result.add(tableInfo);
+            }
+            return result;
+        }
+        return null;
+    }
+
+}

+ 51 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IServicePlanService.java

@@ -0,0 +1,51 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.service;
+
+import org.springblade.manager.bean.TableInfo;
+import org.springblade.manager.dto.ServicePlanDTO;
+import org.springblade.manager.entity.ServicePlan;
+import org.springblade.manager.vo.ServicePlanVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+public interface IServicePlanService extends BaseService<ServicePlan> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param servicePlan
+	 * @return
+	 */
+	IPage<ServicePlanVO> selectServicePlanPage(IPage<ServicePlanVO> page, ServicePlanDTO servicePlan);
+
+    String getServiceHtml(Long projectId,Long contractId,Integer type);
+
+    boolean saveServiceData(List<TableInfo> tableInfoList,Long groupId,Integer type);
+
+    void saveServicePlanPdf(int anInt, long aLong) throws Exception;
+}

+ 671 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ServicePlanServiceImpl.java

@@ -0,0 +1,671 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.service.impl;
+
+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.mixsmart.utils.ListUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.IOUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
+import org.springblade.business.entity.EntrustInfo;
+import org.springblade.business.entity.TrialMaterialMobilization;
+import org.springblade.business.entity.TrialSampleInfo;
+import org.springblade.business.entity.TrialSelfInspectionRecord;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.common.vo.DataVO;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.*;
+import org.springblade.manager.bean.TableInfo;
+import org.springblade.manager.dto.ServicePlanDTO;
+import org.springblade.manager.entity.*;
+import org.springblade.manager.utils.FileUtils;
+import org.springblade.manager.vo.ServicePlanVO;
+import org.springblade.manager.mapper.ServicePlanMapper;
+import org.springblade.manager.service.IServicePlanService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springblade.system.cache.ParamCache;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.amqp.RabbitTemplateConfigurer;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.DefaultTransactionDefinition;
+
+import javax.annotation.Resource;
+import java.io.*;
+import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@Service
+public class ServicePlanServiceImpl extends BaseServiceImpl<ServicePlanMapper, ServicePlan> implements IServicePlanService {
+    @Resource
+    private  JdbcTemplate jdbcTemplate;
+    @Autowired
+    private DataSourceTransactionManager transactionManager1;
+    @Autowired
+    private  NewIOSSClient newIOSSClient;
+
+	@Override
+	public IPage<ServicePlanVO> selectServicePlanPage(IPage<ServicePlanVO> page, ServicePlanDTO servicePlan) {
+        List<ServicePlanVO> vos = baseMapper.selectServicePlanPage(page, servicePlan);
+        for (ServicePlanVO vo : vos) {
+           vo.setStatusValue(vo.getStatus()==1?"1计划中":vo.getStatus()==2?"协同中-甲方":vo.getStatus()==3?"协同中-系统":"已计划");
+           vo.setIsEdit(checkIsEdit(vo));
+           vo.setStartTime(vo.getPlanStartTime().format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
+           vo.setEndTime(vo.getPlanEndTime().format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
+           vo.setSendUserName(slectUserName(vo.getSendUser()));
+        }
+        return page.setRecords(vos);
+	}
+
+    private String slectUserName(String sendUser) {
+        if(StringUtils.isNotEmpty(sendUser)){
+            String sql="select real_name from blade_user where id in("+sendUser+")";
+            List<String> list = jdbcTemplate.queryForList(sql, String.class);
+            if(!list.isEmpty()){
+                return list.stream().collect(Collectors.joining(","));
+            }
+        }
+        return "";
+    }
+
+    private Boolean checkIsEdit(ServicePlanVO vo) {
+        if(vo.getStatus()==1){
+            return true;
+        }else if(vo.getStatus()==2){
+            if(StringUtils.isNotEmpty(vo.getSendUser())){
+                return vo.getSendUser().contains(SecureUtil.getUserId()+"");
+            }
+        }else if(vo.getStatus()==2){
+            if(StringUtils.isNotEmpty(vo.getSendUser())){
+                return vo.getWriteUser().contains(SecureUtil.getUserId()+"");
+            }
+        }else {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String getServiceHtml(Long projectId, Long contractId,Integer type) {
+        Long pkeyId = 0L;
+        if(type==1){
+            pkeyId=1937773223861026820L;
+        }else {
+            pkeyId=1937773223861026822L;
+        }
+        String sql="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject( sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            throw new ServiceException("暂无表单");
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            throw new ServiceException("暂无表单");
+        }
+        try {
+            String fileUrl = wbsTreeContract.getHtmlUrl();
+            InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+            String htmlString = IoUtil.readToString(fileInputStream);
+            htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+            htmlString = htmlString.replaceAll("title", "titlexx");
+
+            // 远程搜索配置
+            Document doc = Jsoup.parse(htmlString);
+            int maxCol = doc.select("Col").size();
+            Element table = doc.select("table").first();
+            Elements hc = doc.select("hc-form-select-search");
+            if (hc.size() >= 1) {
+                for (int i = 0; i < hc.size(); i++) {
+                    Element datax = hc.get(i);
+                    datax.removeAttr("pkeyId");
+                    datax.removeAttr("contractId");
+                    datax.attr("pkeyId", pkeyId + "");
+                    datax.attr("contractId",contractId+"");
+                }
+            }
+
+            // 远程搜索配置2-设计强度搜索
+            Elements hc2 = doc.select("hc-form-select-search2");
+            if (hc2.size() >= 1) {
+                for (int i = 0; i < hc2.size(); i++) {
+                    Element datax = hc2.get(i);
+                    datax.removeAttr("contractId");
+                    datax.attr("contractId", contractId+"");
+                }
+            }
+            // 标题解决
+            String sql1="select * from m_project_info where id="+projectId;
+            ProjectInfo projectInfo = jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(ProjectInfo.class));
+            //判断是否是水利水电表,水利水电项目名14,表名12 。   其他表都是18
+            Boolean isWater = false;
+            // 添加标题显示
+            Elements trs = table.select("tr");
+            for (int i = 1; i < 6; i++) {
+                Element tr = trs.get(i);
+                Elements tds = tr.select("td");
+                for (int j = 0; j < tds.size(); j++) {
+                    Element data = tds.get(j);
+                    String style = data.attr("style");
+                    if (style.indexOf("font-size") >= 0) {
+                        int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
+                        Element element = null;
+                        if (isWater) {
+                            if (StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
+                                element = trs.get(i - 1).select("td").get(0);
+
+                            }
+                        } else {
+                            if (StringUtils.isNotEmpty(data.text()) && fontsize >= 14) {
+                                element = trs.get(i - 1).select("td").get(0);
+                            }
+                        }
+                        if (element != null && Func.isNotEmpty(element)) {
+                            //
+                            Elements allElements = element.children();
+                            if (allElements.size() >= 1) {
+                                String defText = allElements.get(0).attr("deftext");
+                                if (defText != null && Func.isNotEmpty(defText)) {
+                                    element.text(defText);
+                                } else {
+                                    element.text(projectInfo.getProjectName());
+                                }
+                            } else {
+                                element.text(projectInfo.getProjectName());
+                            }
+                        }
+                    }
+                }
+            }
+            fileInputStream.close();
+            return table + "";
+        } catch (Exception e) {
+            throw new ServiceException("暂无表单");
+        }
+    }
+
+    @Override
+    public boolean saveServiceData(List<TableInfo> tableInfoList,Long groupId,Integer type) {
+        //试验填报
+        if (ListUtils.isNotEmpty(tableInfoList)) {
+            for (TableInfo tableInfo : tableInfoList) {
+                Long pkeyId = 0L;
+                if(type==1){
+                    pkeyId=1937773223861026820L;
+                }else {
+                    pkeyId=1937773223861026822L;
+                }
+                String sql="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+                WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject( sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+                if (wbsTreeContract == null || StringUtils.isEmpty(wbsTreeContract.getInitTableName())) {
+                    continue;
+                }
+                //删除SQL
+                String delSql = "delete from " + wbsTreeContract.getInitTableName() + " where p_key_id='" + tableInfo.getPkeyId() + "' and group_id = '" + groupId + "'";
+
+                //新增SQL
+                String sqlInfo = "";
+                LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
+                if(!dataMap2.containsKey("p_key_id")){
+                    if(tableInfo.getPkeyId()!=null&&!tableInfo.getPkeyId().equals("")){
+                        dataMap2.put("p_key_id",tableInfo.getPkeyId());
+                    }
+                }
+                sqlInfo = "INSERT INTO " + wbsTreeContract.getInitTableName() + " ( ";
+                String keyStr = "id,group_id,";
+                String valStr = SnowFlakeUtil.getId() + "," + groupId + ",";
+                for (String keys : dataMap2.keySet()) {
+                    keyStr += keys + ",";
+                    valStr += "'" + dataMap2.get(keys) + "',";
+                }
+                keyStr = keyStr.substring(0, keyStr.lastIndexOf(","));
+                valStr = valStr.substring(0, valStr.lastIndexOf(","));
+                sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
+                TransactionStatus transactionStatus = this.beginTransaction(transactionManager1);
+                try {
+                    //删除
+                    jdbcTemplate.execute(delSql);
+                    //新增
+                    jdbcTemplate.execute(sqlInfo);
+                    //提交事务
+                    transactionManager1.commit(transactionStatus);
+                } catch (Exception e) {
+                    //回滚
+                    transactionManager1.rollback(transactionStatus);
+                    throw new RuntimeException("500"+e.getCause().getMessage()+"  字段过长,新增失败");
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public void saveServicePlanPdf(int type, long id) throws Exception {
+        Long pkeyId = 0L;
+        if(type==1){
+            pkeyId=1937773223861026820L;
+        }else {
+            pkeyId=1937773223861026822L;
+        }
+        String file_path = FileUtils.getSysLocalFileUrl();//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        String sql="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject( sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            throw new ServiceException("该数据下无此节点!");
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            throw new ServiceException("请关联清表!");
+        }
+        String pdfPath = file_path + "/pdf//" + pkeyId + ".pdf";
+        String excelPath = file_path + "/pdf//" + pkeyId + ".xlsx";
+        File tabPdf = ResourceUtil.getFile(pdfPath);
+        if (tabPdf.exists()) {
+            tabPdf.delete();
+        }
+        String sql1="select * from m_excel_tab where id="+wbsTreeContract.getExcelId();
+        //获取清表信息
+        ExcelTab excelTab =jdbcTemplate.queryForObject( sql1, new BeanPropertyRowMapper<>(ExcelTab.class));
+
+        if (excelTab == null) {
+            throw new ServiceException("操作失败!");
+        }
+
+        //获取数据信息info
+        List<Map<String, Object>> bussDataInfoTrial = this.getBussDataInfoTrial(type,id);
+        Map<String, Object> DataInfo = new HashMap<>();
+        if (bussDataInfoTrial.size() > 0) {
+            DataInfo.putAll(bussDataInfoTrial.stream().findAny().orElse(null));
+        }
+
+        //获取清表excel文件
+        org.apache.poi.ss.usermodel.Workbook workbook = WorkbookFactory.create(Objects.requireNonNull(CommonUtil.getOSSInputStreamTow(excelTab.getFileUrl())));
+        Sheet sheet = workbook.getSheetAt(0);
+        sheet.setForceFormulaRecalculation(true);
+
+       String sql2="selece * from m_project_info where id="+wbsTreeContract.getProjectId();
+       ProjectInfo projectInfo = jdbcTemplate.queryForObject(sql2, new BeanPropertyRowMapper<>(ProjectInfo.class));
+        int all = sheet.getRow(0).getLastCellNum();
+        int mergedCellCnt = sheet.getNumMergedRegions();
+        for (
+            int i = 0;
+            i < mergedCellCnt - 1; i++) {
+            CellRangeAddress mergedCell = sheet.getMergedRegion(i);
+            int xx = mergedCell.getNumberOfCells();
+            if (xx <= all) {
+                int fisRow = mergedCell.getFirstRow();
+                int firstCol = mergedCell.getFirstColumn();
+                Cell cell = sheet.getRow(fisRow).getCell(firstCol);
+                short fontIndex = cell.getCellStyle().getFontIndex();
+                Font oldFontAt = workbook.getFontAt(fontIndex);
+                Font redFont = workbook.createFont();
+                redFont.setFontHeightInPoints(oldFontAt.getFontHeightInPoints());//设置字体大小
+                redFont.setFontName(oldFontAt.getFontName());//设置字体
+                CellStyle newStyle = workbook.createCellStyle();//创建单元格样式
+                newStyle.cloneStyleFrom(cell.getCellStyle());
+                short fontHeightInPoints = redFont.getFontHeightInPoints();
+                if (fontHeightInPoints >= 14 && StringUtils.isEmpty(cell.getStringCellValue()) && fisRow <= 8) {
+                    String title = projectInfo.getProjectName();
+                    if (title.length() >= 30) {
+                        sheet.getRow(fisRow).setHeight((short) 900);
+                        newStyle.setWrapText(true);
+                    }
+                    redFont.setBold(true);
+                    newStyle.setFont(redFont);
+                    cell.setCellStyle(newStyle);
+                    cell.setCellValue(title);
+                    break;
+                }
+            }
+        }
+
+        //数据不为空,构造数据
+        String fileUrl = wbsTreeContract.getHtmlUrl();
+        InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+
+        String htmlString = IoUtil.readToString(fileInputStream);
+        htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+        htmlString = htmlString.replaceAll("title", "titlexx");
+
+        Document doc = Jsoup.parse(htmlString);
+        Element table = doc.select("table").first();
+        Elements trs = table.select("tr");
+
+        if (ObjectUtil.isNotEmpty(DataInfo)) {
+            for (String val : Objects.requireNonNull(DataInfo).keySet()) {
+                if (val.contains("__")) {
+                    String[] DataVal = val.split("__");
+                    String[] xy = DataVal[1].split("_");
+                    if (Integer.parseInt(xy[0]) < trs.size()) {
+                        Element ytzData = trs.get(Integer.parseInt(xy[0]));
+                        if (ytzData != null) {
+                            Elements tdsx = ytzData.select("td");
+                            if (Integer.parseInt(xy[1]) < tdsx.size()) {
+                                Element data = ytzData.select("td").get(Integer.parseInt(xy[1]));
+                                if (data != null) {
+                                    if (data.html().contains("x1") && data.html().contains("y1")) {
+                                        int x1 = 0;
+                                        int x2 = 0;
+                                        int y1 = 0;
+                                        int y2 = 0;
+                                        if (data.html().contains("el-tooltip")) {
+                                            x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
+                                            x2 = Integer.parseInt(data.children().get(0).children().get(0).attr("x2"));
+                                            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 = DataInfo.get(val) + "";
+                                        if (myData.contains("T") && myData.contains("-") && myData.contains(":")) {
+                                            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.contains(",") && myData.contains("]")) {
+
+                                                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("-");
+                                                myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
+                                            }
+                                        }
+
+                                        if (myData.contains("lang.String")) {
+                                            Object obj = DataInfo.get(val);
+                                            if (obj instanceof String[]) {
+                                                String[] dataDate = (String[]) obj;
+                                                myData = dataDate[0].trim() + "-" + dataDate[1].trim();
+                                                if (dataDate[0].trim().equals(dataDate[1].trim())) {
+                                                    myData = dataDate[0];
+                                                }
+                                            }
+                                        }
+
+                                        if (myData.contains("http") && myData.contains("aliyuncs")) {
+                                            InputStream imageIn = CommonUtil.getOSSInputStream(myData);
+                                            byte[] byteNew = new byte[0];
+                                            if (imageIn != null) {
+                                                byteNew = IOUtils.toByteArray(imageIn);
+                                            }
+
+                                            byte[] bytes = CommonUtil.compressImage(byteNew);
+
+                                            CreationHelper helper = workbook.getCreationHelper();
+                                            ClientAnchor anchor = helper.createClientAnchor();
+                                            anchor.setCol1(x1); // param1是列号
+                                            anchor.setCol2(x2);
+                                            anchor.setRow1(y1); // param2是行号
+                                            anchor.setRow2(y2); // param2是行号
+
+                                            Drawing<?> drawing = sheet.createDrawingPatriarch();
+                                            anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
+                                            // 插入图片
+                                            Picture picture = drawing.createPicture(anchor, workbook.addPicture(bytes, Workbook.PICTURE_TYPE_PNG));
+                                            picture.resize(1, 1);
+                                            FileUtils.imageOrientation(sheet, anchor, new DataVO(x1 - 1, y1 - 1));
+
+                                        } else if (myData.equals("1") && data.html().contains("hc-form-checkbox-group")) {
+                                            Row row = sheet.getRow(y1 - 1);
+                                            if (row != null) {
+                                                Cell cell = row.getCell(x1 - 1);
+                                                if (cell != null) {
+                                                    String exceVal = cell.getStringCellValue().replaceAll(" ", "");
+                                                    short fontIndex = cell.getCellStyle().getFontIndex();
+                                                    Font fontAt = workbook.getFontAt(fontIndex);
+                                                    fontAt.setFontName("EUDC");
+                                                    cell.setCellValue(exceVal.replace("□", "\u2611"));
+                                                } else {
+                                                    ObjectUtils.isNotEmpty(cell);
+                                                }
+                                            }
+                                        } else {
+                                            Row row = sheet.getRow(y1 - 1);
+                                            if (row != null) {
+                                                Cell cell = row.getCell(x1 - 1);
+                                                if (cell != null) {
+                                                    cell.setCellValue(myData);
+                                                } else {
+                                                    ObjectUtils.isNotEmpty(cell);
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        //输出流
+        FileOutputStream outputStream = new FileOutputStream(excelPath);
+        workbook.write(outputStream);
+        FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
+        BladeFile bladeFile = newIOSSClient.uploadFile(id + ".pdf", pdfPath);
+        if (bladeFile != null) {
+            String sql3="update m_service_plan set pdf_url="+bladeFile.getLink()+" where id="+id;
+            jdbcTemplate.update(sql3);
+        }
+
+    }
+
+    private List<Map<String, Object>> getBussDataInfoTrial(Integer type, Long id) {
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        List<Map<String, Object>> list = new ArrayList<>();
+        Map<String, Object> reData = new HashMap<>();
+        Long pkeyId = 0L;
+        if(type==1){
+            pkeyId=1937773223861026820L;
+        }else {
+            pkeyId=1937773223861026822L;
+        }
+        String sqll="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject(sqll, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            return list;
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            return list;
+        }
+        //表单是否存储在
+        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.size() <= 0) {
+            return list;
+        }
+
+        //实体数据
+        String querySql = "select * from " + wbsTreeContract.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + id;
+        List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
+        String keyNames="";
+        //匹配关联
+        try {
+            String fileUrl = wbsTreeContract.getHtmlUrl();
+            File file1 = ResourceUtil.getFile(fileUrl);
+            InputStream fileInputStream;
+            if (file1.exists()) {
+                fileInputStream = new FileInputStream(file1);
+            } else {
+                String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
+                fileInputStream = CommonUtil.getOSSInputStream(path);
+            }
+            String htmlString = IoUtil.readToString(fileInputStream);
+            htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+            htmlString = htmlString.replaceAll("title", "titlexx");
+            Document doc = Jsoup.parse(htmlString);
+            keyNames= getKeyNameList(doc);
+                if (dataIn.size() >= 1) {
+                    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.contains("T") && tabVal.contains(".000Z]")) {
+                                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("'", "");
+                                if (StringUtils.isNotEmpty(tabData[0])) {
+                                    reData.put(key + "__" + tabData[1], sql);
+                                }
+                            } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) {//时间
+                                // 时间和字符串合作
+                                if (tabVal.indexOf("☆") >= 0) {
+                                    String[] mysql = tabVal.split("☆");
+                                    for (String data : mysql) {
+                                        String[] tabData = data.split("_\\^_");
+                                        if (StringUtils.isNotEmpty(tabData[0])) {
+                                            reData.put(key + "__" + tabData[1], tabData[0]);
+                                        }
+                                    }
+                                } else {
+                                    String[] tabData = tabVal.split("_\\^_");
+                                    if (StringUtils.isNotEmpty(tabData[0])) {
+                                        reData.put(key + "__" + tabData[1], tabData[0]);
+                                    }
+                                }
+                            } else if (tabVal.indexOf("☆") >= 0) {
+                                String[] mysql = tabVal.split("☆");
+                                for (String data : mysql) {
+                                    String[] tabData = data.split("_\\^_");
+                                    if (StringUtils.isNotEmpty(tabData[0])) {
+                                        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);
+                                    }else if (tabVal.contains("[") && tabVal.contains("]") ) {
+                                        String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
+                                        reData.put(key + "__" + tabData[1], strings);
+                                    } else {
+                                        reData.put(key + "__" + tabData[1], tabData[0]);
+                                    }
+                                }
+                            } else {
+                                reData.put(key, tabVal);
+                            }
+                        }
+                    }
+                }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        // 移除Id 和 p_key_id
+        reData.remove("id");
+        reData.remove("p_key_id");
+        reData.remove("classify");
+        reData.remove("contractId");
+        reData.remove("pkeyId");
+        reData.remove("projectId");
+        if(reData.size()>0){
+            //处理key重复导致pdf数据错位
+            for (Iterator<Map.Entry<String, Object>> iterator = reData.entrySet().iterator(); iterator.hasNext(); ) {
+                Map.Entry<String, Object> entry = iterator.next();
+                if (!keyNames.equals("") && keyNames.indexOf(entry.getKey()) <0) {
+                    iterator.remove();
+                }
+            }
+        }
+        list.add(reData);
+        return list;
+    }
+    public String getKeyNameList(Document doc){
+        StringBuilder allKeyName=new StringBuilder();
+        Elements select = doc.getElementsByAttributeValueContaining("keyname","key_");
+        if(!select.isEmpty()){
+            for (Element element : select) {
+                String keyName = element.attr("keyname");
+                allKeyName.append(keyName+",");
+            }
+        }
+        String allKeyNames = allKeyName.toString();
+        if(allKeyNames.endsWith(",")){
+            allKeyNames = allKeyNames.substring(0, allKeyNames.length() - 1);
+        }
+        return allKeyNames;
+    }
+
+    public TransactionStatus beginTransaction(DataSourceTransactionManager transactionManager) {
+        DefaultTransactionDefinition def = new DefaultTransactionDefinition();//事务定义类
+        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
+        return transactionManager.getTransaction(def);
+    }
+
+
+
+}