diff --git a/hf.fo b/hf.fo
new file mode 100644
index 0000000..1a46bb7
--- /dev/null
+++ b/hf.fo
@@ -0,0 +1,5 @@
+BODY CONTENTBODY CONTENTBODY CONTENTBODY CONTENT
+
+
+
+
\ No newline at end of file
diff --git a/hzims-service-api/hzims-operational-api/pom.xml b/hzims-service-api/hzims-operational-api/pom.xml
index 3bbc8d9..10b24a0 100644
--- a/hzims-service-api/hzims-operational-api/pom.xml
+++ b/hzims-service-api/hzims-operational-api/pom.xml
@@ -57,10 +57,19 @@
org.springblade
blade-system-api
+
+
com.hnac.hzims
hzims-biz-common
+
+
+ com.hnac.hzims
+ middle-api
+ 4.0.0-SNAPSHOT
+ provided
+
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/constants/TreatMethodConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/constants/TreatMethodConstant.java
index faa3a8c..fc26179 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/constants/TreatMethodConstant.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/constants/TreatMethodConstant.java
@@ -10,6 +10,7 @@ public interface TreatMethodConstant {
* 流程主键
*/
String DEFECT_CHECK_PRIMARY_KEY = "defect_check";
+ String DEFECT_CHECK = "defectCheck";
/**
* 1-应急抢修处理 、2 - 检修任务处理 、 3- 检修计划处理
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperAppearanceEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperAppearanceEntity.java
new file mode 100644
index 0000000..7549a14
--- /dev/null
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperAppearanceEntity.java
@@ -0,0 +1,169 @@
+package com.hnac.hzims.operational.defect.entity;
+
+import com.baomidou.mybatisplus.annotation.SqlCondition;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.NullSerializer;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.support.QueryField;
+import org.springblade.core.tenant.mp.TenantEntity;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+
+/**
+ * 实体类
+ *
+ * @author Chill
+ */
+@Data
+@TableName("hzims_oper_appearance")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "现象表", description = "现象表")
+public class OperAppearanceEntity extends TenantEntity {
+
+ private static final long serialVersionUID = 8353403086998937117L;
+
+ /**
+ * 缺陷编码
+ */
+ @QueryField(condition = SqlCondition.LIKE)
+ @ApiModelProperty(value = "缺陷编码")
+ private String defectCode;
+ /**
+ * 问题来源:ZB:值班管理,RCWH:日常维护,XJ:巡检管理,JX:检修管理,ZNZD:智能诊断
+ */
+ @QueryField(condition = SqlCondition.EQUAL)
+ @ApiModelProperty(value = "问题来源: 数据字典:defectSource")
+ private String sourceCode;
+
+ /**
+ * 问题发现人
+ */
+ @QueryField(condition = SqlCondition.EQUAL)
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "问题发现人")
+ private Long finder;
+ /**
+ * 问题类型:
+ *
+ */
+ @QueryField(condition = SqlCondition.EQUAL)
+ @ApiModelProperty(value = "问题类型:字典key : defectType")
+ private String typeCode;
+ /**
+ * 发现时间
+ */
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty(value = "发现时间")
+ private Date findTime;
+
+ /**
+ * 名称
+ */
+ @QueryField(condition = SqlCondition.LIKE)
+ @ApiModelProperty(value = "名称,如果是设备则是设备名称。")
+ private String name;
+ /**
+ * 设备编号
+ */
+ @QueryField(condition = SqlCondition.LIKE)
+ @ApiModelProperty(value = "设备编号")
+ private String emCode;
+ /**
+ * 故障缺陷名称
+ */
+ @QueryField(condition = SqlCondition.LIKE)
+ @ApiModelProperty(value = "故障缺陷名称")
+ private String faultName;
+ /**
+ * 现象描述
+ */
+ @ApiModelProperty(value = "现象描述")
+ private String descripiton;
+ /**
+ * 故障文件附件,多个文件url通过,隔开
+ */
+ @ApiModelProperty(value = "现象文件附件,多个文件url通过,隔开")
+ private String fileUrls;
+ /**
+ * 初步分析结果
+ */
+ @ApiModelProperty(value = "初步分析结果")
+ private String initResult;
+
+
+ /**
+ * 甄别人
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "甄别人")
+ private Long discriminator;
+ /**
+ * 甄别时间
+ */
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty(value = "甄别时间")
+ private Date discriminateTime;
+
+
+
+ /**
+ * 甄别状态:已甄别 1 和未甄别 0 ,默认0
+ */
+ @QueryField(condition = SqlCondition.EQUAL)
+ @ApiModelProperty(value = "甄别状态:已甄别 1 和未甄别 0 ,默认0")
+ private String discriminateStatus;
+
+ /**
+ * 是否为缺陷
+ */
+ @QueryField(condition = SqlCondition.EQUAL)
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "是否为缺陷,0 否,1是")
+ private Integer isDefect;
+ /**
+ * 甄别描述
+ */
+ @ApiModelProperty(value = "甄别描述")
+ private String discriminateDesc;
+ /**
+ * 备注(冗余)
+ */
+ @ApiModelProperty(value = "备注(冗余)")
+ private String remark;
+
+ /**
+ * 是否使用智能诊断
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "是否使用智能诊断")
+ private Integer isDiagnosis;
+ /**
+ * 智能诊断任务ID
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "智能诊断任务ID")
+ private Long diagnosisId;
+ /**
+ * 已有缺陷编码
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "已有缺陷编码")
+ private Long existDefectId;
+}
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java
index c4b174c..f600186 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java
@@ -4,17 +4,18 @@ import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springblade.core.mp.support.QueryField;
-import org.springblade.core.tenant.mp.TenantEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.support.QueryField;
+import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.YearMonth;
import java.util.Date;
-import java.util.List;
/**
@@ -80,7 +81,7 @@ public class OperDefectEntity extends TenantEntity {
* 实际工时,多个处理人工时逗号隔开
*/
@ApiModelProperty(value = "实际工时,多个处理人工时逗号隔开")
- private String actHours;
+ private Integer actHours;
/**
* 最后处理人处理描述
@@ -89,16 +90,17 @@ public class OperDefectEntity extends TenantEntity {
private String disposeDesc;
@TableField(exist = false)
- @ApiModelProperty(value = "开始时间")
+ @ApiModelProperty(value = "缺陷创建时间-开始时间")
private String startTime;
@TableField(exist = false)
- @ApiModelProperty(value = "结束时间")
+ @ApiModelProperty(value = "缺陷创建时间-结束时间")
private String endTime;
- @TableField(exist = false)
- @ApiModelProperty(value = "机构编号集合")
- private List deptIds;
+// 20230612弃用该字段,无地方引用
+// @TableField(exist = false)
+// @ApiModelProperty(value = "机构编号集合")
+// private List deptIds;
/**
@@ -113,4 +115,82 @@ public class OperDefectEntity extends TenantEntity {
@ApiModelProperty(value = "年月")
@TableField(exist = false)
private YearMonth yearMonth;
+ /**
+ * 计划处理人
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "计划处理人")
+ private String planHandler;
+ /**
+ * 处理人
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "处理人")
+ private Long handler;
+ /**
+ * 缺陷等级
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "缺陷等级")
+ private String defectGrading;
+ /**
+ * 定论词条
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "定论词条")
+ private String conclusionLabel;
+
+ /**
+ * 备注(冗余)
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "备注(冗余)")
+ private String remark;
+ /**
+ * 是否使用智能诊断
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "是否使用智能诊断")
+ private Integer isDiagnosis;
+ /**
+ * 智能诊断任务ID
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "智能诊断任务ID")
+ private Long diagnosisId;
+ /**
+ * 已有缺陷编码
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "已有缺陷编码")
+ private Long existDefectId;
+ /**
+ * 定论人
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "定论人")
+ private Long conclusionPeople;
+ /**
+ * 定论时间
+ */
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty(value = "定论时间")
+ private Date conclusionTime;
+ /**
+ * 定论描述
+ */
+ @ApiModelProperty(value = "定论描述")
+ private String conclusion;
+ /**
+ * 计划工时
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "计划工时")
+ private Integer planHours;
+
}
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java
index d241884..ea245e5 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java
@@ -5,16 +5,15 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
-import org.springblade.core.mp.support.QueryField;
-import org.springblade.core.tenant.mp.TenantEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.support.QueryField;
+import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
-import java.time.LocalDateTime;
/**
@@ -227,4 +226,54 @@ public class OperDefectStatisticsEntity extends TenantEntity {
@ApiModelProperty(value = "定论时间")
private Date conclusionTime;
+ /**
+ * 计划处理人
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "计划处理人")
+ private String planHandler;
+
+ /**
+ * 是否入库
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "是否入库")
+ private Integer isWarehousing;
+ /**
+ * 当前处理环节
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "当前处理环节")
+ private String currentOperator;
+ /**
+ * 当前环节处理人
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "当前环节处理人")
+ private String currentLinkHandler;
+ /**
+ * 备注(冗余)
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "备注(冗余)")
+ private String remark;
+ /**
+ * 是否使用智能诊断
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "是否使用智能诊断")
+ private Integer isDiagnosis;
+ /**
+ * 智能诊断任务ID
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "智能诊断任务ID")
+ private Long diagnosisId;
+ /**
+ * 已有缺陷编码
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "已有缺陷编码")
+ private Long existDefectId;
+
}
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java
index bbcd030..8c4ecc6 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java
@@ -1,23 +1,19 @@
package com.hnac.hzims.operational.defect.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
-import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import org.springblade.core.mp.support.QueryField;
-import org.springblade.core.tenant.mp.TenantEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.support.QueryField;
+import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
-import java.time.YearMonth;
import java.util.Date;
-import java.time.LocalDateTime;
/**
@@ -28,7 +24,7 @@ import java.time.LocalDateTime;
@Data
@TableName("hzims_oper_phenomenon")
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "问题现象表", description = "问题现象表")
+@ApiModel(value = "问题现象全表", description = "问题现象全表")
public class OperPhenomenonEntity extends TenantEntity {
private static final long serialVersionUID = 8353403086998937117L;
@@ -54,7 +50,7 @@ public class OperPhenomenonEntity extends TenantEntity {
/**
* 甄别流程实例
*/
- @ApiModelProperty(value = "甄别流程实例")
+ @ApiModelProperty(value = "流程实例")
private String checkProcessInstanceId;
/**
* 问题发现人
@@ -64,7 +60,7 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty(value = "问题发现人")
private Long finder;
/**
- * 问题类型:
+ * 问题类型:0-设备和1-非设备。
*
*/
@QueryField(condition = SqlCondition.EQUAL)
@@ -214,10 +210,10 @@ public class OperPhenomenonEntity extends TenantEntity {
private Long handleTaskId;
/**
- * 处理人,处理工作流的第一个处理人
+ * 处理人
*/
@JsonSerialize(nullsUsing = NullSerializer.class)
- @ApiModelProperty(value = "处理人,处理工作流的第一个处理人,第一个处理节点人key 必须是 problemUser")
+ @ApiModelProperty(value = "处理人")
private Long handler;
/**
* 处理状态:已处理1,未处理0,默认0
@@ -287,4 +283,93 @@ public class OperPhenomenonEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty(value = "核算工时")
private Integer checkHours;
+ /**
+ * 计划处理人
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "计划处理人")
+ private String planHandler;
+ /**
+ * 实际开始时间
+ */
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty(value = "实际开始时间")
+ private Date actStartTime;
+
+ /**
+ * 实际结束时间
+ */
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty(value = "实际结束时间")
+ private Date actEndTime;
+ /**
+ * 最后处理人处理描述
+ */
+ @ApiModelProperty(value = "最后处理人处理描述")
+ private String disposeDesc;
+ /**
+ * 是否入库
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "是否入库")
+ private Integer isWarehousing;
+ /**
+ * 缺陷等级
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "缺陷等级")
+ private String defectGrading;
+ /**
+ * 定论词条
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "定论词条")
+ private String conclusionLabel;
+ /**
+ * 当前处理环节
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "当前处理环节")
+ private String currentOperator;
+ /**
+ * 当前环节处理人
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "当前环节处理人")
+ private String currentLinkHandler;
+ /**
+ * 备注(冗余)
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "备注(冗余)")
+ private String remark;
+ /**
+ * 是否使用智能诊断
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "是否使用智能诊断")
+ private Integer isDiagnosis;
+ /**
+ * 智能诊断任务ID
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "智能诊断任务ID")
+ private Long diagnosisId;
+ /**
+ * 已有缺陷编码
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ @ApiModelProperty(value = "已有缺陷编码")
+ private Long existDefectId;
+
}
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/Fallback/IOperDefectClientFallback.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/Fallback/IOperDefectClientFallback.java
index 5419761..421f3a9 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/Fallback/IOperDefectClientFallback.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/Fallback/IOperDefectClientFallback.java
@@ -1,5 +1,6 @@
package com.hnac.hzims.operational.defect.feign.Fallback;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.feign.IOperDefectClient;
@@ -34,4 +35,9 @@ public class IOperDefectClientFallback implements IOperDefectClient {
log.error("远程调用失败,接口:" + CREATE_DEFECT);
return null;
}
+ @Override
+ public R saveDefect(ProcessWorkFlowResponse processWorkFlowResponse) {
+ log.error("远程调用失败,接口:" + SAVE_DEFECT);
+ return null;
+ }
}
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/IOperDefectClient.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/IOperDefectClient.java
index f8fc74c..b3ff803 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/IOperDefectClient.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/feign/IOperDefectClient.java
@@ -1,6 +1,6 @@
package com.hnac.hzims.operational.defect.feign;
-
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
@@ -26,6 +26,8 @@ public interface IOperDefectClient {
String UPDATE_DEFECT_HANDLER_STATE = API_PREFIX + "/updateDefectHandlerState";
String CREATE_DEFECT = API_PREFIX + "/createDefect";
+ String SAVE_DEFECT = API_PREFIX + "/saveDefect";
+
/**
* 修改缺陷信息
* @param entity
@@ -39,4 +41,10 @@ public interface IOperDefectClient {
@PostMapping(CREATE_DEFECT)
R createDefect(@RequestBody OperPhenomenonEntity phenomenon);
+
+ @PostMapping(SAVE_DEFECT)
+ R saveDefect(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse);
+
+
+
}
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperAppearanceVO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperAppearanceVO.java
new file mode 100644
index 0000000..8732dce
--- /dev/null
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperAppearanceVO.java
@@ -0,0 +1,34 @@
+package com.hnac.hzims.operational.defect.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+
+/**
+ * 实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "现象表vo", description = "现象表vo")
+public class OperAppearanceVO extends OperAppearanceEntity {
+ /**
+ * 发现结束时间
+ */
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty(value = "发现结束时间")
+ private Date findEndTime;
+}
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectVO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectVO.java
index 91c67da..401bc90 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectVO.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectVO.java
@@ -1,15 +1,15 @@
package com.hnac.hzims.operational.defect.vo;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
+import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
-import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
+import org.springframework.format.annotation.DateTimeFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
import java.util.Date;
/**
@@ -60,4 +60,16 @@ public class OperDefectVO extends OperDefectEntity {
@ApiModelProperty(value = "定论描述")
private String conclusion;
+ private String typeCode;
+ /**
+ * 定论时间范围-最晚
+ */
+ @DateTimeFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @JsonFormat(
+ pattern = "yyyy-MM-dd HH:mm:ss"
+ )
+ @ApiModelProperty(value = "定论时间范围-最晚")
+ private Date conclusionEndTime;
}
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java
index c24e64f..068222a 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java
@@ -19,6 +19,8 @@ public class EcologyFlowStationEntity extends TenantEntity {
private String stationName;
+ private String city;
+
private Long isOnLine;
private Long isDemonstrate;
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java
index f650ba6..20a1cd1 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java
@@ -2,6 +2,7 @@ package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
import lombok.Data;
/**
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/feign/MaintenanceFeignClient.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/feign/MaintenanceFeignClient.java
index 725bec4..712a3fd 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/feign/MaintenanceFeignClient.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/feign/MaintenanceFeignClient.java
@@ -1,6 +1,6 @@
package com.hnac.hzims.operational.maintenance.feign;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.maintenance.feign.fallback.MaintenanceFeignClientFallback;
import io.swagger.annotations.ApiOperation;
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/feign/fallback/MaintenanceFeignClientFallback.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/feign/fallback/MaintenanceFeignClientFallback.java
index a252c47..86ec9f8 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/feign/fallback/MaintenanceFeignClientFallback.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/feign/fallback/MaintenanceFeignClientFallback.java
@@ -1,6 +1,6 @@
package com.hnac.hzims.operational.maintenance.feign.fallback;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.maintenance.feign.MaintenanceFeignClient;
import org.springframework.stereotype.Component;
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java
index 6741a3f..9960a32 100644
--- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java
@@ -1,7 +1,6 @@
package com.hnac.hzims.message;
import lombok.AllArgsConstructor;
-import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -55,6 +54,8 @@ public class MessageConstants {
ACCESS("access","检修消息"),
TICKETMESSAGE("ticket-message","工作票消息"),
OPERATIONTICKETMESSAGE("operation-ticket-message","操作票消息"),
+ ROUTINEMAINTENANCE("operation-maintenance-message","日常维护消息"),
+ OPERATIONDEFECTMESSAGE("operation-defect-message","消缺消息"),
;
@Getter
private String key;
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java
new file mode 100644
index 0000000..b3d8d4c
--- /dev/null
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java
@@ -0,0 +1,66 @@
+package com.hnac.hzims.message.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.support.QueryField;
+import org.springblade.core.mp.support.SqlCondition;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * @ClassName BusinessMessageDTO
+ * @description:
+ * @author: hx
+ * @create: 2023-06-15 19:10
+ * @Version 4.0
+ **/
+@Data
+@ApiModel("事务消息")
+@EqualsAndHashCode
+public class BusinessMessageDTO implements Serializable {
+ @ApiModelProperty(value = "机构ID",required = true)
+ @NotNull(message = "机构ID不能为空")
+ private Long deptId;
+
+ @ApiModelProperty("机构名称")
+ private String deptName;
+
+ @ApiModelProperty(value = "业务关键字",required = true)
+ @NotNull(message = "业务关键字不能为空")
+ private String businessKey;
+
+ @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true)
+ @NotNull(message = "业务分类不能为空")
+ private String businessClassify;
+
+ @ApiModelProperty("业务任务ID")
+ @QueryField(condition = SqlCondition.EQUAL)
+ private Long taskId;
+
+ @NotNull
+ @ApiModelProperty(value = "内容")
+ private String content;
+
+ @NotNull
+ @ApiModelProperty(value = "主题")
+ private String subject;
+
+ @NotNull
+ @ApiModelProperty(value = "推送用户")
+ private String userIds;
+
+ @ApiModelProperty(value = "创建用户")
+ private Long createUser;
+
+ @ApiModelProperty(value = "租户ID")
+ private String tenantId;
+}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java
index be87e27..887e97c 100644
--- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java
@@ -1,10 +1,7 @@
package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.MessageConstants;
-import com.hnac.hzims.message.dto.MessagePushRecordDto;
-import com.hnac.hzims.message.dto.PlanMsgRecordDto;
-import com.hnac.hzims.message.dto.PushDto;
-import com.hnac.hzims.message.dto.SmsPushDto;
+import com.hnac.hzims.message.dto.*;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import org.springblade.core.tool.api.R;
@@ -29,6 +26,7 @@ public interface IMessageClient {
String SEND_MESSAGE = API_PREFIX + "/sendMessage";
String GET_TEMPLATE_BY_ID = API_PREFIX + "/getMsgTemplateById";
String PLAN_SEND_MESSAGE = API_PREFIX + "/planSendMessage";
+ String SEND_APP_AND_WS_MSG = API_PREFIX + "/sendAppAndWsMsgByUsers";
/**
* 推送消息(短信)
@@ -54,4 +52,13 @@ public interface IMessageClient {
**/
@PostMapping(PLAN_SEND_MESSAGE)
R planSendMessage(@RequestBody PlanMsgRecordDto request);
+
+ /**
+ * 发送多人APP、WEB消息
+ * @Author hx
+ * @param request
+ * @return
+ */
+ @PostMapping(value = SEND_APP_AND_WS_MSG,consumes = "application/json; charset=UTF-8")
+ R sendAppAndWsMsgByUsers(@RequestBody BusinessMessageDTO request);
}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java
index e03c604..37f26e4 100644
--- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java
@@ -1,9 +1,6 @@
package com.hnac.hzims.message.fegin;
-import com.hnac.hzims.message.dto.MessagePushRecordDto;
-import com.hnac.hzims.message.dto.PlanMsgRecordDto;
-import com.hnac.hzims.message.dto.PushDto;
-import com.hnac.hzims.message.dto.SmsPushDto;
+import com.hnac.hzims.message.dto.*;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import org.springblade.core.tool.api.R;
@@ -34,4 +31,9 @@ public class MessageClientFallback implements IMessageClient {
public R planSendMessage(PlanMsgRecordDto request) {
return R.fail("调用失败!");
}
+
+ @Override
+ public R sendAppAndWsMsgByUsers(BusinessMessageDTO request) {
+ return R.fail("调用失败!");
+ }
}
diff --git a/hzims-service-api/middle-api/pom.xml b/hzims-service-api/middle-api/pom.xml
new file mode 100644
index 0000000..198b15e
--- /dev/null
+++ b/hzims-service-api/middle-api/pom.xml
@@ -0,0 +1,42 @@
+
+
+ 4.0.0
+
+ com.hnac.hzims
+ hzims-service-api
+ 4.0.0-SNAPSHOT
+
+
+ middle-api
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+ ${project.name}-${project.version}
+
+
+ com.spotify
+ dockerfile-maven-plugin
+
+ ${docker.username}
+ ${docker.password}
+ ${docker.registry.url}/${docker.namespace}/${project.artifactId}
+ ${project.version}
+ true
+
+ target/${project.build.finalName}.jar
+
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java
similarity index 79%
rename from hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/constant/TicketProcessConstant.java
rename to hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java
index 466e9e4..7770383 100644
--- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/constant/TicketProcessConstant.java
+++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java
@@ -1,4 +1,4 @@
-package com.hnac.hzims.common.logs.constant;
+package com.hnac.hzims.middle.process.constant;
/**
* 开票常量类
@@ -29,4 +29,10 @@ public class TicketProcessConstant {
* 日常维护
*/
public static final String MAINTENANCE_KEY = "maintenance";
+
+
+ /**
+ * 消缺流程
+ */
+ public static final String DEFECT_KEY = "defectDealty";
}
diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/fegin/fallback/ProcessDictFeignServiceFallback.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java
similarity index 88%
rename from hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/fegin/fallback/ProcessDictFeignServiceFallback.java
rename to hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java
index 1f70c8d..d29fdfd 100644
--- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/fegin/fallback/ProcessDictFeignServiceFallback.java
+++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java
@@ -1,6 +1,6 @@
-package com.hnac.hzims.common.logs.fegin.fallback;
+package com.hnac.hzims.middle.process.fallback;
-import com.hnac.hzims.common.logs.fegin.ProcessDictFeignService;
+import com.hnac.hzims.middle.process.feign.ProcessDictFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/fegin/ProcessDictFeignService.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java
similarity index 90%
rename from hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/fegin/ProcessDictFeignService.java
rename to hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java
index fc794a7..4e213e4 100644
--- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/fegin/ProcessDictFeignService.java
+++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java
@@ -1,6 +1,6 @@
-package com.hnac.hzims.common.logs.fegin;
+package com.hnac.hzims.middle.process.feign;
-import com.hnac.hzims.common.logs.fegin.fallback.ProcessDictFeignServiceFallback;
+import com.hnac.hzims.middle.process.fallback.ProcessDictFeignServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/to/process/ProcessWorkFlowResponse.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/to/ProcessWorkFlowResponse.java
similarity index 95%
rename from hzims-biz-common/src/main/java/com/hnac/hzims/common/to/process/ProcessWorkFlowResponse.java
rename to hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/to/ProcessWorkFlowResponse.java
index 0b13613..7dafb53 100644
--- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/to/process/ProcessWorkFlowResponse.java
+++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/to/ProcessWorkFlowResponse.java
@@ -1,4 +1,4 @@
-package com.hnac.hzims.common.to.process;
+package com.hnac.hzims.middle.process.to;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/hzims-service-api/pom.xml b/hzims-service-api/pom.xml
index 46e8f12..397a172 100644
--- a/hzims-service-api/pom.xml
+++ b/hzims-service-api/pom.xml
@@ -26,6 +26,7 @@
ticket-api
weather-api
common-api
+ middle-api
diff --git a/hzims-service-api/ticket-api/pom.xml b/hzims-service-api/ticket-api/pom.xml
index 89ced25..3b3be45 100644
--- a/hzims-service-api/ticket-api/pom.xml
+++ b/hzims-service-api/ticket-api/pom.xml
@@ -21,5 +21,11 @@
com.hnac.hzims
hzims-operational-api
+
+ com.hnac.hzims
+ middle-api
+ 4.0.0-SNAPSHOT
+ provided
+
diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/fallback/OperationTicketFeignClientFallback.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/fallback/OperationTicketFeignClientFallback.java
index 8d424ac..7f8e409 100644
--- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/fallback/OperationTicketFeignClientFallback.java
+++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/fallback/OperationTicketFeignClientFallback.java
@@ -1,6 +1,6 @@
package com.hnac.hzims.ticket.ticketprocess.fallback;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.ticketprocess.feign.OperationTicketFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/fallback/TicketProcessFeignClientFallback.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/fallback/TicketProcessFeignClientFallback.java
index 03c672b..0e2bc75 100644
--- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/fallback/TicketProcessFeignClientFallback.java
+++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/fallback/TicketProcessFeignClientFallback.java
@@ -1,6 +1,6 @@
package com.hnac.hzims.ticket.ticketprocess.fallback;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.ticketprocess.feign.TicketProcessFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/OperationTicketFeignClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/OperationTicketFeignClient.java
index b07f0b0..8070650 100644
--- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/OperationTicketFeignClient.java
+++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/OperationTicketFeignClient.java
@@ -1,6 +1,6 @@
package com.hnac.hzims.ticket.ticketprocess.feign;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.ticketprocess.fallback.OperationTicketFeignClientFallback;
import io.swagger.annotations.ApiOperation;
diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/TicketProcessFeignClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/TicketProcessFeignClient.java
index 94ec0c0..f117e90 100644
--- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/TicketProcessFeignClient.java
+++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/ticketprocess/feign/TicketProcessFeignClient.java
@@ -1,6 +1,6 @@
package com.hnac.hzims.ticket.ticketprocess.feign;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.ticketprocess.fallback.TicketProcessFeignClientFallback;
import io.swagger.annotations.ApiOperation;
diff --git a/hzims-service/hzims-middle/pom.xml b/hzims-service/hzims-middle/pom.xml
index 09d8a4d..f8c28c7 100644
--- a/hzims-service/hzims-middle/pom.xml
+++ b/hzims-service/hzims-middle/pom.xml
@@ -113,6 +113,11 @@
ticket-api
+
+ com.hnac.hzims
+ middle-api
+ 4.0.0-SNAPSHOT
+
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java
index 822e0ea..2cddc09 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java
@@ -2,11 +2,11 @@ package com.hnac.hzims.middle.processflow.consumer;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.entity.WorkflowOperationLog;
import com.hnac.hzims.middle.processflow.service.WorkflowOperationLogService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.middle.processflow.strategy.service.ProcessService;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import lombok.extern.slf4j.Slf4j;
import org.springblade.queue.annotation.RedisQueue;
import org.springblade.queue.consume.IQueueConsume;
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java
index 0ca7ccb..3579ff7 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java
@@ -5,13 +5,13 @@ import com.alibaba.fastjson.JSON;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.entity.ProcessType;
import com.hnac.hzims.middle.processflow.properties.TicketProperties;
import com.hnac.hzims.middle.processflow.properties.WorkTicketProperties;
import com.hnac.hzims.middle.processflow.service.ProcessTypeService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.middle.processflow.strategy.service.ProcessService;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/service/ProcessService.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/service/ProcessService.java
index 432ee87..cf5f4ea 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/service/ProcessService.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/service/ProcessService.java
@@ -1,7 +1,7 @@
package com.hnac.hzims.middle.processflow.strategy.service;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
/**
* @Author dfy
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java
new file mode 100644
index 0000000..95bab8f
--- /dev/null
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java
@@ -0,0 +1,67 @@
+package com.hnac.hzims.middle.processflow.strategy.serviceimpl;
+
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
+import com.hnac.hzims.middle.processflow.service.ProcessDictService;
+import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
+import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
+import com.hnac.hzims.operational.defect.feign.IOperDefectClient;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.tool.api.R;
+import org.springframework.stereotype.Service;
+import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.DEFECT_KEY;
+
+
+/**
+ * 消缺工作流实现类
+ *
+ * @Author dfy
+ * @Version v1.0
+ * @Serial 1.0
+ * @Date 2023/3/28 8:47
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class DefectProcessServiceImpl extends ProcessAbstractService {
+
+
+ private final IOperDefectClient defectClient;
+
+
+ private final ProcessDictService processDictService;
+
+
+ /**
+ * 设置执行那种实现类
+ *
+ * @param flowQueue
+ * @return
+ */
+ @Override
+ public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
+ log.info("是否执行消缺工作流实流程环节操作~~~~,流程ticket: {}", flowQueue);
+ String dictValue = processDictService.selectDictValueByKey(DEFECT_KEY);
+ if (dictValue.equals(flowQueue.getProcessDefinitionKey())) {
+ log.info("已执行消缺工作流程环节操作~~~~");
+ return true;
+ }
+ log.error("未是否执行消缺工作流流程环节操作,请联系管理员~~~~");
+ return false;
+ }
+
+ /**
+ * 两票管理业务方法
+ *
+ * @param response
+ */
+ @Override
+ public void calculate(ProcessWorkFlowResponse response) {
+ R defect = defectClient.saveDefect(response);
+ if (!defect.isSuccess()) {
+ throw new ServiceException("消缺工作流程出现异常呢");
+
+ }
+ }
+}
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java
index d332bb0..42d6ed1 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java
@@ -1,16 +1,16 @@
package com.hnac.hzims.middle.processflow.strategy.serviceimpl;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
-import com.hnac.hzims.ticket.ticketprocess.feign.OperationTicketFeignClient;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
+import com.hnac.hzims.ticket.ticketprocess.feign.TicketProcessFeignClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springframework.stereotype.Service;
-import static com.hnac.hzims.common.logs.constant.TicketProcessConstant.MACHINERY_TICKET_KEY;
+import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.MACHINERY_TICKET_KEY;
/**
@@ -28,7 +28,7 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService {
- private final OperationTicketFeignClient ticketProcessService;
+ private final TicketProcessFeignClient ticketProcessService;
@@ -36,10 +36,6 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService {
-
-
-
-
/**
* 设置执行那种实现类
*
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java
index acf85bd..2e99908 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java
@@ -1,16 +1,16 @@
package com.hnac.hzims.middle.processflow.strategy.serviceimpl;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.operational.maintenance.feign.MaintenanceFeignClient;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springframework.stereotype.Service;
-import static com.hnac.hzims.common.logs.constant.TicketProcessConstant.MAINTENANCE_KEY;
+import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.MAINTENANCE_KEY;
/**
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java
index da0ebae..2b4df40 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java
@@ -1,17 +1,17 @@
package com.hnac.hzims.middle.processflow.strategy.serviceimpl;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
import com.hnac.hzims.ticket.ticketprocess.feign.TicketProcessFeignClient;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springframework.stereotype.Service;
-import static com.hnac.hzims.common.logs.constant.TicketProcessConstant.FIRST_TICKET_KEY;
+import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.FIRST_TICKET_KEY;
/**
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java
index 5d36191..1d8d70b 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java
+++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java
@@ -1,16 +1,17 @@
package com.hnac.hzims.middle.processflow.strategy.serviceimpl;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.middle.processflow.service.ProcessDictService;
import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService;
import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue;
+import com.hnac.hzims.ticket.ticketprocess.feign.OperationTicketFeignClient;
import com.hnac.hzims.ticket.ticketprocess.feign.TicketProcessFeignClient;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springframework.stereotype.Service;
-import static com.hnac.hzims.common.logs.constant.TicketProcessConstant.OPERATION_TICKET_KEY;
+import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.OPERATION_TICKET_KEY;
/**
@@ -28,7 +29,7 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService {
- private final TicketProcessFeignClient operationTicketService;
+ private final OperationTicketFeignClient operationTicketFeignClient;
@@ -44,7 +45,7 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService {
*/
@Override
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
- log.info("是否执行开操作票流程环节操作~~~~,流程flowQueue: {}", flowQueue);
+ log.info("是否执行操作票流程环节操作~~~~,流程flowQueue: {}", flowQueue);
String dictValue = processDictService.selectDictValueByKey(OPERATION_TICKET_KEY);
if (dictValue.equals(flowQueue.getProcessDefinitionKey())) {
log.info("已执行操作票流程环节操作~~~~");
@@ -61,10 +62,9 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
- Boolean pending = operationTicketService.findPending(response);
+ Boolean pending = operationTicketFeignClient.findPending(response);
if (!pending) {
throw new ServiceException("操作票流程出现异常呢");
-
}
}
}
diff --git a/hzims-service/hzims-middle/src/main/resources/db/newsql.sql b/hzims-service/hzims-middle/src/main/resources/db/newsql.sql
new file mode 100644
index 0000000..ac22bdf
--- /dev/null
+++ b/hzims-service/hzims-middle/src/main/resources/db/newsql.sql
@@ -0,0 +1,67 @@
+SET FOREIGN_KEY_CHECKS=0;
+
+CREATE TABLE `hzims-middle`.`hzims_process_type` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `sequence` int(11) NOT NULL COMMENT '序号',
+ `deployment_id` varchar(160) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前环节流程key',
+ `deployment_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前流程名称',
+ `segment` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '一个流程图的名称',
+ `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+ `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
+ `is_deleted` tinyint(4) NULL DEFAULT 0 COMMENT '逻辑删除',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作流审批类型' ROW_FORMAT = Dynamic;
+
+ALTER TABLE `hzims-middle`.`hzims_statistics` MODIFY COLUMN `module_name_num` int(11) NULL DEFAULT 0 COMMENT '功能模块统计' AFTER `module_name`;
+
+ALTER TABLE `hzims-middle`.`hzims_statistics` MODIFY COLUMN `date_calculated` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '统计日期' AFTER `module_name_num`;
+
+ALTER TABLE `hzims-middle`.`hzims_statistics` DROP COLUMN `title`;
+
+ALTER TABLE `hzims-middle`.`hzims_statistics` DROP COLUMN `title_num`;
+
+ALTER TABLE `hzims-middle`.`hzims_statistics` DROP COLUMN `path`;
+
+ALTER TABLE `hzims-middle`.`hzims_statistics` DROP COLUMN `path_num`;
+
+ALTER TABLE `hzims-middle`.`hzims_sys_log` ENGINE = MyISAM;
+
+ALTER TABLE `hzims-middle`.`hzims_sys_log` ADD INDEX `hzims_sys_log_operation_time_index`(`operation_time`) USING BTREE;
+
+ALTER TABLE `hzims-middle`.`hzims_sys_log` ADD INDEX `hzims_sys_log_module_name_index`(`module_name`) USING BTREE;
+
+ALTER TABLE `hzims-middle`.`hzims_sys_log` ADD INDEX `hzims_sys_log_title_index`(`title`) USING BTREE;
+
+CREATE TABLE `hzims-middle`.`hzims_workflow_operation_log` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `take_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务ID',
+ `take_name` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务名称',
+ `process_definition_key` char(160) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前环节流程ID',
+ `process_instance_key` char(160) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '实例key',
+ `next_step_operator` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '下一环节处理人',
+ `variables` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '表单',
+ `user_id` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户Id',
+ `handleType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' 根据handleType区分是用户还是候选组角色 标识 0是用户 1是角色',
+ `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+ `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
+ `is_deleted` tinyint(4) NULL DEFAULT NULL COMMENT '是否逻辑删除,0 可用,1. 不可用',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作流操作日志' ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims-middle`.`process_dict` (
+ `dict_code` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '票据编码',
+ `dict_sort` int(4) NULL DEFAULT 0 COMMENT '票据排序',
+ `dict_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '票据字典码',
+ `dict_value` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '票据流程标识',
+ `dict_label` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '票据标签',
+ `dict_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '票据类型',
+ `is_default` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'N' COMMENT '是否默认(Y是 N否)',
+ `status` tinyint(1) NULL DEFAULT 0 COMMENT '状态(0正常 1停用)',
+ `create_dept` bigint(20) NULL DEFAULT NULL COMMENT '所属机构',
+ `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+ `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
+ `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '票据备注',
+ PRIMARY KEY (`dict_code`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作流字典表' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DataServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DataServiceImpl.java
index c9b3847..6d42bb3 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DataServiceImpl.java
+++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DataServiceImpl.java
@@ -11,7 +11,6 @@ import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
-import com.sun.org.apache.regexp.internal.RE;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java
index 55fb6d7..a008be8 100644
--- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java
+++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java
@@ -1186,7 +1186,7 @@ public class RealTargetServiceImpl implements RealTargetService {
*/
private int getPhotovoltaicState(EminfoAndEmParamVo device, Map map) {
// 获取开关机监测点实时数据
- Double value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY);
+ double value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY);
// 开机状态
if (Math.abs(value) <= 0) {
return 0;
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
index 57afdb2..0660fdd 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
@@ -2,28 +2,26 @@ package com.hnac.hzims.message.fegin;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.google.common.collect.Lists;
import com.hnac.hzims.message.MessageConstants;
-import com.hnac.hzims.message.dto.MessagePushRecordDto;
-import com.hnac.hzims.message.dto.PlanMsgRecordDto;
-import com.hnac.hzims.message.dto.PushDto;
-import com.hnac.hzims.message.dto.SmsPushDto;
+import com.hnac.hzims.message.dto.*;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.service.IMessageService;
import com.hnac.hzims.message.service.IMessageTemplateService;
+import com.hnac.hzims.message.service.impl.PushMessageServiceImpl;
import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.core.tool.utils.*;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.util.Assert;
@@ -33,7 +31,9 @@ import javax.validation.Valid;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
+import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
/**
* @author hx
@@ -115,4 +115,37 @@ public class MessageClient extends BladeController implements IMessageClient{
return R.success("推送成功!");
}
+ @Override
+ @PostMapping(value = SEND_APP_AND_WS_MSG , produces="application/json; charset=UTF-8")
+ public R sendAppAndWsMsgByUsers(@RequestBody BusinessMessageDTO request) {
+ // 保存消息记录
+ List pushRecords = Func.toLongList(request.getUserIds()).stream().flatMap(userId -> {
+ long messageId = IdWorker.getId();
+ return Lists.newArrayList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH).stream().map(messageType -> {
+ MessagePushRecordEntity record = BeanUtil.copy(request, MessagePushRecordEntity.class);
+ record.setMessageId(messageId);
+ record.setPusher(userId.toString());
+ record.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null));
+ record.setPushType(MessageConstants.IMMEDIATELY);
+ record.setAccount(userId.toString());
+ record.setPlanTime(LocalDateTime.now());
+ record.setType(messageType);
+ record.setCreateDept(record.getDeptId());
+ return record;
+ });
+ }).collect(Collectors.toList());
+ boolean saveResult = recordService.saveBatch(pushRecords);
+ if(saveResult) {
+ List appRecords = pushRecords.stream().filter(record -> MessageConstants.APP_PUSH.equals(record.getType())).collect(Collectors.toList());
+ // 推送消息 - app
+ Boolean appFlag = recordService.sendAppMsgByUsers(request, appRecords);
+ // 推送消息 - web
+ Boolean wsFlag = recordService.sendWsMsgByUsers(CollectionUtils.subtract(pushRecords, appRecords).stream().collect(Collectors.toList()));
+ return R.data(appFlag && wsFlag);
+ }
+ else {
+ return R.data(false);
+ }
+ }
+
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
index 40e5e03..b15f874 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
@@ -1,11 +1,14 @@
package com.hnac.hzims.message.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.vo.UnreadMessageVO;
import com.hnac.hzims.message.vo.msgpushrecord.*;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@@ -84,4 +87,7 @@ public interface IMessagePushRecordService extends BaseService getPersonalAppUnreadMessage();
+ Boolean sendAppMsgByUsers(BusinessMessageDTO request,List records);
+
+ Boolean sendWsMsgByUsers(List request);
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
index 437cacc..aeffe5d 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
@@ -14,6 +14,7 @@ import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.CacheUtil;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.config.MessageFactory;
+import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.enums.PushStatEnum;
import com.hnac.hzims.message.mapper.MessagePushRecordMapper;
@@ -30,6 +31,7 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.cache.DictCache;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -41,10 +43,7 @@ import java.time.LocalDateTime;
import java.time.Year;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -321,6 +320,41 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl records) {
+ PushMessageServiceImpl service = SpringUtil.getBean(PushMessageServiceImpl.class);
+ try {
+ boolean sendFlag = service.sendByUsers(request.getSubject(), request.getContent(), Arrays.asList(request.getUserIds().split(",")), request.getTenantId());
+ if(sendFlag) {
+ return this.update(Wrappers.lambdaUpdate()
+ .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now())
+ .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS)
+ .in(MessagePushRecordEntity::getId, records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()))
+ );
+ }
+ return false;
+ }
+ catch(Exception e) {
+ throw new ServiceException(e.getMessage());
+ }
+ }
+
+ @Override
+ public Boolean sendWsMsgByUsers(List request) {
+ WebsocketServiceImpl service = SpringUtil.getBean(WebsocketServiceImpl.class);
+ request.forEach(record -> {
+ boolean sendFlag = service.send(record);
+ if(sendFlag) {
+ this.update(Wrappers.lambdaUpdate()
+ .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now())
+ .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS)
+ .in(MessagePushRecordEntity::getId, record.getId())
+ );
+ }
+ });
+ return true;
+ }
+
/**
* 状态 ===> 状态名称
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java
index b62134f..51a512a 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java
@@ -29,6 +29,8 @@ import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicReference;
/**
@@ -117,4 +119,42 @@ public class PushMessageServiceImpl implements IMessageService {
});
return true;
}
+
+ /**
+ * 发送APP消息(多人)
+ * @param subject 消息主题
+ * @param content 消息内容
+ * @param userIds 用户ID列表
+ * @param tenantId 推送成功标识
+ * @return
+ */
+ public boolean sendByUsers(String subject, String content, List userIds,String tenantId) throws Exception {
+ // 安卓推送
+ FutureTask androidPush = new FutureTask<>(() -> {
+ PushInfoVO pushInfoVO = new PushInfoVO();
+ PushPlatform pushPlatform = PushPlatform.newBuilder().addPlatformType(PlatformType.Android).build();
+ PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, userIds).build();
+ PushInfo pushInfo = new PushInfo("ops-push-android", subject, content,"", null, pushPlatform, pushAudience);
+ pushInfoVO.setPushInfo(pushInfo);
+ pushInfoVO.setTenantId(tenantId);
+ R pushResult = pushClient.tenantPush(pushInfoVO);
+ return pushResult.isSuccess();
+ });
+ new Thread(androidPush,"安卓推送").start();
+
+ // IOS推送
+ FutureTask iosPush = new FutureTask<>(() -> {
+ PushInfoVO pushInfoVO = new PushInfoVO();
+ PushPlatform pushPlatform = PushPlatform.newBuilder().addPlatformType(PlatformType.IOS).build();
+ PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, userIds).build();
+ PushInfo pushInfo = new PushInfo("ops-push-ios", subject, content,"", null, pushPlatform, pushAudience);
+ pushInfoVO.setPushInfo(pushInfo);
+ pushInfoVO.setTenantId(tenantId);
+ R pushResult = pushClient.tenantPush(pushInfoVO);
+ return pushResult.isSuccess();
+ });
+ new Thread(iosPush,"ios推送").start();
+
+ return androidPush.get() && iosPush.get();
+ }
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java
index 07730aa..419da82 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java
@@ -23,6 +23,7 @@ import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import java.io.IOException;
import java.time.LocalDateTime;
+import java.util.List;
import java.util.concurrent.TimeUnit;
/**
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
index 88cde48..26bdfd5 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
@@ -459,7 +459,7 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpllambdaQuery().eq(OperDefectEntity::getDefectCode, operPhenomenonEntity.getDefectCode()).last("limit 1;"));
if (ObjectUtil.isNotEmpty(operDefectEntity)) {
operDefectEntity.setActEndTime(new Date());
- operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours().toString() : null);
+ operDefectEntity.setActHours(ObjectUtil.isNotEmpty(accessTaskEntity.getActHours()) ? accessTaskEntity.getActHours() : null);
operDefectEntity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
operDefectEntity.setDisposeDesc(accessTaskEntity.getDescripiton());
defectService.updateById(operDefectEntity);
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/DefectCheckController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/DefectCheckController.java
index 660d34e..4f93ac5 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/DefectCheckController.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/DefectCheckController.java
@@ -5,17 +5,16 @@ import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IDefectCheckService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java
index cb94c94..9da2925 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperPhenomenonController.java
@@ -3,17 +3,15 @@ package com.hnac.hzims.operational.defect.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import com.google.common.collect.Lists;
-import com.hnac.hzims.common.invalid.DictInvalid;
import com.hnac.hzims.common.invalid.ObjectRequiredInvalid;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.fdp.entity.FdpTaskEntity;
-import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
+import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
+import com.hnac.hzims.operational.defect.service.IOperAppearanceService;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
-import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
-import com.hnac.hzims.operational.defect.wrapper.OperPhenomenonWrapper;
+import com.hnac.hzims.operational.defect.vo.OperAppearanceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -25,14 +23,10 @@ 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.core.tool.utils.StringUtil;
import org.springblade.flow.core.entity.BladeFlow;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import java.util.Date;
-
/**
* 控制器
*
@@ -45,6 +39,7 @@ import java.util.Date;
@Validated
public class OperPhenomenonController extends BladeController {
+ private final IOperAppearanceService operAppearanceService;
private final IOperPhenomenonService phenomenonService;
/**
@@ -54,10 +49,9 @@ public class OperPhenomenonController extends BladeController {
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入phenomenon")
- public R detail(OperPhenomenonEntity phenomenon) {
- OperPhenomenonEntity detail = phenomenonService.getOne(Condition.getQueryWrapper(phenomenon));
- OperPhenomenonVO vo = OperPhenomenonWrapper.build().entityVO(detail);
- return R.data(vo);
+ public R detail(OperAppearanceEntity phenomenon) {
+ OperAppearanceEntity appearanceEntity = operAppearanceService.getOne(Condition.getQueryWrapper(phenomenon));
+ return R.data(appearanceEntity);
}
/**
@@ -72,58 +66,24 @@ public class OperPhenomenonController extends BladeController {
@OperationAnnotation(moduleName = "缺陷管理", title = "现象库", operatorType = OperatorType.MOBILE, businessType =
BusinessType.GENCODE, action
= "分页")
- public R> list(OperPhenomenonEntity entity, String taskIds, Query query, Date findTimeEnd) {
- LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new OperPhenomenonEntity(), entity);
- if (StringUtil.isNotBlank(taskIds)) {
- queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(",")));
- }
- if (Func.isNotEmpty(entity.getFindTime())) {
- queryWrapper.ge(OperPhenomenonEntity::getFindTime, entity.getFindTime());
- }
- if (Func.isNotEmpty(findTimeEnd)) {
- queryWrapper.le(OperPhenomenonEntity::getFindTime, findTimeEnd);
- }
- if (Func.isNotEmpty(entity.getDiscriminateStatus())) {
- queryWrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, entity.getDiscriminateStatus());
- }
- if (Func.isNotEmpty(entity.getCreateDept())) {
- queryWrapper.eq(OperPhenomenonEntity::getCreateDept, entity.getCreateDept());
- }
-
- // // 区域Id
- // if (Func.isNotEmpty(entity.getAreaId())) {
- // queryWrapper.eq(OperPhenomenonEntity::getCreateDept, entity.getAreaId());
- // }
- //
- // // 年份
- // if (Func.isNotEmpty(entity.getYearMonth())) {
- // queryWrapper.apply("date_format(t.CREATE_TIME, '%Y-%m') = '"
- // + (entity.getYearMonth() + "'"));
- // }
- //
- //
- // // 是否为缺陷 已定论1
- // if (Func.isNotEmpty(entity.getDefect()) && Func.isNotEmpty(entity.getConclusionStatusNum())) {
- // queryWrapper.eq(OperPhenomenonEntity::getIsDefect, entity.getDefect());
- // queryWrapper.or().eq(OperPhenomenonEntity::getConclusionStatus, entity.getConclusionStatusNum());
- // }
-
-
- queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime);
- IPage pages = phenomenonService.page(Condition.getPage(query), queryWrapper);
- IPage vos = OperPhenomenonWrapper.build().pageVO(pages);
- return R.data(vos);
+ public R> list(OperAppearanceVO phenomenon, Query query) {
+ LambdaQueryWrapper queryWrapper = operAppearanceService.getQueryWrapper(phenomenon);
+ IPage pages = operAppearanceService.page(Condition.getPage(query), queryWrapper);
+// IPage vos = OperPhenomenonWrapper.build().pageVO(pages);
+ return R.data(pages);
}
- /**
- * 新增 代码自定义代号
- */
- @PostMapping("/save")
- @ApiOperationSupport(order = 4)
- @ApiOperation(value = "提交现象,现象提交后不能修改", notes = "传入phenomenon")
- public R save(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
- return R.data(phenomenonService.submit(phenomenon));
- }
+
+ //此端口弃用20230621
+// /**
+// * 新增 代码自定义代号
+// */
+// @PostMapping("/save")
+// @ApiOperationSupport(order = 4)
+// @ApiOperation(value = "提交现象,现象提交后不能修改", notes = "传入phenomenon")
+// public R save(@Valid @RequestBody OperPhenomenonEntity phenomenon) {
+// return R.data(phenomenonService.submit(phenomenon));
+// }
/* */ /**
* 修改 代码自定义代号
@@ -153,7 +113,7 @@ public class OperPhenomenonController extends BladeController {
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
- return R.status(phenomenonService.deleteLogic(Func.toLongList(ids)));
+ return R.status(operAppearanceService.deleteLogic(Func.toLongList(ids)));
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/feign/OperDefectClient.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/feign/OperDefectClient.java
index 2841984..33366bf 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/feign/OperDefectClient.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/feign/OperDefectClient.java
@@ -1,12 +1,13 @@
package com.hnac.hzims.operational.defect.feign;
+
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IDefectCheckService;
import com.hnac.hzims.operational.defect.service.IOperDefectService;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
-import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@@ -32,8 +33,15 @@ public class OperDefectClient implements IOperDefectClient {
return R.data(service.updateDefectHanderState(entity));
}
+ @PostMapping(CREATE_DEFECT)
@Override
public R createDefect(@RequestBody OperPhenomenonEntity entity) {
return R.data(defectCheckService.startCheck(entity));
}
+
+ @PostMapping(SAVE_DEFECT)
+ @Override
+ public R saveDefect(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse) {
+ return defectCheckService.listenAndUpdateDefect(processWorkFlowResponse);
+ }
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperAppearanceMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperAppearanceMapper.java
new file mode 100644
index 0000000..5e6b381
--- /dev/null
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperAppearanceMapper.java
@@ -0,0 +1,14 @@
+package com.hnac.hzims.operational.defect.mapper;
+
+import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
+import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
+
+/**
+ * Mapper 接口
+ *
+ * @author Chill
+ */
+public interface OperAppearanceMapper extends UserDataScopeBaseMapper {
+
+
+}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperAppearanceMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperAppearanceMapper.xml
new file mode 100644
index 0000000..4fbcacd
--- /dev/null
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperAppearanceMapper.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IDefectCheckService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IDefectCheckService.java
index 54479d2..8869659 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IDefectCheckService.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IDefectCheckService.java
@@ -1,7 +1,9 @@
package com.hnac.hzims.operational.defect.service;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import org.springblade.core.mp.base.BaseService;
+import org.springblade.core.tool.api.R;
import org.springblade.flow.core.vo.ComleteTask;
@@ -42,6 +44,7 @@ public interface IDefectCheckService extends BaseService {
* @param task
*/
void conclusion(ComleteTask task);
+ R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse);
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperAppearanceService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperAppearanceService.java
new file mode 100644
index 0000000..625dad3
--- /dev/null
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperAppearanceService.java
@@ -0,0 +1,15 @@
+package com.hnac.hzims.operational.defect.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
+import com.hnac.hzims.operational.defect.vo.OperAppearanceVO;
+import org.springblade.core.mp.base.BaseService;
+
+/**
+ * 服务类
+ *
+ * @author Chill
+ */
+public interface IOperAppearanceService extends BaseService {
+ LambdaQueryWrapper getQueryWrapper(OperAppearanceVO operAppearanceVO);
+}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java
index 6968b1d..7142578 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java
@@ -1,5 +1,6 @@
package com.hnac.hzims.operational.defect.service;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
@@ -99,4 +100,6 @@ public interface IOperDefectService extends BaseService {
* @return
*/
IPage selectPage(Page operDefectEntityPage, OperDefectEntity defect);
+
+ LambdaQueryWrapper getQueryWrapper(OperDefectVO defectVO);
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
index 0311a6d..7a278e2 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
@@ -4,25 +4,34 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.fdp.feign.IFdpTaskClient;
+import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.dto.MessagePushRecordDto;
+import com.hnac.hzims.message.fegin.IMessageClient;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.dto.OperAccessPlanDTO;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.service.IOperAccessPlanService;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
-import com.hnac.hzims.operational.defect.config.DefectConfiguration;
import com.hnac.hzims.operational.defect.constants.RepairConstant;
import com.hnac.hzims.operational.defect.constants.TreatMethodConstant;
+import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper;
import com.hnac.hzims.operational.defect.service.IDefectCheckService;
+import com.hnac.hzims.operational.defect.service.IOperAppearanceService;
import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService;
import com.hnac.hzims.ticket.repair.entity.RepairEntity;
import com.hnac.hzims.ticket.repair.fegin.IRepairClient;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.math.NumberUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
@@ -34,6 +43,7 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.flow.core.vo.ComleteTask;
import org.springblade.system.cache.DictCache;
+import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
@@ -41,6 +51,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -53,549 +68,777 @@ import java.util.stream.Collectors;
* @author ysj
*/
@Service
+@Slf4j
@RequiredArgsConstructor
public class DefectCheckServiceImpl extends BaseServiceImpl implements IDefectCheckService {
- private final IOperAccessTaskService operAccessTaskService;
-
- private final IOperAccessPlanService operAccessPlanService;
-
- private final IOperDefectStatisticsService statisticsService;
- private final IOperDefectService defectService;
-
- private final IOperAccessPlanService accessPlanService;
-
- private final OperPhenomenonMapper phenomenonMapper;
-
- private final IFlowClient processClient;
-
- private final IUserClient userClient;
-
- private final IFdpTaskClient fdpTaskClient;
-
-
- private final IRepairClient repairClient;
-
- /**
- * 保存现象、开启缺陷处理流程
- * @param entity
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public OperPhenomenonEntity startCheck(OperPhenomenonEntity entity) {
- // 步骤1.保存现象
- if(!this.savePhenomenon(entity)){
- throw new ServiceException("保存现象失败!");
- }
- // 步骤2.开启缺陷流程
- this.startDefectCheck(entity);
- return entity;
- }
-
- /**
- * 保存现象
- * @param entity
- * @return
- */
- private boolean savePhenomenon(OperPhenomenonEntity entity) {
- DateTimeFormatter format = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME_MINI);
- // 缺陷编码 : 缺陷来源 + 时间格式化 + 三位长度随机值
- if(Func.isEmpty(entity.getDefectCode())){
- entity.setDefectCode(entity.getSourceCode() + format.format(LocalDateTime.now()) + Func.random(3));
- }
- // 现象发起人 : 当前用户Id
- if(Func.isEmpty(entity.getFinder())){
- entity.setFinder(AuthUtil.getUserId());
- }
- // 现象发起时间
- entity.setFindTime(new Date());
- // 现象更新时间
- entity.setUpdateTime(new Date());
- // 现在最后甄别时间
- Date discriminateDeadline = DateUtil.plusHours(entity.getUpdateTime(), DefectConfiguration.discriminateDeadline);
- entity.setDiscriminateDeadline(discriminateDeadline);
- return this.save(entity);
- }
-
- /**
- * 启动缺陷处理流程
- * @param entity
- */
- private void startDefectCheck(OperPhenomenonEntity entity) {
- // 获取机构下执行定论缺陷角色用户
- List list = this.getAliasUser(entity.getTenantId(),entity.getCreateDept(),TreatMethodConstant.PHENOMENON_SCREEN_ALIAS);
- if(CollectionUtil.isEmpty(list)){
- throw new ServiceException("请先添加甄别缺陷角色用户,再发起现象!");
- }
- List userList = list.stream().map(o -> "taskUser_" + o.getId().toString()).collect(Collectors.toList());
- // 现象发起人名字
- String userName = Optional.ofNullable(UserCache.getUser(entity.getFinder()).getName()).orElse("");
- // 现象发起来源
- String sourceName = DictCache.getValue(TreatMethodConstant.SOURCE_CODE_PREFIX,entity.getSourceCode());
- // 流程名称
- String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" +"——>" + entity.getDefectCode();
- // 设置下一步执行流程用户
- Kv variables = Kv.create()
- .set(TreatMethodConstant.PHENOMENON_SCREEN_USER,String.join(",", userList));
- // 开启新的缺陷流程
- R result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK_PRIMARY_KEY, FlowUtil.getBusinessKey("hzims_oper_phenomenon","" + entity.getId()), processName, variables);
- // 流程开启失败
- if (!result.isSuccess()) {
- throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getCode());
- }
- // 关联流程唯一键
- entity.setCheckProcessInstanceId(result.getData().getProcessInstanceId());
- this.baseMapper.updateById(entity);
- }
-
-
- /**
- * 获取当前机构指定角色的用户
- * @param tenantId
- * @param deptId
- * @param alias
- * @return
- */
- public List getAliasUser(String tenantId,Long deptId,String alias){
- if(Func.isEmpty(tenantId)){
- tenantId = AuthUtil.getTenantId();
- }
- R> result = userClient.relationUserListByRoleAlias(tenantId, deptId, alias);
- if(!result.isSuccess()){
- throw new ServiceException("查询角色用户信息失败!");
- }
- return result.getData();
- }
-
- /**
- * 修改缺陷状态 -> 问题定论
- * @param handleStatus
- * @param defectCode
- */
- private void updateDefectHandleState(String handleStatus, String defectCode) {
- this.defectService.update(Wrappers.lambdaUpdate()
- .set(OperDefectEntity::getHandleStatus,handleStatus)
- .eq(OperDefectEntity::getDefectCode,defectCode)
- );
- }
-
-
- /**
- * 甄别缺陷
- * @param task
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void screeDefect(ComleteTask task) {
- // 步骤1.现象前置判断(现象状态检查)
- OperPhenomenonEntity entity = this.preposePhenomenon(task.getProcessInstanceId());
-
- // 步骤2.更新甄别状态、数据
- this.screePhenomenonUpdate(task);
-
- // 步骤3.现象添加至缺陷库
- this.defectSave(entity);
-
- // 步骤4.流程执行至甄别处理方式
- processClient.completeTask(task);
- }
-
- /**
- * 现象前置判断
- * @param processInstanceId
- * @return
- */
- private OperPhenomenonEntity preposePhenomenon(String processInstanceId) {
- LambdaQueryWrapper wrapper = new LambdaQueryWrapper() {{
- eq(OperPhenomenonEntity::getCheckProcessInstanceId, processInstanceId);
- }};
- // 查询现象状态
- OperPhenomenonEntity entity = this.getOne(wrapper);
- if(ObjectUtil.isEmpty(entity)){
- throw new ServiceException("现象不存在");
- }
- // 现象已被自动甄别
- if(TreatMethodConstant.AUTO_SCREENED.equals(entity.getAutoDiscriminateStatus())){
- throw new ServiceException("该现象已经自动甄别");
- }
- // 现象已被手动动甄别
- if(TreatMethodConstant.SCREENED.equals(entity.getDiscriminateStatus())){
- throw new ServiceException("该现象已甄别");
- }
- return entity;
- }
-
- /**
- * 缺陷保存
- * @param phenomenon
- */
- private void defectSave(OperPhenomenonEntity phenomenon) {
- OperDefectEntity defect = new OperDefectEntity();
- defect.setHandleStatus(RepairConstant.DEFAULT_DEFECT_STATE);
- defect.setProcessInstanceId(phenomenon.getCheckProcessInstanceId());
- defect.setDefectCode(phenomenon.getDefectCode());
- defect.setCreateUser(phenomenon.getCreateUser());
- defect.setCreateDept(phenomenon.getCreateDept());
- defect.setTenantId(phenomenon.getTenantId());
- this.defectService.save(defect);
- }
-
- /**
- * 更新甄别状态、数据
- * @param task
- */
- private void screePhenomenonUpdate(ComleteTask task) {
- // 查询流程状态
- String processStatus = TreatMethodConstant.RUNNING;
- R result = processClient.queryProcessInstanceStatus(task.getProcessInstanceId());
- if(result.isSuccess() && StringUtil.isNotBlank(result.getData()) && TreatMethodConstant.PROCESS_STATE_OVER.equals(result.getData())){
- processStatus = TreatMethodConstant.PROCESS_STATE_OVER;
- }
- // 获取参数集
- Map variables = task.getVariables();
- boolean invalid = (boolean) variables.get("invalid");
- LambdaUpdateWrapper lambdaUpdate = Wrappers.lambdaUpdate();
- if(invalid){
- lambdaUpdate
- .set(OperPhenomenonEntity::getStatus,processStatus)
- .set(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.IS_DEFECT)
- .set(OperPhenomenonEntity::getAutoDiscriminateStatus, TreatMethodConstant.ORDINARY_SCREENED)
- .set(OperPhenomenonEntity::getDiscriminator, AuthUtil.getUserId())
- .set(OperPhenomenonEntity::getDiscriminateTime, new Date())
- .set(OperPhenomenonEntity::getDiscriminateStatus,variables.get("discriminateStatus").toString())
- .set(OperPhenomenonEntity::getDiscriminateDesc, Optional.ofNullable(variables.get("discriminateDesc")).map(Object::toString).orElse(null))
- .set(OperPhenomenonEntity::getSafeInfos, variables.get("safeInfos").toString())
- .set(OperPhenomenonEntity::getWorkStandards, Optional.ofNullable(variables.get("workStandards")).map(Object::toString).orElse(null))
- .set(OperPhenomenonEntity::getHandleProgramme, variables.get("handleProgramme").toString().substring(9))
- .set(OperPhenomenonEntity::getPlanHours, variables.get("planHours").toString())
- .set(OperPhenomenonEntity::getPlanStartTime, variables.get("planStartTime").toString())
- .set(OperPhenomenonEntity::getPlanEndTime, variables.get("planEndTime").toString())
- .set(OperPhenomenonEntity::getDefectLevel, variables.get("defectLevel").toString())
- .eq(OperPhenomenonEntity::getCheckProcessInstanceId,task.getProcessInstanceId());
- }else{
- lambdaUpdate
- .set(OperPhenomenonEntity::getStatus,processStatus)
- .set(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.NO_DEFECT)
- .set(OperPhenomenonEntity::getDiscriminateStatus,variables.get("discriminateStatus").toString())
- .set(OperPhenomenonEntity::getDiscriminator, AuthUtil.getUserId())
- .set(OperPhenomenonEntity::getDiscriminateTime, new Date())
- .set(OperPhenomenonEntity::getDiscriminateDesc, variables.get("discriminateDesc").toString())
- .eq(OperPhenomenonEntity::getCheckProcessInstanceId,task.getProcessInstanceId());
- }
- this.update(lambdaUpdate);
- }
-
- /**
- * 决策处理方式
- * @param task
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void treatmentMethod(ComleteTask task) {
- // 步骤1.获取参数集
- Map variables = task.getVariables();
-
- // 步骤2.根据处理方式进行处理
- String state = RepairConstant.REPAIR_DEFECT_STATE,processKey = RepairConstant.REPAIR_PROCESS_PRIMARY_KEY
- ,type = variables.get("type").toString();
- switch (type){
- // 应急抢修处理
- case TreatMethodConstant.TYPE_RUSH_TO_REPAIR:
- this.startRepair(task,variables);
- break;
- // 检修计划处理
- case TreatMethodConstant.TYPE_PLAN:
- state = RepairConstant.ACCESS_PLAN_STATE;
- this.startMaintenancePlan(task,variables);
- break;
- // 检修任务处理
- case TreatMethodConstant.TYPE_TASK:
- state = RepairConstant.ACCESS_TASK_STATE;
- this.startMaintenanceTask(task);
- break;
- default:
- throw new IllegalStateException("Unexpected type: " + type);
- }
- // 步骤3.关联处理任务
- this.relationHandlerTask(variables,type,task.getProcessInstanceId(),state);
-
- // 步骤4.缺陷库保存处理任务信息
- this.saveDefectInfo(variables,task.getProcessInstanceId(),processKey,state);
-
- // 步骤5.流程执行 -> 处理缺陷
- processClient.completeTask(task);
- }
-
- /**
- * 启动应急抢修流程
- * @param variables
- */
- private void startRepair(ComleteTask task,Map variables) {
- String json = JSON.toJSONString(variables.get("repair"));
- RepairEntity entity = JSONObject.parseObject(json, RepairEntity.class);
- R result = repairClient.startRepair(entity);
- if(!result.isSuccess()){
- throw new ServiceException("开启检修任务流程失败!");
- }
- variables.put("handlerTaskId",result.getData().getId());
- variables.put("handlerType",TreatMethodConstant.REPAIR);
- variables.put("handlerProcessInstanceId",result.getData().getProcessInstanceId());
- variables.put("handlerUserId",result.getData().getCharge());
- variables.put(TreatMethodConstant.DEFECT_HANDLER_USER,"taskUser_" + result.getData().getCharge());
- task.setVariables(variables);
- }
-
- /**
- * 开启检修计划
- * @param variables
- */
- private void startMaintenancePlan(ComleteTask task,Map variables) {
- String json = JSON.toJSONString(variables.get("accessPlan"));
- OperAccessPlanDTO accessPlan = JSONObject.parseObject(json,OperAccessPlanDTO.class);
- // 查询现象
- OperPhenomenonEntity phenomenon = this.getOne(new LambdaQueryWrapper() {{
- eq(OperPhenomenonEntity::getCheckProcessInstanceId, task.getProcessInstanceId());
- }});
-
- // 查询缺陷
- OperDefectEntity defect = this.defectService.getOne(Wrappers.lambdaUpdate().eq(OperDefectEntity::getDefectCode, phenomenon.getDefectCode()));
- accessPlan.setDefectId(defect.getId());
- accessPlan.setPhenomenonId(phenomenon.getId());
- accessPlan.setActStartTime(DateUtil.now());
- // 计划草稿
- R result = operAccessPlanService.doSave(accessPlan);
- if(!result.isSuccess()){
- throw new ServiceException("开启检修计划失败");
- }
- // 计划流程开启
- accessPlanService.handlePlan(accessPlan,null);
- variables.put("handlerTaskId",accessPlan.getId());
- variables.put("handlerProcessInstanceId",accessPlan.getProcessInstanceId());
- variables.put("handlerUserId",AuthUtil.getUserId());
- variables.put("handlerType",TreatMethodConstant.MAINTENANCE_PLAN);
- variables.put("actStartTime",accessPlan.getActStartTime());
- variables.put(TreatMethodConstant.DEFECT_HANDLER_USER,"taskUser_" + AuthUtil.getUserId());
- task.setVariables(variables);
- }
-
- /**
- * 开启检修任务
- * @param comleteTask
- */
- @Transactional(rollbackFor = Exception.class)
- public void startMaintenanceTask(ComleteTask comleteTask) {
- Assert.isTrue(CollectionUtil.isNotEmpty(comleteTask.getVariables()) && ObjectUtil.isNotEmpty(comleteTask.getVariables().get("accessTask")),()->{
- throw new ServiceException("检修任务信息不能为空!");
- });
- Map variables = comleteTask.getVariables();
- OperAccessTaskDTO accessTask = JSONObject.parseObject(JSON.toJSONString(variables.get("accessTask")),OperAccessTaskDTO.class);
- Assert.isTrue(Func.isNotEmpty(accessTask.getPhenomenonId()),()->{
- throw new ServiceException("检修任务信息必须传入现象Id");
- });
- R result = operAccessTaskService.doSave(accessTask);
- if(result.isSuccess()){
- variables.put("handler", "taskUser_"+accessTask.getHandler());
- }
- comleteTask.setVariables(this.excludeProperties(variables,"accessTask"));
- processClient.completeTask(comleteTask);
- variables.put("handlerTaskId",accessTask.getId());
- variables.put("handlerProcessInstanceId",accessTask.getProcessInstanceId());
- variables.put("handlerUserId",accessTask.getHandler());
- variables.put("handlerType",TreatMethodConstant.MAINTENANCE_TASK);
- variables.put("actStartTime",accessTask.getCreateTime());
- }
-
-
- /**
- * 保存缺陷信息
- * @param variables
- */
- private void saveDefectInfo(Map variables,String processInstanceId,String processKey,String state) {
- // 新启线程保存缺陷
- ExecutorService exe = Executors.newSingleThreadExecutor();
- exe.execute(()->{
- // 查询现象
- OperPhenomenonEntity entity = this.queryPhenomenon(processInstanceId);
-
- // 保存流程信息至缺陷表
- this.defectService.update(Wrappers.lambdaUpdate()
- .set(OperDefectEntity::getProcDefId,processKey + "->" + variables.get("handlerTaskId"))
- .set(OperDefectEntity::getActStartTime,variables.get("actStartTime"))
- .set(OperDefectEntity::getHandleStatus,state)
- .set(OperDefectEntity::getHandleType,variables.get("handlerType"))
- .eq(OperDefectEntity::getDefectCode,entity.getDefectCode())
- );
- });
- exe.shutdown();
- }
-
- /**
- * 关联处理任务
- * @param variables
- * @param type
- * @param processInstanceId
- */
- private void relationHandlerTask( Map variables,String type,String processInstanceId,String state) {
- this.update(Wrappers.lambdaUpdate()
- .set(OperPhenomenonEntity::getHandleTaskId,variables.get("handlerTaskId"))
- .set(OperPhenomenonEntity::getHandler,variables.get("handlerUserId"))
- .set(OperPhenomenonEntity::getHandleType,type)
- .set(OperPhenomenonEntity::getHandleStatus,state)
- .eq(OperPhenomenonEntity::getCheckProcessInstanceId,processInstanceId)
- );
- }
-
- /**
- * 补开工作票
- * @param task
- */
- @Override
- public void makeUpTicket(ComleteTask task) {
- // 步骤1.查询现象
- OperPhenomenonEntity entity = this.queryPhenomenon(task.getProcessInstanceId());
-
- // 步骤2.获取定论角色-用户
- List list = this.getAliasUser(entity.getTenantId(),entity.getCreateDept(),TreatMethodConstant.PHENOMENON_CONCLUSION_ALIAS);
- if(CollectionUtil.isEmpty(list)){
- throw new ServiceException("请先添加缺陷定论角色用户,再进行补工作票");
- }
- List userList = list.stream().map(o -> "taskUser_" + o.getId().toString()).collect(Collectors.toList());
-
- // 步骤3.现象状态 -> 问题定论
- this.updatePhenomenonState(entity);
-
- // 步骤4.缺陷状态 -> 问题定论
- this.updateDefectHandleState(RepairConstant.CONCLUSION_PROBLEM,entity.getDefectCode());
-
- // 步骤5.设置参数
- Map variables = task.getVariables();
- variables.put(TreatMethodConstant.PHENOMENON_CONCLUSION_ALIAS,String.join(",", userList));
- task.setVariables(variables);
-
- // 步骤6.执行流程->问题定论
- processClient.completeTask(task);
- }
-
- /**
- * 现象状态 -> 问题定论
- * @param entity
- */
- private void updatePhenomenonState(OperPhenomenonEntity entity) {
- entity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
- this.phenomenonMapper.updateById(entity);
- }
-
- /**
- * 查询现象
- * @param processInstanceId
- * @return
- */
- private OperPhenomenonEntity queryPhenomenon(String processInstanceId) {
- LambdaQueryWrapper wrapper = new LambdaQueryWrapper() {{
- eq(OperPhenomenonEntity::getCheckProcessInstanceId, processInstanceId);
- }};
- return this.getOne(wrapper);
- }
-
- /**
- * 定论
- * @param task
- */
- @Override
- public void conclusion(ComleteTask task) {
- // 步骤1.查询现象
- OperPhenomenonEntity entity = this.queryPhenomenon(task.getProcessInstanceId());
-
- // 步骤2.更新现象定论信息
- this.defectConclusionInfo(task,entity.getId());
-
- // 步骤3.现象加入台账
- this.saveDefect(entity);
-
- // 步骤4.故障状态更新
- this.updateFaultState(entity.getFaultCode());
-
- // 步骤5.更新缺陷状态 -> 已处理
- this.updateDefectHandleState(RepairConstant.COMPLETE_DEFECT_STATE,entity.getDefectCode());
-
- // 步骤6.缺陷流程->结束
- processClient.completeTask(task);
- }
-
- /**
- * 更新现象定论信息
- * @param task
- */
- private void defectConclusionInfo(ComleteTask task,Long phenomenonId) {
- // 获取参数集
- Map variables = task.getVariables();
-
- // 修改现象定论信息
- OperPhenomenonEntity entity = new OperPhenomenonEntity();
- entity.setStatus(Integer.valueOf(TreatMethodConstant.OVER));
- entity.setHandleStatus(RepairConstant.COMPLETE_DEFECT_STATE);
- entity.setConclusionTime(new Date());
- entity.setConclusionPeople(AuthUtil.getUserId());
- entity.setConclusionStatus(TreatMethodConstant.CONCLUSION_COMPLETED);
- entity.setConclusion((String) variables.get("conclusion"));
- entity.setCheckHours(Integer.valueOf(variables.get("checkHours").toString()));
- entity.setId(phenomenonId);
- this.phenomenonMapper.updateById(entity);
- }
-
- /**
- * 现象加入台账
- * @param entity
- */
- private void saveDefect(OperPhenomenonEntity entity) {
- entity = phenomenonMapper.selectById(entity.getId());
- // 复制现象数据
- OperDefectStatisticsEntity statistics = BeanUtil.copy(entity, OperDefectStatisticsEntity.class);
- // 查询缺陷
- OperDefectEntity defect = this.defectService.getOne(Wrappers.lambdaUpdate().eq(OperDefectEntity::getDefectCode, entity.getDefectCode()));
- if(ObjectUtil.isEmpty(statistics)){
- return;
- }
- // 实际执行时长
- statistics.setCheckHours(entity.getCheckHours());
- statistics.setConclusion(entity.getConclusion());
- statistics.setConclusionPeople(entity.getConclusionPeople());
- statistics.setConclusionTime(entity.getConclusionTime());
- statistics.setActEndTime(defect.getActEndTime());
- statistics.setActStartTime(defect.getActStartTime());
- statistics.setDisposeDesc(defect.getDisposeDesc());
- // 台账存储
- this.statisticsService.save(statistics);
- }
-
- /**
- * 故障状态更新
- * @param faultCode
- */
- private void updateFaultState(String faultCode) {
- if(StringUtil.isBlank(faultCode)){
- return;
- }
- fdpTaskClient.updateFinishStatusByDefectCode(faultCode);
- }
-
- /**
- * 排除业务中所需属性 避免传入工作流中
- * @param variable 工作流传参map
- * @param properties 不计入工作流传参的属性
- * @return
- */
- private Map excludeProperties(Map variable,String... properties) {
- Map result = new HashMap<>();
- variable.forEach((k,v)->{
- if(!Arrays.asList(properties).contains(k)) {
- result.put(k,v);
- }
- });
- return result;
- }
+ private final IOperAccessTaskService operAccessTaskService;
+
+ private final IOperAccessPlanService operAccessPlanService;
+
+ private final IOperAppearanceService operAppearanceService;
+
+ private final IOperDefectStatisticsService statisticsService;
+ private final IOperDefectService defectService;
+
+ private final IOperAccessPlanService accessPlanService;
+
+ private final OperPhenomenonMapper phenomenonMapper;
+
+ private final IFlowClient processClient;
+
+ private final IUserClient userClient;
+
+ private final ISysClient sysClient;
+
+ private final IMessageClient messageClient;
+
+ private final IFdpTaskClient fdpTaskClient;
+
+
+ private final IRepairClient repairClient;
+
+ /**
+ * 保存现象、开启缺陷处理流程
+ *
+ * @param entity
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public OperPhenomenonEntity startCheck(OperPhenomenonEntity entity) {
+ // 步骤1.保存现象
+ if (!this.savePhenomenon(entity)) {
+ throw new ServiceException("保存现象失败!");
+ }
+ // 步骤2.开启缺陷流程
+ this.startDefectCheckV2(entity);
+ return entity;
+ }
+
+ /**
+ * 保存现象
+ *
+ * @param entity
+ * @return
+ */
+ private boolean savePhenomenon(OperPhenomenonEntity entity) {
+ DateTimeFormatter format = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME_MINI);
+ // 缺陷编码 : 缺陷来源 + 时间格式化 + 三位长度随机值
+ if (Func.isEmpty(entity.getDefectCode())) {
+ entity.setDefectCode(entity.getSourceCode() + format.format(LocalDateTime.now()) + Func.random(3));
+ }
+ // 现象发起人 : 当前用户Id
+ if (Func.isEmpty(entity.getFinder())) {
+ entity.setFinder(AuthUtil.getUserId());
+ }
+ // 现象发起时间
+ entity.setFindTime(new Date());
+ // 现象更新时间
+ entity.setUpdateTime(new Date());
+ entity.setCreateUser(AuthUtil.getUserId());
+ entity.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+ // 现在最后甄别时间
+// Date discriminateDeadline = DateUtil.plusHours(entity.getUpdateTime(), DefectConfiguration.discriminateDeadline);
+// entity.setDiscriminateDeadline(discriminateDeadline);
+// 最后甄别时间字段弃用
+ return this.save(entity);
+
+ }
+
+ /**
+ * 启动缺陷处理流程
+ *
+ * @param entity
+ */
+ private void startDefectCheckV2(OperPhenomenonEntity entity) {
+ // 获取机构下执行定论缺陷角色用户
+// List list = this.getAliasUser(entity.getTenantId(), entity.getCreateDept(), TreatMethodConstant.PHENOMENON_SCREEN_ALIAS);
+// if (CollectionUtil.isEmpty(list)) {
+// throw new ServiceException("请先添加甄别缺陷角色用户,再发起现象!");
+// }
+ // 现象发起人名字
+ String userName = Optional.ofNullable(UserCache.getUser(entity.getFinder()).getName()).orElse("");
+ // 现象发起来源
+ String sourceName = DictCache.getValue(TreatMethodConstant.SOURCE_CODE_PREFIX, entity.getSourceCode());
+ // 流程名称
+ String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode();
+ // 开启新的缺陷流程
+ String businessKey = FlowUtil.getBusinessKey("hzims_oper_phenomenon", "" + entity.getId());
+ Map variable = entityToMap(entity);
+ R result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK, businessKey, processName, variable);
+ // 流程开启失败
+ if (!result.isSuccess()) {
+ throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getCode());
+ }
+ // 关联流程唯一键
+ entity.setCheckProcessInstanceId(result.getData().getProcessInstanceId());
+ this.baseMapper.updateById(entity);
+ //新增缺陷流程记录
+ OperDefectStatisticsEntity operDefectStatisticsEntity = new OperDefectStatisticsEntity();
+ BeanUtil.copy(entity, operDefectStatisticsEntity);
+ statisticsService.save(operDefectStatisticsEntity);
+ //新增现象记录
+ OperAppearanceEntity operAppearanceEntity = new OperAppearanceEntity();
+ BeanUtil.copy(entity, operAppearanceEntity);
+ operAppearanceService.save(operAppearanceEntity);
+ }
+
+ /**
+ * 实体类转换成map
+ *
+ * @param obj
+ * @return
+ */
+ public static Map entityToMap(Object obj) {
+ Map map = new HashMap();
+ Class> clazz = obj.getClass();
+ for (Field field : clazz.getDeclaredFields()) {
+ field.setAccessible(true);
+ String fieldName = field.getName();
+ Object object = null;
+ try {
+ object = field.get(obj);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ log.info(e.getMessage());
+ }
+ map.put(fieldName, object);
+ }
+ return map;
+ }
+
+ /**
+ * Map转实体类:要转换的Map的key跟实体类属性名相同的数据会转过去,不相同的字段会为null
+ *
+ * @param clazz
+ * @param map
+ * @return
+ */
+ public static T mapToEntity(Class clazz, Map map) {
+ T obj = null;
+ try {
+ BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
+ obj = clazz.newInstance(); // 创建 JavaBean 对象
+ PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+ // 给 JavaBean 对象的属性赋值
+ for (int i = 0; i < propertyDescriptors.length; i++) {
+ PropertyDescriptor descriptor = propertyDescriptors[i];
+ String propertyName = descriptor.getName();
+ if (map.containsKey(propertyName)) {
+ Object value = map.get(propertyName);
+ Object[] args = new Object[1];
+ args[0] = value;
+ try {
+ descriptor.getWriteMethod().invoke(obj, args);
+ } catch (InvocationTargetException e) {
+ log.info(e.getMessage());
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ return (T) obj;
+ }
+
+
+ /**
+ * @param processWorkFlowResponse
+ */
+ @Override
+ public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) {
+
+ OperPhenomenonEntity operPhenomenonEntity;
+ try {
+ Map variables =(Map) processWorkFlowResponse.getVariables();
+ //现象缺陷全表更新
+ operPhenomenonEntity = mapToEntity(OperPhenomenonEntity.class, variables);
+ } catch (Exception e) {
+ log.info("消息转换失败");
+ return R.fail("消息转换失败");
+ }
+
+ if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) {
+ operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getNextStepOperator());
+ operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getProcessDefinitionKey());
+ }
+ //缺陷记录
+ OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper() {{
+ eq(OperDefectStatisticsEntity::getDefectCode, operPhenomenonEntity.getDefectCode());
+ }});
+ //现象记录
+ OperAppearanceEntity appearanceEntity = operAppearanceService.getOne(new LambdaUpdateWrapper() {{
+ eq(OperAppearanceEntity::getDefectCode, operPhenomenonEntity.getDefectCode());
+ }});
+ if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && "1".equals(operPhenomenonEntity.getIsWarehousing())) {
+ OperDefectEntity operDefectEntity = new OperDefectEntity();
+ BeanUtil.copy(operPhenomenonEntity, operDefectEntity);
+ operDefectEntity.setProcessInstanceId(operPhenomenonEntity.getHandleTaskId().toString());
+ if(ObjectUtil.isNotEmpty(operPhenomenonEntity.getCheckHours())){
+ operDefectEntity.setActHours(operPhenomenonEntity.getCheckHours());
+ }
+ defectService.save(operDefectEntity);
+ log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功");
+ operPhenomenonEntity.setCurrentOperator("定论");
+ operPhenomenonEntity.setCurrentLinkHandler(null);
+ }
+ //更新数据库
+ Long statisticsEntityId = statisticsEntity.getId();
+ Long appearanceEntityId = appearanceEntity.getId();
+ BeanUtil.copy(operPhenomenonEntity, statisticsEntity);
+ BeanUtil.copy(operPhenomenonEntity, appearanceEntity);
+ statisticsEntity.setId(statisticsEntityId);
+ appearanceEntity.setId(appearanceEntityId);
+ this.baseMapper.update(operPhenomenonEntity, new LambdaUpdateWrapper() {{
+ eq(OperPhenomenonEntity::getDefectCode, operPhenomenonEntity.getDefectCode());
+ }});
+ statisticsService.updateById(statisticsEntity);
+ operAppearanceService.updateById(appearanceEntity);
+ //推送消息中心相关消息
+ sendMessage(processWorkFlowResponse, operPhenomenonEntity);
+ return R.success("消息保存成功");
+ }
+
+ private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, OperPhenomenonEntity operPhenomenonEntity) {
+ //推送消息
+ if (processWorkFlowResponse.getTaskId() != null) {
+ MessagePushRecordDto message = new MessagePushRecordDto();
+ message.setBusinessClassify("business");
+ message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getKey());
+ message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getDescription());
+ message.setTaskId(operPhenomenonEntity.getId());
+ message.setTenantId("200000");
+ message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
+ message.setPushType(MessageConstants.IMMEDIATELY);
+ String countent =
+ "您的消缺流程待审批!现象名称:".concat(operPhenomenonEntity.getFaultName())
+ .concat(",审批环节:")
+ .concat(processWorkFlowResponse.getTaskName());
+ message.setContent(countent);
+ message.setDeptId(operPhenomenonEntity.getCreateDept());
+ R deptName = sysClient.getDeptName(operPhenomenonEntity.getCreateDept());
+ if (deptName.isSuccess()) {
+ message.setDeptName(deptName.getData());
+ }
+ String userIds = processWorkFlowResponse.getUserId();
+ if (StringUtils.isBlank(userIds)) {
+ log.error("推送的消息不能为空哦,{}", userIds);
+ return;
+ }
+ String[] split = userIds.split(",");
+ for (String userId : split) {
+ message.setPusher(userId);
+ User user = UserCache.getUser(NumberUtils.toLong(userId));
+ if (ObjectUtils.isNotEmpty(user)) {
+ message.setPusherName(user.getName());
+ }
+ message.setAccount(userId);
+ message.setCreateUser(NumberUtils.toLong(userId));
+ messageClient.sendMessage(message);
+ }
+ }
+ }
+
+ /**
+ * 启动缺陷处理流程
+ * 此端口弃用20230614
+ *
+ * @param entity
+ */
+ @Deprecated
+ private void startDefectCheck(OperPhenomenonEntity entity) {
+ // 获取机构下执行定论缺陷角色用户
+ List list = this.getAliasUser(entity.getTenantId(), entity.getCreateDept(), TreatMethodConstant.PHENOMENON_SCREEN_ALIAS);
+ if (CollectionUtil.isEmpty(list)) {
+ throw new ServiceException("请先添加甄别缺陷角色用户,再发起现象!");
+ }
+ List userList = list.stream().map(o -> "taskUser_" + o.getId().toString()).collect(Collectors.toList());
+ // 现象发起人名字
+ String userName = Optional.ofNullable(UserCache.getUser(entity.getFinder()).getName()).orElse("");
+ // 现象发起来源
+ String sourceName = DictCache.getValue(TreatMethodConstant.SOURCE_CODE_PREFIX, entity.getSourceCode());
+ // 流程名称
+ String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode();
+ // 设置下一步执行流程用户
+ Kv variables = Kv.create()
+ .set(TreatMethodConstant.PHENOMENON_SCREEN_USER, String.join(",", userList));
+ // 开启新的缺陷流程
+ R result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK_PRIMARY_KEY, FlowUtil.getBusinessKey("hzims_oper_phenomenon", "" + entity.getId()), processName, variables);
+ // 流程开启失败
+ if (!result.isSuccess()) {
+ throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getCode());
+ }
+ // 关联流程唯一键
+ entity.setCheckProcessInstanceId(result.getData().getProcessInstanceId());
+ this.baseMapper.updateById(entity);
+ }
+
+ /**
+ * 获取当前机构指定角色的用户
+ *
+ * @param tenantId
+ * @param deptId
+ * @param alias
+ * @return
+ */
+ public List getAliasUser(String tenantId, Long deptId, String alias) {
+ if (Func.isEmpty(tenantId)) {
+ tenantId = AuthUtil.getTenantId();
+ }
+ R> result = userClient.relationUserListByRoleAlias(tenantId, deptId, alias);
+ if (!result.isSuccess()) {
+ throw new ServiceException("查询角色用户信息失败!");
+ }
+ return result.getData();
+ }
+
+ /**
+ * 修改缺陷状态 -> 问题定论
+ *
+ * @param handleStatus
+ * @param defectCode
+ */
+ private void updateDefectHandleState(String handleStatus, String defectCode) {
+ this.defectService.update(Wrappers.lambdaUpdate()
+ .set(OperDefectEntity::getHandleStatus, handleStatus)
+ .eq(OperDefectEntity::getDefectCode, defectCode)
+ );
+ }
+
+
+ /**
+ * 甄别缺陷
+ *
+ * @param task
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void screeDefect(ComleteTask task) {
+ // 步骤1.现象前置判断(现象状态检查)
+ OperPhenomenonEntity entity = this.preposePhenomenon(task.getProcessInstanceId());
+
+ // 步骤2.更新甄别状态、数据
+ this.screePhenomenonUpdate(task);
+
+ // 步骤3.现象添加至缺陷库
+ this.defectSave(entity);
+
+ // 步骤4.流程执行至甄别处理方式
+ processClient.completeTask(task);
+ }
+
+ /**
+ * 现象前置判断
+ *
+ * @param processInstanceId
+ * @return
+ */
+ private OperPhenomenonEntity preposePhenomenon(String processInstanceId) {
+ LambdaQueryWrapper wrapper = new LambdaQueryWrapper() {{
+ eq(OperPhenomenonEntity::getCheckProcessInstanceId, processInstanceId);
+ }};
+ // 查询现象状态
+ OperPhenomenonEntity entity = this.getOne(wrapper);
+ if (ObjectUtil.isEmpty(entity)) {
+ throw new ServiceException("现象不存在");
+ }
+ // 现象已被自动甄别
+ if (TreatMethodConstant.AUTO_SCREENED.equals(entity.getAutoDiscriminateStatus())) {
+ throw new ServiceException("该现象已经自动甄别");
+ }
+ // 现象已被手动动甄别
+ if (TreatMethodConstant.SCREENED.equals(entity.getDiscriminateStatus())) {
+ throw new ServiceException("该现象已甄别");
+ }
+ return entity;
+ }
+
+ /**
+ * 缺陷保存
+ *
+ * @param phenomenon
+ */
+ private void defectSave(OperPhenomenonEntity phenomenon) {
+ OperDefectEntity defect = new OperDefectEntity();
+ defect.setHandleStatus(RepairConstant.DEFAULT_DEFECT_STATE);
+ defect.setProcessInstanceId(phenomenon.getCheckProcessInstanceId());
+ defect.setDefectCode(phenomenon.getDefectCode());
+ defect.setCreateUser(phenomenon.getCreateUser());
+ defect.setCreateDept(phenomenon.getCreateDept());
+ defect.setTenantId(phenomenon.getTenantId());
+ this.defectService.save(defect);
+ }
+
+ /**
+ * 更新甄别状态、数据
+ *
+ * @param task
+ */
+ private void screePhenomenonUpdate(ComleteTask task) {
+ // 查询流程状态
+ String processStatus = TreatMethodConstant.RUNNING;
+ R result = processClient.queryProcessInstanceStatus(task.getProcessInstanceId());
+ if (result.isSuccess() && StringUtil.isNotBlank(result.getData()) && TreatMethodConstant.PROCESS_STATE_OVER.equals(result.getData())) {
+ processStatus = TreatMethodConstant.PROCESS_STATE_OVER;
+ }
+ // 获取参数集
+ Map variables = task.getVariables();
+ boolean invalid = (boolean) variables.get("invalid");
+ LambdaUpdateWrapper lambdaUpdate = Wrappers.lambdaUpdate();
+ if (invalid) {
+ lambdaUpdate
+ .set(OperPhenomenonEntity::getStatus, processStatus)
+ .set(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.IS_DEFECT)
+ .set(OperPhenomenonEntity::getAutoDiscriminateStatus, TreatMethodConstant.ORDINARY_SCREENED)
+ .set(OperPhenomenonEntity::getDiscriminator, AuthUtil.getUserId())
+ .set(OperPhenomenonEntity::getDiscriminateTime, new Date())
+ .set(OperPhenomenonEntity::getDiscriminateStatus, variables.get("discriminateStatus").toString())
+ .set(OperPhenomenonEntity::getDiscriminateDesc, Optional.ofNullable(variables.get("discriminateDesc")).map(Object::toString).orElse(null))
+ .set(OperPhenomenonEntity::getSafeInfos, variables.get("safeInfos").toString())
+ .set(OperPhenomenonEntity::getWorkStandards, Optional.ofNullable(variables.get("workStandards")).map(Object::toString).orElse(null))
+ .set(OperPhenomenonEntity::getHandleProgramme, variables.get("handleProgramme").toString().substring(9))
+ .set(OperPhenomenonEntity::getPlanHours, variables.get("planHours").toString())
+ .set(OperPhenomenonEntity::getPlanStartTime, variables.get("planStartTime").toString())
+ .set(OperPhenomenonEntity::getPlanEndTime, variables.get("planEndTime").toString())
+ .set(OperPhenomenonEntity::getDefectLevel, variables.get("defectLevel").toString())
+ .eq(OperPhenomenonEntity::getCheckProcessInstanceId, task.getProcessInstanceId());
+ } else {
+ lambdaUpdate
+ .set(OperPhenomenonEntity::getStatus, processStatus)
+ .set(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.NO_DEFECT)
+ .set(OperPhenomenonEntity::getDiscriminateStatus, variables.get("discriminateStatus").toString())
+ .set(OperPhenomenonEntity::getDiscriminator, AuthUtil.getUserId())
+ .set(OperPhenomenonEntity::getDiscriminateTime, new Date())
+ .set(OperPhenomenonEntity::getDiscriminateDesc, variables.get("discriminateDesc").toString())
+ .eq(OperPhenomenonEntity::getCheckProcessInstanceId, task.getProcessInstanceId());
+ }
+ this.update(lambdaUpdate);
+ }
+
+ /**
+ * 决策处理方式
+ *
+ * @param task
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void treatmentMethod(ComleteTask task) {
+ // 步骤1.获取参数集
+ Map variables = task.getVariables();
+
+ // 步骤2.根据处理方式进行处理
+ String state = RepairConstant.REPAIR_DEFECT_STATE, processKey = RepairConstant.REPAIR_PROCESS_PRIMARY_KEY, type = variables.get("type").toString();
+ switch (type) {
+ // 应急抢修处理
+ case TreatMethodConstant.TYPE_RUSH_TO_REPAIR:
+ this.startRepair(task, variables);
+ break;
+ // 检修计划处理
+ case TreatMethodConstant.TYPE_PLAN:
+ state = RepairConstant.ACCESS_PLAN_STATE;
+ this.startMaintenancePlan(task, variables);
+ break;
+ // 检修任务处理
+ case TreatMethodConstant.TYPE_TASK:
+ state = RepairConstant.ACCESS_TASK_STATE;
+ this.startMaintenanceTask(task);
+ break;
+ default:
+ throw new IllegalStateException("Unexpected type: " + type);
+ }
+ // 步骤3.关联处理任务
+ this.relationHandlerTask(variables, type, task.getProcessInstanceId(), state);
+
+ // 步骤4.缺陷库保存处理任务信息
+ this.saveDefectInfo(variables, task.getProcessInstanceId(), processKey, state);
+
+ // 步骤5.流程执行 -> 处理缺陷
+ processClient.completeTask(task);
+ }
+
+ /**
+ * 启动应急抢修流程
+ *
+ * @param variables
+ */
+ private void startRepair(ComleteTask task, Map variables) {
+ String json = JSON.toJSONString(variables.get("repair"));
+ RepairEntity entity = JSONObject.parseObject(json, RepairEntity.class);
+ R result = repairClient.startRepair(entity);
+ if (!result.isSuccess()) {
+ throw new ServiceException("开启检修任务流程失败!");
+ }
+ variables.put("handlerTaskId", result.getData().getId());
+ variables.put("handlerType", TreatMethodConstant.REPAIR);
+ variables.put("handlerProcessInstanceId", result.getData().getProcessInstanceId());
+ variables.put("handlerUserId", result.getData().getCharge());
+ variables.put(TreatMethodConstant.DEFECT_HANDLER_USER, "taskUser_" + result.getData().getCharge());
+ task.setVariables(variables);
+ }
+
+ /**
+ * 开启检修计划
+ *
+ * @param variables
+ */
+ private void startMaintenancePlan(ComleteTask task, Map variables) {
+ String json = JSON.toJSONString(variables.get("accessPlan"));
+ OperAccessPlanDTO accessPlan = JSONObject.parseObject(json, OperAccessPlanDTO.class);
+ // 查询现象
+ OperPhenomenonEntity phenomenon = this.getOne(new LambdaQueryWrapper() {{
+ eq(OperPhenomenonEntity::getCheckProcessInstanceId, task.getProcessInstanceId());
+ }});
+
+ // 查询缺陷
+ OperDefectEntity defect = this.defectService.getOne(Wrappers.lambdaUpdate().eq(OperDefectEntity::getDefectCode, phenomenon.getDefectCode()));
+ accessPlan.setDefectId(defect.getId());
+ accessPlan.setPhenomenonId(phenomenon.getId());
+ accessPlan.setActStartTime(DateUtil.now());
+ // 计划草稿
+ R result = operAccessPlanService.doSave(accessPlan);
+ if (!result.isSuccess()) {
+ throw new ServiceException("开启检修计划失败");
+ }
+ // 计划流程开启
+ accessPlanService.handlePlan(accessPlan, null);
+ variables.put("handlerTaskId", accessPlan.getId());
+ variables.put("handlerProcessInstanceId", accessPlan.getProcessInstanceId());
+ variables.put("handlerUserId", AuthUtil.getUserId());
+ variables.put("handlerType", TreatMethodConstant.MAINTENANCE_PLAN);
+ variables.put("actStartTime", accessPlan.getActStartTime());
+ variables.put(TreatMethodConstant.DEFECT_HANDLER_USER, "taskUser_" + AuthUtil.getUserId());
+ task.setVariables(variables);
+ }
+
+ /**
+ * 开启检修任务
+ *
+ * @param comleteTask
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public void startMaintenanceTask(ComleteTask comleteTask) {
+ Assert.isTrue(CollectionUtil.isNotEmpty(comleteTask.getVariables()) && ObjectUtil.isNotEmpty(comleteTask.getVariables().get("accessTask")), () -> {
+ throw new ServiceException("检修任务信息不能为空!");
+ });
+ Map variables = comleteTask.getVariables();
+ OperAccessTaskDTO accessTask = JSONObject.parseObject(JSON.toJSONString(variables.get("accessTask")), OperAccessTaskDTO.class);
+ Assert.isTrue(Func.isNotEmpty(accessTask.getPhenomenonId()), () -> {
+ throw new ServiceException("检修任务信息必须传入现象Id");
+ });
+ R result = operAccessTaskService.doSave(accessTask);
+ if (result.isSuccess()) {
+ variables.put("handler", "taskUser_" + accessTask.getHandler());
+ }
+ comleteTask.setVariables(this.excludeProperties(variables, "accessTask"));
+ processClient.completeTask(comleteTask);
+ variables.put("handlerTaskId", accessTask.getId());
+ variables.put("handlerProcessInstanceId", accessTask.getProcessInstanceId());
+ variables.put("handlerUserId", accessTask.getHandler());
+ variables.put("handlerType", TreatMethodConstant.MAINTENANCE_TASK);
+ variables.put("actStartTime", accessTask.getCreateTime());
+ }
+
+
+ /**
+ * 保存缺陷信息
+ *
+ * @param variables
+ */
+ private void saveDefectInfo(Map variables, String processInstanceId, String processKey, String state) {
+ // 新启线程保存缺陷
+ ExecutorService exe = Executors.newSingleThreadExecutor();
+ exe.execute(() -> {
+ // 查询现象
+ OperPhenomenonEntity entity = this.queryPhenomenon(processInstanceId);
+
+ // 保存流程信息至缺陷表
+ this.defectService.update(Wrappers.lambdaUpdate()
+ .set(OperDefectEntity::getProcDefId, processKey + "->" + variables.get("handlerTaskId"))
+ .set(OperDefectEntity::getActStartTime, variables.get("actStartTime"))
+ .set(OperDefectEntity::getHandleStatus, state)
+ .set(OperDefectEntity::getHandleType, variables.get("handlerType"))
+ .eq(OperDefectEntity::getDefectCode, entity.getDefectCode())
+ );
+ });
+ exe.shutdown();
+ }
+
+ /**
+ * 关联处理任务
+ *
+ * @param variables
+ * @param type
+ * @param processInstanceId
+ */
+ private void relationHandlerTask(Map variables, String type, String processInstanceId, String state) {
+ this.update(Wrappers.lambdaUpdate()
+ .set(OperPhenomenonEntity::getHandleTaskId, variables.get("handlerTaskId"))
+ .set(OperPhenomenonEntity::getHandler, variables.get("handlerUserId"))
+ .set(OperPhenomenonEntity::getHandleType, type)
+ .set(OperPhenomenonEntity::getHandleStatus, state)
+ .eq(OperPhenomenonEntity::getCheckProcessInstanceId, processInstanceId)
+ );
+ }
+
+ /**
+ * 补开工作票
+ *
+ * @param task
+ */
+ @Override
+ public void makeUpTicket(ComleteTask task) {
+ // 步骤1.查询现象
+ OperPhenomenonEntity entity = this.queryPhenomenon(task.getProcessInstanceId());
+
+ // 步骤2.获取定论角色-用户
+ List list = this.getAliasUser(entity.getTenantId(), entity.getCreateDept(), TreatMethodConstant.PHENOMENON_CONCLUSION_ALIAS);
+ if (CollectionUtil.isEmpty(list)) {
+ throw new ServiceException("请先添加缺陷定论角色用户,再进行补工作票");
+ }
+ List userList = list.stream().map(o -> "taskUser_" + o.getId().toString()).collect(Collectors.toList());
+
+ // 步骤3.现象状态 -> 问题定论
+ this.updatePhenomenonState(entity);
+
+ // 步骤4.缺陷状态 -> 问题定论
+ this.updateDefectHandleState(RepairConstant.CONCLUSION_PROBLEM, entity.getDefectCode());
+
+ // 步骤5.设置参数
+ Map variables = task.getVariables();
+ variables.put(TreatMethodConstant.PHENOMENON_CONCLUSION_ALIAS, String.join(",", userList));
+ task.setVariables(variables);
+
+ // 步骤6.执行流程->问题定论
+ processClient.completeTask(task);
+ }
+
+ /**
+ * 现象状态 -> 问题定论
+ *
+ * @param entity
+ */
+ private void updatePhenomenonState(OperPhenomenonEntity entity) {
+ entity.setHandleStatus(RepairConstant.CONCLUSION_PROBLEM);
+ this.phenomenonMapper.updateById(entity);
+ }
+
+ /**
+ * 查询现象
+ *
+ * @param processInstanceId
+ * @return
+ */
+ private OperPhenomenonEntity queryPhenomenon(String processInstanceId) {
+ LambdaQueryWrapper wrapper = new LambdaQueryWrapper() {{
+ eq(OperPhenomenonEntity::getCheckProcessInstanceId, processInstanceId);
+ }};
+ return this.getOne(wrapper);
+ }
+
+ /**
+ * 定论
+ *
+ * @param task
+ */
+ @Override
+ public void conclusion(ComleteTask task) {
+ // 步骤1.查询现象
+ OperPhenomenonEntity entity = this.queryPhenomenon(task.getProcessInstanceId());
+
+ // 步骤2.更新现象定论信息
+ this.defectConclusionInfo(task, entity.getId());
+
+ // 步骤3.现象加入台账
+ this.saveDefect(entity);
+
+ // 步骤4.故障状态更新
+ this.updateFaultState(entity.getFaultCode());
+
+ // 步骤5.更新缺陷状态 -> 已处理
+ this.updateDefectHandleState(RepairConstant.COMPLETE_DEFECT_STATE, entity.getDefectCode());
+
+ // 步骤6.缺陷流程->结束
+ processClient.completeTask(task);
+ }
+
+
+ /**
+ * 更新现象定论信息
+ *
+ * @param task
+ */
+ private void defectConclusionInfo(ComleteTask task, Long phenomenonId) {
+ // 获取参数集
+ Map variables = task.getVariables();
+
+ // 修改现象定论信息
+ OperPhenomenonEntity entity = new OperPhenomenonEntity();
+ entity.setStatus(Integer.valueOf(TreatMethodConstant.OVER));
+ entity.setHandleStatus(RepairConstant.COMPLETE_DEFECT_STATE);
+ entity.setConclusionTime(new Date());
+ entity.setConclusionPeople(AuthUtil.getUserId());
+ entity.setConclusionStatus(TreatMethodConstant.CONCLUSION_COMPLETED);
+ entity.setConclusion((String) variables.get("conclusion"));
+ entity.setCheckHours(Integer.valueOf(variables.get("checkHours").toString()));
+ entity.setId(phenomenonId);
+ this.phenomenonMapper.updateById(entity);
+ }
+
+ /**
+ * 现象加入台账
+ *
+ * @param entity
+ */
+ private void saveDefect(OperPhenomenonEntity entity) {
+ entity = phenomenonMapper.selectById(entity.getId());
+ // 复制现象数据
+ OperDefectStatisticsEntity statistics = BeanUtil.copy(entity, OperDefectStatisticsEntity.class);
+ // 查询缺陷
+ OperDefectEntity defect = this.defectService.getOne(Wrappers.lambdaUpdate().eq(OperDefectEntity::getDefectCode, entity.getDefectCode()));
+ if (ObjectUtil.isEmpty(statistics)) {
+ return;
+ }
+ // 实际执行时长
+ statistics.setCheckHours(entity.getCheckHours());
+ statistics.setConclusion(entity.getConclusion());
+ statistics.setConclusionPeople(entity.getConclusionPeople());
+ statistics.setConclusionTime(entity.getConclusionTime());
+ statistics.setActEndTime(defect.getActEndTime());
+ statistics.setActStartTime(defect.getActStartTime());
+ statistics.setDisposeDesc(defect.getDisposeDesc());
+ // 台账存储
+ this.statisticsService.save(statistics);
+ }
+
+ /**
+ * 故障状态更新
+ *
+ * @param faultCode
+ */
+ private void updateFaultState(String faultCode) {
+ if (StringUtil.isBlank(faultCode)) {
+ return;
+ }
+ fdpTaskClient.updateFinishStatusByDefectCode(faultCode);
+ }
+
+ /**
+ * 排除业务中所需属性 避免传入工作流中
+ *
+ * @param variable 工作流传参map
+ * @param properties 不计入工作流传参的属性
+ * @return
+ */
+ private Map excludeProperties(Map variable, String... properties) {
+ Map result = new HashMap<>();
+ variable.forEach((k, v) -> {
+ if (!Arrays.asList(properties).contains(k)) {
+ result.put(k, v);
+ }
+ });
+ return result;
+ }
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperAppearanceServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperAppearanceServiceImpl.java
new file mode 100644
index 0000000..6a7ecb9
--- /dev/null
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperAppearanceServiceImpl.java
@@ -0,0 +1,61 @@
+package com.hnac.hzims.operational.defect.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
+import com.hnac.hzims.operational.defect.mapper.OperAppearanceMapper;
+import com.hnac.hzims.operational.defect.service.IOperAppearanceService;
+import com.hnac.hzims.operational.defect.vo.OperAppearanceVO;
+import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.stereotype.Service;
+
+/**
+ * 服务实现类
+ *
+ * @author Chill
+ */
+@Service
+public class OperAppearanceServiceImpl extends BaseServiceImpl implements IOperAppearanceService {
+
+ @Override
+ public LambdaQueryWrapper getQueryWrapper(OperAppearanceVO operAppearanceVO) {
+ LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new OperAppearanceEntity(), operAppearanceVO);
+ if (ObjectUtils.isEmpty(operAppearanceVO)) {
+ if (StringUtil.isNotBlank(operAppearanceVO.getDefectCode())) {
+ queryWrapper.eq(OperAppearanceEntity::getId, operAppearanceVO.getDefectCode());
+ }
+ if (StringUtil.isNotBlank(operAppearanceVO.getEmCode())) {
+ queryWrapper.eq(OperAppearanceEntity::getEmCode, operAppearanceVO.getEmCode());
+ }
+ if (Func.isNotEmpty(operAppearanceVO.getFindTime())) {
+ queryWrapper.ge(OperAppearanceEntity::getFindTime, operAppearanceVO.getFindTime());
+ }
+ if (Func.isNotEmpty(operAppearanceVO.getFindEndTime())) {
+ queryWrapper.le(OperAppearanceEntity::getFindTime, operAppearanceVO.getFindEndTime());
+ }
+ if (Func.isNotEmpty(operAppearanceVO.getFinder())) {
+ queryWrapper.eq(OperAppearanceEntity::getFinder, operAppearanceVO.getFinder());
+ }
+ if (Func.isNotEmpty(operAppearanceVO.getName())) {
+ queryWrapper.like(OperAppearanceEntity::getName, operAppearanceVO.getName());
+ }
+ if (Func.isNotEmpty(operAppearanceVO.getDiscriminator())) {
+ queryWrapper.eq(OperAppearanceEntity::getDiscriminator, operAppearanceVO.getDiscriminator());
+ }
+ if (Func.isNotEmpty(operAppearanceVO.getIsDefect())) {
+ queryWrapper.eq(OperAppearanceEntity::getIsDefect, operAppearanceVO.getIsDefect());
+ }
+ if (Func.isNotEmpty(operAppearanceVO.getCreateDept())) {
+ queryWrapper.eq(OperAppearanceEntity::getCreateDept, operAppearanceVO.getCreateDept());
+ }
+ if (Func.isNotEmpty(operAppearanceVO.getIsDiagnosis())) {
+ queryWrapper.eq(OperAppearanceEntity::getIsDiagnosis, operAppearanceVO.getIsDiagnosis());
+ }
+ queryWrapper.orderByDesc(OperAppearanceEntity::getUpdateTime);
+ }
+ return queryWrapper;
+ }
+}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
index 26cad87..9adc2e3 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
@@ -13,7 +13,6 @@ import com.hnac.hzims.operational.access.service.IOperAccessPlanService;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.access.service.impl.OperAccessPlanServiceImpl;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
-import com.hnac.hzims.operational.defect.constants.RepairConstant;
import com.hnac.hzims.operational.defect.dto.*;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
@@ -24,10 +23,9 @@ import com.hnac.hzims.operational.defect.vo.OperDefectVO;
import com.hnac.hzims.operational.defect.wrapper.OperDefectWrapper;
import com.hnac.hzims.operational.report.vo.DefectReportsVO;
import com.hnac.hzims.safeproduct.Constants;
-import com.hnac.hzims.ticket.repair.entity.RepairEntity;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
-import com.sun.javafx.binding.StringFormatter;
import lombok.AllArgsConstructor;
+import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
@@ -55,7 +53,6 @@ import org.springblade.system.cache.DictCache;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
@@ -69,7 +66,6 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@@ -122,8 +118,65 @@ public class OperDefectServiceImpl extends BaseServiceImpl getQueryWrapper(OperDefectVO defectVO) {
+ LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new OperDefectEntity(), defectVO);
+ if (ObjectUtils.isEmpty(defectVO)) {
+ if (defectVO.getActStartTime() != null) {
+ queryWrapper.ge(OperDefectEntity::getActStartTime, defectVO.getActStartTime());
+ }
+ if (defectVO.getActEndTime() != null) {
+ queryWrapper.le(OperDefectEntity::getActEndTime, defectVO.getActEndTime());
+ }
+ if (defectVO.getStartTime() != null) {
+ queryWrapper.ge(OperDefectEntity::getCreateTime, defectVO.getStartTime());
+ }
+ if (defectVO.getEndTime() != null) {
+ queryWrapper.le(OperDefectEntity::getCreateTime, defectVO.getEndTime());
+ }
+ if (defectVO.getCreateDept() != null) {
+ queryWrapper.eq(OperDefectEntity::getCreateDept, defectVO.getCreateDept());
+ }
+ if (StringUtil.isNotBlank(defectVO.getDefectCode())) {
+ queryWrapper.eq(OperDefectEntity::getId, defectVO.getDefectCode());
+ }
+ if (ObjectUtils.isNotEmpty(defectVO.getIsDiagnosis())) {
+ queryWrapper.eq(OperDefectEntity::getIsDiagnosis, defectVO.getIsDiagnosis());
+ }
+ if (Func.isNotEmpty(defectVO.getDefectGrading())) {
+ queryWrapper.like(OperDefectEntity::getDefectGrading, defectVO.getDefectGrading());
+ }
+ if (Func.isNotEmpty(defectVO.getConclusionLabel())) {
+ queryWrapper.like(OperDefectEntity::getConclusionLabel, defectVO.getConclusionLabel());
+ }
+ if (Func.isNotEmpty(defectVO.getDiagnosisId())) {
+ queryWrapper.eq(OperDefectEntity::getDiagnosisId, defectVO.getDiagnosisId());
+ }
+ if (Func.isNotEmpty(defectVO.getConclusionPeople())) {
+ queryWrapper.like(OperDefectEntity::getConclusionPeople, defectVO.getConclusionPeople());
+ }
+ if (Func.isNotEmpty(defectVO.getExistDefectId())) {
+ queryWrapper.eq(OperDefectEntity::getExistDefectId, defectVO.getExistDefectId());
+ }
+ if (Func.isNotEmpty(defectVO.getConclusionTime())) {
+ queryWrapper.le(OperDefectEntity::getConclusionTime, defectVO.getConclusionTime());
+ }
+ if (Func.isNotEmpty(defectVO.getConclusionEndTime())) {
+ queryWrapper.ge(OperDefectEntity::getConclusionTime, defectVO.getConclusionEndTime());
+ }
+ if (Func.isNotEmpty(defectVO.getConclusion())) {
+ queryWrapper.like(OperDefectEntity::getConclusion, defectVO.getConclusion());
+ }
+ if (Func.isNotEmpty(defectVO.getCreateDept())) {
+ queryWrapper.eq(OperDefectEntity::getCreateDept, defectVO.getCreateDept());
+ }
+ if (Func.isNotEmpty(defectVO.getIsDiagnosis())) {
+ queryWrapper.eq(OperDefectEntity::getIsDiagnosis, defectVO.getIsDiagnosis());
+ }
+ queryWrapper.orderByDesc(OperDefectEntity::getUpdateTime);
+ }
+ return queryWrapper;
+ }
/**
* 处理问题
*
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
index c2a247a..8373e6d 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
@@ -246,7 +246,7 @@ public class HomeServiceImpl implements HomeService {
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum();
double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum();
// 装机容量
- target.setTaget_one(list.stream().map(PowerEntity::getInstalledCapacity).collect(Collectors.toSet()).stream().mapToDouble(Double::valueOf).sum());
+ target.setTaget_one(list.get(0).getInstalledCapacity());
// 发电量
target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum());
if(Math.abs(plan) > 0){
@@ -254,7 +254,7 @@ public class HomeServiceImpl implements HomeService {
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
// 双票合格率
- target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
+ target.setTaget_four(BigDecimal.valueOf(pass / list.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
return target;
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java
index 9e0e69b..de1371d 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java
@@ -1,8 +1,8 @@
package com.hnac.hzims.operational.maintenance.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.maintenance.service.MaintenanceService;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
@@ -58,6 +58,7 @@ public class MaintenanceController {
maintenanceService.findPending(response);
return true;
} catch (Exception e) {
+ e.printStackTrace();
throw new ServiceException("日常维护待处理:" + e.getMessage());
}
}
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java
index 1fb0176..164901e 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java
@@ -2,7 +2,7 @@ package com.hnac.hzims.operational.maintenance.service;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import java.util.List;
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
index bf80bbc..0578a39 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
@@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.dto.PlanMsgRecordDto;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import com.hnac.hzims.message.fegin.IMessageClient;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity;
@@ -21,7 +23,6 @@ import com.hnac.hzims.operational.maintenance.service.MaintenanceService;
import com.hnac.hzims.operational.maintenance.template.service.TemplateService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskEntityVo;
import com.hnac.hzims.operational.util.StringObjUtils;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -113,6 +114,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @param response
*/
@Override
+ @Transactional(rollbackFor = RuntimeException.class)
public void findPending(ProcessWorkFlowResponse response) {
log.info("获取businessKey: {}", response.getBusinessKey());
log.info("获取taskId: {} ", response.getTaskId());
@@ -148,41 +150,70 @@ public class MaintenanceServiceImpl implements MaintenanceService {
//推送消息
if (response.getTaskId() != null) {
- MessagePushRecordDto message = new MessagePushRecordDto();
- message.setBusinessClassify("business");
- message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey());
- message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription());
- message.setTaskId(entity.getId());
- message.setTenantId("200000");
- message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
- message.setPushType(MessageConstants.IMMEDIATELY);
+ // MessagePushRecordDto message = new MessagePushRecordDto();
+ // message.setBusinessClassify("business");
+ // message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey());
+ // message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription());
+ // message.setTaskId(entity.getId());
+ // message.setTenantId("200000");
+ // message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
+ // message.setPushType(MessageConstants.IMMEDIATELY);
+ // //您有一张工作票待审批,工作内容:*****,审批环节:*****;
+ // String countent =
+ // "您有一条日常维护任务待审批,工作内容:".concat(entity.getTitle())
+ // .concat(",审批环节:")
+ // .concat(response.getTaskName());
+ // message.setContent(countent);
+ // message.setDeptId(entity.getCreateDept());
+ // R deptName = sysClient.getDeptName(entity.getCreateDept());
+ // if (deptName.isSuccess()) {
+ // message.setDeptName(deptName.getData());
+ // }
+ // String userIds = response.getUserId();
+ // if (com.hnac.hzims.common.logs.utils.StringUtils.isBlank(userIds)) {
+ // log.error("推送的消息不能为空哦,{}", userIds);
+ // return;
+ // }
+ // String[] split = userIds.split(",");
+ // for (String userId : split) {
+ // message.setPusher(userId);
+ // User user = UserCache.getUser(NumberUtils.toLong(userId));
+ // if (ObjectUtils.isNotEmpty(user)) {
+ // message.setPusherName(user.getName());
+ // }
+ // message.setAccount(userId);
+ // message.setCreateUser(NumberUtils.toLong(userId));
+ // messageClient.sendMessage(message);
+ // }
+ BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
+ businessMessageDTO.setBusinessClassify("business");
+ businessMessageDTO.setBusinessKey(MessageConstants.BusinessClassifyEnum.ROUTINEMAINTENANCE.getKey());
+ businessMessageDTO.setSubject(MessageConstants.BusinessClassifyEnum.ROUTINEMAINTENANCE.getDescription());
+ businessMessageDTO.setTaskId(dbOperMaintenanceTaskEntity.getId());
+ businessMessageDTO.setTenantId("200000");
//您有一张工作票待审批,工作内容:*****,审批环节:*****;
String countent =
- "您有一条日常维护任务待审批,工作内容:".concat(entity.getTitle())
+ "您有一条日常维护任务待审批,工作内容:".concat(dbOperMaintenanceTaskEntity.getTitle())
.concat(",审批环节:")
.concat(response.getTaskName());
- message.setContent(countent);
- message.setDeptId(entity.getCreateDept());
- R deptName = sysClient.getDeptName(entity.getCreateDept());
+ businessMessageDTO.setContent(countent);
+ businessMessageDTO.setDeptId(dbOperMaintenanceTaskEntity.getCreateDept());
+ R deptName = sysClient.getDeptName(dbOperMaintenanceTaskEntity.getCreateDept());
if (deptName.isSuccess()) {
- message.setDeptName(deptName.getData());
+ businessMessageDTO.setDeptName(deptName.getData());
}
String userIds = response.getUserId();
- if (com.hnac.hzims.common.logs.utils.StringUtils.isBlank(userIds)) {
- log.error("推送的消息不能为空哦,{}", userIds);
- return;
- }
- String[] split = userIds.split(",");
- for (String userId : split) {
- message.setPusher(userId);
- User user = UserCache.getUser(NumberUtils.toLong(userId));
- if (ObjectUtils.isNotEmpty(user)) {
- message.setPusherName(user.getName());
- }
- message.setAccount(userId);
- message.setCreateUser(NumberUtils.toLong(userId));
- messageClient.sendMessage(message);
+ businessMessageDTO.setUserIds(userIds);
+ businessMessageDTO.setCreateUser(dbOperMaintenanceTaskEntity.getCreateUser());
+
+ log.info("================================================");
+ log.info("businessMessageDTO = " + businessMessageDTO);
+ log.info("================================================");
+ R booleanR = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO);
+ if (!booleanR.isSuccess()) {
+ throw new ServiceException("消息推送失败");
}
+ log.info("推送成功~");
}
}
diff --git a/hzims-service/operational/src/main/resources/db/2.0.0.sql b/hzims-service/operational/src/main/resources/db/2.0.0.sql
new file mode 100644
index 0000000..905c8f0
--- /dev/null
+++ b/hzims-service/operational/src/main/resources/db/2.0.0.sql
@@ -0,0 +1,575 @@
+SET FOREIGN_KEY_CHECKS=0;
+
+CREATE TABLE `hzims_operation`.`ecology_flow_data` (
+ `ID` bigint(20) NOT NULL COMMENT '主键ID',
+ `STATION_ID` bigint(20) NULL DEFAULT NULL COMMENT '站点编号',
+ `STATION_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点名称',
+ `MON` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '月份',
+ `ON_LINE` decimal(15, 2) NULL DEFAULT NULL COMMENT '在线率',
+ `DEMONSTRATE` decimal(15, 2) NULL DEFAULT NULL COMMENT '达标率',
+ `TIMELY` decimal(15, 2) NULL DEFAULT NULL COMMENT '及时率',
+ `COMPLETE` decimal(15, 2) NULL DEFAULT NULL COMMENT '完整率',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
+ `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
+ `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
+ `STATUS` tinyint(4) NOT NULL COMMENT '状态',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`ecology_flow_station` (
+ `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+ `STATION_ID` bigint(20) NULL DEFAULT NULL COMMENT '站点编号',
+ `STATION_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点名称',
+ `IS_ON_LINE` bigint(1) NULL DEFAULT NULL COMMENT '是否在线:0-离线 1-在线',
+ `IS_DEMONSTRATE` bigint(1) NULL DEFAULT NULL COMMENT '是否达标:0-不达标 1-达标',
+ `IS_TIMELY` bigint(1) NULL DEFAULT NULL COMMENT '是否及时:0-不及时 1-及时',
+ `IS_COMPLETE` bigint(1) NULL DEFAULT NULL COMMENT '是否完整:0-不完整 1-完整',
+ `CITY` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '城市: 0-黔东南 1-广宁',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
+ `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
+ `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
+ `STATUS` tinyint(4) NOT NULL COMMENT '状态',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+ALTER TABLE `hzims_operation`.`hz_ims_duty_main_template` MODIFY COLUMN `DUTY_ORDER_IDS` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班组值班周期id' AFTER `TYPE`;
+
+ALTER TABLE `hzims_operation`.`hzims_fill_over` MODIFY COLUMN `ENCL_NAME` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件名称' AFTER `ENCL_PATH`;
+
+ALTER TABLE `hzims_operation`.`hzims_fill_over_config` MODIFY COLUMN `SORT` tinyint(4) NOT NULL COMMENT '排序' AFTER `UNIT_PRICE`;
+
+ALTER TABLE `hzims_operation`.`hzims_fill_over_config` ADD UNIQUE INDEX `OVER_NAME`(`OVER_NAME`) USING BTREE;
+
+ALTER TABLE `hzims_operation`.`hzims_fill_power` MODIFY COLUMN `POWER_MON` double(20, 2) NULL DEFAULT 0.00 COMMENT '月发电量' AFTER `PLANNED_POWER_MON`;
+
+CREATE TABLE `hzims_operation`.`hzims_fill_wind` (
+ `ID` bigint(20) NOT NULL COMMENT '主键ID',
+ `STATION_CODE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点编号',
+ `STATION_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点名称',
+ `FILL_DATE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '填报日期',
+ `PLAN` decimal(15, 2) NULL DEFAULT NULL COMMENT '计划发电量',
+ `POWER` decimal(15, 2) NULL DEFAULT NULL COMMENT '发电量',
+ `SPEED` decimal(15, 2) NULL DEFAULT NULL COMMENT '平均风速',
+ `SURF_POWER` decimal(15, 2) NULL DEFAULT NULL COMMENT '上网电量',
+ `BELOW_POWER` decimal(15, 2) NULL DEFAULT NULL COMMENT '下网电量',
+ `AVAILABLE` decimal(15, 2) NULL DEFAULT NULL COMMENT '可用时长',
+ `COMPREHENSIVE_POWER` decimal(15, 2) NULL DEFAULT NULL COMMENT '综合用电量',
+ `PEAK` decimal(15, 2) NULL DEFAULT NULL COMMENT '峰值功率',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
+ `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
+ `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
+ `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+ALTER TABLE `hzims_operation`.`hzims_history_abnormal_alarm` MODIFY COLUMN `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位' AFTER `SOE_EXPLAIN`;
+
+ALTER TABLE `hzims_operation`.`hzims_history_abnormal_alarm` MODIFY COLUMN `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人' AFTER `CREATE_DEPT`;
+
+ALTER TABLE `hzims_operation`.`hzims_history_abnormal_alarm` MODIFY COLUMN `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '业务状态' AFTER `TENANT_ID`;
+
+ALTER TABLE `hzims_operation`.`hzims_history_abnormal_alarm` MODIFY COLUMN `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间' AFTER `UPDATE_USER`;
+
+ALTER TABLE `hzims_operation`.`hzims_history_abnormal_alarm` MODIFY COLUMN `IS_DELETED` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除' AFTER `UPDATE_TIME`;
+
+ALTER TABLE `hzims_operation`.`hzims_main_work_bench` MODIFY COLUMN `ORD` int(11) NULL DEFAULT NULL COMMENT '排序' AFTER `ENABLE_FLAG`;
+
+ALTER TABLE `hzims_operation`.`hzims_main_work_bench` MODIFY COLUMN `REF_DEPT` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属机构' AFTER `ORD`;
+
+ALTER TABLE `hzims_operation`.`hzims_month_report` MODIFY COLUMN `OBJECT` blob NULL COMMENT '报表保存对象' AFTER `TYPE`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_access_plan` MODIFY COLUMN `phenomenon_id` bigint(20) NULL DEFAULT NULL COMMENT '现象ID' AFTER `DESCRIPITON`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_access_plan` DROP COLUMN `TASK_NAME`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_access_plan` DROP COLUMN `NEXT_STEP_OPERATOR`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_access_task` ADD COLUMN `MESSAGE_TEMPLATE_ID` bigint(20) NULL DEFAULT NULL COMMENT '模板id' AFTER `phenomenon_id`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_access_task` MODIFY COLUMN `PROCESS_INSTANCE_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '工作流实例' AFTER `EM_CODE`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_access_task` MODIFY COLUMN `ticket_id` bigint(20) NULL DEFAULT NULL AFTER `UPDATE_TIME`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_access_task` MODIFY COLUMN `delay_date` datetime(0) NULL DEFAULT NULL AFTER `ticket_id`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_access_task` MODIFY COLUMN `DELAY_STATUS` tinyint(4) NULL DEFAULT NULL AFTER `delay_date`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_fault` MODIFY COLUMN `FAULT_TYPE` tinyint(4) NULL DEFAULT NULL COMMENT '0- 标准;1 - 非标准' AFTER `FAULT_NAME`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_library` MODIFY COLUMN `EM_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编码' AFTER `PROC_DEF_ID`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_plan` MODIFY COLUMN `EM_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编码' AFTER `ID`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_plan` MODIFY COLUMN `TASK_TYPE` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '0:系统生成任务,1:临时任务' AFTER `UPDATE_TIME`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `EM_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编码' AFTER `ID`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `TASK_CODE` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `TYPE_CODE`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `DISPOSER` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '执行人(按,分隔)' AFTER `PROCESS_INSTANCE_ID`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `DISPOSE_TIME` datetime(0) NOT NULL COMMENT '任务按周期生成计划开始时间' AFTER `DISPOSER`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `EXECUTE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '任务执行日期' AFTER `DISPOSE_TIME`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `PUSH_MSG_STATUS` tinyint(4) NULL DEFAULT 0 COMMENT '消息推送状态 0=未推送 1=已推送' AFTER `DESCRIPTION`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `TASK_TYPE` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '0:系统生成任务,1:临时任务' AFTER `UPDATE_TIME`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `DELAY_STATUS` tinyint(4) NULL DEFAULT NULL AFTER `TASK_TYPE`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `DELAY_DATE` datetime(0) NULL DEFAULT NULL AFTER `DELAY_STATUS`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `ticket_id` bigint(20) NULL DEFAULT NULL AFTER `DELAY_DATE`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `PLAN_END_TIME` datetime(0) NULL DEFAULT NULL AFTER `ticket_id`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `flow_status` int(11) NULL DEFAULT NULL COMMENT '流程状态' AFTER `MESSAGE_TEMPLATE_ID`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `flow_description` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程描述' AFTER `flow_status`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `next_step_operator` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '下一个审批人' AFTER `flow_description`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `flow_task_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务名' AFTER `flow_user_id`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_maintenance_task` MODIFY COLUMN `flow_task_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务名' AFTER `flow_task_name`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_phenomenon` MODIFY COLUMN `EM_CODE` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编号' AFTER `NAME`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_phenomenon` MODIFY COLUMN `HANDLE_TASK_ID` bigint(20) NULL DEFAULT NULL COMMENT '处理任务ID' AFTER `HANDLE_TYPE`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_phenomenon` MODIFY COLUMN `HANDLER` bigint(20) NULL DEFAULT NULL COMMENT '处理人,处理工作流的第一个处理人' AFTER `HANDLE_TASK_ID`;
+
+ALTER TABLE `hzims_operation`.`hzims_oper_phenomenon` MODIFY COLUMN `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人' AFTER `UPDATE_TIME`;
+
+CREATE TABLE `hzims_operation`.`hzims_oper_repair` (
+ `ID` bigint(20) NOT NULL COMMENT '主键ID',
+ `EM_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备code',
+ `NUMBER` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编号',
+ `COMPANY` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位',
+ `HANDLE_STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '处理状态',
+ `CHARGE` bigint(20) NULL DEFAULT NULL COMMENT '应急抢修负责人',
+ `REPAIR_TEAM` bigint(20) NULL DEFAULT NULL COMMENT '应急抢修班组',
+ `REPAIR_PERSONNEL` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应急抢修人员',
+ `REPAIR_TASK` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应急抢修任务描述',
+ `ORIGINATOR` bigint(20) NULL DEFAULT NULL COMMENT '应急抢修发起人',
+ `SAFETY_MEASURES` varchar(2080) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '安全措施',
+ `POINTS_ATTENTION` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '注意事项',
+ `LICENSOR` bigint(20) NULL DEFAULT NULL COMMENT '许可人',
+ `LICENSOR_TIME` datetime(0) NULL DEFAULT NULL COMMENT '许可时间',
+ `LICENSOR_MEASURES` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '许可建议安全措施',
+ `LICENSOR_MEMO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '抢修完成许可描述',
+ `LICENSOR_COMPLETE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '抢修完成许可时间',
+ `IMPLEMENT_HOURS` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '抢修工时',
+ `IMPLEMENT_START_TIME` datetime(0) NULL DEFAULT NULL COMMENT '抢修开始时间',
+ `IMPLEMENT_END_TIME` datetime(0) NULL DEFAULT NULL COMMENT '抢修结束时间',
+ `IMPLEMENT_DESC` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '抢修描述',
+ `PROCESS_INSTANCE_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程实例ID',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
+ `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
+ `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
+ `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 ',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`hzims_review_standard` (
+ `id` bigint(20) NOT NULL COMMENT '主键ID',
+ `review_id` bigint(20) NOT NULL COMMENT '评审ID',
+ `standard_id` tinyint(4) NOT NULL COMMENT '标准ID',
+ `standard_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标准名称',
+ `score` tinyint(4) NULL DEFAULT NULL COMMENT '分数',
+ `status` tinyint(4) NULL DEFAULT NULL COMMENT '业务状态',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `IS_DELETED` tinyint(4) NULL DEFAULT NULL,
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+ALTER TABLE `hzims_operation`.`hzims_station` DROP INDEX `hzims_station_pk`;
+
+ALTER TABLE `hzims_operation`.`hzims_station_user` MODIFY COLUMN `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人' AFTER `UPDATE_TIME`;
+
+ALTER TABLE `hzims_operation`.`hzims_station_video_type` MODIFY COLUMN `video_type` tinyint(4) NULL DEFAULT NULL COMMENT '视频类型;默认为1:清污机类型' AFTER `SORT`;
+
+ALTER TABLE `hzims_operation`.`hzims_unit_running_time` MODIFY COLUMN `DATE_TIME` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '年月' AFTER `EM_CODE`;
+
+CREATE TABLE `hzims_operation`.`temp` (
+ `db_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `tablename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `LieName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`temp_dept_sync` (
+ `id` bigint(20) NOT NULL,
+ `old_dept_id` bigint(20) NULL DEFAULT NULL COMMENT '旧机构ID',
+ `new_dept_id` bigint(20) NULL DEFAULT NULL COMMENT '新机构ID',
+ `is_sync` tinyint(255) NULL DEFAULT NULL COMMENT '是否同步',
+ `dept_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构名称',
+ `execute_time` datetime(0) NULL DEFAULT NULL COMMENT '执行时间',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `IS_DELETED` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '机构同步表' ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`temp_sync_info` (
+ `sync_id` bigint(20) NOT NULL COMMENT '同步ID',
+ `db_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据库',
+ `table_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '表',
+ `column_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列',
+ `be_replaced` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '被替换值',
+ `replaced` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '替换值',
+ `replaced_sql` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '替换sql',
+ `create_time` datetime(0) NULL DEFAULT NULL COMMENT '执行时间',
+ `bak_replaced_sql` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '还原sql',
+ `status` tinyint(4) NULL DEFAULT NULL COMMENT '执行状态'
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_allocation` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单据号',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '流程状态',
+ `RPOC_INS_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流实例ID',
+ `IN_WAREHOUSE_ID` bigint(20) NULL DEFAULT NULL COMMENT '入库仓库',
+ `OUT_WAREHOUSE_ID` bigint(20) NULL DEFAULT NULL COMMENT '出库仓库',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_basic` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `MANAGEMENT_ID` bigint(20) NULL DEFAULT NULL COMMENT '分类ID',
+ `NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
+ `CODE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编码',
+ `SPECIFICATIONS` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格',
+ `BRAND` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '品牌',
+ `UNIT` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位',
+ `WEIGHT` decimal(10, 2) NULL DEFAULT NULL COMMENT '重量',
+ `PRICE` decimal(10, 2) NULL DEFAULT NULL COMMENT '单价',
+ `UPPER_LIMIT` int(10) NULL DEFAULT NULL COMMENT '库存上限',
+ `LOWER_LIMIT` int(10) NULL DEFAULT NULL COMMENT '库存下限',
+ `IS_WASTE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否回收废品',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '业务状态',
+ `PARAMETER` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '主要参数',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ `CODE_NUMBER` bigint(20) NULL DEFAULT NULL COMMENT '序列号',
+ `WATER_PLANT_ID` bigint(16) NULL DEFAULT NULL COMMENT '水厂ID',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_management` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `tenant_id` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分类名称',
+ `PARENT_ID` bigint(20) NULL DEFAULT NULL COMMENT '所属父级',
+ `ANCESTORS` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '祖级节点',
+ `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分类编码',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '业务状态',
+ `TYPE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备品备件:1,工具:2',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ `CODE_NUMBER` bigint(20) NULL DEFAULT NULL COMMENT '序列号',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_provider` (
+ `ID` bigint(20) NOT NULL COMMENT '主键ID',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `ORGANIZATION_ID` bigint(20) NULL DEFAULT NULL COMMENT '机构ID',
+ `ORGANIZATION_CODE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机构编码',
+ `SCOPE_OF_SUPPLY` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '供货范围',
+ `SUPPLY_CYCLE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '供货周期',
+ `NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
+ `LOGOGRAM` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称缩写',
+ `SALESMAN` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '业务联系人',
+ `LEGAL_PERSON` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '法人代表',
+ `PHONE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话',
+ `MOBILE_PHONE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机',
+ `WEBSITE` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网址',
+ `ADDRESS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址',
+ `QUALIFIED_FLAG` int(11) NULL DEFAULT 1 COMMENT '是否合格(0:否,1:是)',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(2) NULL DEFAULT NULL COMMENT '业务状态',
+ `REMARK` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(2) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_receive` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单据号',
+ `TICKET_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工单ID',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '流程状态',
+ `RPOC_INS_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流实例ID',
+ `STORAGE_ROOM` bigint(20) NULL DEFAULT NULL COMMENT '仓库库房',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_receives` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单据号',
+ `TICKET_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工单ID',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '流程状态',
+ `RPOC_INS_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流实例ID',
+ `STORAGE_ROOM` bigint(20) NULL DEFAULT NULL COMMENT '仓库库房',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ `VECEIVE_ID` bigint(20) NULL DEFAULT NULL COMMENT '工具领用单ID',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_record` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `BUSINESS_ID` bigint(20) NULL DEFAULT NULL COMMENT '业务表ID',
+ `AMOUNT` int(11) NULL DEFAULT NULL COMMENT '数量AMOUNT',
+ `SP_BASIC_ID` bigint(20) NULL DEFAULT NULL COMMENT '备品备件ID',
+ `WAREHOUSE_ID` bigint(20) NULL DEFAULT NULL COMMENT '所属仓库',
+ `TYPE` int(11) NULL DEFAULT NULL COMMENT '类型1:入库,2:出库,3:调拨,4:领用',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(2) NULL DEFAULT NULL COMMENT '业务状态',
+ `IS_DELETED` int(2) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_revert` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单据号',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '流程状态',
+ `RPOC_INS_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流实例ID',
+ `STORAGE_ROOM` bigint(20) NULL DEFAULT NULL COMMENT '仓库库房',
+ `AMOUNT` int(11) NULL DEFAULT NULL COMMENT '数量',
+ `SP_BASIC_ID` bigint(20) NULL DEFAULT NULL COMMENT '对应备件ID',
+ `NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备品备件名称',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `CURRENT_OPERATOR` bigint(20) NULL DEFAULT NULL COMMENT '当前处理人',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_ticket_relation` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `ORDER_ID` bigint(20) NULL DEFAULT NULL COMMENT '出库单ID',
+ `AMOUNT` int(11) NULL DEFAULT NULL COMMENT '数量',
+ `TICKET` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工单号',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `SP_BASIC_ID` bigint(20) NULL DEFAULT NULL COMMENT '备件ID',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(2) NULL DEFAULT NULL COMMENT '业务状态',
+ `IS_DELETED` int(2) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_tool_basic` (
+ `ID` bigint(20) NOT NULL COMMENT '主键ID',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `SP_BASIC_ID` bigint(20) NULL DEFAULT NULL COMMENT '对应备件ID',
+ `QUALITY_GUARANTEE_PERIOD` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '保质期',
+ `PRODUCTION_PERIOD` datetime(0) NULL DEFAULT NULL COMMENT '生产日期',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '领用时间',
+ `CREATE_USER` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领用人',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `ATACHMENT_ID` bigint(20) NULL DEFAULT NULL COMMENT '类型(文件类型)',
+ `QUANTITY_RECEIVED` bigint(20) NULL DEFAULT NULL COMMENT '领用数量',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '业务状态',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ `WAREHOUSE_ID` bigint(20) NULL DEFAULT NULL COMMENT '所属仓库',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_total` (
+ `ID` bigint(20) NOT NULL COMMENT '主键ID',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `SP_BASIC_ID` bigint(20) NULL DEFAULT NULL COMMENT '对应备件ID',
+ `MIN_STOCK` bigint(20) NULL DEFAULT NULL COMMENT '最低储备量',
+ `MAX_STOCK` bigint(20) NULL DEFAULT NULL COMMENT '最高储备量',
+ `STOCK` bigint(20) NULL DEFAULT NULL COMMENT '库存',
+ `IN_PRICE` decimal(12, 2) NULL DEFAULT NULL COMMENT '最新入库单价',
+ `OUT_PRICE` decimal(12, 2) NULL DEFAULT NULL COMMENT '最新出库单价',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '业务状态',
+ `OUT_STOCK` bigint(20) NULL DEFAULT NULL COMMENT '出库暂存',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ `WARNING_STOCK` bigint(20) NULL DEFAULT NULL COMMENT '警戒百分比',
+ `WAREHOUSE_ID` bigint(20) NULL DEFAULT NULL COMMENT '所属仓库ID',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_type_dictionaries` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分类名称',
+ `CODE` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编码',
+ `P_CODE` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '上级编码',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '业务状态',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_warehouse` (
+ `ID` bigint(20) NOT NULL COMMENT '主键ID',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `ADDRESS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址',
+ `CODE` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编码',
+ `NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
+ `MANAGER` bigint(20) NULL DEFAULT NULL COMMENT '负责人',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '业务状态',
+ `STOCK` bigint(20) NULL DEFAULT NULL COMMENT '当前存量',
+ `MAX_STOCK` bigint(20) NULL DEFAULT NULL COMMENT '库存上限',
+ `MIN_STOCK` bigint(20) NULL DEFAULT NULL COMMENT '库存下限',
+ `WARNING_STOCK` bigint(20) NULL DEFAULT NULL COMMENT '警戒百分比',
+ `REMARK` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ `AFFILIATED_UNIT` bigint(20) NULL DEFAULT NULL COMMENT '所属单位',
+ `AFFILIATED_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属单位名称',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_warehouse_in` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单据号',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `TYPE` bigint(20) NULL DEFAULT NULL COMMENT '入库类型',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '业务状态',
+ `RPOC_INS_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流实例ID',
+ `STORAGE_ROOM` bigint(20) NULL DEFAULT NULL COMMENT '仓库库房',
+ `CURRENT_OPERATOR` bigint(20) NULL DEFAULT NULL COMMENT '当前处理人',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ `TICKET_CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工单编号',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_warehouse_in_record` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '出入库编号',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '业务状态',
+ `TITLE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题',
+ `STORAGE_ROOM` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '仓库库房',
+ `TYPE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型,用枚举来判断是工具还是备品备件',
+ `OPERATION` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作:用枚举来判断是出库还是入库',
+ `AMOUNT` int(11) NULL DEFAULT NULL COMMENT '数量',
+ `SP_BASIC_ID` bigint(20) NULL DEFAULT NULL COMMENT '备品备件ID',
+ `NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备品备件名称',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims_operation`.`wt_sp_warehouse_out` (
+ `ID` bigint(20) NOT NULL COMMENT '主键',
+ `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '部门ID',
+ `CODE` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单据号',
+ `CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+ `CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+ `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
+ `STATUS` int(11) NULL DEFAULT NULL COMMENT '流程状态',
+ `RPOC_INS_ID` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流实例ID',
+ `STORAGE_ROOM` bigint(20) NULL DEFAULT NULL COMMENT '仓库库房',
+ `REMARKS` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
+ `IS_DELETED` int(11) NULL DEFAULT 0 COMMENT '是否已删除(0:否,1:是)',
+ `TYPE` bigint(20) NULL DEFAULT NULL COMMENT '出库类型',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
diff --git a/hzims-service/pom.xml b/hzims-service/pom.xml
index b690007..5db9e32 100644
--- a/hzims-service/pom.xml
+++ b/hzims-service/pom.xml
@@ -55,6 +55,14 @@
org.springblade
blade-starter-datascope
+
+
+
+
+ com.hnac.hzims
+ middle-api
+ 4.0.0-SNAPSHOT
+
diff --git a/hzims-service/ticket/pom.xml b/hzims-service/ticket/pom.xml
index 9325e7a..181070e 100644
--- a/hzims-service/ticket/pom.xml
+++ b/hzims-service/ticket/pom.xml
@@ -280,6 +280,11 @@
+
+ com.hnac.hzims
+ middle-api
+ 4.0.0-SNAPSHOT
+
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java
index 8860871..f2b745f 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/redisConsume/WorkTicketMsgConsume.java
@@ -2,10 +2,10 @@ package com.hnac.hzims.ticket.redisConsume;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.common.config.RedisMessageListener;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/OperRepairServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/OperRepairServiceImpl.java
index f18fb8c..4f5976c 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/OperRepairServiceImpl.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/OperRepairServiceImpl.java
@@ -355,7 +355,7 @@ public class OperRepairServiceImpl extends BaseServiceImpl deptName = sysClient.getDeptName(2000000115L);
+ if (deptName.isSuccess()) {
+ businessMessageDTO.setDeptName(deptName.getData());
+ }
+ String userIds = "1522897714092781569";
+ businessMessageDTO.setUserIds(userIds);
+ businessMessageDTO.setCreateUser(1522897714092781569L);
+
+ System.out.println("businessMessageDTO = " + businessMessageDTO);
+
+ R booleanR = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO);
+ if (!booleanR.isSuccess()) {
+ throw new ServiceException("消息推送失败");
+ }else {
+ System.out.println("推送成功");
+ }
+
+ }
+
+
}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java
index af1d2bc..f2e930b 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java
@@ -113,7 +113,6 @@ public class StandardTicketInfoController extends BladeController {
/**
* 根据月份,区域 获取操作详情数据
- *
* @return
*/
@GetMapping("/areaMonthlyWithOperation/{page}/{size}")
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java
index da8d606..4d5df20 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/OperationTicketService.java
@@ -1,8 +1,8 @@
package com.hnac.hzims.ticket.standardTicket.service;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import javax.servlet.http.HttpServletResponse;
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
index c42e186..0ab4599 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
@@ -5,12 +5,13 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.hnac.hzims.common.logs.fegin.ProcessDictFeignService;
import com.hnac.hzims.common.logs.utils.StringUtils;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
+import com.hnac.hzims.middle.process.feign.ProcessDictFeignService;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.ticket.constants.TicketConstants;
@@ -42,6 +43,7 @@ import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@@ -52,7 +54,7 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
-import static com.hnac.hzims.common.logs.constant.TicketProcessConstant.OPERATION_TICKET_KEY;
+import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.OPERATION_TICKET_KEY;
/**
@@ -77,7 +79,6 @@ public class OperationTicketServiceImpl implements OperationTicketService {
private final ProcessDictFeignService processDictFeignService;
-
private final IFlowClient flowClient;
@@ -133,8 +134,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
//3. 保存操作对象
this.saveStandardTicketInfo(standardTicketInfoVo);
//5. 保存安全措施
- List standardTicketInfoVos = this.saveStandardTicketMeasure(
- this.saveStandardTicketMeasureWichTicket(standardTicketInfoVo));
+ List standardTicketInfoVos = this.saveStandardTicketMeasure(this.saveStandardTicketMeasureWichTicket(standardTicketInfoVo));
standardTicketInfoVo.setStandardTicketMeasureVos(standardTicketInfoVos);
//6. 查询第操作票值
String dictValue = processDictFeignService.selectDictValueByKey(OPERATION_TICKET_KEY);
@@ -152,6 +152,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
* @param response
*/
@Override
+ @Transactional(rollbackFor = RuntimeException.class)
public void findPending(ProcessWorkFlowResponse response) {
log.info("获取businessKey: {}", response.getBusinessKey());
log.info("获取taskId: {} ", response.getTaskId());
@@ -168,9 +169,9 @@ public class OperationTicketServiceImpl implements OperationTicketService {
standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, StandardTicketInfoVo.class);
} catch (Exception e) {
log.error("获取表单出现异常了~~~~");
+ e.printStackTrace();
throw new IllegalArgumentException(e.getMessage());
}
-
//1.查询操作票信息
Long id = NumberUtils.toLong(response.getBusinessKey());
StandardTicketInfoEntity standardTicketInfoEntity = standardTicketInfoService.getById(id);
@@ -178,15 +179,18 @@ public class OperationTicketServiceImpl implements OperationTicketService {
log.error("获取操作票不存在");
return;
}
+
//设置id
StandardTicketInfoEntity newStandardTicketInfoEntity = new StandardTicketInfoEntity();
BeanUtils.copyProperties(standardTicketInfoVo, newStandardTicketInfoEntity);
newStandardTicketInfoEntity.setId(id);
+ newStandardTicketInfoEntity.setCreateUser(standardTicketInfoEntity.getCreateUser());
//填充操作票信息
saveStandardTicketInfoEntity(newStandardTicketInfoEntity, response);
newStandardTicketInfoEntity.setProcessInstanceId(response.getProcessInstanceId());
standardTicketInfoService.updateById(newStandardTicketInfoEntity);
+
//更新安全措施
List standardTicketMeasureVos = standardTicketInfoVo.getStandardTicketMeasureVos();
if (CollectionUtils.isNotEmpty(standardTicketMeasureVos)) {
@@ -198,45 +202,70 @@ public class OperationTicketServiceImpl implements OperationTicketService {
standardTicketMeasureService.updateBatchById(standardTicketMeasureEntities);
}
-
//推送消息
if (response.getTaskId() != null) {
- MessagePushRecordDto message = new MessagePushRecordDto();
- message.setBusinessClassify("business");
- message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey());
- message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription());
- message.setTaskId(standardTicketInfoEntity.getId());
- message.setTenantId("200000");
- message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
- message.setPushType(MessageConstants.IMMEDIATELY);
+ // MessagePushRecordDto message = new MessagePushRecordDto();
+ // message.setBusinessClassify("business");
+ // message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey());
+ // message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription());
+ // message.setTaskId(standardTicketInfoEntity.getId());
+ // message.setTenantId("200000");
+ // message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
+ // message.setPushType(MessageConstants.IMMEDIATELY);
+ // //您有一张工作票待审批,工作内容:*****,审批环节:*****;
+ // String countent = "您有一张工作票待审批,工作内容:".concat(standardTicketInfoEntity.getTitle()).concat(",审批环节:").concat(response.getTaskName());
+ // message.setContent(countent);
+ // message.setDeptId(standardTicketInfoEntity.getCreateDept());
+ // R deptName = sysClient.getDeptName(standardTicketInfoEntity.getCreateDept());
+ // if (deptName.isSuccess()) {
+ // message.setDeptName(deptName.getData());
+ // }
+ // String userIds = response.getUserId();
+ // if (StringUtils.isBlank(userIds)) {
+ // log.error("推送的消息不能为空哦,{}", userIds);
+ // return;
+ // }
+ // String[] split = userIds.split(",");
+ // for (String userId : split) {
+ // message.setPusher(userId);
+ // User user = UserCache.getUser(NumberUtils.toLong(userId));
+ // if (ObjectUtils.isNotEmpty(user)) {
+ // message.setPusherName(user.getName());
+ // }
+ // message.setAccount(userId);
+ //
+ // message.setCreateUser(NumberUtils.toLong(userId));
+ // messageClient.sendMessage(message);
+ // }
+ BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
+ businessMessageDTO.setBusinessClassify("business");
+ businessMessageDTO.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey());
+ businessMessageDTO.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription());
+ businessMessageDTO.setTaskId(standardTicketInfoEntity.getId());
+ businessMessageDTO.setTenantId("200000");
//您有一张工作票待审批,工作内容:*****,审批环节:*****;
String countent =
"您有一张工作票待审批,工作内容:".concat(standardTicketInfoEntity.getTitle())
.concat(",审批环节:")
.concat(response.getTaskName());
- message.setContent(countent);
- message.setDeptId(standardTicketInfoEntity.getCreateDept());
+ businessMessageDTO.setContent(countent);
+ businessMessageDTO.setDeptId(standardTicketInfoEntity.getCreateDept());
R deptName = sysClient.getDeptName(standardTicketInfoEntity.getCreateDept());
if (deptName.isSuccess()) {
- message.setDeptName(deptName.getData());
+ businessMessageDTO.setDeptName(deptName.getData());
}
String userIds = response.getUserId();
- if (StringUtils.isBlank(userIds)) {
- log.error("推送的消息不能为空哦,{}", userIds);
- return;
- }
- String[] split = userIds.split(",");
- for (String userId : split) {
- message.setPusher(userId);
- User user = UserCache.getUser(NumberUtils.toLong(userId));
- if (ObjectUtils.isNotEmpty(user)) {
- message.setPusherName(user.getName());
- }
- message.setAccount(userId);
-
- message.setCreateUser(NumberUtils.toLong(userId));
- messageClient.sendMessage(message);
+ businessMessageDTO.setUserIds(userIds);
+ businessMessageDTO.setCreateUser(newStandardTicketInfoEntity.getCreateUser());
+
+ System.out.println("================================================");
+ System.out.println("businessMessageDTO = " + businessMessageDTO);
+ System.out.println("================================================");
+ R booleanR = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO);
+ if (!booleanR.isSuccess()) {
+ throw new ServiceException("消息推送失败");
}
+ log.info("推送成功~");
}
}
@@ -249,19 +278,23 @@ public class OperationTicketServiceImpl implements OperationTicketService {
*/
private void saveStandardTicketInfoEntity(StandardTicketInfoEntity newStandardTicketInfoEntity, ProcessWorkFlowResponse response) {
String flowDescription = "";
- //如果response.getHandleType() 是0使用户
- newStandardTicketInfoEntity.setFlowUserId(response.getUserId());
- newStandardTicketInfoEntity.setNextStepOperator(response.getNextStepOperator());
- flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(response.getNextStepOperator()).concat("审批");
+
+ if (response.getNextStepOperator() != null) {
+ flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(response.getNextStepOperator()).concat("审批");
+ }
//如果taskId为空
String taskId = response.getTaskId();
- if (StringUtils.isEmpty(taskId)) {
+ log.info("StringUtils.isBlank(taskId) = " + StringUtils.isBlank(taskId));
+ if (StringUtils.isBlank(taskId)) {
newStandardTicketInfoEntity.setFlowDescription("结束");
newStandardTicketInfoEntity.setFlowTaskId(" ");
newStandardTicketInfoEntity.setFlowTaskName("结束");
newStandardTicketInfoEntity.setNextStepOperator(" ");
newStandardTicketInfoEntity.setFlowStatus(999);
} else {
+ //如果response.getHandleType() 是0使用户
+ newStandardTicketInfoEntity.setFlowUserId(response.getUserId());
+ newStandardTicketInfoEntity.setNextStepOperator(response.getNextStepOperator());
newStandardTicketInfoEntity.setFlowTaskId(taskId);
newStandardTicketInfoEntity.setFlowTaskName(response.getTaskName());
newStandardTicketInfoEntity.setFlowDescription(flowDescription);
@@ -281,8 +314,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
params.put("taskId", standardTicketInfoVo.getId());
params.put("guardianUserIds", "taskUser_".concat(standardTicketInfoVo.getGuardian().toString()));
//已开启流程
- R processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(dictValue,
- String.valueOf(standardTicketInfoVo.getId()), standardTicketInfoVo.getTitle(), params);
+ R processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(dictValue, String.valueOf(standardTicketInfoVo.getId()), standardTicketInfoVo.getTitle(), params);
if (!processInstanceContainNameByKey.isSuccess()) {
log.error("processInstanceContainNameByKey {}", processInstanceContainNameByKey.getMsg());
throw new ServiceException("不好意思,您暂无权限...");
@@ -304,8 +336,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
private List saveStandardTicketMeasureWichTicket(StandardTicketInfoVo standardTicketInfoVo) {
List standardTicketMeasureVos = standardTicketInfoVo.getStandardTicketMeasureVos();
if (CollectionUtils.isNotEmpty(standardTicketMeasureVos)) {
- List measureEntityList = BeanUtil.copyProperties(standardTicketMeasureVos,
- StandardTicketMeasureEntity.class);
+ List measureEntityList = BeanUtil.copyProperties(standardTicketMeasureVos, StandardTicketMeasureEntity.class);
List collect = measureEntityList.stream().map(item -> {
item.setTicketId(standardTicketInfoVo.getId());
return item;
@@ -379,8 +410,6 @@ public class OperationTicketServiceImpl implements OperationTicketService {
}
-
-
/**
* 新预览
*
@@ -398,7 +427,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
StandardTicketInfoVo standardTicketInfoVo = standardTicketInfoService.selectDetailsById(ticketId);
//将查询的数据转换为map
Map workTicketInfoMap = this.convertMap(standardTicketInfoVo);
- //导入下在word
+ //导入下在word
Map resultMap = OperationWordHelper.resultMap(workTicketInfoMap);
String workTicketStatus = OperationWordHelper.getWorkTicketStatus(status);
String os = TicketConstant.OS_NAME;
@@ -421,6 +450,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
/**
* 将查询的数据转换为map
+ *
* @param standardTicketInfoVo
* @return
*/
@@ -439,17 +469,17 @@ public class OperationTicketServiceImpl implements OperationTicketService {
map.put("index", index.get());
map.put("status", TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : "");
map.put("operationTime", measure.getOperationTime());
- map.put("hello","");
- map.put("hello1","");
+ map.put("hello", "");
+ map.put("hello1", "");
index.getAndIncrement();
measureMapLists.add(map);
}
result.put("measureMapList", measureMapLists);
- }else {
+ } else {
result.put("measureMapList", new ArrayList<>());
}
- WordMapUtils.newMapWithList("measureMapList",result,false,17,null);
+ WordMapUtils.newMapWithList("measureMapList", result, false, 17, null);
return result;
}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java
index 9ed5c45..c0d95ca 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java
@@ -1,9 +1,9 @@
package com.hnac.hzims.ticket.twoTicket.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
@@ -41,29 +41,29 @@ public class TicketProcessController {
@ApiOperation("启动流程")
@PostMapping("/startUp")
public R start(@RequestBody WorkTicketVo workTicketVo) {
- ticketProcessService.startUp(workTicketVo);
- return R.success("申请开票成功");
+ Long ticketId = ticketProcessService.startUp(workTicketVo);
+ return R.data(ticketId);
}
/**
* 工作票待处理
+ *
* @param response
*/
@PostMapping("/findPending")
@ApiOperation(value = "工作票待处理")
- public Boolean findPending(@RequestBody ProcessWorkFlowResponse response){
+ public Boolean findPending(@RequestBody ProcessWorkFlowResponse response) {
try {
ticketProcessService.findPending(response);
return true;
} catch (Exception e) {
+ e.printStackTrace();
throw new ServiceException("工作票待处理:" + e.getMessage());
}
}
-
-
/**
* 预览
*/
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java
index 9117268..906c85d 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java
@@ -1,7 +1,7 @@
package com.hnac.hzims.ticket.twoTicket.service;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import javax.servlet.http.HttpServletResponse;
@@ -17,7 +17,7 @@ public interface TicketProcessService {
/**
* 启动开票流程
*/
- void startUp(WorkTicketVo workTicketVo);
+ Long startUp(WorkTicketVo workTicketVo);
/**
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
index e671ae2..844cc6f 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
@@ -7,11 +7,13 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.hnac.hzims.common.logs.fegin.ProcessDictFeignService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
+import com.hnac.hzims.middle.process.feign.ProcessDictFeignService;
+import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.feign.IAccessTaskClient;
@@ -38,7 +40,6 @@ import com.hnac.hzims.ticket.workTicket.entity.*;
import com.hnac.hzims.ticket.workTicket.service.*;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketDelayServiceImpl;
import com.hnac.hzims.ticket.workTicket.service.impl.WorkTicketOperateTimeServiceImpl;
-import com.hnac.hzims.common.to.process.ProcessWorkFlowResponse;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@@ -71,8 +72,8 @@ import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
-import static com.hnac.hzims.common.logs.constant.TicketProcessConstant.FIRST_TICKET_KEY;
-import static com.hnac.hzims.common.logs.constant.TicketProcessConstant.MACHINERY_TICKET_KEY;
+import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.FIRST_TICKET_KEY;
+import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.MACHINERY_TICKET_KEY;
/**
@@ -159,7 +160,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
@SneakyThrows
@Override
@Transactional
- public void startUp(WorkTicketVo workTicketVo) {
+ public Long startUp(WorkTicketVo workTicketVo) {
log.info("执行 com.hnac.hzims.ticket.twoTicket.service.impl【startUp】 。。。方法");
if (workTicketVo.getWorkTicket().getSignage() == null) {
throw new ServiceException("票据抬头未配置,请您到站点管理配置");
@@ -214,6 +215,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//8. 处理任务
this.returnTicket(workTicketVo);
+ return workTicketVo.getWorkTicket().getId();
}
/**
@@ -275,98 +277,79 @@ public class TicketProcessServiceImpl implements TicketProcessService {
log.error("获取工作票的数据为不存在");
return;
}
- try {
- //更新工作票
- workTicket.setId(workTicketInfo.getId());
- //保存流程描述
- workTicketInfo.setCreateDept(workTicketInfo.getCreateDept());
- workTicket.setTenantId(workTicketInfo.getTenantId());
- saveWorkTicket(workTicket, response);
- //工作流ID
- workTicket.setProcessInstanceId(response.getProcessInstanceId());
- workTicketInfoService.updateById(workTicket);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ //更新工作票
+ workTicket.setId(workTicketInfo.getId());
+ //保存流程描述
+ workTicket.setCreateDept(workTicketInfo.getCreateDept());
+ workTicket.setCreateUser(workTicketInfo.getCreateUser());
+ workTicket.setTenantId(workTicketInfo.getTenantId());
+ saveWorkTicket(workTicket, response);
+ //工作流ID
+ workTicket.setProcessInstanceId(response.getProcessInstanceId());
+ workTicketInfoService.updateById(workTicket);
//更新安全措施
- try {
- List safetyMeasuresList = workTicketVo.getSafetyMeasuresList();
- if (CollectionUtils.isNotEmpty(safetyMeasuresList)) {
- log.info("获取安全措施的数据:{}", safetyMeasuresList);
- for (WorkTicketSafetyMeasureEntity item : safetyMeasuresList) {
- if (ObjectUtils.isNotEmpty(item.getId())) {
- workTicketSafetyMeasureService.updateById(item);
- } else {
- item.setTicketId(workTicketInfo.getId());
- workTicketSafetyMeasureService.save(item);
- }
+ List safetyMeasuresList = workTicketVo.getSafetyMeasuresList();
+ if (CollectionUtils.isNotEmpty(safetyMeasuresList)) {
+ log.info("获取安全措施的数据:{}", safetyMeasuresList);
+ for (WorkTicketSafetyMeasureEntity item : safetyMeasuresList) {
+ if (ObjectUtils.isNotEmpty(item.getId())) {
+ workTicketSafetyMeasureService.updateById(item);
+ } else {
+ item.setTicketId(workTicketInfo.getId());
+ workTicketSafetyMeasureService.save(item);
}
}
- } catch (Exception e) {
- e.printStackTrace();
}
// 第二种 工作票工作任务组
List workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList();
- try {
- if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) {
- log.info("获取工作票工作任务组:{}", workTicketContentDtoList);
- workTicketContentDtoList.forEach(item -> {
- if (ObjectUtils.isEmpty(item.getId())) {
- contentService.save(item);
- } else {
- contentService.updateById(item);
- }
- });
- }
- } catch (Exception e) {
- e.printStackTrace();
+ if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) {
+ log.info("获取工作票工作任务组:{}", workTicketContentDtoList);
+ workTicketContentDtoList.forEach(item -> {
+ if (ObjectUtils.isEmpty(item.getId())) {
+ contentService.save(item);
+ } else {
+ contentService.updateById(item);
+ }
+ });
}
-
// 工作票延期
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay();
- try {
- if (ObjectUtils.isNotEmpty(workTicketDelay) && "延期".equals(workTicket.getInput())) {
-
- WorkTicketDelayEntity workTicketDelayEntity = workTicketDelayService.selectByTicketId(workTicketInfo.getId());
- log.info("获取工作票延期:{}", workTicketDelay);
- workTicketDelay.setCreateDept(workTicketInfo.getCreateDept());
- workTicketDelay.setTicketId(workTicketInfo.getId());
- workTicketDelay.setTenantId(workTicketInfo.getTenantId());
- if (ObjectUtils.isEmpty(workTicketDelayEntity)) {
- log.info("正在保存工作票延期");
- workTicketDelayService.save(workTicketDelay);
- } else {
- log.info("正在更新工作票延期");
- workTicketDelayService.updateByTicketId(workTicketDelay);
- }
+ if (ObjectUtils.isNotEmpty(workTicketDelay) && "延期".equals(workTicket.getInput())) {
+
+ WorkTicketDelayEntity workTicketDelayEntity = workTicketDelayService.selectByTicketId(workTicketInfo.getId());
+ log.info("获取工作票延期:{}", workTicketDelay);
+ workTicketDelay.setCreateDept(workTicketInfo.getCreateDept());
+ workTicketDelay.setTicketId(workTicketInfo.getId());
+ workTicketDelay.setTenantId(workTicketInfo.getTenantId());
+ if (ObjectUtils.isEmpty(workTicketDelayEntity)) {
+ log.info("正在保存工作票延期");
+ workTicketDelayService.save(workTicketDelay);
+ } else {
+ log.info("正在更新工作票延期");
+ workTicketDelayService.updateByTicketId(workTicketDelay);
}
- } catch (Exception e) {
- e.printStackTrace();
}
//工作结束
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish();
- try {
- log.info("工作结束==============>" + (workTicket.getFlowStatus().intValue()));
- if (ObjectUtils.isNotEmpty(workTicketFinish)) {
- WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId());
- log.info("获取工作结束:{}", workTicketFinish);
- if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) {
- log.info("获取工作结束保存成功");
- workTicketFinish.setTicketId(workTicketInfo.getId());
- workTicketFinishService.save(workTicketFinish);
- } else {
- log.info("获取工作结束更新成功");
- workTicketDelay.setInitialTime(LocalDateTime.now());
- workTicketFinishService.updateByTicketId(workTicketFinish);
- }
+ log.info("工作结束==============>" + (workTicket.getFlowStatus().intValue()));
+ if (ObjectUtils.isNotEmpty(workTicketFinish)) {
+ WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId());
+ log.info("获取工作结束:{}", workTicketFinish);
+ if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) {
+ log.info("获取工作结束保存成功");
+ workTicketFinish.setTicketId(workTicketInfo.getId());
+ workTicketFinishService.save(workTicketFinish);
+ } else {
+ log.info("获取工作结束更新成功");
+ workTicketDelay.setInitialTime(LocalDateTime.now());
+ workTicketFinishService.updateByTicketId(workTicketFinish);
}
- } catch (Exception e) {
- e.printStackTrace();
}
+
// 工作开始时间和结束时间
// List workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities();
// if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) {
@@ -375,104 +358,126 @@ public class TicketProcessServiceImpl implements TicketProcessService {
// }
//工作票负责人变更
WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange();
- try {
- if (ObjectUtils.isNotEmpty(workTicketPrincipalChange) && "转移".equals(workTicket.getInput())) {
- log.info("工作票负责人变更: {}", workTicketPrincipalChange);
- //原来的负责人
- User user = UserCache.getUser(workTicketPrincipalChange.getInitialPrincipal());
- //新的负责人
- User newUser = UserCache.getUser(workTicketPrincipalChange.getChangePrincipal());
- workTicketPrincipalChange.setCreateDept(workTicketInfo.getCreateDept());
- workTicketPrincipalChange.setTicketId(workTicketInfo.getId());
- workTicketPrincipalChange.setTenantId(workTicketInfo.getTenantId());
- if (workTicketPrincipalChange.getFlowCode() == null) {
- workTicketPrincipalChange.setFlowCode(IdWorker.getIdStr());
- }
+ if (ObjectUtils.isNotEmpty(workTicketPrincipalChange) && "转移".equals(workTicket.getInput())) {
+ log.info("工作票负责人变更: {}", workTicketPrincipalChange);
+ //原来的负责人
+ User user = UserCache.getUser(workTicketPrincipalChange.getInitialPrincipal());
+ //新的负责人
+ User newUser = UserCache.getUser(workTicketPrincipalChange.getChangePrincipal());
+ workTicketPrincipalChange.setCreateDept(workTicketInfo.getCreateDept());
+ workTicketPrincipalChange.setTicketId(workTicketInfo.getId());
+ workTicketPrincipalChange.setTenantId(workTicketInfo.getTenantId());
+ if (workTicketPrincipalChange.getFlowCode() == null) {
+ workTicketPrincipalChange.setFlowCode(IdWorker.getIdStr());
+ }
- WorkTicketPrincipalChangeEntity workTicketPrincipalChangeEntity = workTicketPrincipalChangeService.selectByTicketId(workTicket.getId());
+ WorkTicketPrincipalChangeEntity workTicketPrincipalChangeEntity = workTicketPrincipalChangeService.selectByTicketId(workTicket.getId());
- if (ObjectUtils.isEmpty(workTicketPrincipalChangeEntity)) {
- log.info("工作票负责人保存变更");
- workTicketPrincipalChangeService.save(workTicketPrincipalChange);
- } else {
- log.info("工作票负责人更新变更");
- workTicketPrincipalChangeService.updateByTicketId(workTicketPrincipalChange);
- }
- log.info("工作负责人变更 原来的负责人 {},变更为 {}", user.getName(), newUser.getName());
- workTicket.setPrincipal(workTicketPrincipalChange.getChangePrincipal());
- workTicket.setPrincipalName(newUser.getName());
- //更新工作票
- workTicketInfoService.updateById(workTicket);
+ if (ObjectUtils.isEmpty(workTicketPrincipalChangeEntity)) {
+ log.info("工作票负责人保存变更");
+ workTicketPrincipalChangeService.save(workTicketPrincipalChange);
+ } else {
+ log.info("工作票负责人更新变更");
+ workTicketPrincipalChangeService.updateByTicketId(workTicketPrincipalChange);
}
- } catch (Exception e) {
- e.printStackTrace();
+ log.info("工作负责人变更 原来的负责人 {},变更为 {}", user.getName(), newUser.getName());
+ workTicket.setPrincipal(workTicketPrincipalChange.getChangePrincipal());
+ workTicket.setPrincipalName(newUser.getName());
+ //更新工作票
+ workTicketInfoService.updateById(workTicket);
}
//工作票危险点分析及控制措施票
- try {
- if (workTicket.getIsHazard()) {
- List ticketInfoDangers = workTicketVo.getTicketInfoDangers();
- if (CollectionUtils.isNotEmpty(ticketInfoDangers)) {
- List collect = ticketInfoDangers.stream().map(item -> {
- item.setTicketId(workTicketInfo.getId());
- return item;
- }).collect(Collectors.toList());
+ if (workTicket.getIsHazard()) {
+ List ticketInfoDangers = workTicketVo.getTicketInfoDangers();
+ if (CollectionUtils.isNotEmpty(ticketInfoDangers)) {
+ List collect = ticketInfoDangers.stream().map(item -> {
+ item.setTicketId(workTicketInfo.getId());
+ return item;
+ }).collect(Collectors.toList());
- System.out.println("工作票危险点分析及控制措施票 : " + collect);
+ System.out.println("工作票危险点分析及控制措施票 : " + collect);
- ticketInfoDangerService.saveBatch(collect);
- }
+ ticketInfoDangerService.saveBatch(collect);
}
- } catch (Exception e) {
- e.printStackTrace();
}
if (response.getTaskId() != null || response.getUserId() != null) {
//推送消息
- try {
- MessagePushRecordDto message = new MessagePushRecordDto();
- message.setBusinessClassify("business");
- message.setBusinessKey(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getKey());
- message.setSubject(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getDescription());
- message.setTaskId(workTicketInfo.getId());
- message.setTenantId("200000");
- message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
- message.setPushType(MessageConstants.IMMEDIATELY);
- //您有一张工作票待审批,工作内容:*****,审批环节:*****;
- String countent =
- "您有一张工作票待审批,工作内容: ".concat(workTicketInfo.getWorkContent())
- .concat(",审批环节: ")
- .concat(response.getTaskName());
- message.setContent(countent);
- message.setDeptId(workTicketInfo.getCreateDept());
- message.setCreateDept(workTicketInfo.getCreateDept());
- R deptName = sysClient.getDeptName(workTicketInfo.getCreateDept());
- if (deptName.isSuccess()) {
- message.setDeptName(deptName.getData());
- }
- String userIds = response.getUserId();
- if (StringUtils.isBlank(userIds)) {
- log.error("推送的消息不能为空哦,{}", userIds);
- return;
- }
- String[] split = userIds.split(",");
- for (String userId : split) {
- message.setPusher(userId);
- User user = UserCache.getUser(NumberUtils.toLong(userId));
- if (ObjectUtils.isNotEmpty(user)) {
- message.setPusherName(user.getName());
- }
- message.setAccount(userId);
- message.setCreateUser(NumberUtils.toLong(userId));
- messageClient.sendMessage(message);
- log.info("推送消息成功,用户名称{},消息{}", user.getName(), message);
- }
- } catch (Exception e) {
- e.printStackTrace();
+ // try {
+ // MessagePushRecordDto message = new MessagePushRecordDto();
+ // message.setBusinessClassify("business");
+ // message.setBusinessKey(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getKey());
+ // message.setSubject(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getDescription());
+ // message.setTaskId(workTicketInfo.getId());
+ // message.setTenantId("200000");
+ // message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
+ // message.setPushType(MessageConstants.IMMEDIATELY);
+ // //您有一张工作票待审批,工作内容:*****,审批环节:*****;
+ // String countent =
+ // "您有一张工作票待审批,工作内容: ".concat(workTicketInfo.getWorkContent())
+ // .concat(",审批环节: ")
+ // .concat(response.getTaskName());
+ // message.setContent(countent);
+ // message.setDeptId(workTicketInfo.getCreateDept());
+ // message.setCreateDept(workTicketInfo.getCreateDept());
+ // R deptName = sysClient.getDeptName(workTicketInfo.getCreateDept());
+ // if (deptName.isSuccess()) {
+ // message.setDeptName(deptName.getData());
+ // }
+ // String userIds = response.getUserId();
+ // if (StringUtils.isBlank(userIds)) {
+ // log.error("推送的消息不能为空哦,{}", userIds);
+ // return;
+ // }
+ // String[] split = userIds.split(",");
+ // for (String userId : split) {
+ // message.setPusher(userId);
+ // User user = UserCache.getUser(NumberUtils.toLong(userId));
+ // if (ObjectUtils.isNotEmpty(user)) {
+ // message.setPusherName(user.getName());
+ // }
+ // message.setAccount(userId);
+ // message.setCreateUser(NumberUtils.toLong(userId));
+ // messageClient.sendMessage(message);
+ // log.info("推送消息成功,用户名称{},消息{}", user.getName(), message);
+ // }
+ // } catch (Exception e) {
+ // e.printStackTrace();
+ // }
+
+
+ BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
+ businessMessageDTO.setBusinessClassify("business");
+ businessMessageDTO.setBusinessKey(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getKey());
+ businessMessageDTO.setSubject(MessageConstants.BusinessClassifyEnum.TICKETMESSAGE.getDescription());
+ businessMessageDTO.setTaskId(workTicketInfo.getId());
+ businessMessageDTO.setTenantId("200000");
+ //您有一张工作票待审批,工作内容:*****,审批环节:*****;
+ String countent =
+ "您有一张工作票待审批,工作内容: ".concat(workTicketInfo.getWorkContent())
+ .concat(",审批环节: ")
+ .concat(response.getTaskName());
+ businessMessageDTO.setContent(countent);
+ businessMessageDTO.setDeptId(workTicketInfo.getCreateDept());
+ R deptName = sysClient.getDeptName(workTicketInfo.getCreateDept());
+ if (deptName.isSuccess()) {
+ businessMessageDTO.setDeptName(deptName.getData());
+ }
+ String userIds = response.getUserId();
+ businessMessageDTO.setUserIds(userIds);
+ businessMessageDTO.setCreateUser(workTicketInfo.getCreateUser());
+ System.out.println("======================================================");
+ System.out.println("businessMessageDTO = " + businessMessageDTO);
+ System.out.println("======================================================");
+ R booleanR = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO);
+ if (!booleanR.isSuccess()) {
+ throw new ServiceException("消息推送失败");
}
+ log.info("推送成功~");
}
}
diff --git a/hzims-service/ticket/src/main/resources/db/newsql.sql b/hzims-service/ticket/src/main/resources/db/newsql.sql
new file mode 100644
index 0000000..5bb14f5
--- /dev/null
+++ b/hzims-service/ticket/src/main/resources/db/newsql.sql
@@ -0,0 +1,180 @@
+SET FOREIGN_KEY_CHECKS=0;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `signage` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点标识-两票编码' AFTER `ticket_type`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `signage_code` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编号(原站点ID)' AFTER `signage`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `flow_user_id` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户Id' AFTER `signage_code`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `flow_task_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务Id' AFTER `flow_user_id`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `flow_task_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务名称' AFTER `flow_task_id`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `next_step_operator` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '下一个审批人' AFTER `flow_task_name`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `flow_status` int(11) NULL DEFAULT NULL COMMENT '流程状态' AFTER `next_step_operator`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `flow_description` varchar(6000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程描述' AFTER `flow_status`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `project_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目名称' AFTER `flow_description`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_info` ADD COLUMN `class_group_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班组' AFTER `project_name`;
+
+ALTER TABLE `hzims-ticket`.`hzims_standard_ticket_measure` ADD COLUMN `operation_time` datetime(0) NULL DEFAULT NULL COMMENT '操作时间' AFTER `matter_group`;
+
+CREATE TABLE `hzims-ticket`.`hzims_ticket_info_danger` (
+ `id` bigint(20) NULL DEFAULT NULL COMMENT '编号',
+ `ticket_id` bigint(20) NULL DEFAULT NULL,
+ `dangerous_point` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '危险点',
+ `maintenance` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '安全措施',
+ `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+ `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
+ `is_deleted` tinyint(4) NULL DEFAULT 0 COMMENT '逻辑删除'
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `hzims-ticket`.`hzims_work_ticket_finish` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
+ `ticket_id` bigint(20) NULL DEFAULT NULL COMMENT '工作票编号',
+ `temp_ground_num` int(11) NULL DEFAULT NULL COMMENT '临时接地线',
+ `temp_dismantle_num` int(11) NULL DEFAULT NULL COMMENT '临时拆除几组',
+ `ground_num` int(11) NULL DEFAULT NULL COMMENT '接地线几组',
+ `dismantle_num` int(11) NULL DEFAULT NULL COMMENT '拆除几组',
+ `retain_num` int(11) NULL DEFAULT NULL COMMENT '保留几组',
+ `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
+ `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
+ `principal` bigint(20) NULL DEFAULT NULL COMMENT '负责人名称',
+ `licensor` bigint(20) NULL DEFAULT NULL COMMENT '许可人',
+ `licensor_end_time` datetime(0) NULL DEFAULT NULL COMMENT '工作票终结时间',
+ `principal_end_time` datetime(0) NULL DEFAULT NULL COMMENT '负责人工作结束时间',
+ `content` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+ `tell_content` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '交底内容',
+ `work_end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
+ `brake_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '刀闸编号',
+ `guardian` bigint(20) NULL DEFAULT NULL COMMENT '监护人',
+ `guardian_place` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '监护人地址',
+ `other_items` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他事项',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作结束' ROW_FORMAT = Dynamic;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `power` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' 工作条件( 停电或不停电)' AFTER `watch_principal_end_time`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `flow_user_id` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户Id' AFTER `step_operator`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `project_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目名称' AFTER `flow_task_name`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `job_receiver` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作接收人' AFTER `project_name`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `job_receiver_time` datetime(0) NULL DEFAULT NULL COMMENT '工作接收人时间' AFTER `job_receiver`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `is_safety` tinyint(1) NULL DEFAULT 0 COMMENT '安全隔离措施附页 (true,展示附件,false,不展示附件)' AFTER `job_receiver_time`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `is_hazard` tinyint(1) NULL DEFAULT 0 COMMENT '危险点分析与预控措施票 (true,展示附件,false,不展示附件)' AFTER `is_safety`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `is_railway` tinyint(1) NULL DEFAULT 0 COMMENT '动火工作票 (true,展示附件,false,不展示附件)' AFTER `is_hazard`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `is_limited` tinyint(1) NULL DEFAULT 0 COMMENT ' 有限空间监测记录单(true,展示附件,false,不展示附件)' AFTER `is_railway`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` ADD COLUMN `is_start` tinyint(1) NULL DEFAULT 0 COMMENT '每日开工和收工时间附页' AFTER `is_limited`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` MODIFY COLUMN `flow_description` varchar(6000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程描述' AFTER `flow_status`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` MODIFY COLUMN `follower_num` int(11) NULL DEFAULT 1 COMMENT '附页第几张' AFTER `flow_description`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` MODIFY COLUMN `next_step_operator` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '下一个审批人' AFTER `input`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` MODIFY COLUMN `step_operator` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前审批人' AFTER `next_step_operator`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` DROP COLUMN `is_power`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` DROP COLUMN `start_date_time`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` DROP COLUMN `end_date_time`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` DROP COLUMN `content`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` DROP COLUMN `work_ticket_end_time`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_info` DROP COLUMN `tell_content`;
+
+CREATE TABLE `hzims-ticket`.`hzims_work_ticket_info_copy1` (
+ `id` bigint(20) NOT NULL COMMENT '主键',
+ `em_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称',
+ `em_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称',
+ `process_instance_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流ID',
+ `type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工作票类型',
+ `company` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '单位',
+ `code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号',
+ `task_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联业务类型',
+ `task_id` bigint(20) NULL DEFAULT NULL COMMENT '关联业务ID',
+ `task_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联业务名称',
+ `class_group` bigint(20) NULL DEFAULT NULL COMMENT '班组',
+ `class_group_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班组名称',
+ `class_group_members` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班组成员',
+ `class_group_members_manual` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班组成员手填',
+ `address_equ_name` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作地点及设备名称',
+ `work_content` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作任务及内容',
+ `plan_start_time` datetime(0) NULL DEFAULT NULL COMMENT '计划开始时间',
+ `plan_end_time` datetime(0) NULL DEFAULT NULL COMMENT '计划结束时间',
+ `signer` bigint(20) NULL DEFAULT NULL COMMENT '签发人',
+ `principal` bigint(20) NULL DEFAULT NULL COMMENT '负责人',
+ `principal_manual` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '负责人手填',
+ `licensor` bigint(20) NULL DEFAULT NULL COMMENT '许可人',
+ `license_time` datetime(0) NULL DEFAULT NULL COMMENT '许可时间',
+ `flow_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流程进行code',
+ `license_end_time` datetime(0) NULL DEFAULT NULL COMMENT '许可人确认工作结束时间',
+ `is_evaluate` tinyint(4) NULL DEFAULT 0 COMMENT '是否评价',
+ `status` tinyint(4) NULL DEFAULT NULL COMMENT '1:未完成 2:执行中 3:已完成',
+ `tenant_id` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
+ `create_user` bigint(20) NOT NULL COMMENT '创建人',
+ `create_time` datetime(0) NOT NULL COMMENT '创建时间',
+ `update_user` bigint(20) NULL DEFAULT NULL,
+ `update_time` datetime(0) NULL DEFAULT NULL,
+ `is_deleted` tinyint(4) NULL DEFAULT NULL,
+ `create_dept` bigint(20) NOT NULL COMMENT '创建部门',
+ `confirm_img_urls` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作负责人确认工作完成上传图片地址',
+ `confirm_img_filenames` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作负责人确认工作完成上传图片名称',
+ `sort` tinyint(4) NULL DEFAULT NULL COMMENT '排序',
+ `confirm_work_time` datetime(0) NULL DEFAULT NULL COMMENT '工作负责人确认工作完成时间',
+ `pattern` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型(1:值班人员添加2:许可人添加)',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作票' ROW_FORMAT = Dynamic;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_safety_measure` MODIFY COLUMN `type` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型(1:值班人员添加2:签发人添加3:许可人添加)' AFTER `measure`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_safety_measure` MODIFY COLUMN `execute_img_url` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '拍照上传图片url' AFTER `execute_remark`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_safety_measure` MODIFY COLUMN `completer` bigint(20) NULL DEFAULT NULL COMMENT '内容执行人' AFTER `status`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_safety_measure` MODIFY COLUMN `complete_img_url` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '完成内容上传图片地址' AFTER `complete_time`;
+
+ALTER TABLE `hzims-ticket`.`hzims_work_ticket_safety_measure` MODIFY COLUMN `pattern` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '类型(1:值班人员添加2:许可人添加)' AFTER `sort`;
+
+CREATE TABLE `hzims-ticket`.`hzims_work_ticket_safety_measure_copy1` (
+ `id` bigint(20) NOT NULL COMMENT '主键ID',
+ `ticket_id` bigint(20) NOT NULL COMMENT '工作票ID',
+ `measure_id` bigint(20) NULL DEFAULT NULL COMMENT '安全措施ID',
+ `matter_group` bigint(20) NULL DEFAULT NULL COMMENT '分组',
+ `measure` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '安全措施',
+ `type` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型(1:值班人员添加2:签发人添加3:许可人添加)',
+ `executor` bigint(20) NULL DEFAULT NULL COMMENT '执行人',
+ `execute_time` datetime(0) NULL DEFAULT NULL COMMENT '执行时间',
+ `execute_remark` tinytext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '执行情况',
+ `execute_img_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '拍照上传图片url',
+ `status` tinyint(20) NULL DEFAULT NULL,
+ `completer` bigint(20) NULL DEFAULT NULL COMMENT '内容执行人',
+ `complete_time` datetime(0) NULL DEFAULT NULL COMMENT '内容完成时间',
+ `complete_img_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '完成内容上传图片地址',
+ `create_user` bigint(20) NOT NULL COMMENT '创建人',
+ `create_time` datetime(0) NOT NULL COMMENT '创建时间',
+ `update_user` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
+ `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
+ `is_deleted` tinyint(4) NULL DEFAULT NULL,
+ `create_dept` bigint(20) NOT NULL COMMENT '创建机构',
+ `tenant_id` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户id',
+ `sort` tinyint(4) NULL DEFAULT NULL COMMENT '排序',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工作票安全措施列表' ROW_FORMAT = Dynamic;
+
+DROP TABLE `hzims-ticket`.`hzims_workflow_operation_log`;
+
+SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
diff --git a/hzims-service/ticket/src/main/resources/template/~$第一种工作票模版.docx b/hzims-service/ticket/src/main/resources/template/~$第一种工作票模版.docx
new file mode 100644
index 0000000..1ffd967
Binary files /dev/null and b/hzims-service/ticket/src/main/resources/template/~$第一种工作票模版.docx differ
diff --git a/hzims-service/ticket/src/main/resources/template/电气操作票.docx b/hzims-service/ticket/src/main/resources/template/电气操作票.docx
new file mode 100644
index 0000000..54f4ffb
Binary files /dev/null and b/hzims-service/ticket/src/main/resources/template/电气操作票.docx differ