Эх сурвалжийг харах

Merge branch 'dev' of http://219.151.181.73:3000/zhuwei/bladex into dev

# Conflicts:
#	blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
lvy 16 цаг өмнө
parent
commit
1121c521d1
42 өөрчлөгдсөн 1395 нэмэгдсэн , 90 устгасан
  1. 2 2
      blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/OssBuilder.java
  2. 34 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TaskProgressDTO.java
  3. 67 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TaskProgress.java
  4. 19 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/TaskProgressClient.java
  5. 34 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TaskProgressVO.java
  6. 19 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TaskProgressVO1.java
  7. 37 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/FormulaReferenceDTO.java
  8. 12 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ProfilerOffset.java
  9. 5 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsTreeContractExtend.java
  10. 59 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/profiler/ProfilerDataPush.java
  11. 66 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/profiler/ProfilerOffsetPush.java
  12. 52 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/profiler/ProfilerSectionPush.java
  13. 23 8
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
  14. 137 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskProgressController.java
  15. 23 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/TaskProgressClientImpl.java
  16. 2 2
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml
  17. 53 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskProgressMapper.java
  18. 58 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskProgressMapper.xml
  19. 49 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskProgressService.java
  20. 2 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java
  21. 159 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskProgressServiceImpl.java
  22. 9 6
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  23. 7 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  24. 4 11
      blade-service/blade-business/src/main/java/org/springblade/business/sync/TaskSync.java
  25. 3 0
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java
  26. 2 1
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/ScrDataServiceImpl.java
  27. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FormulaController.java
  28. 21 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ProfilerController.java
  29. 8 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java
  30. 3 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java
  31. 3 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProfilerOffsetMapper.java
  32. 3 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProfilerOffsetMapper.xml
  33. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IFormulaService.java
  34. 3 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  35. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreePrivateService.java
  36. 7 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/ProfilerOffsetService.java
  37. 46 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  38. 31 5
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java
  39. 162 22
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ProfilerOffsetServiceImpl.java
  40. 48 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsParamServiceImpl.java
  41. 76 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  42. 44 13
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

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

@@ -91,13 +91,13 @@ public class OssBuilder {
 		String tenantId = AuthUtil.getTenantId();
 		Oss oss = getOss(tenantId, code);
         String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
-       /* if(SystemUtils.isMacOs()||SystemUtils.isWindows()){
+       if(SystemUtils.isMacOs()||SystemUtils.isWindows()){
             if("20".equals(sys_isonline)){
                 oss.setEndpoint("http://183.247.216.148:9000/");
             }else {
                 oss.setEndpoint("https://xinan1.zos.ctyun.cn");
             }
-        }*/
+        }
 		//oss.setEndpoint("https://xinan1.zos.ctyun.cn");
 		System.out.println("oss111="+oss.getEndpoint());
 		Oss ossCached = ossPool.get(tenantId);

+ 34 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TaskProgressDTO.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.business.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.business.entity.TaskProgress;
+
+/**
+ * 任务进度表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2025-10-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class TaskProgressDTO extends TaskProgress {
+	private static final long serialVersionUID = 1L;
+
+}

+ 67 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TaskProgress.java

@@ -0,0 +1,67 @@
+/*
+ *      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.business.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 任务进度表实体类
+ *
+ * @author BladeX
+ * @since 2025-10-15
+ */
+@Data
+@TableName("m_task_progress")
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class TaskProgress extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long projectId;
+	private Long contractId;
+	/**
+	* 1.sava_again 2.re_sign 3.电签检测 4.一键电签
+	*/
+		private Integer type;
+	/**
+	* 任务总数
+	*/
+		private Integer taskTotal;
+	/**
+	* 已完成数
+	*/
+		private Integer finishTatol;
+	/**
+	* 是否已完成 0否 1是
+	*/
+		private Integer isFinish;
+	/**
+	 * 任务ID
+ 	 */
+		private String dataId;
+
+
+}

+ 19 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/TaskProgressClient.java

@@ -0,0 +1,19 @@
+package org.springblade.business.feign;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import static org.springblade.core.launch.constant.AppConstant.APPLICATION_NAME_PREFIX;
+
+@FeignClient(value = APPLICATION_NAME_PREFIX + "business")
+public interface TaskProgressClient {
+    /**
+     * 接口前缀
+     */
+    String API_PREFIX = "/api/business/taskProgress";
+
+
+    @GetMapping(API_PREFIX + "/updateTaskProgress")
+    Boolean updateTaskProgress(@RequestParam("projectId") Long projectId,@RequestParam("contractId") Long contractId,@RequestParam("type") Integer type,@RequestParam("finishTotal") Integer finishTotal,@RequestParam("dataId") String dataId);
+}

+ 34 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TaskProgressVO.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.business.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.business.entity.TaskProgress;
+
+/**
+ * 任务进度表视图实体类
+ *
+ * @author BladeX
+ * @since 2025-10-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class TaskProgressVO extends TaskProgress {
+	private static final long serialVersionUID = 1L;
+
+}

+ 19 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TaskProgressVO1.java

@@ -0,0 +1,19 @@
+package org.springblade.business.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class TaskProgressVO1 {
+
+    private Integer finishCount;
+
+    private Integer totalCount;
+
+    private BigDecimal pace;
+}

+ 37 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/FormulaReferenceDTO.java

@@ -0,0 +1,37 @@
+package org.springblade.manager.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 公式应用设置
+ * @author LHB
+ */
+@Data
+public class FormulaReferenceDTO {
+    @ApiModelProperty("表单pKeyId")
+    private Long pKeyId;
+
+    @ApiModelProperty(value = "节点pKeyId",required = true)
+    @NotNull(message = "节点pKeyId不能为空")
+    private Long pId;
+
+    @ApiModelProperty(value = "选择表格的元素key",required = true)
+    @NotBlank(message = "选择表格的元素key不能为空")
+    private String key;
+
+    @ApiModelProperty(value = "表单元素表名称",required = true)
+    @NotBlank(message = "表单元素表名称不能为空")
+    private String initTableName;
+
+    @ApiModelProperty(value = "状态 0禁用 1启用",required = true)
+    @NotNull(message = "状态不能为空")
+    private Integer status;
+
+        @ApiModelProperty(value = "类型 1-质检 2-试验",required = true)
+    @NotNull(message = "类型")
+    private Integer type;
+}

+ 12 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ProfilerOffset.java

