Ver Fonte

Merge remote-tracking branch 'origin/master' into master

yangyj há 2 anos atrás
pai
commit
afc5435b7c
19 ficheiros alterados com 405 adições e 263 exclusões
  1. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ContractLogWbs.java
  2. 2 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/SaveContractLogVO.java
  3. 10 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ExctabCell.java
  4. 10 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ExctabCellVO2.java
  5. 12 27
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java
  6. 11 44
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ContractLogClientImpl.java
  7. 1 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogWbsMapper.xml
  8. 11 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/bean/TableInfo.java
  9. 74 34
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  10. 19 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExctabCellController.java
  11. 165 135
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExpaileHtml.java
  12. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java
  13. 3 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExctabCellMapper.java
  14. 4 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExctabCellMapper.xml
  15. 8 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExctabCellService.java
  16. 22 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  17. 35 12
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExctabCellServiceImpl.java
  18. 8 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java
  19. 6 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ContractLogWbs.java

@@ -44,6 +44,9 @@ public class ContractLogWbs extends BaseEntity {
     @ApiModelProperty("contract_log表主键")
     private Long contractLogId;
 
+    @ApiModelProperty("数据ID")
+    private String businessId;
+
     /**
      * 关联的工序唯一键,wbs_tree_contract表p_key_id
      */

+ 2 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/SaveContractLogVO.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.apache.http.client.utils.DateUtils;
+import org.springblade.business.entity.ContractLog;
+import org.springblade.business.entity.ContractLogWbs;
 import org.springblade.core.tool.utils.DateUtil;
 
 import java.util.Date;

+ 10 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ExctabCell.java

@@ -66,6 +66,16 @@ public class ExctabCell implements Serializable {
      */
     private String xys;
 
+    /**
+     * 元素类型
+     */
+    private Integer textElementType;
+
+    /**
+     * 偏差值
+     */
+    private String textDeviation;
+
     /**
      * 是否已删除
      */

+ 10 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ExctabCellVO2.java

@@ -38,6 +38,16 @@ public class ExctabCellVO2 implements Serializable {
 	 */
 	private String xys;
 
+	/**
+	 * 元素类型
+	 */
+	private Integer textElementType;
+
+	/**
+	 * 偏差值
+	 */
+	private String textDeviation;
+
 	/**
 	 * 是否已删除
 	 */

+ 12 - 27
blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java

@@ -183,36 +183,21 @@ public class ContractLogController extends BladeController {
 	@PostMapping("/queryCurrentLogSelectProcessList")
 	@ApiOperationSupport(order = 7)
 	@ApiOperation(value = "获取当前日志资料关联的工序节点信息")
-	@ApiImplicitParams(
-		{
-			@ApiImplicitParam(name = "theLogId", value = "日志记录的id,可能为空"),
-			@ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志类型ID,即左侧列表的节点primaryKeyId"),
-			@ApiImplicitParam(name = "recordTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd")
-		}
-	)
-	public R<List<JSONObject>> querySelectProcessList(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId){
+    @ApiImplicitParam(name = "businessId", value = "数据ID")
+	public R<List<JSONObject>> querySelectProcessList(String businessId){
 		List<JSONObject> jsonResult = new ArrayList<>();
 
-		if(StringUtils.isEmpty(theLogId)){
-			ContractLog log = this.contractLogService.getOne(Wrappers.<ContractLog>lambdaQuery()
-					.eq(ContractLog::getWbsNodeId, nodePrimaryKeyId)
-					.eq(ContractLog::getRecordTime, recordTime).eq(ContractLog::getContractId, contractId).eq(ContractLog::getCreateUser, AuthUtil.getUserId()));
-			if(log == null){
-				return R.data(300, null, "未找到数据");
-			}
-
-			theLogId = String.valueOf(log.getId());
-		}
-
-		List<ContractLogWbs> result = this.contractLogWbsService.list(Wrappers.<ContractLogWbs>lambdaQuery().eq(ContractLogWbs::getContractLogId, theLogId));
-		if(result != null && result.size() > 0){
-			result.forEach(logWbs -> {
-				JSONObject json = new JSONObject();
-				json.put("primaryKeyId", logWbs.getTreePrimaryKeyId());
-				json.put("path", logWbs.getTitle());
+		if(StringUtils.isNotEmpty(businessId)){
+			List<ContractLogWbs> result = this.contractLogWbsService.list(Wrappers.<ContractLogWbs>lambdaQuery().eq(ContractLogWbs::getBusinessId, businessId));
+			if(result != null && result.size() > 0){
+				result.forEach(logWbs -> {
+					JSONObject json = new JSONObject();
+					json.put("primaryKeyId", logWbs.getTreePrimaryKeyId());
+					json.put("path", logWbs.getTitle());
 
-				jsonResult.add(json);
-			});
+					jsonResult.add(json);
+				});
+			}
 		}
 
 		return R.data(jsonResult);

+ 11 - 44
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ContractLogClientImpl.java

@@ -89,50 +89,16 @@ public class ContractLogClientImpl implements ContractLogClient {
             //主键不为空,说明是修改
             //修改只修改关联的工序ids
             if(saveContractLogVO.getCorrelationIds() != null && saveContractLogVO.getCorrelationIds().size() > 0){
-                List<ContractLogWbs> oldLogWbsList = this.contractLogWbsService.list(Wrappers.<ContractLogWbs>lambdaQuery().eq(ContractLogWbs::getContractLogId, contractLog.getId()));
-                if(oldLogWbsList.size() > 0){
-                    List<ContractLogWbs> saveList = new ArrayList<>();
-
-                    //检查哪些数据是新增的
-                    List<JSONObject> jsonList = saveContractLogVO.getCorrelationIds();
-                    Iterator<JSONObject> iterator = jsonList.iterator();
-                    while (iterator.hasNext()){
-                        JSONObject next = iterator.next();
-                        for(ContractLogWbs oldWbs : oldLogWbsList){
-                            if(oldWbs.getTreePrimaryKeyId().toString().equals(next.getString("primaryKeyId"))){
-                                //存在则删除
-                                iterator.remove();
-                            }
-                        }
-                    }
-
-                    //检查哪些数据是删除的
-                    Iterator<ContractLogWbs> iterator1 = oldLogWbsList.iterator();
-                    while (iterator1.hasNext()){
-                        ContractLogWbs next = iterator1.next();
-                        for(JSONObject json : jsonList){
-                            if(json.getString("primaryKeyId").equals(next.getTreePrimaryKeyId().toString())){
-                                iterator1.remove();
-                            }
-                        }
-                    }
-
-                    //处理新增数据
-                    jsonList.forEach(json -> saveList.add(this.createContractLogWbs(json, JSONObject.parseObject(JSONObject.toJSONString(logJson), ContractLog.class))));
-                    //删除掉已经被取消的数据
-                    this.contractLogWbsService.removeBatchByIds(oldLogWbsList);
-                    //保存新增的数据
-                    this.contractLogWbsService.saveBatch(saveList);
-
-                } else {
-                    //没有旧数据,直接新增
-                    List<JSONObject> jsonList = saveContractLogVO.getCorrelationIds();
-
-                    List<ContractLogWbs> saveList = new ArrayList<>();
-                    jsonList.forEach(json -> saveList.add(this.createContractLogWbs(json, JSONObject.parseObject(JSONObject.toJSONString(logJson), ContractLog.class))));
-
-                    this.contractLogWbsService.saveBatch(saveList);
-                }
+                //删除旧的关联
+                this.contractLogWbsService.update(Wrappers.<ContractLogWbs>lambdaUpdate().set(ContractLogWbs::getIsDeleted, 1).eq(ContractLogWbs::getContractLogId, logJson.getString("id")));
+
+                //重新新增
+                List<JSONObject> jsonList = saveContractLogVO.getCorrelationIds();
+
+                List<ContractLogWbs> saveList = new ArrayList<>();
+                jsonList.forEach(json -> saveList.add(this.createContractLogWbs(json, JSONObject.parseObject(JSONObject.toJSONString(logJson), ContractLog.class))));
+
+                this.contractLogWbsService.saveBatch(saveList);
             }
             //修改数据ID指向
             this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getDataId, contractLog.getDataId()).eq(ContractLog::getId, logJson.getString("id")));
@@ -164,6 +130,7 @@ public class ContractLogClientImpl implements ContractLogClient {
         newLogWbs.setContractLogId(contractLog.getId());
         newLogWbs.setTreePrimaryKeyId(Long.parseLong(json.getString("primaryKeyId")));
         newLogWbs.setTitle(json.getString("path"));
+        newLogWbs.setBusinessId(json.getString("businessId"));
         newLogWbs.setCreateTime(new Date());
         newLogWbs.setCreateUser(AuthUtil.getUserId());
 

+ 1 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogWbsMapper.xml

@@ -15,6 +15,7 @@
         <result column="contract_log_id" property="contractLogId"/>
         <result column="tree_primary_key_id" property="treePrimaryKeyId"/>
         <result column="title" property="title"/>
+        <result column="business_id" property="businessId"/>
     </resultMap>
 
     <resultMap id="contractLogResultMap" type="org.springblade.business.entity.ContractLog">

+ 11 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/bean/TableInfo.java

@@ -34,8 +34,19 @@ public class TableInfo {
      */
     private String theLogId;
 
+    /**
+     * 日志关联的工序信息
+     */
     private List<Object> linkTabIds;
 
+    /**
+     * 日志填写时间
+     */
     private String recordTime;
 
+    /**
+     * id,用于给日志关联的工序信息做特殊化处理
+     */
+    private String businessId;
+
 }

+ 74 - 34
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -18,6 +18,7 @@ import com.spire.xls.core.IStyle;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
 import com.spire.xls.core.spreadsheet.pivottables.PivotStyle;
 import com.spire.xls.core.spreadsheet.shapes.XlsTextBoxShape;
+import io.reactivex.Single;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
@@ -488,7 +489,7 @@ public class ExcelTabController extends BladeController {
                     String filedType = "";
 
                     for (WbsFormElement elementInfo : elementList) {
-                        String ysName = elementInfo.getEName().replaceAll("[^\u4E00-\u9FA5_]", "");
+                        String ysName = elementInfo.getEName();
                         if (titleName.equals(ysName)) {
                             lastName = elementInfo.getEName();
                             attrInfo = elementInfo.getEKey() + "__" + i + "_" + j;
@@ -656,12 +657,13 @@ public class ExcelTabController extends BladeController {
     }
 
 
-/*
-    public static void main(String[] args) throws FileNotFoundException {
+
+
+ /*   public static void main(String[] args) throws FileNotFoundException {
 
         String thmlUrl = "/Users/hongchuangyanfa/Desktop/1234567890.html";
 
-        File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/Downloads/G4.xlsx");
+        File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/Downloads/A16.xlsx");
 
         Workbook wb = new Workbook();
         wb.loadFromMHtml(new FileInputStream(file1));
@@ -670,12 +672,13 @@ public class ExcelTabController extends BladeController {
 
         sheet.saveToHtml(thmlUrl);
         expailHtmlInfo(thmlUrl,1L);
-    }
-*/
+    }*/
+
+
 
 
     // 上传解析 html
-    public static void expailHtmlInfo(String thmlUrl, Long excelId) throws FileNotFoundException {
+    public void  expailHtmlInfo(String thmlUrl, Long excelId) throws FileNotFoundException {
 
         // 读取
         File file1 = ResourceUtil.getFile(thmlUrl);
@@ -760,14 +763,37 @@ public class ExcelTabController extends BladeController {
                     //x 移位 算法
                     String getRowInfo = rowData[y1];
 
-                    if(i==10){
 
-                        System.out.println("");
-                    }
 
                     if (getRowInfo != null) {
                         String[] dataInfo2 = getRowInfo.split(",");
 
+                        // 排序
+                        int lastMax = 0;
+                        List<String> datax = Arrays.stream(dataInfo2).sorted((a,b)->Integer.parseInt(a.split(":")[1])-Integer.parseInt(b.split(":")[1])).collect(Collectors.toList());
+                        List<String> lastdata = new ArrayList<>();
+                        //组合
+                        for (int h = 0; h < datax.size() ; h++) {
+                            int mx1 = Integer.parseInt(datax.get(h).split(":")[0]);
+                            int mx2 = Integer.parseInt(datax.get(h).split(":")[1]);
+                            if(lastdata.size()==0){
+                                lastdata.add(datax.get(0));
+
+                            }else{
+                                if(lastMax+1==mx1){
+                                    int minVal =  Integer.parseInt(lastdata.get(lastdata.size()-1).split(":")[0]);
+                                    lastdata.remove(lastdata.size()-1);
+                                    lastdata.add(minVal+":"+mx2);
+                                }else{
+                                    lastdata.add(datax.get(h));
+                                }
+                            }
+                            lastMax = mx2;
+                        }
+                        dataInfo2 = lastdata.stream().toArray(String[]::new);
+
+
+
                         // 先逻辑处理 连续时,归一
                         if ((dataInfo2[0].split(":")[0]).equals("1") && j == 0) {
                             x = Integer.parseInt(dataInfo2[0].split(":")[1]);
@@ -804,6 +830,10 @@ public class ExcelTabController extends BladeController {
                         }
                     }
 
+                    if(i==13){
+                        System.out.println("");
+                    }
+
                     //x y 坐标
                     if (rowspan == 0) {
                         y2 = i + 1;
@@ -835,7 +865,7 @@ public class ExcelTabController extends BladeController {
                     }
 
                     data.text(textInfo.replaceAll(" ", ""));
-                    if (!textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) && !textInfo.equals("—") && !textInfo.equals("-")) {  // 标题区域
+                    if (textInfo.indexOf("□")<0 && !textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) && !textInfo.equals("—") && !textInfo.equals("-")) {  // 标题区域
                         Map<String, String> dataInfo = new HashMap<String, String>();
                         dataInfo.put("name", textInfo);
                         dataInfo.put("x1", x1 + "");
@@ -843,9 +873,15 @@ public class ExcelTabController extends BladeController {
                         dataInfo.put("y1", y1 + "");
                         dataInfo.put("y2", y2 + "");
                         dataInfo.put("xytype", xy_type + "");
-                        zikey.add(dataInfo);
-
+                        if(textInfo.indexOf("/")<0){ // 带/为分割数据
+                            zikey.add(dataInfo);
+                        }
                     } else { //空行
+
+                        if(i==20){
+                            System.out.println("");
+                        }
+
                         List<Map<String, String>> left = new ArrayList<>();
                         List<Map<String, String>> top = new ArrayList<>();
                         for (int k = 0; k < zikey.size(); k++) {
@@ -868,6 +904,9 @@ public class ExcelTabController extends BladeController {
                                 }
                             }
                         }
+                        if(i==9 && j==2){
+                            System.out.println();
+                        }
 
                         String inputText = "";
                         // 特征值赛选 规则
@@ -878,19 +917,21 @@ public class ExcelTabController extends BladeController {
                             int yy1 = Integer.parseInt(left.get(k).get("y1"));
                             int yy2 = Integer.parseInt(left.get(k).get("y2"));
 
-                            if (index_state && !StringUtil.isNumeric(name) && name.length() <= 20) { // 正向规则匹配
-                                if (istrue) {
-                                    if (x1 - xx2 <= 1 && y1 == yy2) {
-                                        inputText = name;
+                            if(!StringUtil.isNumeric(name) && name.length() <= 20){ // 数字不匹配
+                                if (index_state ) { // 正向规则匹配
+                                    if (istrue) { // 是否空格等于值
+                                        if (x1 - xx2 <= 1 && y1 == yy2) {
+                                            inputText = name;
+                                        } else {
+                                            inputText += name + "_";
+                                        }
                                     } else {
                                         inputText += name + "_";
                                     }
                                 } else {
-                                    inputText += name + "_";
-                                }
-                            } else {
-                                if (x1 - xx2 <= 1 && y1 == yy2) {
-                                    inputText = name;
+                                    if (x1 - xx2 <= 1 && y1 == yy2) {
+                                        inputText = name;
+                                    }
                                 }
                             }
                         }
@@ -909,10 +950,6 @@ public class ExcelTabController extends BladeController {
                             }
                         }
 
-                        if(i==9){
-                            System.out.println();
-                            System.out.println(zikey);
-                        }
 
                         if (inputText != null && inputText != "" && inputText.indexOf("_") >= 0) {
                             inputText = inputText.substring(0, inputText.lastIndexOf("_"));
@@ -931,6 +968,8 @@ public class ExcelTabController extends BladeController {
                             colTitle.add(exctabCell);
                             data.attr("title", inputText);
 
+                        }else if(textInfo.indexOf("□")>=0){
+                            data.attr("title", inputText);
                         } else {
                             if (index_state) {
                                 if (rowspan >= 1) {
@@ -974,10 +1013,10 @@ public class ExcelTabController extends BladeController {
         }
         System.out.println(zikey);
         // 去掉重复的数
-/*       Map<String, String> groupMap2 = colTitle.stream()
+       Map<String, String> groupMap2 = colTitle.stream()
                 .collect(Collectors.groupingBy(ExctabCell::getTextInfo, Collectors.mapping(ExctabCell::getXys, Collectors.joining(","))));
 
-        exctabCellService.DeletExcelByTableId(excelId + "");
+      //  exctabCellService.DeletExcelByTableId(excelId + "");
 
         List<ExctabCell> colTitle2 = new ArrayList<>();
         for (String title : groupMap2.keySet()) {
@@ -988,7 +1027,7 @@ public class ExcelTabController extends BladeController {
             exctabCell.setXys(groupMap2.get(title));
             colTitle2.add(exctabCell);
         }
-        exctabCellService.saveBatch(colTitle2);*/
+     //   exctabCellService.saveBatch(colTitle2);
 
         // 保存
         File writefile = new File(thmlUrl);
@@ -1003,7 +1042,6 @@ public class ExcelTabController extends BladeController {
         int text_width = 0;
         int width = 0;
 
-
         int null_count = 0;
         int val_count = 0;
 
@@ -1077,7 +1115,7 @@ public class ExcelTabController extends BladeController {
         }
 
         // 空是否等于值的个数
-        if (null_count == val_count) {
+        if (null_count == val_count && width==maxCol) {
             istrue = true;
         } else {
             istrue = false;
@@ -1328,8 +1366,8 @@ public class ExcelTabController extends BladeController {
                                 }
                                 //https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
                                 if (myData.indexOf("https") >= 0 && myData.indexOf("aliyuncs") >= 0) {
-                                    Element element = trs.get(y1).select("td").get(x1);
-                                    String styles[] = element.attr("style").split(";");
+                                  //  Element element = trs.get(y1).select("td").get(x1);
+                                    String styles[] = data.attr("style").split(";");
                                     int Height = 0;
                                     for (String sty : styles) {
                                         if (sty.indexOf("height:") >= 0) {
@@ -1340,6 +1378,8 @@ public class ExcelTabController extends BladeController {
                                     BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
                                     ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
                                     pic.setHeight(Height);
+                                    System.out.println(sheet.getCellRange(y1, x1).getRowHeight());
+                                    System.out.println(sheet.getCellRange(y1, x1).getColumnWidth());
                                     sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
 
                                 } else {
@@ -2017,7 +2057,7 @@ public class ExcelTabController extends BladeController {
                     }
 
                     // 移除Id 和 p_key_id
-                    reData.remove("id");
+//                    reData.remove("id");
                     reData.remove("p_key_id");
                     reData.remove("classify");
                     reData.remove("contractId");

+ 19 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExctabCellController.java

@@ -28,6 +28,7 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.entity.WbsFormElement;
 import org.springblade.manager.unit.CopyUtil;
 import org.springblade.manager.vo.ExctabCellVO2;
 import org.springframework.web.bind.annotation.*;
@@ -106,6 +107,24 @@ public class ExctabCellController extends BladeController {
     @ApiOperationSupport(order = 5)
     @ApiOperation(value = "修改", notes = "传入exctabCell")
     public R update(@Valid @RequestBody ExctabCell exctabCell) {
+        //获取所有元素表ids
+        List<Long> ids = exctabCellService.getTabIds(exctabCell.getExctabId());
+        //获取所有元素表下的元素信息
+        List<WbsFormElement> infos = exctabCellService.getElementInfos(ids);
+        for (WbsFormElement info : infos) {
+            if (!exctabCell.getTextInfo().equals(info.getEName())) {
+                //名称不同就不同步修改,而是新增,关联元素表时新增
+                continue;
+            }
+            if (exctabCell.getTextInfo().equals(info.getEName())
+                    && (!exctabCell.getTextElementType().equals(info.getEType()) || !exctabCell.getTextDeviation().equals(info.getEAllowDeviation()))) {
+                //修改对应关联的元素表中的元素信息
+                info.setEType(exctabCell.getTextElementType());
+                info.setEAllowDeviation(exctabCell.getTextDeviation());
+                exctabCellService.updateElementInfo(info);
+            }
+        }
+        //修改基础信息
         return R.status(exctabCellService.updateById(exctabCell));
     }
 

+ 165 - 135
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExpaileHtml.java

@@ -10,6 +10,9 @@ import com.spire.xls.ExcelVersion;
 import com.spire.xls.Workbook;
 import com.spire.xls.Worksheet;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
+import io.swagger.models.auth.In;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
@@ -26,13 +29,42 @@ import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-public  class ExpaileHtml {
+public class ExpaileHtml {
 
-   // private final IExctabCellService exctabCellService;
+    // private final IExctabCellService exctabCellService;
 
     public static void main11(String[] args) throws IOException {
-        String dataInfo ="-";
 
+        List<String> data = new ArrayList<>();
+        List<String> data2 = new ArrayList<>();
+        data.add("1:2");
+
+
+        String[] intArray = new String[data.size()];
+        int lastMax = 0;
+        for (int h = 0; h < data.size() ; h++) {
+            int mx1 = Integer.parseInt(data.get(h).split(":")[0]);
+            int mx2 = Integer.parseInt(data.get(h).split(":")[1]);
+            if(data2.size()==0){
+                data2.add(data.get(0));
+
+            }else{
+                if(lastMax+1==mx1){
+                  int minVal =  Integer.parseInt(data2.get(data2.size()-1).split(":")[0]);
+                    data2.remove(data2.size()-1);
+                    data2.add(minVal+":"+mx2);
+                }else{
+                    data2.add(data.get(h));
+                }
+            }
+            lastMax = mx2;
+        }
+
+
+        System.out.println("开始");
+        for (String s : data2) {
+            System.out.println(s);
+        }
 
 
        /* String  thmlUrl = "/Users/hongchuangyanfa/Desktop/C10.1.xlsx" ;
@@ -53,21 +85,21 @@ public  class ExpaileHtml {
         //String url = "/Users/hongchuangyanfa/Desktop/privateUrl/1560108472350015488.html";
 
         //指定输出文档路径
-       // String fileName = "/Users/hongchuangyanfa/Desktop/pdf/UrlToPdf.pdf";
+        // String fileName = "/Users/hongchuangyanfa/Desktop/pdf/UrlToPdf.pdf";
 
         //指定插件路径
-     //   String pluginPath = "/Users/hongchuangyanfa/tool/plugins_mac";
+        //   String pluginPath = "/Users/hongchuangyanfa/tool/plugins_mac";
 
         //设置插件路径
-     //   HtmlConverter.setPluginPath(pluginPath);
+        //   HtmlConverter.setPluginPath(pluginPath);
         //将URL转换为PDF595×842
-       // HtmlConverter.convert(url, fileName, true, 1000000, new Size(842,595), new PdfMargins(0));
-     //   HtmlConverter.convert(url, fileName, true, 1000000, new Size(595,842), new PdfMargins(50,0,50,50 ));
+        // HtmlConverter.convert(url, fileName, true, 1000000, new Size(842,595), new PdfMargins(0));
+        //   HtmlConverter.convert(url, fileName, true, 1000000, new Size(595,842), new PdfMargins(50,0,50,50 ));
 
 
         //
-       // HTMLOptions options = new HTMLOptions();
-       // options.setTextMode();
+        // HTMLOptions options = new HTMLOptions();
+        // options.setTextMode();
 /*        Workbook wb = new Workbook();
         wb.loadFromMHtml(file.getInputStream());
         //获取工作表
@@ -87,11 +119,11 @@ public  class ExpaileHtml {
     }
 
     // 清表上传解析方案
-    public  static void expailHtmlInfo(String thmlUrl) throws FileNotFoundException {
+    public static void expailHtmlInfo(String thmlUrl) throws FileNotFoundException {
 
         // 读取
         File file1 = ResourceUtil.getFile(thmlUrl);
-        String htmlString =  IoUtil.readToString(new FileInputStream(file1));
+        String htmlString = IoUtil.readToString(new FileInputStream(file1));
 
         /*
            解析
@@ -102,7 +134,7 @@ public  class ExpaileHtml {
         // 样式集合
         Document doc = Jsoup.parse(htmlString);
         // 解析 style
-        Map<String ,String > styleMap = getHtmlStyle(doc);
+        Map<String, String> styleMap = getHtmlStyle(doc);
 
         //解析
         Element table = doc.select("table").first();
@@ -110,28 +142,28 @@ public  class ExpaileHtml {
 
         // 获取总行列数
         int maxCol = doc.select("Col").size();
-        String [] rowData = new String[trs.size()+1];
+        String[] rowData = new String[trs.size() + 1];
 
         // 行的状态
         boolean index_state = false;
         // 区域划分表示
-        int xy_type = 1  ;
+        int xy_type = 1;
 
         // 解析 excel元素集合
         Set<String> colTitleSet = new HashSet<>();
 
 //      标题集合信息
-        List<Map<String,String>> zikey = new ArrayList<>();
-        for(int i = 0 ;i <=trs.size()-1 ;i++) {
+        List<Map<String, String>> zikey = new ArrayList<>();
+        for (int i = 0; i <= trs.size() - 1; i++) {
             Element tr = trs.get(i);
             Elements tds = tr.select("td");
-            String xyInof = getTrInfo(tds,styleMap,index_state,xy_type,maxCol);
+            String xyInof = getTrInfo(tds, styleMap, index_state, xy_type, maxCol);
             xy_type = Integer.parseInt(xyInof.split(",")[0]);
-            tr.attr("xy_type",xyInof);
+            tr.attr("xy_type", xyInof);
             index_state = Boolean.parseBoolean(xyInof.split(",")[1]);
-           boolean isMaxCol = Integer.parseInt(xyInof.split(",")[2])==maxCol;
+            boolean isMaxCol = Integer.parseInt(xyInof.split(",")[2]) == maxCol;
             // 计算单元格坐标
-            int x= 0;
+            int x = 0;
             for (int j = 0; j < tds.size(); j++) {
                 {
                     Element data = tds.get(j);
@@ -139,141 +171,141 @@ public  class ExpaileHtml {
                     int rowspan = data.attr("ROWSPAN").equals("") ? 0 : Integer.parseInt(data.attr("ROWSPAN"));
                     Map<String, String> textObject = new HashMap<>();
                     // 计算
-                    int x1 =0;
-                    int x2 =0;
-                    int y1 =0;
-                    int y2 =0;
+                    int x1 = 0;
+                    int x2 = 0;
+                    int y1 = 0;
+                    int y2 = 0;
 
-                    String textInfo = data.text().trim().replaceAll(" ","");
+                    String textInfo = data.text().trim().replaceAll(" ", "");
 
-                    y1=i+1;
+                    y1 = i + 1;
                     //x 移位 算法
                     String getRowInfo = rowData[y1];
-                    if(getRowInfo!=null){
-                        String [] dataInfo2 = getRowInfo.split(",");
-                        if(getRowInfo.indexOf("1")>=0 && j==0){
-                            x= Integer.parseInt(dataInfo2[0].split(":")[1]);
-                        }else{
-                            for(int m =0;m<dataInfo2.length ;m++){
+                    if (getRowInfo != null) {
+                        String[] dataInfo2 = getRowInfo.split(",");
+                        if (getRowInfo.indexOf("1") >= 0 && j == 0) {
+                            x = Integer.parseInt(dataInfo2[0].split(":")[1]);
+                        } else {
+                            for (int m = 0; m < dataInfo2.length; m++) {
                                 int mx1 = Integer.parseInt(dataInfo2[m].split(":")[0]);
                                 int mx2 = Integer.parseInt(dataInfo2[m].split(":")[1]);
-                                if((mx1-x)==1 && mx1>x){
-                                    x = mx2 ;
+                                if ((mx1 - x) == 1 && mx1 > x) {
+                                    x = mx2;
                                 }
                             }
                         }
                     }
 
                     // X 坐标
-                    if(colspan==0){
-                        x1 = x+1;
-                        x2 = x+1;
-                        x= x +1;
-                    }else{
-                        x1 = x+1;
-                        x2 = x+colspan;
-                        x = x+colspan;
+                    if (colspan == 0) {
+                        x1 = x + 1;
+                        x2 = x + 1;
+                        x = x + 1;
+                    } else {
+                        x1 = x + 1;
+                        x2 = x + colspan;
+                        x = x + colspan;
                     }
 
                     //x y 坐标
-                    if(rowspan==0){
-                        y2 = i+1;
-                    }else{
-                        y2 = i+rowspan;
-                        for(int k=0;k<rowspan-1;k++){
-                            String dataInfo = rowData[k+2+i];
-                            if(dataInfo==null){
-                                dataInfo = x1+":"+x2;
-                            }else{
-                                String [] dataInfo2 = dataInfo.split(",");
-                                String dataInfo3 = dataInfo2[dataInfo2.length-1];
+                    if (rowspan == 0) {
+                        y2 = i + 1;
+                    } else {
+                        y2 = i + rowspan;
+                        for (int k = 0; k < rowspan - 1; k++) {
+                            String dataInfo = rowData[k + 2 + i];
+                            if (dataInfo == null) {
+                                dataInfo = x1 + ":" + x2;
+                            } else {
+                                String[] dataInfo2 = dataInfo.split(",");
+                                String dataInfo3 = dataInfo2[dataInfo2.length - 1];
                                 int mx1 = Integer.parseInt(dataInfo3.split(":")[0]);
                                 int mx2 = Integer.parseInt(dataInfo3.split(":")[1]);
-                                if(mx2+1==x1){
-                                    dataInfo = dataInfo+","+mx1+":"+x2;
-                                }else{
-                                    dataInfo = dataInfo+","+x1+":"+x2;
+                                if (mx2 + 1 == x1) {
+                                    dataInfo = dataInfo + "," + mx1 + ":" + x2;
+                                } else {
+                                    dataInfo = dataInfo + "," + x1 + ":" + x2;
                                 }
                             }
-                            rowData[k+2+i] = dataInfo;
+                            rowData[k + 2 + i] = dataInfo;
                         }
                     }
 
 
-                  //  System.out.println(x1+"_"+x2+"_"+y1+"_"+y2+"_"+textInfo);
-                  //  data.text(textInfo.replaceAll(" ",""));
-                    if(!textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0)&& !textInfo.equals("—") && !textInfo.equals("-") ){  // 标题区域
-                        Map<String,String> dataInfo =new HashMap<String,String>();
-                        dataInfo.put("name",textInfo);
-                        dataInfo.put("x1",x1+"");
-                        dataInfo.put("x2",x2+"");
-                        dataInfo.put("y1",y1+"");
-                        dataInfo.put("y2",y2+"");
-                        dataInfo.put("xytype",xy_type+"");
+                    //  System.out.println(x1+"_"+x2+"_"+y1+"_"+y2+"_"+textInfo);
+                    //  data.text(textInfo.replaceAll(" ",""));
+                    if (!textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) && !textInfo.equals("—") && !textInfo.equals("-")) {  // 标题区域
+                        Map<String, String> dataInfo = new HashMap<String, String>();
+                        dataInfo.put("name", textInfo);
+                        dataInfo.put("x1", x1 + "");
+                        dataInfo.put("x2", x2 + "");
+                        dataInfo.put("y1", y1 + "");
+                        dataInfo.put("y2", y2 + "");
+                        dataInfo.put("xytype", xy_type + "");
                         zikey.add(dataInfo);
-                    }else{ //空行
-                        List<Map<String,String>> left = new ArrayList<>();
-                        List<Map<String,String>> top = new ArrayList<>();
-                        for(int k=0 ; k< zikey.size() ;k++){
+                    } else { //空行
+                        List<Map<String, String>> left = new ArrayList<>();
+                        List<Map<String, String>> top = new ArrayList<>();
+                        for (int k = 0; k < zikey.size(); k++) {
                             String name = zikey.get(k).get("name");
-                          //  String name2 = zikey.get(k).get("name").replaceAll("[^\u4E00-\u9FA5]", "");
-                            int xx1 = Integer.parseInt( zikey.get(k).get("x1"));
-                            int xx2 = Integer.parseInt( zikey.get(k).get("x2"));
-                            int yy1 = Integer.parseInt( zikey.get(k).get("y1"));
-                            int yy2 = Integer.parseInt( zikey.get(k).get("y2"));
-                            int xytype2 = Integer.parseInt( zikey.get(k).get("xytype"));
+                            //  String name2 = zikey.get(k).get("name").replaceAll("[^\u4E00-\u9FA5]", "");
+                            int xx1 = Integer.parseInt(zikey.get(k).get("x1"));
+                            int xx2 = Integer.parseInt(zikey.get(k).get("x2"));
+                            int yy1 = Integer.parseInt(zikey.get(k).get("y1"));
+                            int yy2 = Integer.parseInt(zikey.get(k).get("y2"));
+                            int xytype2 = Integer.parseInt(zikey.get(k).get("xytype"));
                             // 左匹配
-                            if( yy1<=y1 && yy2>=y2 && xx2<x1 && xytype2==xy_type){
+                            if (yy1 <= y1 && yy2 >= y2 && xx2 < x1 && xytype2 == xy_type) {
                                 left.add(zikey.get(k));
                             }
                             //向 上 匹配
-                            if(index_state){
-                                if( xx1<=x1 && xx2 >=x2 && yy2<y1 && xytype2==xy_type){
+                            if (index_state) {
+                                if (xx1 <= x1 && xx2 >= x2 && yy2 < y1 && xytype2 == xy_type) {
                                     top.add(zikey.get(k));
                                 }
                             }
                         }
-                        String inputText ="";
+                        String inputText = "";
                         // 特征值赛选 规则
-                        for(int k=0 ; k< left.size() ;k++){ // 左计算
-                            String name = left.get(k).get("name") ;//.replaceAll("[^\u4E00-\u9FA5]", "");
-                            int xx1 = Integer.parseInt( left.get(k).get("x1"));
-                            int xx2 = Integer.parseInt( left.get(k).get("x2"));
-                            int yy1 = Integer.parseInt( left.get(k).get("y1"));
-                            int yy2 = Integer.parseInt( left.get(k).get("y2"));
-                            if(index_state){ // 正向规则匹配
-                                inputText+=name+"_";
-                            }else{
-                                if(x1-xx2<=1 && y1==yy2){
+                        for (int k = 0; k < left.size(); k++) { // 左计算
+                            String name = left.get(k).get("name");//.replaceAll("[^\u4E00-\u9FA5]", "");
+                            int xx1 = Integer.parseInt(left.get(k).get("x1"));
+                            int xx2 = Integer.parseInt(left.get(k).get("x2"));
+                            int yy1 = Integer.parseInt(left.get(k).get("y1"));
+                            int yy2 = Integer.parseInt(left.get(k).get("y2"));
+                            if (index_state) { // 正向规则匹配
+                                inputText += name + "_";
+                            } else {
+                                if (x1 - xx2 <= 1 && y1 == yy2) {
                                     inputText = name;
                                 }
                             }
                         }
 
                         // 特征值赛选 规则
-                        if(top!=null && top.size()>=1){
-                            for(int k=0 ; k< top.size() ;k++){ // 向上计算
-                                String name = top.get(k).get("name") ;//.replaceAll("[^\u4E00-\u9FA5]", "");
-                                int xx1 = Integer.parseInt( top.get(k).get("x1"));
-                                int xx2 = Integer.parseInt( top.get(k).get("x2"));
-                                int yy1 = Integer.parseInt( top.get(k).get("y1"));
-                                int yy2 = Integer.parseInt( top.get(k).get("y2"));
-                                inputText+=name+"_";
+                        if (top != null && top.size() >= 1) {
+                            for (int k = 0; k < top.size(); k++) { // 向上计算
+                                String name = top.get(k).get("name");//.replaceAll("[^\u4E00-\u9FA5]", "");
+                                int xx1 = Integer.parseInt(top.get(k).get("x1"));
+                                int xx2 = Integer.parseInt(top.get(k).get("x2"));
+                                int yy1 = Integer.parseInt(top.get(k).get("y1"));
+                                int yy2 = Integer.parseInt(top.get(k).get("y2"));
+                                inputText += name + "_";
                             }
                         }
 
-                        if(inputText!=null && inputText!="" && inputText.indexOf("_")>=0){
-                            inputText = inputText.substring(0,inputText.lastIndexOf("_"));
+                        if (inputText != null && inputText != "" && inputText.indexOf("_") >= 0) {
+                            inputText = inputText.substring(0, inputText.lastIndexOf("_"));
                         }
 
                         // 计算当前 输入框 标题匹配原则(左 - 上- 下)
-                      //  System.out.println(x1+"_"+x2+","+y1+"_"+y2+"=="+textInfo+"=left"+left.toString() +"===top"+top.toString()+"__index_state="+index_state+"inputtext="+inputText);
+                        //  System.out.println(x1+"_"+x2+","+y1+"_"+y2+"=="+textInfo+"=left"+left.toString() +"===top"+top.toString()+"__index_state="+index_state+"inputtext="+inputText);
 
                         // 设置文本信息
-                        if(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0){
+                        if (textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) {
                             data.empty().append("<input type='time' style='width:100%;height:100%' placeholder=''> </input>");
-                            colTitleSet.add(inputText+"签字时间");
-                        }else {
+                            colTitleSet.add(inputText + "签字时间");
+                        } else {
                             if (index_state) {
                                 data.empty().append("<input type='text' style='width:100%;height:100%' placeholder='" + inputText + "' > </input>");
                             } else {
@@ -291,12 +323,12 @@ public  class ExpaileHtml {
                             colTitleSet.add(inputText);
                         }
                     }
-                   // data.text(textInfo.replaceAll(" ",""));
+                    // data.text(textInfo.replaceAll(" ",""));
                 }
             }
         }
 
-        for (String keys:colTitleSet){
+        for (String keys : colTitleSet) {
             System.out.println(keys.replaceAll("[^(\u4E00-\u9FA5_)]", ""));
         }
 
@@ -306,13 +338,11 @@ public  class ExpaileHtml {
     }
 
 
-
-
     //计算区域坐标
-    public static String getTrInfo(Elements tds,Map<String ,String > styleMap,boolean index_state,Integer xy_type,int maxCol){
+    public static String getTrInfo(Elements tds, Map<String, String> styleMap, boolean index_state, Integer xy_type, int maxCol) {
 
-        int x_width = 0 ;
-        int y_width = 0 ;
+        int x_width = 0;
+        int y_width = 0;
         int text_width = 0;
         int width = 0;
 
@@ -323,56 +353,56 @@ public  class ExpaileHtml {
 
             int colspan = data.attr("COLSPAN").equals("") ? 1 : Integer.parseInt(data.attr("COLSPAN"));
             String classInfo = styleMap.get(keyId);
-            if(classInfo ==null){
+            if (classInfo == null) {
                 classInfo = data.attr("style");
-            }else{
+            } else {
                 data.removeAttr("class");
-                data.attr("style",styleMap.get(keyId).replaceAll("break-word","inherit"));
+                data.attr("style", styleMap.get(keyId).replaceAll("break-word", "inherit"));
             }
 
             // 计算线开始
-            if(classInfo.indexOf("border-left-style")>=0 && classInfo.indexOf("border-top-style")>=0 && classInfo.indexOf("border-bottom-style")>=0 && classInfo.indexOf("border-right-style")>=0){
+            if (classInfo.indexOf("border-left-style") >= 0 && classInfo.indexOf("border-top-style") >= 0 && classInfo.indexOf("border-bottom-style") >= 0 && classInfo.indexOf("border-right-style") >= 0) {
                 x_width += colspan;
             }
 
             // 计算结束
-            if(classInfo.indexOf("border-left-style")< 0 && (classInfo.indexOf("border-top-style")<0 ||classInfo.indexOf("border-top-style")>=0) && classInfo.indexOf("border-bottom-style")<0 && classInfo.indexOf("border-right-style")<0){
+            if (classInfo.indexOf("border-left-style") < 0 && (classInfo.indexOf("border-top-style") < 0 || classInfo.indexOf("border-top-style") >= 0) && classInfo.indexOf("border-bottom-style") < 0 && classInfo.indexOf("border-right-style") < 0) {
                 y_width += colspan;
             }
 
             String name = data.text().replaceAll("[^\u4E00-\u9FA5]", "");
-            if(!name.isEmpty()){
+            if (!name.isEmpty()) {
                 text_width += colspan;
             }
-            width +=colspan;
+            width += colspan;
         }
 
         // 在区域内
-        if(index_state){
+        if (index_state) {
             //是否需要改变
-            if(maxCol == y_width ){
-                index_state =  false ;
-                xy_type+=1;
+            if (maxCol == y_width) {
+                index_state = false;
+                xy_type += 1;
             }
-            if(maxCol == text_width){
-                xy_type+=1;
+            if (maxCol == text_width) {
+                xy_type += 1;
             }
-        }else{ // 区域外
-            if(maxCol == x_width ){
-                index_state =  true ;
-                xy_type+=1;
+        } else { // 区域外
+            if (maxCol == x_width) {
+                index_state = true;
+                xy_type += 1;
             }
         }
-        return xy_type+","+index_state+","+width;
+        return xy_type + "," + index_state + "," + width;
     }
 
     // 获取解析样式
-    public static   Map<String ,String > getHtmlStyle(Document doc){
-        Map<String ,String > styleMap = new HashMap<>();
+    public static Map<String, String> getHtmlStyle(Document doc) {
+        Map<String, String> styleMap = new HashMap<>();
         Element style = doc.select("style").first();
         Matcher cssMatcher = Pattern.compile("(\\w+)\\s*[{]([^}]+)[}]").matcher(style.html());
         while (cssMatcher.find()) {
-            styleMap.put(cssMatcher.group(1),cssMatcher.group(2));
+            styleMap.put(cssMatcher.group(1), cssMatcher.group(2));
         }
         return styleMap;
     }

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

@@ -334,7 +334,7 @@ public class WbsTreeController extends BladeController {
      * 查询公有wbs节点元素表与节点参数
      */
     @ApiOperationSupport(order = 12)
-    @ApiOperation(value = "查询节点元素表与节点参数", notes = "传入父节点id")
+    @ApiOperation(value = "查询公有wbs节点元素表与节点参数", notes = "传入父节点id")
     @RequestMapping(value = "/getNodeTabAndParam", method = RequestMethod.GET)
     public R<WbsNodeTabAndParamVO> getNodeTabAndParam(@ApiParam(value = "父节点id", required = true) @RequestParam String id) {
         WbsNodeTabAndParamVO rs = wbsTreeService.getNodeTabAndParam(id);

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExctabCellMapper.java

@@ -46,4 +46,7 @@ public interface ExctabCellMapper extends BaseMapper<ExctabCell> {
 	List<ExctabCellVO> getColSelect(String tabId);
 
 	Integer DeletExcelByTableId(String tabId);
+
+    List<Long> selectTabIdsByExcelId(Long id);
+
 }

+ 4 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExctabCellMapper.xml

@@ -20,6 +20,10 @@
         select * from m_exctab_cell where is_deleted = 0 and exctab_id =#{tabId}
     </select>
 
+    <select id="selectTabIdsByExcelId" resultType="java.lang.Long">
+        SELECT wbs_tab_id FROM m_wbs_tab_relation_excel_tab WHERE excel_tab_id = #{id}
+    </select>
+
     <delete id="DeletExcelByTableId" >
         delete from m_exctab_cell where exctab_id =#{tabId}
     </delete>

+ 8 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExctabCellService.java

@@ -19,6 +19,7 @@ package org.springblade.manager.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.manager.entity.ExctabCell;
 import org.springblade.manager.entity.LinkdataInfo;
+import org.springblade.manager.entity.WbsFormElement;
 import org.springblade.manager.vo.ExctabCellVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -46,4 +47,11 @@ public interface IExctabCellService extends IService<ExctabCell> {
 	List<ExctabCellVO> getColSelect(String tabId);
 
 	Integer DeletExcelByTableId(String tabId);
+
+    List<Long> getTabIds(Long id);
+
+	List<WbsFormElement> getElementInfos(List<Long> ids);
+
+	Integer updateElementInfo(WbsFormElement info);
+
 }

+ 22 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -189,6 +189,11 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 					tableInfo.setRecordTime(dataInfo2.getString("recordTime"));
 				}
 				//huangjn 日志所选时间
+				//huangjn 每份填报数据的id,目前日志专用
+				if(dataInfo2.containsKey("id")){
+					tableInfo.setBusinessId(dataInfo2.getString("id"));
+				}
+				//huangjn 每份填报数据的id,目前日志专用
 
 				dataInfo2.fluentRemove("contractId")
 						 .fluentRemove("pkeyId")
@@ -311,7 +316,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 				}
 			}
 		}
-		List<JSONObject> linkTabIds = JSONArray.parseArray(JSONObject.toJSONString(tableInfoList.get(0).getLinkTabIds()), JSONObject.class);
 
 		if(StringUtils.isNotEmpty(businessId)){
 			//删除旧数据
@@ -319,6 +323,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 			this.jdbcTemplate.execute(delSql);
 		}
 
+		List<JSONObject> logWbsList = new ArrayList<>();
+
 		for(TableInfo tableInfo : tableInfoList){
 			WbsTreePrivate wbsTreePrivate = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, tableInfo.getPkeyId()));
 			if(wbsTreePrivate == null){
@@ -326,10 +332,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 			}
 			String tabName = wbsTreePrivate.getInitTableName();
 
+			String id = tableInfo.getBusinessId();
+			if(StringUtils.isEmpty(id)){
+				id = SnowFlakeUtil.getId() + "";
+			}
+
 			//拼接SQL
 			StringBuilder sql = new StringBuilder("INSERT INTO " + tabName ),
 						  keySql = new StringBuilder("id, group_id"),
-					      valSql = new StringBuilder("" + SnowFlakeUtil.getId() + ", " + businessId);
+					      valSql = new StringBuilder("" + id + ", " + businessId);
 			//参数
 			LinkedHashMap<String,String> dataMap2 = tableInfo.getDataMap();
 			for(String key : dataMap2.keySet()){
@@ -345,6 +356,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 			}catch (Exception e){
 				e.printStackTrace();
 			}
+
+			//处理每个表格的关联情况
+			List<JSONObject> linkTabIds = JSONArray.parseArray(JSONObject.toJSONString(tableInfo.getLinkTabIds()), JSONObject.class);
+			for(JSONObject json : linkTabIds){
+				json.put("businessId", id);
+			}
+			logWbsList.addAll(linkTabIds);
 		}
 
 		//保存日志记录
@@ -356,7 +374,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 				tableNode.getPKeyId(),
 				parentNode.getMajorDataType(),
 				recordTime,
-				linkTabIds
+				logWbsList
 		));
 
 	}
@@ -468,7 +486,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 					//	String x2 = data.children().get(0).attr("x2");
 					String y1 = data.children().get(0).attr("y1");
 					//String y2 = data.children().get(0).attr("y2");
-					String keyVal = x1+"_"+y1;
+					String keyVal = i+"_"+j;
 					String keyname = data.children().get(0).attr("keyname");
 					if(StringUtils.isNotEmpty(keyname)){
 						String[] keys = keyname.split("__");

+ 35 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExctabCellServiceImpl.java

@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
 import org.springblade.manager.entity.ExctabCell;
 import org.springblade.manager.entity.LinkdataInfo;
+import org.springblade.manager.entity.WbsFormElement;
 import org.springblade.manager.vo.ExctabCellVO;
 import org.springblade.manager.mapper.ExctabCellMapper;
 import org.springblade.manager.service.IExctabCellService;
@@ -28,6 +29,7 @@ import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import javax.validation.constraints.NotEmpty;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -40,20 +42,41 @@ import java.util.List;
 @AllArgsConstructor
 public class ExctabCellServiceImpl extends ServiceImpl<ExctabCellMapper, ExctabCell> implements IExctabCellService {
 
+    private final WbsFormElementServiceImpl wbsFormElementService;
 
-	@Override
-	public IPage<ExctabCellVO> selectExctabCellPage(IPage<ExctabCellVO> page, ExctabCellVO exctabCell) {
-		return page.setRecords(baseMapper.selectExctabCellPage(page, exctabCell));
-	}
+    @Override
+    public IPage<ExctabCellVO> selectExctabCellPage(IPage<ExctabCellVO> page, ExctabCellVO exctabCell) {
+        return page.setRecords(baseMapper.selectExctabCellPage(page, exctabCell));
+    }
 
-	@Override
-	public List<ExctabCellVO> getColSelect(String tabId) {
-		return baseMapper.getColSelect(tabId);
-	}
+    @Override
+    public List<ExctabCellVO> getColSelect(String tabId) {
+        return baseMapper.getColSelect(tabId);
+    }
 
-	@Override
-	public Integer DeletExcelByTableId(String tabId) {
-		return baseMapper.DeletExcelByTableId(tabId);
-	}
+    @Override
+    public Integer DeletExcelByTableId(String tabId) {
+        return baseMapper.DeletExcelByTableId(tabId);
+    }
+
+    @Override
+    public List<Long> getTabIds(Long id) {
+        return baseMapper.selectTabIdsByExcelId(id);
+    }
+
+    @Override
+    public List<WbsFormElement> getElementInfos(List<Long> ids) {
+        List<WbsFormElement> result = new ArrayList<>();
+        for (Long id : ids) {
+            List<WbsFormElement> wbsFormElements = wbsFormElementService.selectElementListByFid(String.valueOf(id));
+            result.addAll(wbsFormElements);
+        }
+        return result;
+    }
+
+    @Override
+    public Integer updateElementInfo(WbsFormElement info) {
+        return wbsFormElementService.updateById(info) ? 1 : -1;
+    }
 
 }

+ 8 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -400,8 +400,14 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
         WbsNodeTabAndParamVO resultList = new WbsNodeTabAndParamVO();
         //获取该节点下所有表单
         List<WbsNodeTableVO> list = baseMapper.selectNodeTabAndParamList(id, wbsId, projectId);
-        //获取节点参数 id=表单parentId=节点id; id重复,后期可能会出问题,此处建议使用pKeyId与参数的wbsId做绑定;
-        List<WbsParam> paramList = wbsParamServiceImpl.findByNodeId(Long.valueOf(id));
+        //获取节点信息
+        WbsTreePrivate nodeInfo = baseMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
+                .eq(WbsTreePrivate::getId, id)
+                .eq(WbsTreePrivate::getWbsId, wbsId)
+                .eq(WbsTreePrivate::getProjectId, projectId)
+        );
+        //获取节点参数,此处使用pKeyId与参数表的wbsId做的绑定才能确定唯一;
+        List<WbsParam> paramList = wbsParamServiceImpl.findByNodeId(nodeInfo.getPKeyId());
         resultList.setTabData(list);
         resultList.setParamData(paramList);
         return resultList;

+ 6 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

@@ -1010,13 +1010,13 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                 //新增
                 if (pawDTO.getReferenceType().equals("public")) {
                     //批量插入
-                    insertBatch(insertData1, 10);
+                    insertBatch(insertData1, 100);
 
                     projectInfoMapper.updateTemplateIdById(pawDTO.getProjectId(), pawDTO.getWbsId(), "public");
 
                 } else if (pawDTO.getReferenceType().equals("private")) {
                     //批量插入
-                    insertBatch(insertData2, 10);
+                    insertBatch(insertData2, 100);
 
                     //同步电签位置配置信息、编辑默认信息数据
                     textDictInfoService.saveBatch(insertData3, 100);
@@ -1025,8 +1025,10 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                 }
 
                 //Redis
-                bladeRedis.set("submit-wbs-project:" + pawDTO.getProjectId(), "1");
-                bladeRedis.expire("submit-wbs-project:" + pawDTO.getProjectId(), 60);
+                if (saveIds.size() >= 1000) {
+                    bladeRedis.set("submit-wbs-project:" + pawDTO.getProjectId(), "1");
+                    bladeRedis.expire("submit-wbs-project:" + pawDTO.getProjectId(), 60);
+                }
             }
         }