@@ -119,6 +119,18 @@ public class ProfilerOffset {
     @ApiModelProperty("文件地址")
     private String fileUrl;
 
+    /**
+     * 是否推送(0-未推送,1-已推送,2-推送失败)
+     */
+    @ApiModelProperty("是否推送(0-未推送,1-已推送,2-推送失败)")
+    private Integer push;
+
+    /**
+     * 推送时间
+     */
+    @ApiModelProperty("推送时间")
+    private LocalDateTime pushTime;
+
     /**
      *  创建时间
      */

+ 5 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsTreeContractExtend.java

@@ -64,4 +64,9 @@ public class WbsTreeContractExtend {
      *  修改人
      */
     private Long updateUser;
+
+    /**
+     * 哪些元素执行公式
+     */
+    private String formulaConfig;
 }

+ 59 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/profiler/ProfilerDataPush.java

@@ -0,0 +1,59 @@
+package org.springblade.manager.entity.profiler;
+
+import com.alibaba.druid.util.StringUtils;
+import lombok.Data;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.manager.entity.ProfilerData;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author LHB
+ * 断面仪 测量数据推送对象
+ */
+@Data
+public class ProfilerDataPush {
+    /**
+     * 测点
+     */
+    private String measurement_point;
+    /**
+     * 距离
+     */
+    private String distance;
+    /**
+     * x坐标
+     */
+    private String x_coordinate;
+    /**
+     * z坐标
+     */
+    private String z_coordinate;
+    /**
+     * 超挖值(米)
+     */
+    private String overbreak_value;
+    /**
+     * 欠挖值(米)
+     */
+    private String underbreak_value;
+    public static List<ProfilerDataPush> parameterMapping(List<ProfilerData> data) {
+        return data.stream().map(f -> {
+            ProfilerDataPush sectionPush = new ProfilerDataPush();
+            sectionPush.setMeasurement_point(f.getAngle());
+            sectionPush.setDistance(f.getDist());
+            sectionPush.setX_coordinate(f.getX());
+            sectionPush.setZ_coordinate(f.getZ());
+            if(StringUtil.isNotBlank(f.getBackBreak()) && StringUtils.isNumber(f.getBackBreak())){
+                if(Double.parseDouble(f.getBackBreak()) >= 0){
+                    sectionPush.setOverbreak_value(f.getBackBreak());
+
+                }else{
+                    sectionPush.setUnderbreak_value(f.getBackBreak());
+                }
+            }
+            return sectionPush;
+        }).collect(Collectors.toList());
+    }
+}

+ 66 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/profiler/ProfilerOffsetPush.java

@@ -0,0 +1,66 @@
+package org.springblade.manager.entity.profiler;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import lombok.Data;
+import org.springblade.manager.entity.ProfilerOffset;
+
+import java.util.List;
+
+/**
+ * @author LHB
+ * 断面仪 基础信息推送对象
+ */
+@Data
+public class ProfilerOffsetPush {
+    /**
+     * 上传时间 yyyy-MM-dd
+     */
+    private String report_date;
+    /**
+     * 测量时间 yyyy-MM-dd HH:mm:ss
+     */
+    private String measurement_time;
+    /**
+     * 测量人
+     */
+    private String measurement_person;
+    /**
+     * 桩号
+     */
+    private String pile_number;
+    /**
+     * x方向偏移量(米)
+     */
+    private String x_offset;
+    /**
+     * y方向偏移量(米)
+     */
+    private String y_offset;
+    /**
+     * 仪器高度(米)
+     */
+    private String instrument_height;
+    /**
+     * 测量断面
+     */
+    private List<ProfilerSectionPush> measurement_section;
+    /**
+     * 测量数据
+     */
+    private List<ProfilerDataPush> receipt_data;
+
+
+
+    public static ProfilerOffsetPush parameterMapping(ProfilerOffset push) {
+        ProfilerOffsetPush profilerOffsetPush = new ProfilerOffsetPush();
+        profilerOffsetPush.setReport_date(DateUtil.format(DateTime.now(),"yyyy-MM-dd"));
+        profilerOffsetPush.setMeasurement_time(push.getDate());
+        profilerOffsetPush.setMeasurement_person(push.getUserName());
+        profilerOffsetPush.setPile_number(null);
+        profilerOffsetPush.setX_offset(push.getX0());
+        profilerOffsetPush.setY_offset(push.getZ0());
+        profilerOffsetPush.setInstrument_height(push.getDeviceHeight());
+        return profilerOffsetPush;
+    }
+}

+ 52 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/profiler/ProfilerSectionPush.java

@@ -0,0 +1,52 @@
+package org.springblade.manager.entity.profiler;
+
+import lombok.Data;
+import org.springblade.manager.entity.ProfilerStandardSectionBean;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author LHB
+ * 断面仪 测量断面推送对象
+ */
+@Data
+public class ProfilerSectionPush {
+    /**
+     * 方向
+     */
+    private String direction;
+    /**
+     * 终角
+     */
+    private String final_angle;
+    /**
+     * 起角
+     */
+    private String start_angle;
+    /**
+     * 半径
+     */
+    private String radius;
+    /**
+     * 圆心X
+     */
+    private String center_x;
+    /**
+     * 圆心Y
+     */
+    private String center_y;
+
+    public static List<ProfilerSectionPush> parameterMapping(List<ProfilerStandardSectionBean> sectionBeans) {
+        return sectionBeans.stream().map(f -> {
+            ProfilerSectionPush sectionPush = new ProfilerSectionPush();
+            sectionPush.setDirection(f.getDirection());
+            sectionPush.setFinal_angle(f.getEndAngle());
+            sectionPush.setStart_angle(f.getStartAngle());
+            sectionPush.setRadius(f.getRadius());
+            sectionPush.setCenter_x(f.getX());
+            sectionPush.setCenter_y(f.getY());
+            return sectionPush;
+        }).collect(Collectors.toList());
+    }
+}

+ 23 - 8
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -5390,14 +5390,15 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 					if(!list.isEmpty()){
 						StringBuilder fileName=new StringBuilder();
 						for (String result : list) {
+							result=result.replaceAll("\\s+", "");
 							if(result.contains("档号")){
 								String fileNum=result.replace("档号","").replace(":","").replace(":","");
 								auto.setFileNumber(fileNum);
 							}else if(result.contains("立卷单位")){
-								String unit=result.replace("立卷单位","").replace(":","").replace(":","");
+								String unit=result.replace("立卷单位","").replace(":","").replace(":","").replaceAll("_","");
 								auto.setUnit(unit);
-							} else if (result.contains("起止日期")) {
-								String time=result.replace("起止日期","").replace(":","").replace(":","");
+							}else if (result.contains("起止日期")) {
+								String time=result.replace("起止日期","").replace(":","").replace(":","").replaceAll("_","");
 								if(result.contains("~")){
 									LocalDateTime[] localDateTimes = convertDateRange(time, "~");
 									auto.setStartDate(localDateTimes[0]);
@@ -5408,16 +5409,30 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 									auto.setEndDate(localDateTimes[1]);
 								}
 							} else if (result.contains("保管期限")||result.contains("保管限期")) {
-								String storageTime=result.replace("保管期限","").replace("保管限期","").replace(":","").replace(":","");
-								auto.setStorageTime(storageTime);
+								String storageTime=result.replace("保管期限","").replace("保管限期","").replace(":","").replace(":","").replaceAll("_","");
+								if(StringUtils.isNotEmpty(storageTime)){
+									if("10年".equals(storageTime)){
+										auto.setStorageTime("1");
+									} else if("30年".equals(storageTime)){
+										auto.setStorageTime("2");
+									} else{
+										auto.setStorageTime("3");
+									}
+								}
 							} else if (result.contains("密1")||result.contains("密级")) {
-								String secretLevel=result.replace("密1","").replace("密级","");
+								String secretLevel=result.replace("密1","").replace("密级","").replaceAll("_","");
 								auto.setSecretLevel(secretLevel);
 							} else {
-								fileName.append(result);
+								if(StringUtils.isNotEmpty(result)){
+									fileName.append(result);
+									System.out.println("文件题名识别结果:"+result);
+									System.out.println(fileName);
+								}
 							}
 						}
-						auto.setName(fileName.toString());
+						if(StringUtils.isNotEmpty(fileName.toString())){
+							auto.setName(fileName.toString().replace("密级",""));
+						}
 					}
 				}
 			}catch (Exception e){

+ 137 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskProgressController.java

@@ -0,0 +1,137 @@
+/*
+ *      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.business.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.business.entity.TaskProgress;
+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.business.vo.TaskProgressVO1;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.vo.TaskProgressVO;
+import org.springblade.business.service.ITaskProgressService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.Map;
+
+/**
+ * 任务进度表 控制器
+ *
+ * @author BladeX
+ * @since 2025-10-15
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/taskProgress")
+@Api(value = "任务进度表", tags = "任务进度表接口")
+public class TaskProgressController extends BladeController {
+
+	private final ITaskProgressService taskProgressService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入taskProgress")
+	public R<TaskProgress> detail(TaskProgress taskProgress) {
+		TaskProgress detail = taskProgressService.getOne(Condition.getQueryWrapper(taskProgress));
+		return R.data(detail);
+	}
+
+	@GetMapping("/getTaskProgress")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "获取进度", notes = "传入taskProgress")
+	public R<Map<String, TaskProgressVO1>> getTaskProgress(Long projectId, Long contractId){
+		return R.data(taskProgressService.selectNewTaskProgress(projectId,contractId));
+	}
+
+	/**
+	 * 分页 任务进度表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入taskProgress")
+	public R<IPage<TaskProgress>> list(TaskProgress taskProgress, Query query) {
+		IPage<TaskProgress> pages = taskProgressService.page(Condition.getPage(query), Condition.getQueryWrapper(taskProgress));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 任务进度表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入taskProgress")
+	public R<IPage<TaskProgressVO>> page(TaskProgressVO taskProgress, Query query) {
+		IPage<TaskProgressVO> pages = taskProgressService.selectTaskProgressPage(Condition.getPage(query), taskProgress);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 任务进度表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入taskProgress")
+	public R save(@Valid @RequestBody TaskProgress taskProgress) {
+		return R.status(taskProgressService.save(taskProgress));
+	}
+
+	/**
+	 * 修改 任务进度表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入taskProgress")
+	public R update(@Valid @RequestBody TaskProgress taskProgress) {
+		return R.status(taskProgressService.updateById(taskProgress));
+	}
+
+	/**
+	 * 新增或修改 任务进度表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入taskProgress")
+	public R submit(@Valid @RequestBody TaskProgress taskProgress) {
+		return R.status(taskProgressService.saveOrUpdate(taskProgress));
+	}
+
+	
+	/**
+	 * 删除 任务进度表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(taskProgressService.deleteLogic(Func.toLongList(ids)));
+	}
+
+	
+}

+ 23 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/TaskProgressClientImpl.java

@@ -0,0 +1,23 @@
+package org.springblade.business.feignClient;
+
+import lombok.AllArgsConstructor;
+
+import org.springblade.business.feign.TaskProgressClient;
+import org.springblade.business.service.ITaskProgressService;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@AllArgsConstructor
+public class TaskProgressClientImpl implements TaskProgressClient {
+
+
+    private final ITaskProgressService taskProgressService;
+
+
+
+
+    @Override
+    public Boolean updateTaskProgress(Long projectId, Long contractId, Integer type, Integer finishTotal,String dataId) {
+        return taskProgressService.updateTaskProgress(projectId, contractId, type, finishTotal,dataId);
+    }
+}

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -97,7 +97,7 @@
         <if test="vo.sourceType != null and vo.sourceType != ''">
             and u.source_type = #{vo.sourceType}
         </if>
-        <if test="vo.isArchive != null and vo.isArchive != ''">
+        <if test="vo.isArchive != null">
             <choose>
                 <when test="vo.isArchive == 0">
                     AND (u.is_archive = #{vo.isArchive} OR u.is_archive IS NULL)
@@ -183,7 +183,7 @@
         <if test="vo.sourceType != null and vo.sourceType != ''">
             and u.source_type = #{vo.sourceType}
         </if>
-        <if test="vo.isArchive != null and vo.isArchive != ''">
+        <if test="vo.isArchive != null">
             <choose>
                 <when test="vo.isArchive == 0">
                     AND (u.is_archive = #{vo.isArchive} OR u.is_archive IS NULL)

+ 53 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskProgressMapper.java

@@ -0,0 +1,53 @@
+/*
+ *      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.business.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.business.entity.TaskProgress;
+import org.springblade.business.vo.TaskProgressVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+
+/**
+ * 任务进度表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2025-10-15
+ */
+public interface TaskProgressMapper extends BaseMapper<TaskProgress> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param taskProgress
+	 * @return
+	 */
+	List<TaskProgressVO> selectTaskProgressPage(IPage page, TaskProgressVO taskProgress);
+
+	TaskProgressVO selectNewTaskProgress(@Param("projectId") Long projectId, @Param("contractId") Long contractId,@Param("type") Integer type);
+
+	void addFinishTotalById(@Param("id") Long id, @Param("finishTotal") Integer finishTotal);
+
+	void checkAndUpdateIsFinish(@Param("id") Long id);
+
+	TaskProgressVO selectNewTaskProgress1(@Param("projectId") Long projectId, @Param("contractId") Long contractId, @Param("type") Integer type);
+
+	Integer selectTaskBatchSize(@Param("dataIds") List<Long> dataIds);
+}

+ 58 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskProgressMapper.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.business.mapper.TaskProgressMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="taskProgressResultMap" type="org.springblade.business.entity.TaskProgress">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="project_id" property="projectId"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="type" property="type"/>
+        <result column="task_total" property="taskTotal"/>
+        <result column="finish_tatol" property="finishTatol"/>
+        <result column="is_finish" property="isFinish"/>
+    </resultMap>
+    <update id="addFinishTotalById">
+        update m_task_progress set finish_tatol = finish_tatol + #{finishTotal} where id = #{id}
+    </update>
+    <update id="checkAndUpdateIsFinish">
+        update m_task_progress set is_finish = 1 where id = #{id} and finish_tatol >= task_total
+    </update>
+
+
+    <select id="selectTaskProgressPage" resultMap="taskProgressResultMap">
+        select * from m_task_progress where is_deleted = 0
+    </select>
+    <select id="selectNewTaskProgress" resultType="org.springblade.business.vo.TaskProgressVO">
+        select * from m_task_progress where is_deleted = 0 and project_id = #{projectId} and contract_id = #{contractId} and type = #{type} and is_finish=0 order by create_time desc limit 1
+    </select>
+    <select id="selectNewTaskProgress1" resultType="org.springblade.business.vo.TaskProgressVO">
+        select * from m_task_progress where is_deleted = 0 and project_id = #{projectId} and contract_id = #{contractId} and type = #{type}  order by create_time desc limit 1
+    </select>
+    <select id="selectTaskBatchSize" resultType="java.lang.Integer">
+        SELECT COUNT(*)
+        FROM (
+        SELECT DISTINCT JSON_UNQUOTE(JSON_EXTRACT(utb.json_data, '$.taskId')) as taskId
+        FROM u_task_batch utb
+        INNER JOIN m_task_progress mtp
+        ON FIND_IN_SET(
+        JSON_UNQUOTE(JSON_EXTRACT(utb.json_data, '$.formDataId')),
+        mtp.data_id
+        ) > 0
+        <if test="dataIds != null and dataIds.size() > 0">
+            WHERE JSON_UNQUOTE(JSON_EXTRACT(utb.json_data, '$.formDataId')) IN
+            <foreach collection="dataIds" item="id" open="(" close=")" separator=",">
+                #{id}
+            </foreach>
+        </if>
+        ) distinct_tasks
+    </select>
+
+</mapper>

+ 49 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskProgressService.java

@@ -0,0 +1,49 @@
+/*
+ *      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.business.service;
+
+import org.springblade.business.entity.TaskProgress;
+import org.springblade.business.vo.TaskProgressVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.vo.TaskProgressVO1;
+
+import java.util.Map;
+
+/**
+ * 任务进度表 服务类
+ *
+ * @author BladeX
+ * @since 2025-10-15
+ */
+public interface ITaskProgressService extends BaseService<TaskProgress> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param taskProgress
+	 * @return
+	 */
+	IPage<TaskProgressVO> selectTaskProgressPage(IPage<TaskProgressVO> page, TaskProgressVO taskProgress);
+
+	Map<String, TaskProgressVO1> selectNewTaskProgress(Long projectId, Long contractId);
+
+	Boolean updateTaskProgress(Long projectId,Long contractId,Integer type,Integer finishTotal,String dataId);
+
+	Boolean addTaskProgress(Long projectId,Long contractId,Integer type,Integer taskTotal,String dataIds);
+}

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -35,6 +35,7 @@ import org.springblade.manager.entity.TabBusstimeInfo;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.WbsTreeContractClient;
+import org.springblade.business.service.ITaskProgressService;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.cache.ParamCache;
@@ -44,7 +45,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
@@ -83,6 +83,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 
     private final JdbcTemplate jdbcTemplate;
     private final IOperationLogService operationLogService;
+    private final ITaskProgressService taskProgressService;
 
     @Autowired
     StringRedisTemplate RedisTemplate;

+ 159 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskProgressServiceImpl.java

@@ -0,0 +1,159 @@
+/*
+ *      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.business.service.impl;
+
+import org.apache.commons.lang.StringUtils;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.business.entity.TaskProgress;
+import org.springblade.business.vo.TaskProgressVO;
+import org.springblade.business.mapper.TaskProgressMapper;
+import org.springblade.business.service.ITaskProgressService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.business.vo.TaskProgressVO1;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 任务进度表 服务实现类
+ *
+ * @author BladeX
+ * @since 2025-10-15
+ */
+@Service
+public class TaskProgressServiceImpl extends BaseServiceImpl<TaskProgressMapper, TaskProgress> implements ITaskProgressService {
+
+	@Override
+	public IPage<TaskProgressVO> selectTaskProgressPage(IPage<TaskProgressVO> page, TaskProgressVO taskProgress) {
+		return page.setRecords(baseMapper.selectTaskProgressPage(page, taskProgress));
+	}
+
+	@Override
+	public Map<String, TaskProgressVO1> selectNewTaskProgress(Long projectId, Long contractId) {
+		Map<String, TaskProgressVO1> map = new HashMap<>();
+		TaskProgressVO vo1 = baseMapper.selectNewTaskProgress1(projectId, contractId,1);
+		if(vo1!=null){
+			BigDecimal result = (vo1.getTaskTotal() != null && vo1.getTaskTotal() > 0 && vo1.getFinishTatol() != null) ?
+					new BigDecimal(vo1.getFinishTatol())
+							.divide(new BigDecimal(vo1.getTaskTotal()), 2, RoundingMode.HALF_UP)
+							.multiply(new BigDecimal(100)) :
+					BigDecimal.ZERO;
+			map.put("save-again", new TaskProgressVO1(vo1.getFinishTatol(),vo1.getTaskTotal(),result));
+		}
+		TaskProgressVO vo2 = baseMapper.selectNewTaskProgress1(projectId, contractId,2);
+		if(vo2!=null){
+			Integer size=0;
+			if(StringUtils.isNotEmpty(vo2.getDataId())){
+				size=baseMapper.selectTaskBatchSize(Func.toLongList(vo2.getDataId()));
+			}
+			Integer finishTatol=vo2.getTaskTotal()-size;
+			// 使用 BigDecimal 进行精确计算并保留两位小数
+			BigDecimal result = vo2.getTaskTotal() > 0 ?
+					new BigDecimal(finishTatol).divide(new BigDecimal(vo2.getTaskTotal()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)) :
+					BigDecimal.ZERO;
+			result = result.setScale(2, RoundingMode.HALF_UP);
+			map.put("re-sign", new TaskProgressVO1(finishTatol,vo2.getTaskTotal(),result));
+			if(size==0){
+				vo2.setIsDeleted(0);
+				baseMapper.updateById(vo2);
+			}
+		}
+		TaskProgressVO vo3 = baseMapper.selectNewTaskProgress1(projectId, contractId,4);
+		if(vo3!=null){
+			Integer size=0;
+			if(StringUtils.isNotEmpty(vo3.getDataId())){
+				size=baseMapper.selectTaskBatchSize(Func.toLongList(vo3.getDataId()));
+			}
+			Integer finishTatol=vo3.getTaskTotal()-size;
+			// 使用 BigDecimal 进行精确计算并保留两位小数
+			BigDecimal result = vo3.getTaskTotal() > 0 ?
+					new BigDecimal(finishTatol).divide(new BigDecimal(vo3.getTaskTotal()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)) :
+					BigDecimal.ZERO;
+			result = result.setScale(2, RoundingMode.HALF_UP);
+			map.put("electronic-sign", new TaskProgressVO1(finishTatol,vo3.getTaskTotal(),result));
+			if(size==0){
+				vo3.setIsDeleted(0);
+				baseMapper.updateById(vo3);
+			}
+		}
+		return map;
+	}
+
+	/**
+	 * 完成任务后更新进度
+	 * @param projectId
+	 * @param contractId
+	 * @param type 1.sava_again 2.re_sign 3.电签检测 4.一键电签
+	 * @param finishTotal
+	 * @return
+	 */
+	public Boolean updateTaskProgress(Long projectId,Long contractId,Integer type,Integer finishTotal,String dataId) {
+		TaskProgressVO vo = baseMapper.selectNewTaskProgress(projectId, contractId,type);
+		if (vo==null) {
+			return false;
+		} else if (StringUtils.isNotEmpty(dataId)&&StringUtils.isNotEmpty(vo.getDataId())) {
+			if(!vo.getDataId().contains(dataId)){
+				return false;
+			}
+		}
+		if(vo.getIsFinish()!=1){
+			baseMapper.addFinishTotalById(vo.getId(),finishTotal);
+			baseMapper.checkAndUpdateIsFinish(vo.getId());
+		}
+		return true;
+	}
+
+	/**
+	 * 添加任务进度
+	 * @param projectId
+	 * @param contractId
+	 * @param type
+	 * @param taskTotal
+	 * @param dataIds
+	 * @return
+	 */
+	public Boolean addTaskProgress(Long projectId,Long contractId,Integer type,Integer taskTotal,String dataIds) {
+		TaskProgressVO vo = baseMapper.selectNewTaskProgress(projectId, contractId,type);
+		if(vo==null){
+			TaskProgress progress = new TaskProgress();
+			progress.setId(SnowFlakeUtil.getId());
+			progress.setProjectId(projectId);
+			progress.setContractId(contractId);
+			progress.setType(type);
+			progress.setTaskTotal(taskTotal);
+			progress.setFinishTatol(0);
+			progress.setIsFinish(0);
+			if(StringUtils.isNotEmpty(dataIds)){
+				progress.setDataId(dataIds);
+			}
+			baseMapper.insert(progress);
+		}else {
+			vo.setTaskTotal(vo.getTaskTotal()+taskTotal);
+			if(StringUtils.isNotEmpty(dataIds)){
+				vo.setDataId(vo.getDataId()+","+dataIds);
+			}
+			baseMapper.updateById(vo);
+		}
+		return true;
+	}
+}

+ 9 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -43,10 +43,7 @@ import org.springblade.flow.core.feign.IFlowClient;
 import org.springblade.flow.core.feign.NewFlowClient;
 import org.springblade.flow.core.utils.FlowUtil;
 
-import org.springblade.manager.entity.ContractInfo;
-import org.springblade.manager.entity.ProjectInfo;
-import org.springblade.manager.entity.TabBusstimeInfo;
-import org.springblade.manager.entity.WbsTreeContract;
+import org.springblade.manager.entity.*;
 import org.springblade.manager.feign.*;
 import org.springblade.manager.vo.AppWbsTreeContractVO;
 import org.springblade.manager.vo.WbsTreePrivateVO4;
@@ -142,6 +139,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 
     private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
 
+    private final ITaskProgressService taskProgressService;
+
 
     @Override
     public List<TaskParallel> queryApprovalUser(String formDataIds) {
@@ -1972,6 +1971,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     .in(InformationQuery::getId, newIds));
             List<InformationQuery> list = informationQueryService.list(new LambdaQueryWrapper<>(InformationQuery.class).in(InformationQuery::getId, newIds));
             recordResignLog("save-again", StringUtils.join(newIds, ","), list, dtos, dtos.get(0).getProjectId()+"", dtos.get(0).getContractId()+"", null);
+            taskProgressService.addTaskProgress(dtos.get(0).getProjectId(), dtos.get(0).getContractId(), 1,dtos.size(),StringUtils.join(newIds, ","));
         }
         return R.success("操作成功");
     }
@@ -2008,8 +2008,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             Map<String, List<TaskParallel>> finalTaskParallelGroupMap = taskParallelGroupMap;
             //获取每条任务对应的节点信息
             List<String> dataIdList = taskList.stream().map(Task::getFormDataId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
+            //Map<String, String> queryMap = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class)).stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getWbsId() + ""));
             List<InformationQuery> list = informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, dataIdList));
-            Map<String, String> queryMap = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class)).stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getWbsId() + ""));
+            taskProgressService.addTaskProgress(Long.parseLong(projectId), Long.parseLong(contractId), 2,taskList.size(),StringUtils.join(dataIdList, ","));
+            Map<String, String> queryMap=list.stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getWbsId() + ""));
             Map<String, String> typeMap = jdbcTemplate.query("select * from u_information_query where id in(" + StringUtils.join(dataIdList, ",") + ")", new BeanPropertyRowMapper<>(InformationQuery.class)).stream().collect(Collectors.toMap(l -> l.getId() + "", l -> l.getClassify() + ""));
 
             try {
@@ -2340,7 +2342,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             }
             ids2 = ids2.substring(0, ids2.length() - 1);
         }
-        List<InformationQuery> queryList = jdbcTemplate.query("select id, e_visa_pdf_url, status from u_information_query where id in( " + ids + ") and is_deleted=0 and status in (1,2)", new BeanPropertyRowMapper<>(InformationQuery.class));
+        List<InformationQuery> queryList = jdbcTemplate.query("select id, e_visa_pdf_url, status ,project_id,contract_id from u_information_query where id in( " + ids + ") and is_deleted=0 and status in (1,2)", new BeanPropertyRowMapper<>(InformationQuery.class));
         String sqlqu = "update u_information_query set status=2,e_visa_pdf_url='' where id in( " + ids + ") and is_deleted=0 and status in (1,2)";
         String sqlForTask = "update u_task set status=2 where form_data_id in( " + ids2 + ") and status in(1,2) and is_deleted=0 ";
         String sqlForTaskPall = "update u_task_parallel a INNER JOIN u_task b on a.process_instance_id = b.process_instance_id set a.is_resign = 1, a.`status`=2 , a.e_visa_status=1 ,a.e_visa_content='电签成功' where b.form_data_id in( " + ids2 + ") and b.status in(0,1,2) and b.is_deleted = 0 and a.`status` in(0,1,3)";
@@ -2368,6 +2370,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             requestMap.put("userIds", userIds);
             recordResignLog("一键重签", ids, queryList, requestMap, null, null, null);
         }
+        taskProgressService.addTaskProgress(queryList.get(0).getProjectId(), queryList.get(0).getContractId(), 4,queryList.size(),ids);
         return R.success("操作成功");
     }
 

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -1156,6 +1156,10 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         if (ObjectUtil.isNotEmpty(dto.getId())) {
             dto.setTableIds(null);
         }
+
+        //获取之前关联的委托单id
+        TrialSelfInspectionRecord oldData = baseMapper.selectById(dto.getId());
+        
         this.saveOrUpdate(dto);
         dto.setTableIds(tableIds);
         if (ObjectUtil.isNotEmpty(dto.getId())) {
@@ -1187,6 +1191,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             //修改项目节点基础信息
             jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='" + dto.getEntrustId() + "'");
         }
+        if(oldData != null && oldData.getEntrustId() != null && dto.getEntrustId() == null){
+            entrustInfoService.update(Wrappers.<EntrustInfo>lambdaUpdate().eq(EntrustInfo::getId, oldData.getEntrustId()).set(EntrustInfo::getExpCount, 0));
+        }
         String[] strings = dto.getTableType().split(",");
         if (StringUtils.isNotEmpty(dto.getRecordAutoNumber()) || StringUtils.isNotEmpty(dto.getReportAutoNumber())) {
             if (dto.getOldRecordNumber() != null && dto.getOldRecordNumber().equals(dto.getRecordNo()) || dto.getOldReportNumber() != null && dto.getOldReportNumber().equals(dto.getReportNo())) {

+ 4 - 11
blade-service/blade-business/src/main/java/org/springblade/business/sync/TaskSync.java

@@ -1,26 +1,18 @@
 package org.springblade.business.sync;
 
 import cn.hutool.core.date.DateTime;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.google.common.collect.Lists;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springblade.business.dto.reSigningEVisaStatus;
 import org.springblade.business.entity.InformationQuery;
-import org.springblade.business.service.IInformationQueryFileService;
 import org.springblade.business.service.IInformationQueryService;
 import org.springblade.common.utils.SystemUtils;
-import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.tool.api.R;
-import org.springblade.manager.entity.WbsTreeSynchronousRecord;
 import org.springblade.manager.feign.ExcelTabClient;
+import org.springblade.business.feign.TaskProgressClient;
 import org.springblade.system.user.feign.IUserClient;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -29,7 +21,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ThreadPoolExecutor;
-import java.util.stream.Collectors;
 
 /**
  * @author LHB
@@ -49,6 +40,8 @@ public class TaskSync {
     @Resource
     private IUserClient userClient;
 
+    private final TaskProgressClient taskProgressClient;
+
 
     public void reSigningEVisaStatusSync(InformationQuery dto, String header) {
         log.info("数据正在重刷,线程名称:{}", Thread.currentThread().getName());
@@ -75,7 +68,7 @@ public class TaskSync {
         }
         lambda.set(InformationQuery::getUpdateTime, DateTime.now());
         lambda.eq(InformationQuery::getId, dto.getId());
-
+        taskProgressClient.updateTaskProgress(dto.getProjectId(), dto.getContractId(), 1, 1,dto.getId()+"");
         informationQueryService.update(lambda);
         log.info("数据重刷完毕,线程名称:{}", Thread.currentThread().getName());
     }

+ 3 - 0
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java

@@ -15,6 +15,7 @@ import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.feign.TaskClient;
+import org.springblade.business.feign.TaskProgressClient;
 import org.springblade.business.vo.TaskSignInfoVO;
 import org.springblade.business.vo.TrialRawMaterialSelfRecord;
 import org.springblade.common.constant.CommonConstant;
@@ -69,6 +70,8 @@ public class EVDataServiceImpl implements EVDataService {
     @Autowired
      private final MessageWarningClient messageWarningClient;
 
+    private final TaskProgressClient taskProgressClient;
+
     /**
      * 电签主要流程
      *

+ 2 - 1
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/ScrDataServiceImpl.java

@@ -10,10 +10,10 @@ import org.springblade.business.vo.ScrSignInfoVO;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.core.tool.utils.CollectionUtil;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.evisa.service.ScrDataService;
 import org.springblade.evisa.utils.PdfAddimgUtil;
 import org.springblade.evisa.vo.SignKeyVO;
+import org.springblade.business.feign.TaskProgressClient;
 import org.springblade.manager.vo.PDFIndexInfo;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -29,6 +29,7 @@ public class ScrDataServiceImpl implements ScrDataService {
 
     private final JdbcTemplate jdbcTemplate;
     private final StringRedisTemplate RedisTemplate;
+
     // 主流程
     @Override
     public void sctTaskBatch(ScrSignInfoVO taskApp) throws Exception {

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

@@ -424,7 +424,7 @@ public class FormulaController {
             ContractInfo contract = this.contractInfoService.getById(fo.getContractId());
             WbsTreeContract parent = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getId,fo.getParentId()).eq(WbsTreeContract::getContractId,fo.getContractId()).last("limit 1"));
 
-            List<KeyMapper> kms = this.service.getKeyMapperList(Collections.singletonList(fo.getPkeyId()), contract.getPId(), parent.getPKeyId().toString(), ExecuteType.INSPECTION);
+            List<KeyMapper> kms = this.service.getKeyMapperList(Collections.singletonList(fo.getPkeyId()), contract.getPId(), parent.getPKeyId().toString(), ExecuteType.INSPECTION, null);
             KeyMapper keyMapper = null;
             if (Func.isNotEmpty(kms)) {
                 Optional<KeyMapper> optionalKeyMapper = kms.stream().filter(e -> StringUtils.isEquals(e.getField(), key)).findFirst();

+ 21 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ProfilerController.java

@@ -16,6 +16,9 @@ import org.springblade.manager.service.ProfilerOffsetService;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
 /**
  * @author LHB
  */
@@ -85,4 +88,22 @@ public class ProfilerController {
         return R.status(offsetService.edit(offset));
     }
 
+    /**
+     * 查询测量人
+     */
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "查询测量人", notes = "")
+    @GetMapping("/getListUserName")
+    public R<List<String>> getListUserName(){
+        return R.data(offsetService.getListUserName());
+    }
+
+    /**
+     * 推送接口
+     */
+    @GetMapping("/push")
+    public R push(){
+        offsetService.push();
+        return R.success("正在推送中");
+    }
 }

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

@@ -41,6 +41,7 @@ import org.springblade.core.tool.utils.CollectionUtil;
 import org.springblade.core.tool.utils.IoUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
+import org.springblade.manager.dto.FormulaReferenceDTO;
 import org.springblade.manager.dto.MoveNodeDTO;
 import org.springblade.manager.dto.TableSortDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
@@ -1223,5 +1224,11 @@ public class WbsTreeContractController extends BladeController {
     }
 
 
-
+    @PostMapping("/setFormulaReference")
+    @ApiOperation(value = "公式引用")
+    @ApiOperationSupport(order = 33)
+    public R setFormulaReference(@RequestBody FormulaReferenceDTO dto) {
+        iWbsTreeContractService.setFormulaReference(dto);
+        return R.success("成功");
+    }
 }

+ 3 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -849,9 +849,9 @@ public class WbsTreePrivateController extends BladeController {
      */
     @GetMapping("/get-excel-html")
     @ApiOperationSupport(order = 23)
-    @ApiOperation(value = "试验-客户端获取表的HTML", notes = "传入节点primaryKeyId")
-    public Object getExcelHtml(@RequestParam String primaryKeyId) throws Exception {
-        return wbsTreePrivateService.getExcelHtml(primaryKeyId);
+    @ApiOperation(value = "试验-客户端获取表的HTML", notes = "传入节点primaryKeyId和试验id")
+    public Object getExcelHtml(@RequestParam String primaryKeyId, String id) throws Exception {
+        return wbsTreePrivateService.getExcelHtml(primaryKeyId, id);
     }
 
     /**

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

@@ -4,6 +4,8 @@ import org.apache.ibatis.annotations.Mapper;
 import org.springblade.manager.entity.ProfilerOffset;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
 * @author LHB
 * @description 针对表【q_profiler_offset(断面仪-基础信息+测量者信息)】的数据库操作Mapper
@@ -13,6 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 @Mapper
 public interface ProfilerOffsetMapper extends BaseMapper<ProfilerOffset> {
 
+    List<String> getListUserName();
 }
 
 

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

@@ -30,4 +30,7 @@
         info_channel_name,info_construction_unit,info_date,info_name_of_project,info_user_name,
         info_mileage_number,file_url,create_time,create_user,update_time,update_user
     </sql>
+    <select id="getListUserName" resultType="java.lang.String">
+        select info_user_name from q_profiler_offset group by info_user_name
+    </select>
 </mapper>

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

@@ -63,7 +63,7 @@ public interface IFormulaService extends BaseService<Formula> {
     /**
      * ids 表流水号 projectId项目 nodeId工序节点的pkeyId ExecuteType执行模式 质检或者试验 首件
      */
-    List<KeyMapper> getKeyMapperList(List<Long> ids, String projectId, String nodeId, ExecuteType executeType);
+    List<KeyMapper> getKeyMapperList(List<Long> ids, String projectId, String nodeId, ExecuteType executeType, String testGroupId);
 
    void formulaInto(List<FormData> curFormDatas, String projectId, String nodeId, ExecuteType executeType);
 

+ 3 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java

@@ -4,10 +4,7 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.springblade.business.dto.EKeyDto;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.tool.api.R;
-import org.springblade.manager.dto.MoveNodeDTO;
-import org.springblade.manager.dto.RangeInfo;
-import org.springblade.manager.dto.WbsTreeContractDTO;
-import org.springblade.manager.dto.WbsTreeContractDTO2;
+import org.springblade.manager.dto.*;
 import org.springblade.manager.entity.ContractRelationJlyz;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreePrivate;
@@ -118,4 +115,6 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
     Object getWbsContractSubdivisionMeasurable(String projectId, String sectionId, String pid, Boolean judgment);
 
     List<QualityData> qualityDataAcquisition(String projectId, String sectionId, String codesId);
+
+    void setFormulaReference(FormulaReferenceDTO dto);
 }

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

@@ -84,7 +84,7 @@ public interface IWbsTreePrivateService extends BaseService<WbsTreePrivate> {
 
     List<WbsTreePrivateVO4> searchNodeAllTable(String primaryKeyId, String type, String tableType, String contractId, String projectId, Integer isAdd, Long id);
 
-    Object getExcelHtml(String primaryKeyId) throws Exception;
+    Object getExcelHtml(String primaryKeyId, String id) throws Exception;
 
     Object getExcelHtmlEntrust(String nodeId,String contractId) throws Exception;
 

+ 7 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/ProfilerOffsetService.java

@@ -7,8 +7,11 @@ import org.springblade.manager.entity.ProfilerOffset;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.manager.entity.profiler.ProfilerResult;
 import org.springblade.manager.entity.profiler.ProfilerSaveDTO;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
+
 /**
 * @author LHB
 * @description 针对表【q_profiler_offset(断面仪-基础信息+测量者信息)】的数据库操作Service
@@ -24,4 +27,8 @@ public interface ProfilerOffsetService extends IService<ProfilerOffset> {
 
     Page<ProfilerOffset> getPage(ProfilerOffsetDTO offset);
 
+    List<String> getListUserName();
+
+    @Async
+    void push();
 }

+ 46 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -116,6 +116,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
     private final InformationQueryClient informationQueryClient;
     private final IWbsTreeContractService wbsTreeContractService;
+    private final WbsTreeContractExtendService wbsTreeContractExtendService;
     private final IFormulaService formulaService;
     @Autowired
     private JdbcTemplate jdbcTemplate;
@@ -503,6 +504,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                 e.setClassify(example.getClassify());
                                 e.setProjectId(example.getProjectId());
                                 e.setGroupId(example.getGroupId());
+                                e.setTestGroupId(example.getTestGroupId());
                                 map.forEach((key, value) -> {
                                     if (key.startsWith("key_")) {
                                         e.getDataMap().put(key, Func.toStr(value));
@@ -516,7 +518,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     tableInfoList.sort(Comparator.comparingInt(a -> tableAllIds.indexOf(Long.parseLong(a.getPkeyId()))));
                 }
                 StopWatch stopWatch = new StopWatch();
-                List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableAll.stream().map(NodeTable::getPKeyId).filter(Func::isNotEmpty).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(), String.valueOf(nodeId), type);
+                List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableAll.stream().map(NodeTable::getPKeyId).filter(Func::isNotEmpty).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(), String.valueOf(nodeId), type, tableInfoList.get(0).getTestGroupId());
                 if (Func.isNotEmpty(keyMappers) && Func.isNotEmpty(tableAll)) {
                     Map<String, Map<String, String>> coordinateMap = createCoordinateMap(keyMappers, type);
                     stopWatch.start("公式处理");
@@ -1089,13 +1091,35 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     @Override
     public void gsColor(Long pKeyId, String nodeId, String projectId, Document doc) {
         try {
-            List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(Collections.singletonList(pKeyId), projectId, nodeId, ExecuteType.INSPECTION);
+            List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(Collections.singletonList(pKeyId), projectId, nodeId, ExecuteType.INSPECTION, "1");
+            //扩展----根据父节点查询不允许执行的公式
+            WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(nodeId);
+            List<String> list;
+
+            if(byId != null){
+                String formulaConfig = byId.getFormulaConfig();
+                if(StringUtils.isNotEmpty(formulaConfig)){
+                    list = Arrays.asList(formulaConfig.split(","));
+                } else {
+                    list = new ArrayList<>();
+                }
+            } else {
+                list = new ArrayList<>();
+            }
+
             if (!keyMappers.isEmpty()) {
                 keyMappers.stream()
                         .filter(e -> e.getFormulaId() != null)
                         .forEach(e -> {
                             String key = e.getField() + "__";
-                            processElements(doc.select("table").first().select("[keyname^=" + key + "]"));
+                            Elements select = doc.select("table").first().select("[keyname^=" + key + "]");
+                            if(list.contains(e.getTableName() + ":" + e.getField())){
+                                //当前元素不执行公式
+                                select.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearFormula", "1"));
+                            }else{
+                                select.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearFormula", "0"));
+                                processElements(select);
+                            }
                         });
             }
         } catch (Exception e) {
@@ -1834,6 +1858,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     }
                 }
             }
+            //取消公式执行 的单元格不自动获取html上的数据到表格中
+            WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(nodeId);
+            if(byId != null && StringUtils.isNotEmpty(byId.getFormulaConfig())){
+                List<String> notFormula = Arrays.asList(byId.getFormulaConfig().split(","));
+                reData.keySet().removeIf(key -> {
+                    String[] keyParts = key.split("__");
+                    return keyParts.length > 1 && notFormula.contains(wbsTreeContract.getInitTableName() + ":" + keyParts[0]);
+                });
+            }
 
             //电签默认值
             if (defText.size() >= 1) {
@@ -3229,6 +3262,16 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         break;
                     }
                 }
+                //取消公式执行 过滤html数据
+                WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(record.getId());
+                if(byId != null && StringUtils.isNotEmpty(byId.getFormulaConfig())){
+                    List<String> notFormula = Arrays.asList(byId.getFormulaConfig().split(","));
+                    reData.keySet().removeIf(key -> {
+                        String[] keyParts = key.split("__");
+                        return keyParts.length > 1 && notFormula.contains(wbsTreePrivate.getInitTableName() + ":" + keyParts[0]);
+                    });
+
+                }
 
                 ProjectInfo projectInfo = jdbcTemplate.query("select project_name from m_project_info where id = " + wbsTreePrivate.getProjectId(), new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
                 if (projectInfo != null) {

+ 31 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -131,6 +131,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     private final IWbsParamService wpService;
     private final FormulaStrategyFactory formulaStrategyFactory;
     private final IWbsTreeContractService wbsTreeContractService;
+    private final WbsTreeContractExtendService wbsTreeContractExtendService;
     private final WbsTreePrivateMapper wbsTreePrivateMapper;
     private final IElementFormulaMappingService elementFormulaMappingService;
     private final JdbcTemplate jdbcTemplate;
@@ -2284,12 +2285,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     }
 
     @Override
-    public List<KeyMapper> getKeyMapperList(List<Long> ids, String projectId, String nodeId, ExecuteType executeType) {
+    public List<KeyMapper> getKeyMapperList(List<Long> ids, String projectId, String nodeId, ExecuteType executeType, String testGroupId) {
         /*ids 表流水号 projectId项目 nodeId工序节点的pkeyId ExecuteType执行模式 质检或者试验 首件*/
         if (executeType.equals(ExecuteType.INSPECTION)) {
-            return listForContract(ids, projectId, nodeId);
+            return listForContract(ids, projectId, nodeId, testGroupId);
         } else if (executeType.equals(ExecuteType.TESTING) ) {
-            return listForPrivate(ids, projectId, nodeId);
+            return listForPrivate(ids, projectId, nodeId, testGroupId);
         } else if (executeType.equals(ExecuteType.LOGINFO) ) {
             return listForPrivateByLog(ids, projectId, nodeId);
         }
@@ -4962,8 +4963,18 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     }
 
     /*表id,项目id,节点Id*/
-    public List<KeyMapper> listForContract(List<Long> ids, String projectId, String nodeId) {
+    public List<KeyMapper> listForContract(List<Long> ids, String projectId, String nodeId, String testGroupId) {
         List<Map<String, Object>> listMap = listMap(ids, ExecuteType.INSPECTION);
+        //质检这个参数为0,表示过滤公式,为1,表示html渲染表格
+        if(!"1".equals(testGroupId)){
+            //根据节点id查询 合同段扩展表
+            WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(nodeId);
+            if (byId != null && StringUtils.isNotEmpty(byId.getFormulaConfig())) {
+                List<String> list = Arrays.asList(byId.getFormulaConfig().split(","));
+                listMap = listMap.stream().filter(m -> !list.contains(m.get("tableName").toString() + ":" + m.get("field").toString())).collect(Collectors.toList());
+            }
+        }
+
         WbsTreePrivate wtp = wtpId(Long.parseLong(nodeId));
         if (Func.isNotEmpty(listMap)) {
             /*当前节点的某个元素存在多种作用域的公式,作用域范围越小优先级越高*/
@@ -5048,9 +5059,17 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
 
     }
 
-    private List<KeyMapper> listForPrivate(List<Long> ids, String projectId, String nodeId) {
+    private List<KeyMapper> listForPrivate(List<Long> ids, String projectId, String nodeId, String testGroupId) {
         /**/
         List<Map<String, Object>> listMap = listMap(ids, ExecuteType.TESTING);
+        if(StringUtil.isNotBlank(testGroupId)){
+            //根据节点id查询 合同段扩展表
+            WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(testGroupId);
+            if (byId != null && StringUtils.isNotEmpty(byId.getFormulaConfig())) {
+                List<String> list = Arrays.asList(byId.getFormulaConfig().split(","));
+                listMap = listMap.stream().filter(m -> !list.contains(m.get("tableName").toString() + ":" + m.get("field").toString())).collect(Collectors.toList());
+            }
+        }
         List<KeyMapper> list = listMap.stream().map(m -> BeanUtil.toBean(m, KeyMapper.class)).collect(Collectors.toList());
         if (Func.isNotEmpty(listMap)) {
             WbsTreePrivate wtp = this.wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, nodeId));
@@ -6208,6 +6227,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                 });
             }*/
             fds.removeIf(f -> f.getFormula() == null);
+            //取消公式执行
+            WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(wtc.getPId());
+            if(byId != null && org.apache.commons.lang.StringUtils.isNotEmpty(byId.getFormulaConfig())){
+                List<String> list = Arrays.asList(byId.getFormulaConfig().split(","));
+                fds = fds.stream().filter(f -> !list.contains(f.getCode())).collect(Collectors.toList());
+            }
+
             if (fds.size() > 0) {
                 /*执行结果放回数据集合*/
                 Map<String, Object> currentMap = new HashMap<>(30);

+ 162 - 22
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ProfilerOffsetServiceImpl.java

@@ -1,5 +1,11 @@
 package org.springblade.manager.service.impl;
 
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.util.URLUtil;
+import cn.hutool.http.HttpException;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONConfig;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.nacos.common.utils.MD5Utils;
@@ -7,6 +13,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.digest.HmacAlgorithms;
+import org.apache.commons.codec.digest.HmacUtils;
+import org.apache.commons.lang.RandomStringUtils;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.utils.BeanUtil;
@@ -17,20 +27,23 @@ import org.springblade.manager.dto.ProfilerOffsetResultDTO;
 import org.springblade.manager.entity.ProfilerData;
 import org.springblade.manager.entity.ProfilerOffset;
 import org.springblade.manager.entity.ProfilerStandardSectionBean;
-import org.springblade.manager.entity.profiler.ProfilerResult;
-import org.springblade.manager.entity.profiler.ProfilerSaveDTO;
+import org.springblade.manager.entity.profiler.*;
 import org.springblade.manager.service.ProfilerDataService;
 import org.springblade.manager.service.ProfilerOffsetService;
 import org.springblade.manager.mapper.ProfilerOffsetMapper;
 import org.springblade.manager.service.ProfilerStandardSectionBeanService;
 import org.springblade.resource.feign.NewIOSSClient;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import java.time.Instant;
-import java.util.List;
+import java.util.*;
 
 /**
  * @author LHB
@@ -38,6 +51,7 @@ import java.util.List;
  * @createDate 2025-10-27 15:58:56
  */
 @Service
+@Slf4j
 public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper, ProfilerOffset>
         implements ProfilerOffsetService {
 
@@ -53,20 +67,20 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
     private ProfilerDataService dataService;
     @Resource
     private ProfilerStandardSectionBeanService beanService;
-
-
+    @Resource
+    private JdbcTemplate jdbcTemplate;
     @Override
     @Transactional(rollbackFor = Exception.class)
     public ProfilerResult save(ProfilerSaveDTO save, MultipartFile file) {
         if (!save.getAppKey().equals(APP_KEY)) {
             return ProfilerResult.error("10006", "appKey错误", "");
         }
-        String s = MD5Utils.md5Hex(APP_KEY +  APP_SECRET + save.getTimestamp(),  "UTF-8");
+        String s = MD5Utils.md5Hex(APP_KEY + APP_SECRET + save.getTimestamp(), "UTF-8");
         if (!s.equals(save.getSign())) {
             return ProfilerResult.error("10007", "sign错误", "");
         }
-        if(!isValidTimestamp(save.getTimestamp())){
-            return ProfilerResult.error("10008","签名验证失败:timeTicks的时间和当前时间必须小于30分钟","");
+        if (!isValidTimestamp(save.getTimestamp())) {
+            return ProfilerResult.error("10008", "签名验证失败:timeTicks的时间和当前时间必须小于30分钟", "");
         }
 
         //主键id
@@ -78,18 +92,18 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
         try {
             jsonObject = JSONUtil.parseObj(save.getData());
         } catch (Exception e) {
-            return ProfilerResult.error("10009","data参数格式错误","");
+            return ProfilerResult.error("10009", "data参数格式错误", "");
         }
         //获取基础信息 + 测量者信息
         ProfilerOffset offset = jsonObject.getBean("offset", ProfilerOffset.class);
-        if(offset == null){
+        if (offset == null) {
             offset = new ProfilerOffset();
         }
         offset.setId(id);
         offset.setDeviceCode(deviceCode);
         ProfilerOffset info = jsonObject.getBean("info", ProfilerOffset.class);
         //把测量者信息赋值给基础信息对象
-        if(info != null){
+        if (info != null) {
             offset.setChannelName(info.getChannelName());
             offset.setConstructionUnit(info.getConstructionUnit());
             offset.setDate(info.getDate());
@@ -100,10 +114,10 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
         //获取标准断面数据
         JSONObject mStandardSectionDataBeanList = jsonObject.getJSONObject("standardSectionBean");
         List<ProfilerStandardSectionBean> standardSectionBean = null;
-        if(mStandardSectionDataBeanList != null){
+        if (mStandardSectionDataBeanList != null) {
             standardSectionBean = mStandardSectionDataBeanList.getBeanList("mStandardSectionDataBeanList", ProfilerStandardSectionBean.class);
-            if(standardSectionBean != null){
-                standardSectionBean.forEach(f ->{
+            if (standardSectionBean != null) {
+                standardSectionBean.forEach(f -> {
                     f.setId(SnowFlakeUtil.getId());
                     f.setOffsetId(id);
                 });
@@ -111,7 +125,7 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
         }
         //获取测量数据
         List<ProfilerData> data = jsonObject.getBeanList("data", ProfilerData.class);
-        if(data != null){
+        if (data != null) {
             data.forEach(f -> {
                 f.setId(SnowFlakeUtil.getId());
                 f.setOffsetId(id);
@@ -125,10 +139,10 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
         }
         //保存数据
         baseMapper.insert(offset);
-        if(CollectionUtil.isNotEmpty(standardSectionBean)){
+        if (CollectionUtil.isNotEmpty(standardSectionBean)) {
             beanService.saveBatch(standardSectionBean);
         }
-        if(CollectionUtil.isNotEmpty(data)){
+        if (CollectionUtil.isNotEmpty(data)) {
             dataService.saveBatch(data);
         }
         return ProfilerResult.success();
@@ -153,9 +167,9 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
     @Override
     public ProfilerOffsetResultDTO getOne(Long id) {
         ProfilerOffset byId = this.getById(id);
-        if(byId != null){
+        if (byId != null) {
             ProfilerOffsetResultDTO resultDTO = BeanUtil.copyProperties(byId, ProfilerOffsetResultDTO.class);
-            if(resultDTO != null){
+            if (resultDTO != null) {
                 List<ProfilerStandardSectionBean> list = beanService.list(Wrappers.<ProfilerStandardSectionBean>lambdaQuery().eq(ProfilerStandardSectionBean::getOffsetId, id));
                 List<ProfilerData> list1 = dataService.list(Wrappers.<ProfilerData>lambdaQuery().eq(ProfilerData::getOffsetId, id));
                 resultDTO.setSectionBeans(list);
@@ -173,11 +187,11 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
         boolean update = this.updateById(qProfilerOffset);
 
         List<ProfilerStandardSectionBean> sectionBeans = offset.getSectionBeans();
-        if(CollectionUtil.isNotEmpty(sectionBeans)){
+        if (CollectionUtil.isNotEmpty(sectionBeans)) {
             beanService.updateBatchById(sectionBeans);
         }
         List<ProfilerData> data = offset.getData();
-        if(CollectionUtil.isNotEmpty(data)){
+        if (CollectionUtil.isNotEmpty(data)) {
             dataService.updateBatchById(data);
         }
         return update;
@@ -188,9 +202,135 @@ public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper,
         QueryWrapper<ProfilerOffset> qProfilerOffsetQueryWrapper = new QueryWrapper<>();
         qProfilerOffsetQueryWrapper.lambda()
                 .eq(StringUtil.isNotBlank(offset.getUserName()), ProfilerOffset::getUserName, offset.getUserName())
+                .eq(StringUtil.isNotBlank(offset.getBackBreak()), ProfilerOffset::getBackBreak, offset.getBackBreak())
                 .ge(StringUtil.isNotBlank(offset.getStartTime()), ProfilerOffset::getDate, offset.getStartTime())
                 .le(StringUtil.isNotBlank(offset.getEndTime()), ProfilerOffset::getDate, offset.getEndTime());
-        return baseMapper.selectPage(new Page<>(offset.getCurrent(), offset.getSize()),qProfilerOffsetQueryWrapper);
+        return baseMapper.selectPage(new Page<>(offset.getCurrent(), offset.getSize()), qProfilerOffsetQueryWrapper);
+    }
+
+    @Override
+    public List<String> getListUserName() {
+        return baseMapper.getListUserName();
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    @Scheduled(cron = "0 0 23 ? * FRI")
+    public void push() {
+        String url = "/data/openapi/v1/push";
+
+
+        //从系统参数中获取配置信息
+        String sql = "select param_value from blade_param where param_key = 'profiler.isPush' and is_deleted = 0";
+        Integer isPush = jdbcTemplate.queryForObject(sql, Integer.class);
+        //判断是否上传数据
+        if(isPush != null && isPush == 0){
+            return;
+        }
+
+        //从系统参数中获取配置信息
+        String baseUrl = null;
+        try {
+            sql = "select param_value from blade_param where param_key = 'profiler.baseUrl' and is_deleted = 0";
+            baseUrl = jdbcTemplate.queryForObject(sql, String.class);
+        } catch (DataAccessException e) {
+            log.error("系统参数未找到 profiler.baseUrl");
+        }
+
+        String clientKey = null;
+        try {
+            sql = "select param_value from blade_param where param_key = 'profiler.clientKey' and is_deleted = 0";
+            //第三方提供的key
+            clientKey = jdbcTemplate.queryForObject(sql, String.class);
+        } catch (DataAccessException e) {
+            log.error("系统参数未找到 profiler.clientKey");
+            return;
+        }
+
+        String secret = null;
+        try {
+            sql = "select param_value from blade_param where param_key = 'profiler.secret' and is_deleted = 0";
+            //第三方提供的key
+            secret = jdbcTemplate.queryForObject(sql, String.class);
+        } catch (DataAccessException e) {
+            log.error("系统参数未找到 profiler.secret");
+            return;
+        }
+
+        String protocolApiId = null;
+        try {
+            sql = "select param_value from blade_param where param_key = 'profiler.protocolApiId' and is_deleted = 0";
+            //第三方提供的key
+            protocolApiId = jdbcTemplate.queryForObject(sql, String.class);
+        } catch (DataAccessException e) {
+            log.error("系统参数未找到 profiler.protocolApiId");
+            return;
+        }
+        if(StringUtil.isBlank(baseUrl) || StringUtil.isBlank(clientKey) || StringUtil.isBlank(secret) || StringUtil.isBlank(protocolApiId)){
+            log.error("系统参数未找到配置项");
+            return;
+        }
+
+        //当前时间戳
+        String secTimestamp = String.valueOf(System.currentTimeMillis());
+
+        //获取数据
+        List<ProfilerOffset> list = this.list(Wrappers.<ProfilerOffset>lambdaQuery().eq(ProfilerOffset::getPush, 0));
+        log.info("开始推送断面仪数据------{}", DateTime.now());
+        for (ProfilerOffset f : list) {
+            //随机字符串 每次推送都是唯一的
+            String secNonce = UUID.randomUUID().toString();
+            //获取测量断面
+            List<ProfilerStandardSectionBean> sectionBeans = beanService.list(Wrappers.<ProfilerStandardSectionBean>lambdaQuery().eq(ProfilerStandardSectionBean::getOffsetId, f.getId()));
+            List<ProfilerSectionPush> sectionPushes = ProfilerSectionPush.parameterMapping(sectionBeans);
+            //获取测量数据
+            List<ProfilerData> data = dataService.list(Wrappers.<ProfilerData>lambdaQuery().eq(ProfilerData::getOffsetId, f.getId()));
+            List<ProfilerDataPush> dataPushes = ProfilerDataPush.parameterMapping(data);
+
+            //赋值
+            ProfilerOffsetPush profilerOffsetPush = ProfilerOffsetPush.parameterMapping(f);
+            profilerOffsetPush.setMeasurement_section(sectionPushes);
+            profilerOffsetPush.setReceipt_data(dataPushes);
+            //设置不忽略空值
+            JSONConfig config = JSONConfig.create().setIgnoreNullValue(false);
+            JSONObject jsonObject = new JSONObject(config);
+            jsonObject.set("protocolApiId", protocolApiId);
+            jsonObject.set("data", profilerOffsetPush);
+
+            //数据json字符串
+            String catLog = jsonObject.toString();
+            //http对象
+            HttpRequest post = HttpUtil.createPost(baseUrl + url);
+            //获取签名字符串
+            String sign = "POST_" + url + "_" + secTimestamp + "_" + secNonce;
+            //请求头
+            HashMap<String, String> catLogHeaders = new HashMap<>();
+            catLogHeaders.put("Content-Type", "application/json");
+            //应用ID
+            catLogHeaders.put("Sec-API-Key", clientKey);
+            //当前时间 毫秒值
+            catLogHeaders.put("Sec-Timestamp", secTimestamp);
+            //请求发起时的随机字符串,需要保证唯一性
+            catLogHeaders.put("Sec-Nonce", secNonce);
+            //签名
+            catLogHeaders.put("Sec-Signature", new HmacUtils(HmacAlgorithms.HMAC_SHA_256, secret).hmacHex(sign));
+
+            try {
+                String catLogBody = post.addHeaders(catLogHeaders).body(catLog).contentType("application/json").execute().body();
+                //响应结果
+                JSONObject result = JSONUtil.parseObj(catLogBody);
+                log.info("推送结果:{}",result);
+                if ("200".equals(result.getStr("code"))) {
+                    f.setPush(1);
+                } else {
+                    f.setPush(2);
+                }
+            } catch (HttpException e) {
+                f.setPush(2);
+            }
+        }
+        log.info("推送完成------{}", DateTime.now());
+        this.updateBatchById(list);
     }
 }
 

+ 48 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsParamServiceImpl.java

@@ -260,14 +260,58 @@ public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsPara
                     //如果有部分节点优先部分
                     List<WbsParam> collect1 = result.stream().filter(o -> o.getNameType() == 2).collect(Collectors.toList());
                     if(collect1.size()>0){
-                        WbsParam param = collect1.get(0);
-                        return R.data(Arrays.asList(param.getV().split("-")));
+                        //如果节点的资料类型不为null
+                        if(contract.getMajorDataType()!=null){
+                            //如果与配置的文件题名资料类型一致
+                            List<WbsParam> data = collect1.stream().filter(o -> StringUtils.isNotEmpty(o.getRemark()) && o.getRemark().contains(contract.getMajorDataType() + "")).collect(Collectors.toList());
+                            if(data.size()>0){
+                                WbsParam param = data.get(0);
+                                return R.data(Arrays.asList(param.getV().split("-")));
+                            }else {
+                                //与配置的文件题名类型不一致,就使用全部类型的文件题名规则
+                                List<WbsParam> data1 = collect1.stream().filter(o -> o.getRemark() != null && o.getRemark().equals("0")).collect(Collectors.toList());
+                                if(data1.size()>0){
+                                    WbsParam param = data1.get(0);
+                                    return R.data(Arrays.asList(param.getV().split("-")));
+                                }
+                            }
+                        }else {
+                            //如果节点的资料类型为null
+                            List<WbsParam> data1 = collect1.stream().filter(o -> o.getRemark() != null && o.getRemark().equals("0")).collect(Collectors.toList());
+                            //使用全部类型的文件题名规则
+                            if(data1.size()>0){
+                                WbsParam param = data1.get(0);
+                                return R.data(Arrays.asList(param.getV().split("-")));
+                            }
+                        }
                     }
                     //没有部分节点用所有节点
                     List<WbsParam> collect2 = result.stream().filter(o -> o.getNameType() == 1).collect(Collectors.toList());
                     if(collect2.size()>0){
-                        WbsParam param = collect2.get(0);
-                        return R.data(Arrays.asList(param.getV().split("-")));
+                        //如果节点的资料类型不为null
+                        if(contract.getMajorDataType()!=null){
+                            //如果与配置的文件题名资料类型一致
+                            List<WbsParam> data = collect2.stream().filter(o -> StringUtils.isNotEmpty(o.getRemark()) && o.getRemark().contains(contract.getMajorDataType() + "")).collect(Collectors.toList());
+                            if(data.size()>0){
+                                WbsParam param = data.get(0);
+                                return R.data(Arrays.asList(param.getV().split("-")));
+                            }else {
+                                //与配置的文件题名类型不一致,就使用全部类型的文件题名规则
+                                List<WbsParam> data1 = collect2.stream().filter(o -> o.getRemark() != null && o.getRemark().equals("0")).collect(Collectors.toList());
+                                if(data1.size()>0){
+                                    WbsParam param = data1.get(0);
+                                    return R.data(Arrays.asList(param.getV().split("-")));
+                                }
+                            }
+                        }else {
+                            //如果节点的资料类型为null
+                            List<WbsParam> data1 = collect2.stream().filter(o -> o.getRemark() != null && o.getRemark().equals("0")).collect(Collectors.toList());
+                            //使用全部类型的文件题名规则
+                            if(data1.size()>0){
+                                WbsParam param = data1.get(0);
+                                return R.data(Arrays.asList(param.getV().split("-")));
+                            }
+                        }
                     }
                 }
             }

+ 76 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -20,6 +20,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.DateUtil;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.util.CellRangeAddress;
@@ -66,6 +67,7 @@ import org.springblade.manager.mapper.*;
 import org.springblade.manager.service.INodeBaseInfoService;
 import org.springblade.manager.service.ITableFileService;
 import org.springblade.manager.service.IWbsTreeContractService;
+import org.springblade.manager.service.WbsTreeContractExtendService;
 import org.springblade.manager.util.DataStructureFormatUtils;
 import org.springblade.manager.utils.CompositeKey;
 import org.springblade.manager.vo.*;
@@ -136,6 +138,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
     private final TrialCyAccessoriesClient trialCyAccessoriesClient;
     private final WbsTreeContractStatisticsClient wbsTreeContractStatisticsClient;
     private final FormulaDataBlockMapper formulaDataBlockMapper;
+    private final WbsTreeContractExtendService wbsTreeContractExtendService;
     private final OperationLogClient operationLogClient;
 
 
@@ -3496,7 +3499,23 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
      */
     private static Object getCellValue1(Cell cell) {
         if (cell == null) return null;
-        return cell.getStringCellValue();
+
+        switch (cell.getCellTypeEnum()) {
+            case STRING:
+                return cell.getStringCellValue();
+            case NUMERIC:
+                if (DateUtil.isCellDateFormatted(cell)) {
+                    return cell.getDateCellValue();
+                } else {
+                    return cell.getNumericCellValue();
+                }
+            case BOOLEAN:
+                return cell.getBooleanCellValue();
+            case FORMULA:
+                return cell.getCellFormula();
+            default:
+                return null;
+        }
     }
 
     /**
@@ -6093,4 +6112,60 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         // 如果共同部分都相同,长度短的排在前面(父级在子级前面)
         return Integer.compare(arr1.length, arr2.length);
     }
+
+    @Override
+    public void setFormulaReference(FormulaReferenceDTO dto) {
+        try {
+            dto.setKey(dto.getKey().split("__")[0]);
+            WbsTreeContract parentNode = null;
+            if(dto.getType() == 1){
+                //查询父节点
+                parentNode = wbsTreeContractMapper.selectById(dto.getPId());
+            }
+
+            //查询父节点的扩展信息
+            WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(dto.getPId());
+
+            if(byId != null){
+                String formulaConfig = byId.getFormulaConfig();
+                if(StringUtils.isNotEmpty(formulaConfig)){
+                    List<String> list = Arrays.asList(formulaConfig.split(","));
+                    HashSet<String> strings = new HashSet<>(list);
+                    if(dto.getStatus() == 1){
+                        strings.remove(dto.getInitTableName() + ":" + dto.getKey());
+                    }else{
+                        strings.add(dto.getInitTableName() + ":" + dto.getKey());
+                    }
+                    byId.setFormulaConfig(StringUtils.join(strings, ","));
+                }else{
+                    if(dto.getStatus() == 0){
+                        byId.setFormulaConfig(dto.getInitTableName() + ":" + dto.getKey());
+                    }
+                }
+                wbsTreeContractExtendService.updateById(byId);
+            }else{
+                if(dto.getStatus() == 0){
+                    WbsTreeContractExtend wbsTreeContractExtend = new WbsTreeContractExtend();
+                    if(dto.getType() == 1){
+                        if(parentNode == null){
+                            throw new ServiceException("父节点不存在");
+                        }
+                        wbsTreeContractExtend.setPKeyId(parentNode.getPKeyId());
+                        wbsTreeContractExtend.setContractId(Long.valueOf(parentNode.getContractId()));
+                        wbsTreeContractExtend.setAncestors(parentNode.getAncestorsPId());
+                    }
+                    if(dto.getType() == 2){
+                        wbsTreeContractExtend.setPKeyId(dto.getPId());
+                    }
+                    wbsTreeContractExtend.setType(null);
+                    wbsTreeContractExtend.setIsSync(0);
+                    wbsTreeContractExtend.setFormulaConfig(dto.getInitTableName() + ":" + dto.getKey());
+                    wbsTreeContractExtendService.save(wbsTreeContractExtend);
+                }
+            }
+        } catch (NumberFormatException e) {
+            e.printStackTrace();
+            throw new RuntimeException("失败");
+        }
+    }
 }

+ 44 - 13
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -39,10 +39,7 @@ import org.springblade.manager.dto.WbsTreePrivateDTO2;
 import org.springblade.manager.dto.WbsTreePrivateDTO3;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.mapper.*;
-import org.springblade.manager.service.IElementFormulaMappingService;
-import org.springblade.manager.service.IFormulaService;
-import org.springblade.manager.service.ITableInfoService;
-import org.springblade.manager.service.IWbsTreePrivateService;
+import org.springblade.manager.service.*;
 import org.springblade.manager.utils.CompositeKey1;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.manager.vo.*;
@@ -76,6 +73,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
 
     private final WbsTreeContractMapper wbsTreeContractMapper;
     private final WbsTreeContractServiceImpl wbsTreeContractService;
+    private final WbsTreeContractExtendService wbsTreeContractExtendService;
     private final ITableInfoService tableInfoService;
     private final WbsTreeMapper wbsTreeMapper;
     private final ContractInfoMapper contractInfoMapper;
@@ -2901,7 +2899,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
     }
 
     @Override
-    public Object getExcelHtml(String primaryKeyId) throws Exception {
+    public Object getExcelHtml(String primaryKeyId, String id) throws Exception {
 
         WbsTreePrivate wbsTreePrivate = baseMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getPKeyId, primaryKeyId));
@@ -2957,18 +2955,51 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
         //字段查询、获取公式字段
         String colKeys = "SELECT e_key from m_table_info a ,m_wbs_form_element b WHERE a.tab_en_name = '" + tabName + "' and a.id=b.f_id and b.id  in(SELECT element_id from m_element_formula_mapping c where c.is_deleted=0) ";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(colKeys);
+        //扩展----根据父节点查询不允许执行的公式
+        List<String>  list = new ArrayList<>();;
+        if(StringUtil.isNotBlank(id)){
+            WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(id);
+            if(byId != null){
+                String formulaConfig = byId.getFormulaConfig();
+                if(StringUtils.isNotEmpty(formulaConfig)){
+                    list = Arrays.asList(formulaConfig.split(","));
+                }
+            }
+        }
+
         if (maps.size() > 0) {
             for (Map<String, Object> keys : maps) {
                 String key = keys.get("e_key") + "__";
-                Elements gsColor = doc.select("el-input[keyname~=^" + key + "]");
-                for (Element element : gsColor) {
-                    element.parent().attr("gscolor", "11");
+                //采用质检html渲染方式获取表单数据
+                Elements select = doc.select("table").first().select("[keyname^=" + key + "]");
+                if(list.contains(tabName + ":" + keys.get("e_key"))){
+                    //当前元素不执行公式
+                    select.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearFormula", "1"));
+                }else{
+                    //当前元素不执行公式
+                    select.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearFormula", "0"));
+                    for (Element element : select) {
+                        element.parent().attr("gscolor", "11");
+                    }
                 }
 
-                Elements dateColor = doc.select("el-date-picker[keyname~=^" + key + "]");
-                for (Element element : dateColor) {
-                    element.parent().attr("gscolor", "11");
-                }
+//                Elements gsColor = doc.select("el-input[keyname~=^" + key + "]");
+//                if(list.contains(tabName + ":" + keys.get("e_key"))){
+//                    gsColor.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearFormula", "1"));
+//                }else{
+//                    for (Element element : gsColor) {
+//                        element.parent().attr("gscolor", "11");
+//                    }
+//                }
+//                Elements dateColor = doc.select("el-date-picker[keyname~=^" + key + "]");
+//                if(list.contains(tabName + ":" + keys.get("e_key"))){
+//                    dateColor.stream().filter(Objects::nonNull).forEach(element -> element.attr("clearFormula", "1"));
+//                }else{
+//                    for (Element element : dateColor) {
+//                        element.parent().attr("gscolor", "11");
+//                    }
+//                }
+
             }
         }
         doc.select("Col").remove();
@@ -3003,7 +3034,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
         } else {
             return R.fail("该合同段没有委托单权限业务");
         }
-        Object excelHtml = getExcelHtml(pkeyId);
+        Object excelHtml = getExcelHtml(pkeyId, null);
         return excelHtml;
     }