Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.njcn.advance.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* Advacne枚举
|
||||
* @author cdf
|
||||
* @date 2021/6/21
|
||||
*/
|
||||
@Getter
|
||||
public enum AdvanceResponseEnum {
|
||||
|
||||
/**
|
||||
* A00500 ~ A01550 用于终端模块的枚举
|
||||
*/
|
||||
PROJECT_COMMON_ERROR("A00500","同一用户下项目名不能相同"),
|
||||
;
|
||||
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
AdvanceResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.advance.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/11/11 15:20【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class AppProjectAddParm {
|
||||
|
||||
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value="项目名称")
|
||||
@NotBlank(message="项目名称不能为空!")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message="项目类型不能为空!")
|
||||
private String projectType;
|
||||
/**
|
||||
* 关联用户Id
|
||||
*/
|
||||
@ApiModelProperty(value="关联用户Id")
|
||||
@NotBlank(message="关联用户Id不能为空!")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 地市Id
|
||||
*/
|
||||
@ApiModelProperty(value="地市")
|
||||
@NotBlank(message="地市不能为空!")
|
||||
private String area;
|
||||
|
||||
/**
|
||||
* 中心点经度
|
||||
*/
|
||||
@ApiModelProperty(value="中心点经度")
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 中心点纬度
|
||||
*/
|
||||
@ApiModelProperty(value="中心点纬度")
|
||||
private BigDecimal lat;
|
||||
|
||||
@ApiModelProperty(value = "拓扑图文件")
|
||||
@NotNull(message="拓扑图文件不能为空!")
|
||||
private MultipartFile[] files;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.njcn.advance.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/11/11 15:20【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class AppProjectAuditParm {
|
||||
|
||||
@NotNull(message="项目id不能为空!")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value="项目名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 关联用户Id
|
||||
*/
|
||||
@ApiModelProperty(value="关联用户Id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 地市Id
|
||||
*/
|
||||
@ApiModelProperty(value="地市")
|
||||
private String area;
|
||||
|
||||
/**
|
||||
* 中心点经度
|
||||
*/
|
||||
@ApiModelProperty(value="中心点经度")
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 中心点纬度
|
||||
*/
|
||||
@ApiModelProperty(value="中心点纬度")
|
||||
private BigDecimal lat;
|
||||
|
||||
@ApiModelProperty(value="0:删除 1:正常")
|
||||
private String status;
|
||||
|
||||
private String description;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.advance.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/11/11 15:20【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class AppProjectQueryParm {
|
||||
|
||||
@NotNull(message="当前页不能为空!")
|
||||
@Min(value = 1, message = "当前页不能为0")
|
||||
@ApiModelProperty(value = "当前页",name = "currentPage",dataType ="Integer",required = true)
|
||||
private Integer currentPage;
|
||||
/**显示条数*/
|
||||
@NotNull(message="显示条数不能为空!")
|
||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty(value="项目Id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty(value="起始时间")
|
||||
// @NotNull(message="起始时间不能为空!")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
// @NotNull(message="结束时间不能为空!")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value="模糊查询条件")
|
||||
private String searchValue;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.advance.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* 项目拓扑图关系表
|
||||
*/
|
||||
@Data
|
||||
public class AppTopologyDiagramAddParm {
|
||||
|
||||
|
||||
/**
|
||||
* 拓扑图名称
|
||||
*/
|
||||
@ApiModelProperty(value = "拓扑图名称")
|
||||
@NotBlank(message="拓扑图名称不能为空!")
|
||||
private String topologyDiagramName;
|
||||
|
||||
/**
|
||||
* 项目Id
|
||||
*/
|
||||
@ApiModelProperty(value = "项目Id")
|
||||
@NotBlank(message="项目Id不能为空!")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 拓扑图文件
|
||||
*/
|
||||
@ApiModelProperty(value = "拓扑图文件")
|
||||
@NotNull(message="拓扑图文件不能为空!")
|
||||
private MultipartFile file;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.advance.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* 项目拓扑图关系表
|
||||
*/
|
||||
@Data
|
||||
public class AppTopologyDiagramAuditParm {
|
||||
@ApiModelProperty(value = "拓扑图id")
|
||||
@NotBlank(message="拓扑图id不能为空!")
|
||||
private String id;
|
||||
/**
|
||||
* 拓扑图名称
|
||||
*/
|
||||
@ApiModelProperty(value = "拓扑图名称")
|
||||
private String topologyDiagramName;
|
||||
|
||||
/**
|
||||
* 项目Id
|
||||
*/
|
||||
@ApiModelProperty(value = "项目Id")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 拓扑图文件
|
||||
*/
|
||||
@ApiModelProperty(value = "拓扑图文件")
|
||||
private MultipartFile file;
|
||||
|
||||
@ApiModelProperty(value="0:删除 1:正常")
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.advance.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/11/11 15:20【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class AppTopologyDiagramQueryParm {
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value="拓扑图Id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value="拓扑图名称")
|
||||
private String name;
|
||||
|
||||
|
||||
@ApiModelProperty(value="项目Id")
|
||||
private String projectId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.advance.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:18【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
/**
|
||||
* 项目拓扑图关系表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "cs_line_topology_diagram")
|
||||
public class AppLineTopologyDiagramPO extends BaseEntity {
|
||||
/**
|
||||
* 拓扑图Id
|
||||
*/
|
||||
@MppMultiId(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 拓扑图名称
|
||||
*/
|
||||
@TableField(value = "line_id")
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 0:删除 1:正常
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.njcn.advance.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
/**
|
||||
* 项目表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "cs_project")
|
||||
public class AppProjectPO extends BaseEntity {
|
||||
/**
|
||||
* 项目Id
|
||||
*/
|
||||
@MppMultiId(value = "id")
|
||||
private String id;
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
@TableField(value = "project_type")
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 关联用户Id
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 地市Id
|
||||
*/
|
||||
@TableField(value = "area")
|
||||
private String area;
|
||||
|
||||
/**
|
||||
* 中心点经度
|
||||
*/
|
||||
@TableField(value = "lng")
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 中心点纬度
|
||||
*/
|
||||
@TableField(value = "lat")
|
||||
private BigDecimal lat;
|
||||
|
||||
/**
|
||||
* 0:删除 1:正常
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private String status;
|
||||
|
||||
@TableField(value = "description")
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.advance.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
/**
|
||||
* 项目拓扑图关系表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "cs_topology_diagram")
|
||||
public class AppTopologyDiagramPO extends BaseEntity {
|
||||
/**
|
||||
* 拓扑图Id
|
||||
*/
|
||||
@MppMultiId(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 拓扑图名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件大小(kb)
|
||||
*/
|
||||
@TableField(value = "file_size")
|
||||
private Integer fileSize;
|
||||
|
||||
/**
|
||||
* 项目Id
|
||||
*/
|
||||
@TableField(value = "project_id")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 拓扑图文件路径
|
||||
*/
|
||||
@TableField(value = "file_path")
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 0:删除 1:正常
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.njcn.advance.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
public class AppProjectVO {
|
||||
/**
|
||||
* 项目Id
|
||||
*/
|
||||
private String id;
|
||||
private String projectType;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 关联用户Id
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String area;
|
||||
/**
|
||||
* 拓扑图路径
|
||||
*/
|
||||
private List<String> topologyDiagramPaths;
|
||||
|
||||
/**
|
||||
* 中心点经度
|
||||
*/
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 中心点纬度
|
||||
*/
|
||||
private BigDecimal lat;
|
||||
|
||||
/**
|
||||
* 0:删除 1:正常
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private String description;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.advance.pojo.vo;
|
||||
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* 项目拓扑图关系表
|
||||
*/
|
||||
@Data
|
||||
public class AppTopologyDiagramVO extends BaseEntity {
|
||||
/**
|
||||
* 拓扑图Id
|
||||
*/
|
||||
@ApiModelProperty(value = "拓扑图Id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 拓扑图名称
|
||||
*/
|
||||
@ApiModelProperty(value = "拓扑图名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件大小(kb)
|
||||
*/
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private Integer fileSize;
|
||||
|
||||
/**
|
||||
* 项目Id
|
||||
*/
|
||||
@ApiModelProperty(value = "项目Id")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 拓扑图文件路径
|
||||
*/
|
||||
@ApiModelProperty(value = "拓扑图文件路径")
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 0:删除 1:正常
|
||||
*/
|
||||
@ApiModelProperty(value = "status")
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@@ -10,6 +10,35 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>advance-api</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-db</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-poi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.jeffreyning</groupId>
|
||||
<artifactId>mybatisplus-plus</artifactId>
|
||||
<version>1.5.1-RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
<artifactId>common-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-db</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
@@ -43,7 +48,13 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-influxDB</artifactId>
|
||||
<artifactId>advance-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.njcn.advance.controller.project;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.advance.pojo.param.AppProjectAddParm;
|
||||
import com.njcn.advance.pojo.param.AppProjectAuditParm;
|
||||
import com.njcn.advance.pojo.param.AppProjectQueryParm;
|
||||
import com.njcn.advance.pojo.vo.AppProjectVO;
|
||||
import com.njcn.advance.service.AppProjectService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:54【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/project")
|
||||
@Api(tags = " 项目管理")
|
||||
@AllArgsConstructor
|
||||
public class AppProjectController extends BaseController {
|
||||
|
||||
|
||||
private final AppProjectService appProjectService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryProject")
|
||||
@ApiOperation("项目查询")
|
||||
@ApiImplicitParam(name = "appProjectQueryParm", value = "项目查询参数", required = true)
|
||||
public HttpResult<IPage<AppProjectVO>> queryProject(@Validated @RequestBody AppProjectQueryParm appProjectQueryParm){
|
||||
String methodDescribe = getMethodDescribe("queryProject");
|
||||
|
||||
IPage<AppProjectVO> appProjectVOIPage = appProjectService.queryProject (appProjectQueryParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appProjectVOIPage, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addAppProject")
|
||||
@ApiOperation("新增项目")
|
||||
public HttpResult<Boolean> addAppProject(@Validated AppProjectAddParm appProjectAddParm){
|
||||
String methodDescribe = getMethodDescribe("addAppProject");
|
||||
|
||||
Boolean flag = appProjectService.addAppProject(appProjectAddParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/auditAppProject")
|
||||
@ApiOperation("修改/删除项目")
|
||||
@ApiImplicitParam(name = "appProjectAuditParm", value = "修改项目参数", required = true)
|
||||
public HttpResult<Boolean> auditAppProject(@Validated @RequestBody AppProjectAuditParm appProjectAuditParm){
|
||||
String methodDescribe = getMethodDescribe("auditAppProject");
|
||||
|
||||
Boolean flag = appProjectService.AuditAppProject(appProjectAuditParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.njcn.advance.controller.project;
|
||||
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramAddParm;
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramAuditParm;
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramQueryParm;
|
||||
import com.njcn.advance.pojo.vo.AppTopologyDiagramVO;
|
||||
import com.njcn.advance.service.AppTopologyDiagramService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 15:31【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/topologyDiagram")
|
||||
@Api(tags = " 项目拓扑图")
|
||||
@AllArgsConstructor
|
||||
public class AppTopologyController extends BaseController {
|
||||
|
||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addAppTopologyDiagram")
|
||||
@ApiOperation("新增拓扑图")
|
||||
// @ApiImplicitParam(name = "appTopologyDiagramAddParm", value = "新增项目参数", required = true)
|
||||
public HttpResult<Boolean> addAppTopologyDiagram(@Validated AppTopologyDiagramAddParm appTopologyDiagramAddParm){
|
||||
String methodDescribe = getMethodDescribe("addAppTopologyDiagram");
|
||||
|
||||
Boolean flag = appTopologyDiagramService.addAppTopologyDiagram(appTopologyDiagramAddParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/AuditAppTopologyDiagram")
|
||||
@ApiOperation("修改拓扑图")
|
||||
public HttpResult<Boolean> AuditAppTopologyDiagram(@Validated AppTopologyDiagramAuditParm appTopologyDiagramAuditParm){
|
||||
String methodDescribe = getMethodDescribe("addAppProject");
|
||||
|
||||
Boolean flag = appTopologyDiagramService.AuditAppTopologyDiagram(appTopologyDiagramAuditParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryAppTopologyDiagram")
|
||||
@ApiOperation("查询拓扑图")
|
||||
public HttpResult<List<AppTopologyDiagramVO>> queryAppTopologyDiagram(@Validated @RequestBody AppTopologyDiagramQueryParm appTopologyDiagramAuditParm){
|
||||
String methodDescribe = getMethodDescribe("queryAppTopologyDiagram");
|
||||
|
||||
List<AppTopologyDiagramVO> appTopologyDiagramVOList = appTopologyDiagramService.queryAppTopologyDiagram(appTopologyDiagramAuditParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appTopologyDiagramVOList, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.advance.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.advance.pojo.po.AppLineTopologyDiagramPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:18【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface AppLineTopologyDiagramMapper extends MppBaseMapper<AppLineTopologyDiagramPO> {
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.njcn.advance.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.advance.pojo.param.AppProjectQueryParm;
|
||||
import com.njcn.advance.pojo.po.AppProjectPO;
|
||||
import com.njcn.advance.pojo.vo.AppProjectVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface AppProjectMapper extends MppBaseMapper<AppProjectPO> {
|
||||
@Select (
|
||||
{"<script>",
|
||||
"SELECT\n" +
|
||||
"\ta.id id,\n" +
|
||||
"\ta.`name` name,\n" +
|
||||
"\ta.user_id user_id,\n" +
|
||||
"\t\"username\" user_name,\n" +
|
||||
"\ta.area area,\n" +
|
||||
// "\tb.file_path topologyDiagramPath,\n" +
|
||||
"\ta.lng lng,\n" +
|
||||
"\ta.lat lat,\n" +
|
||||
"\ta.`status` STATUS,\n" +
|
||||
"\ta.create_by create_by,\n" +
|
||||
"\ta.create_time create_time,\n" +
|
||||
"\ta.update_by update_by,\n" +
|
||||
"\ta.update_time update_time\n" +
|
||||
"FROM\n" +
|
||||
"\tcs_project a\n" +
|
||||
"LEFT JOIN cs_topology_diagram b ON a.id = b.project_id\n" +
|
||||
"WHERE\n" +
|
||||
"\t1 = 1 AND a.status=\"1\"\n" ,
|
||||
"<when test='temp.projectId!=null and temp.projectId!=\"\"'>",
|
||||
"AND a.id = #{temp.projectId} "+
|
||||
"</when>",
|
||||
"<when test='temp.endTime!=null and temp.endTime!=\"\"'>",
|
||||
"AND a.create_time <= #{temp.endTime}" +
|
||||
"</when>",
|
||||
"<when test='temp.startTime!=null and temp.startTime!=\"\"'>",
|
||||
"AND a.create_time >= #{temp.startTime}" +
|
||||
"</when>",
|
||||
"<when test='temp.searchValue!=null and temp.searchValue!=\"\"'>",
|
||||
"AND a.`name` like concat('%',#{temp.searchValue},'%')",
|
||||
"</when>",
|
||||
"</script>"}
|
||||
)
|
||||
Page<AppProjectVO> getPageVo(Page<AppProjectVO> returnpage, @Param("temp")AppProjectQueryParm appProjectQueryParm);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.advance.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.advance.pojo.po.AppTopologyDiagramPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface AppTopologyDiagramMapper extends MppBaseMapper<AppTopologyDiagramPO> {
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.AppLineTopologyDiagramMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.po.AppLineTopologyDiagramPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table app_line_topology_diagram-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="line_id" jdbcType="VARCHAR" property="lineId" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="create_by" jdbcType="CHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="CHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, line_id, `status`, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.AppProjectMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.po.AppProjectPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table app_project-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="area_id" jdbcType="VARCHAR" property="areaId" />
|
||||
<result column="lng" jdbcType="DECIMAL" property="lng" />
|
||||
<result column="lat" jdbcType="DECIMAL" property="lat" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="create_by" jdbcType="CHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="CHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, user_id, area_id, lng, lat, `status`, create_by, create_time, update_by,
|
||||
update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.AppTopologyDiagramMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.po.AppTopologyDiagramPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table app_topology_diagram-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="file_size" jdbcType="INTEGER" property="fileSize" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="file_path" jdbcType="VARCHAR" property="filePath" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="create_by" jdbcType="CHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="CHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, file_size, project_id, file_path, `status`, create_by, create_time, update_by,
|
||||
update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.advance.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.advance.pojo.po.AppLineTopologyDiagramPO;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:18【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface AppLineTopologyDiagramService extends IMppService<AppLineTopologyDiagramPO> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.njcn.advance.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.advance.pojo.param.AppProjectAddParm;
|
||||
import com.njcn.advance.pojo.param.AppProjectAuditParm;
|
||||
import com.njcn.advance.pojo.param.AppProjectQueryParm;
|
||||
import com.njcn.advance.pojo.po.AppProjectPO;
|
||||
import com.njcn.advance.pojo.vo.AppProjectVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface AppProjectService extends IMppService<AppProjectPO> {
|
||||
|
||||
/**
|
||||
* @Description: addOrAuditPlan
|
||||
* @Param: [appProjectAddOrAuditParm]
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: clam
|
||||
* @Date: 2023/3/27
|
||||
*/
|
||||
Boolean addAppProject(AppProjectAddParm appProjectAddOrAuditParm);
|
||||
/**
|
||||
* @Description: AuditAppProject
|
||||
* @Param: [appProjectAuditParm]
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: clam
|
||||
* @Date: 2023/3/27
|
||||
*/
|
||||
Boolean AuditAppProject(AppProjectAuditParm appProjectAuditParm);
|
||||
/**
|
||||
* @Description: queryProject
|
||||
* @Param: [appProjectQueryParm]
|
||||
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.njcn.advance.pojo.vo.AppProjectVO>
|
||||
* @Author: clam
|
||||
* @Date: 2023/3/28
|
||||
*/
|
||||
IPage<AppProjectVO> queryProject(AppProjectQueryParm appProjectQueryParm);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.advance.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramAddParm;
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramAuditParm;
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramQueryParm;
|
||||
import com.njcn.advance.pojo.po.AppTopologyDiagramPO;
|
||||
import com.njcn.advance.pojo.vo.AppTopologyDiagramVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface AppTopologyDiagramService extends IMppService<AppTopologyDiagramPO> {
|
||||
|
||||
/**
|
||||
* @Description: addAppTopologyDiagram
|
||||
* @Param: [appTopologyDiagramAddParm]
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: clam
|
||||
* @Date: 2023/3/27
|
||||
*/
|
||||
Boolean addAppTopologyDiagram(AppTopologyDiagramAddParm appTopologyDiagramAddParm);
|
||||
/**
|
||||
* @Description: AuditAppTopologyDiagram
|
||||
* @Param: [appTopologyDiagramAuditParm]
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: clam
|
||||
* @Date: 2023/3/27
|
||||
*/
|
||||
Boolean AuditAppTopologyDiagram(AppTopologyDiagramAuditParm appTopologyDiagramAuditParm);
|
||||
/**
|
||||
* @Description: queryAppTopologyDiagram
|
||||
* @Param: [appTopologyDiagramAuditParm]
|
||||
* @return: java.util.List<com.njcn.advance.pojo.vo.AppTopologyDiagramVO>
|
||||
* @Author: clam
|
||||
* @Date: 2023/3/29
|
||||
*/
|
||||
List<AppTopologyDiagramVO> queryAppTopologyDiagram(AppTopologyDiagramQueryParm appTopologyDiagramAuditParm);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.advance.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.advance.mapper.AppLineTopologyDiagramMapper;
|
||||
import com.njcn.advance.pojo.po.AppLineTopologyDiagramPO;
|
||||
import com.njcn.advance.service.AppLineTopologyDiagramService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:18【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class AppLineTopologyDiagramServiceImpl extends MppServiceImpl<AppLineTopologyDiagramMapper, AppLineTopologyDiagramPO> implements AppLineTopologyDiagramService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.njcn.advance.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.AppProjectMapper;
|
||||
import com.njcn.advance.pojo.param.*;
|
||||
import com.njcn.advance.pojo.po.AppProjectPO;
|
||||
import com.njcn.advance.pojo.vo.AppProjectVO;
|
||||
import com.njcn.advance.pojo.vo.AppTopologyDiagramVO;
|
||||
import com.njcn.advance.service.AppProjectService;
|
||||
import com.njcn.advance.service.AppTopologyDiagramService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppProjectServiceImpl extends MppServiceImpl<AppProjectMapper, AppProjectPO> implements AppProjectService {
|
||||
|
||||
private final AppProjectMapper appProjectMapper;
|
||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addAppProject(AppProjectAddParm appProjectAddOrAuditParm) {
|
||||
AppProjectPO appProjectPO = new AppProjectPO ( );
|
||||
Boolean result = checkName (appProjectAddOrAuditParm.getUserId ( ), appProjectAddOrAuditParm.getName ( ));
|
||||
if (result) {
|
||||
throw new BusinessException (AdvanceResponseEnum.PROJECT_COMMON_ERROR);
|
||||
}
|
||||
BeanUtils.copyProperties (appProjectAddOrAuditParm, appProjectPO);
|
||||
appProjectPO.setStatus ("1");
|
||||
boolean save = this.save (appProjectPO);
|
||||
for (int i = 0; i < appProjectAddOrAuditParm.getFiles ( ).length; i++) {
|
||||
|
||||
AppTopologyDiagramAddParm appTopologyDiagramAddParm = new AppTopologyDiagramAddParm ( );
|
||||
appTopologyDiagramAddParm.setProjectId (appProjectPO.getId ( ));
|
||||
appTopologyDiagramAddParm.setTopologyDiagramName (appProjectAddOrAuditParm.getFiles ( )[i].getOriginalFilename ( ));
|
||||
appTopologyDiagramAddParm.setFile (appProjectAddOrAuditParm.getFiles ( )[i]);
|
||||
appTopologyDiagramService.addAppTopologyDiagram (appTopologyDiagramAddParm);
|
||||
}
|
||||
return save;
|
||||
}
|
||||
|
||||
private Boolean checkName(String userId, String name) {
|
||||
QueryWrapper<AppProjectPO> queryWrapper = new QueryWrapper ( );
|
||||
queryWrapper.select ("1").
|
||||
eq ("status", "1").
|
||||
eq ("user_id", userId).
|
||||
eq ("name", name);
|
||||
Integer integer = appProjectMapper.selectCount (queryWrapper);
|
||||
return integer > 0 ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean AuditAppProject(AppProjectAuditParm appProjectAuditParm) {
|
||||
AppProjectPO appProjectPO = new AppProjectPO ( );
|
||||
|
||||
QueryWrapper<AppProjectPO> queryWrapper = new QueryWrapper ( );
|
||||
queryWrapper.eq ("id", appProjectAuditParm.getId ( ));
|
||||
AppProjectPO appProjectPO1 = appProjectMapper.selectOne (queryWrapper);
|
||||
if (appProjectAuditParm.getUserId ( ) != null || appProjectAuditParm.getName ( ) != null) {
|
||||
Boolean result = checkName (appProjectAuditParm.getUserId ( ) != null ? appProjectAuditParm.getUserId ( ) : appProjectPO1.getUserId ( ),
|
||||
appProjectAuditParm.getName ( ) != null ? appProjectAuditParm.getName ( ) : appProjectPO1.getName ( ));
|
||||
if (result) {
|
||||
throw new BusinessException (AdvanceResponseEnum.PROJECT_COMMON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
BeanUtils.copyProperties (appProjectAuditParm, appProjectPO);
|
||||
UpdateWrapper<AppProjectPO> updateWrapper = new UpdateWrapper ( );
|
||||
updateWrapper.eq ("id", appProjectAuditParm.getId ( ));
|
||||
|
||||
int i = appProjectMapper.update (appProjectPO, updateWrapper);
|
||||
Boolean result = checkName (appProjectPO.getUserId ( ), appProjectPO.getName ( ));
|
||||
if (result) {
|
||||
throw new BusinessException (AdvanceResponseEnum.PROJECT_COMMON_ERROR);
|
||||
}
|
||||
return i == 1 ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<AppProjectVO> queryProject(AppProjectQueryParm appProjectQueryParm) {
|
||||
|
||||
Page<AppProjectVO> returnpage = new Page<> (appProjectQueryParm.getCurrentPage ( ), appProjectQueryParm.getPageSize ( ));
|
||||
returnpage = appProjectMapper.getPageVo (returnpage, appProjectQueryParm);
|
||||
Page<AppProjectPO> appProjectPOPage = new Page<> (appProjectQueryParm.getCurrentPage ( ), appProjectQueryParm.getPageSize ( ));
|
||||
QueryWrapper<AppProjectPO> queryWrapper = new QueryWrapper ( );
|
||||
queryWrapper.eq ("status", "1").
|
||||
eq (StringUtils.isNotBlank (appProjectQueryParm.getProjectId ( )), "id", appProjectQueryParm.getProjectId ( )).
|
||||
le (StringUtils.isNotBlank (appProjectQueryParm.getEndTime ( )), "create_time", appProjectQueryParm.getEndTime ( )).
|
||||
ge (StringUtils.isNotBlank (appProjectQueryParm.getStartTime ( )), "create_time", appProjectQueryParm.getStartTime ( )).
|
||||
like (StringUtils.isNotBlank (appProjectQueryParm.getSearchValue ( )), "name", appProjectQueryParm.getSearchValue ( ));
|
||||
Page<AppProjectPO> appProjectPOPage1 = appProjectMapper.selectPage (appProjectPOPage, queryWrapper);
|
||||
List<AppProjectVO> collect = appProjectPOPage1.getRecords ( ).stream ( ).map (temp -> {
|
||||
AppProjectVO vo = new AppProjectVO ( );
|
||||
BeanUtils.copyProperties (temp, vo);
|
||||
AppTopologyDiagramQueryParm appTopologyDiagramQueryParm = new AppTopologyDiagramQueryParm ( );
|
||||
appTopologyDiagramQueryParm.setProjectId (vo.getId ( ));
|
||||
List<AppTopologyDiagramVO> appTopologyDiagramVOList = appTopologyDiagramService.queryAppTopologyDiagram (appTopologyDiagramQueryParm);
|
||||
List<String> collect1 = appTopologyDiagramVOList.stream ( ).map (AppTopologyDiagramVO::getFilePath).collect (Collectors.toList ( ));
|
||||
vo.setTopologyDiagramPaths (collect1);
|
||||
return vo;
|
||||
}
|
||||
|
||||
).collect (Collectors.toList ( ));
|
||||
return returnpage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.njcn.advance.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.google.common.base.Objects;
|
||||
import com.njcn.advance.mapper.AppTopologyDiagramMapper;
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramAddParm;
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramAuditParm;
|
||||
import com.njcn.advance.pojo.param.AppTopologyDiagramQueryParm;
|
||||
import com.njcn.advance.pojo.po.AppTopologyDiagramPO;
|
||||
import com.njcn.advance.pojo.vo.AppTopologyDiagramVO;
|
||||
import com.njcn.advance.service.AppTopologyDiagramService;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:24【需求编号】d
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppTopologyDiagramServiceImpl extends MppServiceImpl<AppTopologyDiagramMapper, AppTopologyDiagramPO> implements AppTopologyDiagramService {
|
||||
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean addAppTopologyDiagram(AppTopologyDiagramAddParm appTopologyDiagramAddParm) {
|
||||
AppTopologyDiagramPO appTopologyDiagramPO = new AppTopologyDiagramPO();
|
||||
|
||||
MultipartFile file = appTopologyDiagramAddParm.getFile ( );
|
||||
long size = file.getSize ( );
|
||||
String filePath = fileStorageUtil.uploadMultipart (file, OssPath.TOPOLOGY);
|
||||
appTopologyDiagramPO.setFilePath (filePath);
|
||||
appTopologyDiagramPO.setProjectId (appTopologyDiagramAddParm.getProjectId ());
|
||||
appTopologyDiagramPO.setName (appTopologyDiagramAddParm.getTopologyDiagramName ());
|
||||
appTopologyDiagramPO.setFileSize (Integer.valueOf (size+""));
|
||||
appTopologyDiagramPO.setStatus ("1");
|
||||
boolean save = this.save (appTopologyDiagramPO);
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean AuditAppTopologyDiagram(AppTopologyDiagramAuditParm appTopologyDiagramAuditParm) {
|
||||
AppTopologyDiagramPO appTopologyDiagramPO = new AppTopologyDiagramPO();
|
||||
if(!Objects.equal (appTopologyDiagramAuditParm.getFile (),null )){
|
||||
MultipartFile file = appTopologyDiagramAuditParm.getFile ( );
|
||||
long size = file.getSize ( );
|
||||
String filePath = fileStorageUtil.uploadMultipart (file, OssPath.TOPOLOGY);
|
||||
appTopologyDiagramPO.setFilePath (filePath);
|
||||
appTopologyDiagramPO.setFileSize (Integer.valueOf (size+""));
|
||||
}
|
||||
if(appTopologyDiagramAuditParm.getProjectId ()!=null&&appTopologyDiagramAuditParm.getProjectId ()!=""){
|
||||
appTopologyDiagramPO.setProjectId (appTopologyDiagramAuditParm.getProjectId ());
|
||||
}
|
||||
if(appTopologyDiagramAuditParm.getTopologyDiagramName ()!=null&&appTopologyDiagramAuditParm.getTopologyDiagramName ()!=""){
|
||||
appTopologyDiagramPO.setName (appTopologyDiagramAuditParm.getTopologyDiagramName ());
|
||||
}
|
||||
if(appTopologyDiagramAuditParm.getStatus ()!=null&&appTopologyDiagramAuditParm.getTopologyDiagramName ()!=""){
|
||||
appTopologyDiagramPO.setStatus (appTopologyDiagramAuditParm.getStatus ());
|
||||
}
|
||||
UpdateWrapper<AppTopologyDiagramPO> updateWrapper = new UpdateWrapper ();
|
||||
updateWrapper.eq ("id",appTopologyDiagramAuditParm.getId ());
|
||||
boolean update = this.update (appTopologyDiagramPO, updateWrapper);
|
||||
return update;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppTopologyDiagramVO> queryAppTopologyDiagram(AppTopologyDiagramQueryParm appTopologyDiagramAuditParm) {
|
||||
QueryWrapper<AppTopologyDiagramPO> queryWrapper = new QueryWrapper ();
|
||||
queryWrapper.eq ("status","1").
|
||||
eq (StringUtils.isNotBlank (appTopologyDiagramAuditParm.getId ()),"id",appTopologyDiagramAuditParm.getId ()).
|
||||
eq (StringUtils.isNotBlank (appTopologyDiagramAuditParm.getProjectId ()),"project_id",appTopologyDiagramAuditParm.getProjectId ()).
|
||||
like (StringUtils.isNotBlank (appTopologyDiagramAuditParm.getName ()),"name", appTopologyDiagramAuditParm.getName ());
|
||||
List<AppTopologyDiagramPO> list = this.list (queryWrapper);
|
||||
List<AppTopologyDiagramVO> collect = list.stream ( ).map (temp -> {
|
||||
AppTopologyDiagramVO vo = new AppTopologyDiagramVO ( );
|
||||
BeanUtils.copyProperties (temp, vo);
|
||||
vo.setFilePath (fileStorageUtil.getFileUrl (vo.getFilePath ()));
|
||||
return vo;
|
||||
}).collect (Collectors.toList ( ));
|
||||
return collect;
|
||||
}
|
||||
}
|
||||
@@ -47,4 +47,9 @@ public interface OssPath {
|
||||
* 终端检测监督管理 检测报告
|
||||
*/
|
||||
String TEST_REPORT = "testReport/";
|
||||
|
||||
/***
|
||||
* app拓扑图文件
|
||||
*/
|
||||
String TOPOLOGY = "topology/";
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ public class Knife4jSwaggerConfig {
|
||||
"com.njcn.event.controller",
|
||||
"com.njcn.energy.controller",
|
||||
"com.njcn.quality.controller",
|
||||
"com.njcn.process.controller"
|
||||
"com.njcn.process.controller",
|
||||
"com.njcn.advance.controller"
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
List<GrantType> grantTypes = new ArrayList<>();
|
||||
|
||||
@@ -227,6 +227,9 @@ public class COverlimit {
|
||||
case "515kV":
|
||||
uL = 535.0f;
|
||||
break;
|
||||
case "800kV":
|
||||
uL = 825.0f;
|
||||
break;
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,11 @@ package com.njcn.device.pq.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.po.LineDataIntegrity;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -14,4 +18,11 @@ import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
*/
|
||||
public interface RStatIntegrityDMapper extends BaseMapper<RStatIntegrityD> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取监测点数据完整性
|
||||
* @author cdf
|
||||
* @date 2023/3/29
|
||||
*/
|
||||
List<LineDataIntegrity> getLineIntegrityRate(@Param("lineIds")List<String> lineIds,@Param("startTime")String startTime,@Param("endTime")String endTime);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.TerminalOnlineRateDataMapper">
|
||||
|
||||
<select id="getLineIntegrityRate" resultType="LineDataIntegrity">
|
||||
select line_index lineId,avg(real_time/due_time) integrityData
|
||||
from r_stat_integrity_d
|
||||
where line_index in
|
||||
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
and time_id between #{startTime} and #{endTime}
|
||||
group by line_index
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -172,7 +172,7 @@
|
||||
|
||||
|
||||
<select id="getDevOnlineByDevIds" resultType="TerminalOnlineRateData">
|
||||
select dev_index,avg(offline_min) offlineRate
|
||||
select dev_index devId,avg(online_min/(online_min+offline_min)) onlineRate
|
||||
from r_stat_onlinerate_d
|
||||
where dev_index in
|
||||
<foreach collection="devIds" item="item" open="(" close=")" separator=",">
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.device.pq.api.AlarmClient;
|
||||
import com.njcn.device.pq.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.LineIntegrityDataMapper;
|
||||
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.LineIntegrityDataParam;
|
||||
import com.njcn.device.pq.pojo.po.LineDataIntegrity;
|
||||
@@ -54,6 +55,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
|
||||
private final GeneralDeviceService generalDeviceService;
|
||||
|
||||
private final RStatIntegrityDMapper rStatIntegrityDMapper;
|
||||
|
||||
/**
|
||||
* 监测点数据完整性
|
||||
*
|
||||
@@ -105,13 +108,9 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
// 通过供电公司索引查询省会
|
||||
List<LineIntegrityDataVO> proList = lineIntegrityDataMapper.getProvinceList(gdIds);
|
||||
|
||||
List<LineDataIntegrity> percentageOfCompleteDatas = rStatIntegrityDMapper.getLineIntegrityRate(generalDeviceDTO.getLineIndexes(),lineIntegrityDataParam.getSearchBeginTime(), lineIntegrityDataParam.getSearchEndTime());
|
||||
|
||||
|
||||
// 通过工具类得到查询influxdb的条件(相当于mysql中的in)
|
||||
StringBuilder lineIdsForInfluxdb = InfluxDBCommUtils.assToInfluxParam(generalDeviceDTO.getLineIndexes());
|
||||
// 通过监测点id集合查询influxdb监测点数据完整性
|
||||
List<LineDataIntegrity> percentageOfCompleteDatas = getPercentageOfCompleteData(lineIntegrityDataParam.getSearchBeginTime(), lineIntegrityDataParam.getSearchEndTime(), lineIdsForInfluxdb);
|
||||
|
||||
|
||||
for (LineIntegrityDataVO lineDataIntegrity : lineList) {
|
||||
boolean flag = false;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final IRStatOnlinerateDService irStatOnlinerateDService;
|
||||
|
||||
|
||||
/**
|
||||
* 终端在线率列表
|
||||
@@ -188,40 +188,6 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 从influxdb中获取完整数据百分比
|
||||
*
|
||||
* @param startTime 查询开始时间
|
||||
* @param endTime 查询结束时间
|
||||
* @param deviceIndexes 终端id索引集合
|
||||
*/
|
||||
private List<TerminalOnlineRateData> getPercentageOfOnlineRate(String startTime, String endTime, StringBuilder deviceIndexes) {
|
||||
|
||||
//组装sql语句
|
||||
StringBuilder queryCriteria = new StringBuilder();
|
||||
// 构造sql查询条件
|
||||
queryCriteria.append(deviceIndexes)
|
||||
.append(" and ")
|
||||
.append(InfluxDBPublicParam.TIME)
|
||||
.append(" >= '")
|
||||
.append(startTime)
|
||||
.append(InfluxDBPublicParam.START_TIME)
|
||||
.append("' and ")
|
||||
.append(InfluxDBPublicParam.TIME)
|
||||
.append(" <= '")
|
||||
.append(endTime)
|
||||
.append(InfluxDBPublicParam.END_TIME)
|
||||
.append("'");
|
||||
//sql语句
|
||||
String sql = "SELECT mean(online_rate) as online_rate FROM pqs_onlinerate WHERE " + queryCriteria + " group by dev_id " + InfluxDBPublicParam.TIME_ZONE;
|
||||
// 结果集
|
||||
QueryResult results = influxDbUtils.query(sql);
|
||||
|
||||
// 结果集映射到对象中
|
||||
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
|
||||
// 返回结果
|
||||
return resultMapper.toPOJO(results, TerminalOnlineRateData.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,12 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SuperviseDto extends BaseParam {
|
||||
@ApiModelProperty("删除的技术监督id集合")
|
||||
@ApiModelProperty(value = "删除的技术监督id集合", required = true)
|
||||
private List<String> deleteIds;
|
||||
@ApiModelProperty(value = "事务类型(0:预警;1:告警)")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "进度(0:开始;1:预/告警单下发;2:反馈单上传;3:现场测试;4:整改通知单下发:5:整改通知反馈单;6:完结)")
|
||||
private Integer progress;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.njcn.prepare.harmonic.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ThsOverRunLogDto {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty(name = "id", value = "主键", required = true)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 监测点ID
|
||||
*/
|
||||
@ApiModelProperty(name = "lineIndex", value = "监测点ID")
|
||||
private String lineIndex;
|
||||
@ApiModelProperty(name = "lineIndexName", value = "监测点名称")
|
||||
private String lineIndexName;
|
||||
|
||||
/**
|
||||
* 名称(变电站_监测点_日期_id)
|
||||
*/
|
||||
@ApiModelProperty(name = "name", value = "名称", required = true)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 技术监督Guid
|
||||
*/
|
||||
@ApiModelProperty(name = "supIndex", value = "技术监督Guid", required = true)
|
||||
private String supIndex;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(name = "description", value = "描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 预/告警单
|
||||
*/
|
||||
@ApiModelProperty(name = "alarmTicket", value = "预/告警单")
|
||||
private String alarmTicket;
|
||||
|
||||
/**
|
||||
* 反馈单
|
||||
*/
|
||||
@ApiModelProperty(name = "feedback", value = "反馈单")
|
||||
private String feedback;
|
||||
|
||||
/**
|
||||
* 测试报告
|
||||
*/
|
||||
@ApiModelProperty(name = "testReport", value = "测试报告")
|
||||
private String testReport;
|
||||
|
||||
/**
|
||||
* 整改通知单
|
||||
*/
|
||||
@ApiModelProperty(name = "reviseNotice", value = "整改通知单")
|
||||
private String reviseNotice;
|
||||
|
||||
/**
|
||||
* 整改通知反馈单
|
||||
*/
|
||||
@ApiModelProperty(name = "reviseFeedback", value = "整改通知反馈单")
|
||||
private String reviseFeedback;
|
||||
/**
|
||||
* 越限时间(yyyy-MM-dd)
|
||||
*/
|
||||
@ApiModelProperty(name = "updateTime", value = "越限时间", required = true)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(name = "createTime", value = "创建时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
@ApiModelProperty(name = "companyName", value = "供电公司")
|
||||
private String companyName;
|
||||
}
|
||||
@@ -26,4 +26,6 @@ public class SuperviseParam {
|
||||
private String description;
|
||||
@ApiModelProperty(name = "thsSupervise", value = "技术监督参数")
|
||||
private ThsSupervise thsSupervise;
|
||||
@ApiModelProperty(name = "type", value = "类型(0:预警;1:告警)")
|
||||
private Integer type;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.prepare.harmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -95,6 +96,15 @@ public class ThsOverRunLog {
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
@ApiModelProperty(name = "companyName", value = "供电公司")
|
||||
@TableField(exist = false)
|
||||
private String companyName;
|
||||
@ApiModelProperty(name = "lineIndexName", value = "监测点名称")
|
||||
@TableField(exist = false)
|
||||
private String lineIndexName;
|
||||
@ApiModelProperty(name = "fileName", value = "文件名")
|
||||
@TableField(exist = false)
|
||||
private String fileName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,4 +17,5 @@ public class SuperviceRunLogVo {
|
||||
private ThsSupervise thsSupervise;
|
||||
@ApiModelProperty(name = "overRunLog", value = "监测点集合", required = true)
|
||||
private List<ThsOverRunLog> overRunLog;
|
||||
|
||||
}
|
||||
|
||||
@@ -111,4 +111,11 @@ public class SuperviseVo {
|
||||
*/
|
||||
@ApiModelProperty(name = "haveReviseFeedback", value = "是否已经上传 整改通知反馈单")
|
||||
private boolean haveReviseFeedback;
|
||||
@ApiModelProperty(name = "companyName", value = "部门名称")
|
||||
private String companyName;
|
||||
@ApiModelProperty(name = "alertType", value = "预警类型:0 无预警,1 一级预警 2 二级预警 3 超时")
|
||||
private Integer alertType;
|
||||
@ApiModelProperty(name = "progressTime", value = "进行时间(天)")
|
||||
private Integer progressTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.prepare.harmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ThsSuperviseVo {
|
||||
@ApiModelProperty(name = "superviseVoList", value = "技术监督列表")
|
||||
private List<SuperviseVo> superviseVoList;
|
||||
@ApiModelProperty(name = "progressTime", value = "开始数量")
|
||||
private Integer startNum;
|
||||
@ApiModelProperty(name = "alarmTicketIssueNum", value = "预/告警单下发数量")
|
||||
private Integer alarmTicketIssueNum;
|
||||
@ApiModelProperty(name = "feedbackUploadNum", value = "预/告警单反馈数量")
|
||||
private Integer feedbackUploadNum;
|
||||
@ApiModelProperty(name = "testReportNum", value = "现场测试数量")
|
||||
private Integer testReportNum;
|
||||
@ApiModelProperty(name = "reviseNoticeIssueNum", value = "整改通知单下发数量")
|
||||
private Integer reviseNoticeIssueNum;
|
||||
@ApiModelProperty(name = "reviseFeedbackNum", value = "整改通知单反馈数量")
|
||||
private Integer reviseFeedbackNum;
|
||||
@ApiModelProperty(name = "endNum", value = "完结数量")
|
||||
private Integer endNum;
|
||||
}
|
||||
@@ -5,7 +5,13 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum ProgressEnum {
|
||||
|
||||
START(0, "开始");
|
||||
START(0, "开始"),
|
||||
ALARM_TICKET_ISSUE(1, "预/告警单下发"),
|
||||
FEEDBACK_UPLOAD(2, "反馈单上传"),
|
||||
TEST_REPORT(3, "现场测试"),
|
||||
REVISE_NOTICE_ISSUE(4, "整改通知单下发"),
|
||||
REVISE_FEEDBACK(5, "整改通知单反馈"),
|
||||
END(6, "完结");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -93,5 +95,14 @@ public class ThsSuperviseController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("查询流程状态列表")
|
||||
@PostMapping("/queryProgressValues")
|
||||
public HttpResult queryProgressValues() {
|
||||
List<Map<Integer, String>> values = thsSuperviseService.queryProgressValues();
|
||||
String methodDescribe = getMethodDescribe("queryProgressValues");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, values, methodDescribe);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!--查询技术监督列表-->
|
||||
<select id="querySuperviseList" parameterType="com.njcn.prepare.harmonic.pojo.dto.SuperviseDto"
|
||||
resultType="com.njcn.prepare.harmonic.pojo.vo.SuperviseVo">
|
||||
select ts.* from ths_supervise ts where ts.name like CONCAT(CONCAT('%', #{param.searchValue}), '%')
|
||||
select ts.* from ths_supervise ts where 1=1
|
||||
<if test="param.searchBeginTime != null and param.searchBeginTime != ''">
|
||||
AND DATE_FORMAT(ts.create_time, '%Y-%m-%d') >= DATE_FORMAT(#{param.searchBeginTime}, '%Y-%m-%d')
|
||||
</if>
|
||||
|
||||
@@ -311,6 +311,17 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<Integer, String>> queryProgressValues() {
|
||||
List<Map<Integer, String>> list = new ArrayList<>();
|
||||
Arrays.asList(ProgressEnum.values()).forEach(value -> {
|
||||
Map<Integer, String> progress = new HashMap<>();
|
||||
progress.put(value.getCode(), value.getMessage());
|
||||
list.add(progress);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询策略列表
|
||||
|
||||
@@ -127,4 +127,11 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
* @param response
|
||||
*/
|
||||
void uploadSuperviseTicket(String id, String ticketType, MultipartFile[] files, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 查询流程状态枚举列表
|
||||
* @return
|
||||
*/
|
||||
List<Map<Integer, String>> queryProgressValues();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum AlarmTypeEnum {
|
||||
EARLY_WARN(0, "电能质量技术预警单"),
|
||||
REPORT_WARN(1, "电能质量技术告警单");
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
AlarmTypeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static AlarmTypeEnum getAlarmTypeEnumByCode(Integer code) {
|
||||
for (AlarmTypeEnum alarmTypeEnum : AlarmTypeEnum.values()) {
|
||||
if (alarmTypeEnum.getCode().equals(code)) {
|
||||
return alarmTypeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum AlertTypeEnum {
|
||||
BLACK(0, "无预警"),
|
||||
YELLOW(1, "一级预警"),
|
||||
ORANGE(2, "二级预警"),
|
||||
RED(3, "超时");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
AlertTypeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static AlertTypeEnum getAlertTypeEnumByCode(Integer code) {
|
||||
for (AlertTypeEnum alertTypeEnum : AlertTypeEnum.values()) {
|
||||
if (alertTypeEnum.getCode().equals(code)) {
|
||||
return alertTypeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum BigTypeEnum {
|
||||
COMMON(0, "通用策略"),
|
||||
CUSTOM(1, "定制策略");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
BigTypeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum GradeEnum {
|
||||
ONE_LEVEL(0, "一级"),
|
||||
TWO_LEVEL(1, "二级"),
|
||||
THREE_LEVEL(2, "三级");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
GradeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum InitTypeEnum {
|
||||
AUTO(0, "自动"),
|
||||
MANUAL(1, "手动");
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
InitTypeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 干扰源类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum InterferenceTypeEnum {
|
||||
Electric_Load("Electric_Load", "电加热负荷"),
|
||||
Electrolytic_Load("Electrolytic_Load", "电解负荷"),
|
||||
Transportation_Hubs("Transportation_Hubs", "交通枢纽"),
|
||||
Nonlinear_Loads("Nonlinear_Loads", "非线性负荷"),
|
||||
Electrified_Railways("Electrified_Railways", "电气化铁路"),
|
||||
Fre_Equipment("Fre_Equipment", "变频调速设备"),
|
||||
Mill("Mill", "轧机"),
|
||||
Medium_Furnace("Medium_Furnace", "中频炉"),
|
||||
Precision_Mach("Precision_Mach", "精密加工"),
|
||||
Com_Muni("Com_Muni", "商业/市政"),
|
||||
AC_DC_Inverter("AC_DC_Inverter", "交直流逆变器"),
|
||||
Shock_Loads("Shock_Loads", "冲击性负荷"),
|
||||
Electric_Weld_Load("Electric_Weld_Load", "电焊负荷"),
|
||||
dycs("dycs", "电压测试"),
|
||||
dlcs("dlcs", "电流测试"),
|
||||
Zlzz("Zlzz", "整流装置"),
|
||||
Hospital("Hospital", "医院"),
|
||||
Manufacturing("Manufacturing", "半导体制造");
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
InterferenceTypeEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum OperationEnum {
|
||||
|
||||
AND(0, "与"),
|
||||
OR(1, "或");
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
OperationEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ProgressEnum {
|
||||
|
||||
START(0, "开始"),
|
||||
ALARM_TICKET_ISSUE(1, "预/告警单下发"),
|
||||
FEEDBACK_UPLOAD(2, "反馈单上传"),
|
||||
TEST_REPORT(3, "现场测试"),
|
||||
REVISE_NOTICE_ISSUE(4, "整改通知单下发"),
|
||||
REVISE_FEEDBACK(5, "整改通知单反馈"),
|
||||
END(6, "完结");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
ProgressEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static ProgressEnum getProgressEnumByCode(Integer code) {
|
||||
for (ProgressEnum progressEnum : ProgressEnum.values()) {
|
||||
if (progressEnum.getCode().equals(code)) {
|
||||
return progressEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 指标参数类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum SteadyIndicatorEnum {
|
||||
|
||||
Negative_Voltage("Negative_Voltage", "负序电压不平衡度超标"),
|
||||
Interhar_Voltage("Interhar_Voltage", "间谐波电压超标"),
|
||||
Neg_Current("Neg_Current", "负序电流超标"),
|
||||
Fre_Deviation("Fre_Deviation", "频率偏差超标"),
|
||||
Voltage_Dev("Voltage_Dev", "电压偏差超标"),
|
||||
Har_Current("Har_Current", "谐波电流超标"),
|
||||
Voltage_Fluc("Voltage_Fluc", "电压波动与闪变超标"),
|
||||
Har_Voltage("Har_Voltage", "谐波电压超标");
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
SteadyIndicatorEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static SteadyIndicatorEnum getSteadyIndicatorEnumByCode(String code) {
|
||||
for (SteadyIndicatorEnum steadyIndicatorEnum : SteadyIndicatorEnum.values()) {
|
||||
if (StringUtils.equals(code, steadyIndicatorEnum.getCode())) {
|
||||
return steadyIndicatorEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Getter
|
||||
public enum TicketTypeEnum {
|
||||
|
||||
|
||||
ALARM_TICKET("alarm_ticket", "预/告警单"),
|
||||
FEEDBACK("feedback", "反馈单"),
|
||||
TEST_REPORT("test_report", "测试报告"),
|
||||
REVISE_NOTICE("revise_notice", "整改通知单"),
|
||||
REVISE_FEEDBACK("revise_feedback", "整改通知反馈单");
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
TicketTypeEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static TicketTypeEnum getTicketTypeEnumByCode(String code) {
|
||||
for (TicketTypeEnum ticketTypeEnum : TicketTypeEnum.values()) {
|
||||
if (StringUtils.equals(code, ticketTypeEnum.getCode())) {
|
||||
return ticketTypeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.process.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum TypeEnum {
|
||||
MONITOR_TYPE(2, "监测点表类型"),
|
||||
INTERFERENCE_TYPE(1, "指标类型"),
|
||||
SOURCE_TYPE(0, "干扰源类型");
|
||||
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
TypeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.process.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author lee
|
||||
* @since 2023-03-29
|
||||
*/
|
||||
@Data
|
||||
@TableName("ths_alarm_formwork")
|
||||
public class ThsAlarmFormwork {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 类型(0:预警;1:告警)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 单据类型(0:预/告警单模板;1:整改通知反馈单模板
|
||||
*/
|
||||
private Integer formworkType;
|
||||
|
||||
/**
|
||||
* 模板路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
|
||||
}
|
||||
@@ -90,6 +90,12 @@
|
||||
<artifactId>common-oss</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- 多数据源切换,当数据源为oracle时需要使用 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.njcn.process.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.service.ThsOverRunLogService;
|
||||
import com.njcn.process.service.ThsSuperviseService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
@Api(tags = "预警-告警技术监督")
|
||||
@RestController
|
||||
@RequestMapping("/thsSupervise")
|
||||
public class ThsSuperviseController extends BaseController {
|
||||
@Autowired
|
||||
private ThsSuperviseService thsSuperviseService;
|
||||
@Autowired
|
||||
private ThsOverRunLogService thsOverRunLogService;
|
||||
|
||||
@ApiOperation("预警/告警事务生成")
|
||||
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
|
||||
@PostMapping("/initSupervise")
|
||||
public HttpResult<SuperviceRunLogVo> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
return thsSuperviseService.initSupervise(superviseParam);
|
||||
}
|
||||
|
||||
@ApiOperation("保存技术监督监测点")
|
||||
@ApiImplicitParam(name = "superviceRunLogVo", value = "技术监督监测点参数", required = true)
|
||||
@PostMapping("/saveOverRunLog")
|
||||
public HttpResult saveOverRunLog(@RequestBody SuperviceRunLogVo superviceRunLogVo) {
|
||||
thsSuperviseService.saveOverRunLog(superviceRunLogVo);
|
||||
String methodDescribe = getMethodDescribe("saveOverRunLog");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("技术监督详情")
|
||||
@ApiImplicitParam(name = "supIndex", value = "技术监督id", required = true)
|
||||
@PostMapping("/superviseDetail")
|
||||
public HttpResult superviseDetail(@RequestParam String supIndex) {
|
||||
SuperviceRunLogVo result = thsOverRunLogService.superviseDetail(supIndex);
|
||||
String methodDescribe = getMethodDescribe("superviseDetail");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("删除技术监督")
|
||||
@ApiImplicitParam(name = "superviseDto", value = "删除技术监督请求体", required = true)
|
||||
@PostMapping("/deleteSupervise")
|
||||
public HttpResult deleteSupervise(@RequestBody SuperviseDto superviseDto) {
|
||||
return thsSuperviseService.deleteSupervise(superviseDto);
|
||||
}
|
||||
|
||||
@ApiOperation("查询技术监督列表")
|
||||
@ApiImplicitParam(name = "superviseDto", value = "查询技术监督列表参数", required = true)
|
||||
@PostMapping("/querySuperviseList")
|
||||
public HttpResult<Page<SuperviseVo>> querySuperviseList(@RequestBody SuperviseDto superviseDto) {
|
||||
Page<SuperviseVo> pageResult = thsSuperviseService.querySuperviseList(superviseDto);
|
||||
String methodDescribe = getMethodDescribe("querySuperviseList");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pageResult, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("上传技术监督单据")
|
||||
@PostMapping("/uploadSuperviseTicket")
|
||||
public HttpResult uploadSuperviseTicket(@ApiParam(value = "文件", required = true)
|
||||
@RequestPart(value = "files") MultipartFile[] files,
|
||||
@ApiParam(name = "id", value = "越限监测点记录id", required = true) @RequestParam("id") String id,
|
||||
@ApiParam(name = "supIndex", value = "技术监督id", required = true) @RequestParam("supIndex") String supIndex,
|
||||
@ApiParam(name = "ticketType", value = "上传单据类型", required = true) @RequestParam("ticketType") String ticketType,
|
||||
HttpServletResponse response) {
|
||||
thsSuperviseService.uploadSuperviseTicket(id, supIndex, ticketType, files, response);
|
||||
String methodDescribe = getMethodDescribe("uploadSuperviseTicket");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("查询流程状态列表")
|
||||
@PostMapping("/queryProgressValues")
|
||||
public HttpResult queryProgressValues() {
|
||||
List<Map<Integer, String>> values = thsSuperviseService.queryProgressValues();
|
||||
String methodDescribe = getMethodDescribe("queryProgressValues");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, values, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("上传单据模板")
|
||||
@PostMapping("/uploadAlarmFormwork")
|
||||
public HttpResult uploadAlarmFormwork(@ApiParam(value = "文件", required = true)
|
||||
@RequestPart(value = "file") MultipartFile file,
|
||||
@ApiParam(name = "type", value = "类型(0:预警;1:告警)", required = true) @RequestParam("type") Integer type,
|
||||
@ApiParam(name = "formworkType", value = "0:预/告警单模板;1:整改通知反馈单模板", required = true) @RequestParam("formworkType") Integer formworkType,
|
||||
HttpServletResponse response) {
|
||||
thsSuperviseService.uploadAlarmFormwork(type, formworkType, file, response);
|
||||
String methodDescribe = getMethodDescribe("uploadAlarmFormwork");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("下载单据模板")
|
||||
@PostMapping("/dowloadAlarmFormwork")
|
||||
public HttpResult dowloadAlarmFormwork(@ApiParam(name = "type", value = "类型(0:预警;1:告警)", required = true) @RequestParam("type") Integer type,
|
||||
@ApiParam(name = "formworkType", value = "0:预/告警单模板;1:整改通知反馈单模板", required = true) @RequestParam("formworkType") Integer formworkType,
|
||||
HttpServletResponse response) {
|
||||
String httpPath = thsSuperviseService.dowloadAlarmFormwork(type, formworkType, response);
|
||||
String methodDescribe = getMethodDescribe("uploadAlarmFormwork");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, httpPath, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("监督首页")
|
||||
@ApiImplicitParam(name = "superviseDto", value = "查询技术监督列表参数", required = true)
|
||||
@PostMapping("/superviseIndex")
|
||||
public HttpResult<Page<ThsSuperviseVo>> superviseIndex(@RequestBody SuperviseDto superviseDto) {
|
||||
Page<ThsSuperviseVo> pageResult = thsSuperviseService.superviseIndex(superviseDto);
|
||||
String methodDescribe = getMethodDescribe("superviseIndex");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pageResult, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.process.pojo.po.LimitRate;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
@DS("master")
|
||||
@Mapper
|
||||
public interface LimitRateMapper extends BaseMapper<LimitRate> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author yzh
|
||||
* @date 2022/10/17
|
||||
*/
|
||||
@DS("master")
|
||||
@Mapper
|
||||
public interface PmsMonitorMapper extends BaseMapper<Monitor> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.process.pojo.po.ThsAlarmFormwork;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lee
|
||||
* @since 2023-03-29
|
||||
*/
|
||||
@Mapper
|
||||
public interface ThsAlarmFormworkMapper extends BaseMapper<ThsAlarmFormwork> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 告警/预警监测点列表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
@DS("process")
|
||||
@Mapper
|
||||
public interface ThsOverRunLogMapper extends BaseMapper<ThsOverRunLog> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
@DS("process")
|
||||
@Mapper
|
||||
public interface ThsSuperviseMapper extends BaseMapper<ThsSupervise> {
|
||||
/**
|
||||
* 查询技术监督列表
|
||||
*
|
||||
* @param superviseDto
|
||||
* @return
|
||||
*/
|
||||
Page<SuperviseVo> querySuperviseList(Page<SuperviseVo> page, @Param("param") SuperviseDto superviseDto);
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.param.StrategyParam;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategy;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,6 +18,7 @@ import java.util.List;
|
||||
* @author wr
|
||||
* @since 2023-03-10
|
||||
*/
|
||||
@DS("process")
|
||||
public interface ThsWarnStrategyMapper extends BaseMapper<ThsWarnStrategy> {
|
||||
|
||||
/***
|
||||
@@ -47,10 +50,8 @@ public interface ThsWarnStrategyMapper extends BaseMapper<ThsWarnStrategy> {
|
||||
List<String> getMonitorTagDetail(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 查询所有部门的策略列表
|
||||
*
|
||||
* @return
|
||||
* 查询策略的集合
|
||||
*/
|
||||
List<ThsStrategyVo> selectStrategyList();
|
||||
List<ThsStrategyVo> selectStrategyList(@Param("param") SuperviseParam superviseParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.process.mapper.ThsSuperviseMapper">
|
||||
<!--查询技术监督列表-->
|
||||
<select id="querySuperviseList" parameterType="com.njcn.prepare.harmonic.pojo.dto.SuperviseDto"
|
||||
resultType="com.njcn.prepare.harmonic.pojo.vo.SuperviseVo">
|
||||
select ts.* from ths_supervise ts where 1=1
|
||||
<if test="param.searchValue != null and param.searchValue != ''">
|
||||
AND ts.name like CONCAT(CONCAT('%', #{param.searchValue}), '%')
|
||||
</if>
|
||||
<if test="param.searchBeginTime != null and param.searchBeginTime != ''">
|
||||
AND DATE_FORMAT(ts.create_time, '%Y-%m-%d') >= DATE_FORMAT(#{param.searchBeginTime}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="param.searchEndTime != null and param.searchEndTime != ''">
|
||||
AND DATE_FORMAT(ts.create_time, '%Y-%m-%d') <= DATE_FORMAT(#{param.searchEndTime}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="param.searchState != null">
|
||||
AND ts.progress=#{param.searchState}
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND ts.type=#{param.type}
|
||||
</if>
|
||||
order by ts.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -4,23 +4,23 @@
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.njcn.process.pojo.po.ThsWarnStrategy">
|
||||
<id column="Id" property="id" />
|
||||
<result column="Create_Time" property="createTime" />
|
||||
<result column="Update_TIme" property="updateTime" />
|
||||
<result column="Name" property="name" />
|
||||
<result column="Grade" property="grade" />
|
||||
<result column="Operation" property="operation" />
|
||||
<result column="type" property="type" />
|
||||
<result column="State" property="state" />
|
||||
<result column="Create_By" property="createBy" />
|
||||
<result column="Update_By" property="updateBy" />
|
||||
<id column="Id" property="id"/>
|
||||
<result column="Create_Time" property="createTime"/>
|
||||
<result column="Update_TIme" property="updateTime"/>
|
||||
<result column="Name" property="name"/>
|
||||
<result column="Grade" property="grade"/>
|
||||
<result column="Operation" property="operation"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="State" property="state"/>
|
||||
<result column="Create_By" property="createBy"/>
|
||||
<result column="Update_By" property="updateBy"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="StrategyResultMap" type="com.njcn.process.pojo.param.StrategyParam$StrategyUpdateParam">
|
||||
<id column="Id" property="id" />
|
||||
<result column="Name" property="name" />
|
||||
<result column="Grade" property="grade" />
|
||||
<result column="Operation" property="operation" />
|
||||
<id column="Id" property="id"/>
|
||||
<result column="Name" property="name"/>
|
||||
<result column="Grade" property="grade"/>
|
||||
<result column="Operation" property="operation"/>
|
||||
<collection
|
||||
property="monitorTag"
|
||||
column="{id = id}"
|
||||
@@ -51,21 +51,44 @@
|
||||
WHERE
|
||||
Warn_Id = #{id} and ts.Type=1
|
||||
</select>
|
||||
<!--查询所有部门的策略列表-->
|
||||
<select id="selectStrategyList" resultType="com.njcn.harmonic.pojo.vo.ThsStrategyVo">
|
||||
<!--查询策略的集合-->
|
||||
<select id="selectStrategyList" parameterType="com.njcn.prepare.harmonic.pojo.param.SuperviseParam"
|
||||
resultType="com.njcn.harmonic.pojo.vo.ThsStrategyVo">
|
||||
select
|
||||
tws.id,
|
||||
tws.name,
|
||||
tws.grade,
|
||||
tws.operation,
|
||||
tws.type,
|
||||
Monitor_Id as monitorId,
|
||||
tda.dept_Id as deptId
|
||||
from
|
||||
ths_warn_strategy tws
|
||||
left join ths_dept_alarm tda on
|
||||
INNER join ths_dept_alarm tda on
|
||||
tws.Id = tda.Alarm_Id
|
||||
where
|
||||
<where>
|
||||
<choose>
|
||||
<when test="param.initType==0">
|
||||
tws.State = 1 and tws.Grade in(0,2)
|
||||
</when>
|
||||
<when test="param.initType==1">
|
||||
tws.State = 1 and tws.Grade in(1,2)
|
||||
</when>
|
||||
</choose>
|
||||
<if test="param.deptId !=null and param.deptId !=''">
|
||||
and tda.Dept_Id=#{param.deptId}
|
||||
</if>
|
||||
<if test="param.type !=null">
|
||||
and tda.type=#{param.type}
|
||||
</if>
|
||||
<!-- <if test="param != null and param.overRunLog != null and param.overRunLog.size > 0">
|
||||
AND tda.Monitor_Id IN
|
||||
<foreach collection='param.overRunLog' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item.lineIndex}
|
||||
</foreach>
|
||||
</if>-->
|
||||
and tws.Big_Type=1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getMonitorTagDetail" resultType="java.lang.String">
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.process.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 告警/预警监测点列表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
public interface ThsOverRunLogService extends IService<ThsOverRunLog> {
|
||||
|
||||
/**
|
||||
* 保存技术监督监测点
|
||||
*
|
||||
* @param superviseParam
|
||||
* @return
|
||||
*/
|
||||
void saveOverRunLog(SuperviseParam superviseParam);
|
||||
|
||||
/**
|
||||
* 查询技术监督监测点集合
|
||||
*
|
||||
* @param supIndex
|
||||
* @return
|
||||
*/
|
||||
SuperviceRunLogVo superviseDetail(String supIndex);
|
||||
|
||||
/**
|
||||
* 更新技术监督
|
||||
*
|
||||
* @param superviseParam
|
||||
*/
|
||||
HttpResult updateSupervise(SuperviseParam superviseParam);
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.njcn.process.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.harmonic.pojo.vo.SourceSteadyIndicator;
|
||||
import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.enums.TypeEnum;
|
||||
import com.njcn.process.pojo.po.LimitRate;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategyAss;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
/**
|
||||
* 初始化技术监督
|
||||
*/
|
||||
HttpResult<SuperviceRunLogVo> initSupervise(SuperviseParam superviseParam);
|
||||
|
||||
/**
|
||||
* 查新策略集合
|
||||
*
|
||||
* @param superviseParam
|
||||
* @return
|
||||
*/
|
||||
List<ThsStrategyVo> selectStrategyList(SuperviseParam superviseParam);
|
||||
|
||||
/**
|
||||
* 查询LimitTarget数据
|
||||
*
|
||||
* @param monitorId
|
||||
*/
|
||||
LimitRate queryLimitTargetData(String monitorId);
|
||||
|
||||
/**
|
||||
* 生成监督数据
|
||||
*
|
||||
* @param limitBoolMap
|
||||
*/
|
||||
void buildData(SourceSteadyIndicator steady, Map<String, Object> limitBoolMap, Monitor monitor, LimitRate limitRate, Integer initType, ThsSupervise thsSupervise, List<ThsOverRunLog> thsOverRunLogs);
|
||||
|
||||
/**
|
||||
* 查询策略绑定的干扰源列表或指标参数列表
|
||||
*
|
||||
* @param id
|
||||
* @param typeEnum
|
||||
* @return
|
||||
*/
|
||||
List<ThsWarnStrategyAss> queryWarnStrategyAss(String id, TypeEnum typeEnum);
|
||||
|
||||
/**
|
||||
* 生成监督数据
|
||||
*
|
||||
* @param steady
|
||||
* @param monitor
|
||||
* @return
|
||||
*/
|
||||
void buildSuperviseData(SourceSteadyIndicator steady, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType, ThsSupervise thsSupervise, List<ThsOverRunLog> thsOverRunLogs);
|
||||
|
||||
/**
|
||||
* 生成 告警/预警监测点列表 数据
|
||||
*
|
||||
* @param steady
|
||||
* @param thsSupervise
|
||||
* @param monitor
|
||||
*/
|
||||
void buildOverRunLog(SourceSteadyIndicator steady, ThsSupervise thsSupervise, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType, List<ThsOverRunLog> thsOverRunLogs);
|
||||
|
||||
|
||||
void deleteTodayData(String depId, Integer initType);
|
||||
|
||||
/**
|
||||
* 生成技术监督数据
|
||||
*
|
||||
* @param thsSupervise
|
||||
* @param overRunLogList
|
||||
*/
|
||||
void creatData(Dept dept, ThsSupervise thsSupervise, List<ThsOverRunLog> overRunLogList);
|
||||
|
||||
/**
|
||||
* 保存技术监督数据
|
||||
*
|
||||
* @param superviceRunLogVo
|
||||
*/
|
||||
void saveOverRunLog(SuperviceRunLogVo superviceRunLogVo);
|
||||
|
||||
/**
|
||||
* 查询技术监督列表
|
||||
*
|
||||
* @param superviseDto
|
||||
*/
|
||||
Page<SuperviseVo> querySuperviseList(SuperviseDto superviseDto);
|
||||
|
||||
/**
|
||||
* 删除技术监督
|
||||
*
|
||||
* @param superviseDto
|
||||
* @return
|
||||
*/
|
||||
HttpResult deleteSupervise(SuperviseDto superviseDto);
|
||||
|
||||
/**
|
||||
* 上传技术监督单据
|
||||
*
|
||||
* @param id
|
||||
* @param ticketType
|
||||
* @param files
|
||||
* @param response
|
||||
*/
|
||||
void uploadSuperviseTicket(String id, String supIndex, String ticketType, MultipartFile[] files, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 查询流程状态枚举列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<Integer, String>> queryProgressValues();
|
||||
|
||||
/**
|
||||
* 上传单据模板
|
||||
*
|
||||
* @param type
|
||||
* @param formworkType
|
||||
* @param file
|
||||
* @param response
|
||||
*/
|
||||
void uploadAlarmFormwork(Integer type, Integer formworkType, MultipartFile file, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 下载单据模板
|
||||
*
|
||||
* @param type
|
||||
* @param formworkType
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
String dowloadAlarmFormwork(Integer type, Integer formworkType, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 技术监督首页
|
||||
*
|
||||
* @param superviseDto
|
||||
* @return
|
||||
*/
|
||||
Page<ThsSuperviseVo> superviseIndex(SuperviseDto superviseDto);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.njcn.process.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.mapper.ThsOverRunLogMapper;
|
||||
import com.njcn.process.mapper.ThsSuperviseMapper;
|
||||
import com.njcn.process.service.ThsOverRunLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 告警/预警监测点列表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@DS("process")
|
||||
public class ThsOverRunLogServiceImpl extends ServiceImpl<ThsOverRunLogMapper, ThsOverRunLog> implements ThsOverRunLogService {
|
||||
@Autowired
|
||||
private ThsOverRunLogMapper thsOverRunLogMapper;
|
||||
@Autowired
|
||||
private ThsSuperviseMapper thsSuperviseMapper;
|
||||
@Autowired
|
||||
private FileStorageUtil fileStorageUtil;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveOverRunLog(SuperviseParam superviseParam) {
|
||||
this.saveBatch(superviseParam.getOverRunLog());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperviceRunLogVo superviseDetail(String supIndex) {
|
||||
ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex));
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
if (CollectionUtil.isNotEmpty(thsOverRunLogs)) {
|
||||
thsOverRunLogs.forEach(item -> {
|
||||
if (StringUtils.isNotBlank(item.getAlarmTicket())) {
|
||||
item.setAlarmTicket(fileStorageUtil.getFileUrl(item.getAlarmTicket()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(item.getFeedback())) {
|
||||
item.setFeedback(fileStorageUtil.getFileUrl(item.getFeedback()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(item.getTestReport())) {
|
||||
item.setTestReport(fileStorageUtil.getFileUrl(item.getTestReport()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(item.getReviseNotice())) {
|
||||
item.setReviseNotice(fileStorageUtil.getFileUrl(item.getReviseNotice()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(item.getReviseFeedback())) {
|
||||
item.setReviseFeedback(fileStorageUtil.getFileUrl(item.getReviseFeedback()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
return SuperviceRunLogVo.builder().overRunLog(thsOverRunLogs).thsSupervise(thsSupervise).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult updateSupervise(SuperviseParam superviseParam) {
|
||||
List<ThsOverRunLog> overRunLog = superviseParam.getOverRunLog();
|
||||
if (CollectionUtil.isEmpty(overRunLog)) {
|
||||
HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "监测点不能为空", null);
|
||||
}
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, superviseParam.getSupIndex()));
|
||||
List<String> saveIds = superviseParam.getOverRunLog().stream().map(ThsOverRunLog::getId).collect(Collectors.toList());
|
||||
List<String> allIds = thsOverRunLogs.stream().map(ThsOverRunLog::getId).collect(Collectors.toList());
|
||||
allIds.removeAll(saveIds);
|
||||
thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, allIds));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,739 @@
|
||||
package com.njcn.process.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.harmonic.pojo.vo.SourceSteadyIndicator;
|
||||
import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.annotaion.HarCurrent;
|
||||
import com.njcn.process.annotaion.HarVoltage;
|
||||
import com.njcn.process.annotaion.InterharVoltage;
|
||||
import com.njcn.process.enums.*;
|
||||
import com.njcn.process.mapper.*;
|
||||
import com.njcn.process.pojo.po.LimitRate;
|
||||
import com.njcn.process.pojo.po.ThsAlarmFormwork;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategyAss;
|
||||
import com.njcn.process.service.ThsSuperviseService;
|
||||
import com.njcn.process.utils.ReadPatientExcelUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, ThsSupervise> implements ThsSuperviseService {
|
||||
|
||||
@Autowired
|
||||
private PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
@Autowired
|
||||
private ThsWarnStrategyMapper thsWarnStrategyMapper;
|
||||
@Autowired
|
||||
private ThsWarnStrategyAssMapper thsWarnStrategyAssMapper;
|
||||
@Autowired
|
||||
private PmsMonitorMapper pmsMonitorMapper;
|
||||
@Autowired
|
||||
private LimitRateMapper limitRateMapper;
|
||||
@Autowired
|
||||
private DicDataFeignClient dicDataFeignClient;
|
||||
@Autowired
|
||||
private ThsSuperviseMapper thsSuperviseMapper;
|
||||
@Autowired
|
||||
private ThsOverRunLogMapper thsOverRunLogMapper;
|
||||
@Autowired
|
||||
private DeptFeignClient deptFeignClient;
|
||||
@Autowired
|
||||
private FileStorageUtil fileStorageUtil;
|
||||
@Autowired
|
||||
private ThsAlarmFormworkMapper thsAlarmFormworkMapper;
|
||||
private static final String DESCRIPTION = "description";
|
||||
|
||||
@Override
|
||||
public HttpResult<SuperviceRunLogVo> initSupervise(SuperviseParam superviseParam) {
|
||||
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
||||
List<ThsOverRunLog> overRunLogList = new ArrayList<>();
|
||||
if (InitTypeEnum.MANUAL.getCode().equals(superviseParam.getInitType()) && StringUtils.isBlank(superviseParam.getDeptId())) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.INVALID_PARAMETER, null, "");
|
||||
}
|
||||
List<ThsStrategyVo> thsStrategyList = this.selectStrategyList(superviseParam);
|
||||
//按部门进行分组
|
||||
if (CollectionUtil.isNotEmpty(thsStrategyList)) {
|
||||
Map<String, List<ThsStrategyVo>> deptMap = thsStrategyList.stream().collect(Collectors.groupingBy(ThsStrategyVo::getDeptId));
|
||||
for (Map.Entry<String, List<ThsStrategyVo>> entry : deptMap.entrySet()) {
|
||||
String depId = entry.getKey();
|
||||
ThsSupervise thsSupervise = new ThsSupervise();
|
||||
List<ThsStrategyVo> deptList = entry.getValue();
|
||||
List<ThsStrategyVo> oneLevel = deptList.stream().filter(r -> !GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//一级或二级策略集合
|
||||
List<SourceSteadyIndicator> oneSourceSteadyIndicatorList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(oneLevel)) {
|
||||
for (ThsStrategyVo oneStrategyVo : oneLevel) {
|
||||
List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
|
||||
List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//干扰源列表
|
||||
List<String> oneSteadyIndicatorAssesIds = oneSteadyIndicatorAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
|
||||
//封装每一种干扰源和对应的指标
|
||||
for (ThsWarnStrategyAss oneWarnStrategyAss : oneInterferenceSourceAsses) {
|
||||
SourceSteadyIndicator build = SourceSteadyIndicator.builder().id(oneStrategyVo.getId()).operation(oneStrategyVo.getOperation())
|
||||
.interferenceSource(oneWarnStrategyAss.getAssId())
|
||||
.steadyIndicator(oneSteadyIndicatorAssesIds)
|
||||
.deptId(oneStrategyVo.getDeptId())
|
||||
.type(oneStrategyVo.getType())
|
||||
.monitorId(oneStrategyVo.getMonitorId())
|
||||
.build();
|
||||
oneSourceSteadyIndicatorList.add(build);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<ThsStrategyVo> threeLevel = deptList.stream().filter(r -> GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//三级策略集合
|
||||
if (CollectionUtil.isNotEmpty(threeLevel)) {
|
||||
for (ThsStrategyVo threeStrategyVo : threeLevel) {
|
||||
Iterator<SourceSteadyIndicator> iterator = oneSourceSteadyIndicatorList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
SourceSteadyIndicator sourceSteady = iterator.next();
|
||||
if (sourceSteady.getType().equals(threeStrategyVo.getType())) {
|
||||
if (StringUtils.equals(threeStrategyVo.getMonitorId(), sourceSteady.getMonitorId())) {
|
||||
List<ThsWarnStrategyAss> interferenceSourceAsses = this.queryWarnStrategyAss(threeStrategyVo.getId(), TypeEnum.SOURCE_TYPE);
|
||||
//干扰源类型id
|
||||
List<String> threeInterferenceSourceIds = interferenceSourceAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
|
||||
List<ThsWarnStrategyAss> threeSteadyIndicatorAsses = this.queryWarnStrategyAss(threeStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);
|
||||
//指标类型id
|
||||
List<String> steadyIndicatorIds = threeSteadyIndicatorAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
|
||||
for (String threeInterferenceSourceId : threeInterferenceSourceIds) {
|
||||
if (OperationEnum.AND.getCode().equals(threeStrategyVo.getOperation())) {//处理三级策略的与
|
||||
if (OperationEnum.AND.getCode().equals(sourceSteady.getOperation())) {
|
||||
if (StringUtils.equals(threeInterferenceSourceId, sourceSteady.getInterferenceSource()) &&
|
||||
steadyIndicatorIds.containsAll(sourceSteady.getSteadyIndicator())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
} else {//处理三级策略的或
|
||||
if (StringUtils.equals(threeInterferenceSourceId, sourceSteady.getInterferenceSource())) {
|
||||
if (steadyIndicatorIds.containsAll(sourceSteady.getSteadyIndicator())) {
|
||||
iterator.remove();
|
||||
} else {
|
||||
List<String> steadyIndicator = sourceSteady.getSteadyIndicator();
|
||||
steadyIndicator.removeAll(steadyIndicatorIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(oneSourceSteadyIndicatorList)) {
|
||||
oneSourceSteadyIndicatorList.forEach(steady -> {
|
||||
Monitor monitor = pmsMonitorMapper.selectById(steady.getMonitorId());
|
||||
if (monitor != null) {
|
||||
if (StringUtils.equals(monitor.getMonitorTag(), steady.getInterferenceSource())) {//匹配该监测点属于的干扰源类型
|
||||
//查询该监测点的检测数据
|
||||
LimitRate limitRate = this.queryLimitTargetData(monitor.getId());
|
||||
//判断指标是否超标
|
||||
Map<String, Object> limitBoolMap = this.verifyLimit(limitRate, steady);
|
||||
//构建监督数据
|
||||
this.buildData(steady, limitBoolMap, monitor, limitRate, superviseParam.getInitType(), thsSupervise, overRunLogList);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
//生成技术监督数据
|
||||
HttpResult<Dept> deptById = deptFeignClient.getDeptById(depId);
|
||||
Dept dept = deptById.getData();
|
||||
if (InitTypeEnum.AUTO.getCode().equals(superviseParam.getInitType())) {
|
||||
this.creatData(dept, thsSupervise, overRunLogList);
|
||||
} else {
|
||||
this.buildSuperviseName(thsSupervise, overRunLogList, dept);
|
||||
superviceRunLogVo.setOverRunLog(overRunLogList);
|
||||
superviceRunLogVo.setThsSupervise(thsSupervise);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, superviceRunLogVo, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建技术监督名称
|
||||
*
|
||||
* @param thsSupervise
|
||||
* @param overRunLogList
|
||||
* @param dept
|
||||
*/
|
||||
private void buildSuperviseName(ThsSupervise thsSupervise, List<ThsOverRunLog> overRunLogList, Dept dept) {
|
||||
if (CollectionUtil.isNotEmpty(overRunLogList)) {
|
||||
thsSupervise.setDescription(overRunLogList.get(0).getDescription());
|
||||
String str = Arrays.asList(overRunLogList.get(0).getDescription().split(",")).get(0);
|
||||
String overItem = str.substring(0, str.indexOf("次") - 1);
|
||||
thsSupervise.setName(DateUtil.today() + dept.getName() + overRunLogList.get(0).getName() + "等" + overRunLogList.size() + "个监测点" + overItem);
|
||||
}
|
||||
}
|
||||
|
||||
//生成技术监督数据
|
||||
@DS("process")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void creatData(Dept dept, ThsSupervise thsSupervise, List<ThsOverRunLog> overRunLogList) {
|
||||
if (CollectionUtil.isNotEmpty(overRunLogList)) {
|
||||
thsSupervise.setDescription(overRunLogList.get(0).getDescription());
|
||||
String str = Arrays.asList(overRunLogList.get(0).getDescription().split(",")).get(0);
|
||||
String overItem = str.substring(0, str.indexOf("次") - 1);
|
||||
thsSupervise.setName(DateUtil.today() + dept.getName() + overRunLogList.get(0).getName() + "等" + overRunLogList.size() + "个监测点" + overItem);
|
||||
thsSuperviseMapper.insert(thsSupervise);
|
||||
for (ThsOverRunLog thsOverRunLog : overRunLogList) {
|
||||
thsOverRunLogMapper.insert(thsOverRunLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("process")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveOverRunLog(SuperviceRunLogVo superviceRunLogVo) {
|
||||
if (CollectionUtil.isNotEmpty(superviceRunLogVo.getOverRunLog())) {
|
||||
ThsSupervise thsSupervise = superviceRunLogVo.getThsSupervise();
|
||||
HttpResult<Dept> deptById = deptFeignClient.getDeptById(thsSupervise.getDeptId());
|
||||
Dept dept = deptById.getData();
|
||||
Date date = new Date();
|
||||
thsSupervise.setCreateTime(date);
|
||||
thsSupervise.setCreateUser(RequestUtil.getUsername());
|
||||
thsSupervise.setModifyUser(RequestUtil.getUsername());
|
||||
thsSupervise.setModifyTime(date);
|
||||
thsSupervise.setSupIndex(IdUtil.simpleUUID());
|
||||
this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept);
|
||||
this.thsSuperviseMapper.insert(thsSupervise);
|
||||
for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) {
|
||||
thsOverRunLog.setCreateTime(date);
|
||||
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
|
||||
this.thsOverRunLogMapper.insert(thsOverRunLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SuperviseVo> querySuperviseList(SuperviseDto superviseDto) {
|
||||
Integer pageNum = PageFactory.getPageNum(superviseDto);
|
||||
Integer pageSize = PageFactory.getPageSize(superviseDto);
|
||||
Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize);
|
||||
Page<SuperviseVo> page = thsSuperviseMapper.querySuperviseList(superviseVoPage, superviseDto);
|
||||
List<SuperviseVo> pageRecords = page.getRecords();
|
||||
if (CollectionUtil.isNotEmpty(pageRecords)) {
|
||||
for (SuperviseVo superviseVo : pageRecords) {
|
||||
superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName());
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, superviseVo.getSupIndex()));
|
||||
if (CollectionUtil.isNotEmpty(thsOverRunLogs)) {
|
||||
List<String> alarmTickets = thsOverRunLogs.stream().map(ThsOverRunLog::getAlarmTicket).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(alarmTickets)) {
|
||||
superviseVo.setHaveAlarmticket(true);
|
||||
}
|
||||
List<String> feedbacks = thsOverRunLogs.stream().map(ThsOverRunLog::getFeedback).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(feedbacks)) {
|
||||
superviseVo.setHaveFeedback(true);
|
||||
}
|
||||
List<String> testReports = thsOverRunLogs.stream().map(ThsOverRunLog::getTestReport).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(testReports)) {
|
||||
superviseVo.setHaveTestReport(true);
|
||||
}
|
||||
List<String> reviseNotices = thsOverRunLogs.stream().map(ThsOverRunLog::getReviseNotice).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(reviseNotices)) {
|
||||
superviseVo.setHaveReviseNotice(true);
|
||||
}
|
||||
List<String> reviseFeedbacks = thsOverRunLogs.stream().map(ThsOverRunLog::getReviseFeedback).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(reviseFeedbacks)) {
|
||||
superviseVo.setHaveReviseFeedback(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setRecords(pageRecords);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult deleteSupervise(SuperviseDto superviseDto) {
|
||||
if (CollectionUtil.isNotEmpty(superviseDto.getDeleteIds())) {
|
||||
superviseDto.getDeleteIds().forEach(id -> {
|
||||
thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, id));
|
||||
thsSuperviseMapper.deleteById(id);
|
||||
});
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSuperviseTicket(String id, String supIndex, String ticketType, MultipartFile[] files, HttpServletResponse response) {
|
||||
ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex).last("limit 1"));
|
||||
ThsOverRunLog thsOverRunLog = thsOverRunLogMapper.selectById(id);
|
||||
thsSupervise.setSupIndex(thsOverRunLog.getSupIndex());
|
||||
thsOverRunLog.setId(id);
|
||||
if (files != null && files.length == 1) {
|
||||
String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY);
|
||||
this.updateSuperviesData(path, thsOverRunLog, ticketType);
|
||||
} else {
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
this.batchUploadFile(thsSupervise, thsOverRunLogs, files, ticketType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上传文件
|
||||
*
|
||||
* @param thsSupervise
|
||||
* @param thsOverRunLogs
|
||||
* @param files
|
||||
* @param ticketType
|
||||
*/
|
||||
private void batchUploadFile(ThsSupervise thsSupervise, List<ThsOverRunLog> thsOverRunLogs, MultipartFile[] files, String ticketType) {
|
||||
if (files != null && files.length > 1) {
|
||||
List<ThsOverRunLog> excelData = new ArrayList<>();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
String originalFilename = files[i].getOriginalFilename();
|
||||
String fileType = originalFilename.substring(originalFilename.lastIndexOf("."));
|
||||
if (".xls".equalsIgnoreCase(fileType) || ".xlsx".equalsIgnoreCase(fileType)) {
|
||||
excelData = ReadPatientExcelUtil.getExcelInfo(files[i]);
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isEmpty(excelData)) {
|
||||
throw new BusinessException("没有Excel文件,或Excel文件无数据!");
|
||||
}
|
||||
for (ThsOverRunLog thsOverRunLogDto : excelData) {
|
||||
for (ThsOverRunLog thsOverRunLog : thsOverRunLogs) {
|
||||
if (StringUtils.equals(thsOverRunLog.getLineIndexName(), thsOverRunLogDto.getLineIndexName()) &&
|
||||
StringUtils.equals(thsOverRunLog.getName(), thsOverRunLogDto.getName())) {
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
String originalFilename = files[i].getOriginalFilename();
|
||||
String filename = originalFilename.substring(0, originalFilename.lastIndexOf("."));
|
||||
if (StringUtils.equals(filename, thsOverRunLogDto.getLineIndexName())) {
|
||||
this.uploadFile(files[i], ticketType, thsOverRunLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void uploadFile(MultipartFile file, String ticketType, ThsOverRunLog thsOverRunLog) {
|
||||
String path = fileStorageUtil.uploadMultipart(file, OssPath.ELECTRICITY_QUALITY);
|
||||
this.updateSuperviesData(path, thsOverRunLog, ticketType);
|
||||
}
|
||||
|
||||
private void updateSuperviesData(String path, ThsOverRunLog thsOverRunLog, String ticketType) {
|
||||
TicketTypeEnum ticketTypeEnum = TicketTypeEnum.getTicketTypeEnumByCode(ticketType);
|
||||
if (ticketTypeEnum == null) {
|
||||
throw new BusinessException("上传单据参数类型错误!");
|
||||
}
|
||||
switch (ticketTypeEnum) {
|
||||
case ALARM_TICKET:
|
||||
thsOverRunLog.setAlarmTicket(path);
|
||||
break;
|
||||
case FEEDBACK:
|
||||
thsOverRunLog.setFeedback(path);
|
||||
break;
|
||||
case TEST_REPORT:
|
||||
thsOverRunLog.setTestReport(path);
|
||||
break;
|
||||
case REVISE_NOTICE:
|
||||
thsOverRunLog.setTestReport(path);
|
||||
break;
|
||||
case REVISE_FEEDBACK:
|
||||
thsOverRunLog.setReviseFeedback(path);
|
||||
break;
|
||||
}
|
||||
thsOverRunLogMapper.updateById(thsOverRunLog);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<Integer, String>> queryProgressValues() {
|
||||
List<Map<Integer, String>> list = new ArrayList<>();
|
||||
Arrays.asList(ProgressEnum.values()).forEach(value -> {
|
||||
Map<Integer, String> progress = new HashMap<>();
|
||||
progress.put(value.getCode(), value.getMessage());
|
||||
list.add(progress);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadAlarmFormwork(Integer type, Integer formworkType, MultipartFile file, HttpServletResponse response) {
|
||||
thsAlarmFormworkMapper.delete(new LambdaQueryWrapper<ThsAlarmFormwork>().eq(ThsAlarmFormwork::getFormworkType, formworkType)
|
||||
.eq(ThsAlarmFormwork::getType, type));
|
||||
String path = fileStorageUtil.uploadMultipart(file, OssPath.ELECTRICITY_QUALITY);
|
||||
ThsAlarmFormwork alarmFormwork = new ThsAlarmFormwork();
|
||||
alarmFormwork.setId(IdUtil.simpleUUID());
|
||||
alarmFormwork.setType(type);
|
||||
alarmFormwork.setFormworkType(formworkType);
|
||||
alarmFormwork.setPath(path);
|
||||
thsAlarmFormworkMapper.insert(alarmFormwork);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dowloadAlarmFormwork(Integer type, Integer formworkType, HttpServletResponse response) {
|
||||
ThsAlarmFormwork thsAlarmFormwork = thsAlarmFormworkMapper.selectOne(new LambdaQueryWrapper<ThsAlarmFormwork>().eq(ThsAlarmFormwork::getFormworkType, formworkType)
|
||||
.eq(ThsAlarmFormwork::getType, type).last("limit 1"));
|
||||
return fileStorageUtil.getFileUrl(thsAlarmFormwork.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ThsSuperviseVo> superviseIndex(SuperviseDto superviseDto) {
|
||||
Integer pageNum = PageFactory.getPageNum(superviseDto);
|
||||
Integer pageSize = PageFactory.getPageSize(superviseDto);
|
||||
Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize);
|
||||
Page<SuperviseVo> page = thsSuperviseMapper.querySuperviseList(superviseVoPage, superviseDto);
|
||||
List<SuperviseVo> pageRecords = page.getRecords();
|
||||
Page<ThsSuperviseVo> thsSuperviseVoPage = new Page<>(pageNum, pageSize);
|
||||
thsSuperviseVoPage.setTotal(superviseVoPage.getTotal());
|
||||
ThsSuperviseVo thsSuperviseVo = new ThsSuperviseVo();
|
||||
if (CollectionUtil.isNotEmpty(pageRecords)) {
|
||||
for (SuperviseVo superviseVo : pageRecords) {
|
||||
superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName());
|
||||
//处理预警类型
|
||||
Date modifyTime = superviseVo.getModifyTime();
|
||||
Long progressTime = DateUtil.between(modifyTime, new Date(), DateUnit.DAY);
|
||||
superviseVo.setProgressTime(progressTime.intValue());
|
||||
switch (ProgressEnum.getProgressEnumByCode(superviseVo.getProgress())) {
|
||||
case START:
|
||||
case ALARM_TICKET_ISSUE:
|
||||
if (progressTime >= 1) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else {
|
||||
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (progressTime >= 10) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else if (progressTime >= 8) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.ORANGE.getCode());
|
||||
} else if (progressTime >= 5) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.YELLOW.getCode());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
thsSuperviseVo.setSuperviseVoList(pageRecords);
|
||||
//分组处理每种流程状态的数量
|
||||
Map<Integer, List<SuperviseVo>> map = pageRecords.stream().collect(Collectors.groupingBy(SuperviseVo::getProgress));
|
||||
for (Map.Entry<Integer, List<SuperviseVo>> entry : map.entrySet()) {
|
||||
Integer code = entry.getKey();
|
||||
switch (ProgressEnum.getProgressEnumByCode(code)) {
|
||||
case START:
|
||||
thsSuperviseVo.setStartNum(entry.getValue().size());
|
||||
break;
|
||||
case ALARM_TICKET_ISSUE:
|
||||
thsSuperviseVo.setAlarmTicketIssueNum(entry.getValue().size());
|
||||
break;
|
||||
case FEEDBACK_UPLOAD:
|
||||
thsSuperviseVo.setFeedbackUploadNum(entry.getValue().size());
|
||||
break;
|
||||
case TEST_REPORT:
|
||||
thsSuperviseVo.setTestReportNum(entry.getValue().size());
|
||||
break;
|
||||
case REVISE_NOTICE_ISSUE:
|
||||
thsSuperviseVo.setReviseFeedbackNum(entry.getValue().size());
|
||||
break;
|
||||
case REVISE_FEEDBACK:
|
||||
thsSuperviseVo.setReviseFeedbackNum(entry.getValue().size());
|
||||
break;
|
||||
case END:
|
||||
thsSuperviseVo.setEndNum(entry.getValue().size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
thsSuperviseVoPage.setRecords(Collections.singletonList(thsSuperviseVo));
|
||||
return thsSuperviseVoPage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询策略列表
|
||||
*
|
||||
* @param superviseParam
|
||||
* @return
|
||||
*/
|
||||
@DS("process")
|
||||
@Override
|
||||
public List<ThsStrategyVo> selectStrategyList(SuperviseParam superviseParam) {
|
||||
return thsWarnStrategyMapper.selectStrategyList(superviseParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询策略绑定的干扰源列表或指标参数列表
|
||||
*
|
||||
* @param warnId
|
||||
* @param typeEnum
|
||||
* @return
|
||||
*/
|
||||
@DS("process")
|
||||
@Override
|
||||
public List<ThsWarnStrategyAss> queryWarnStrategyAss(String warnId, TypeEnum typeEnum) {
|
||||
return thsWarnStrategyAssMapper.selectList(new LambdaQueryWrapper<ThsWarnStrategyAss>()
|
||||
.eq(ThsWarnStrategyAss::getWarnId, warnId)
|
||||
.eq(ThsWarnStrategyAss::getType, typeEnum.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成监督数据
|
||||
*
|
||||
* @param limitBoolMap
|
||||
*/
|
||||
@Override
|
||||
public void buildData(SourceSteadyIndicator steady, Map<String, Object> limitBoolMap, Monitor monitor, LimitRate limitRate, Integer initType, ThsSupervise thsSupervise, List<ThsOverRunLog> thsOverRunLogs) {
|
||||
if (CollectionUtil.isNotEmpty(limitBoolMap)) {
|
||||
if (OperationEnum.AND.getCode().equals(steady.getOperation())) {
|
||||
for (Map.Entry<String, Object> entry : limitBoolMap.entrySet()) {
|
||||
if (entry.getValue() instanceof Boolean && !(boolean) entry.getValue()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//构建监督数据
|
||||
this.buildSuperviseData(steady, monitor, limitRate, limitBoolMap, initType, thsSupervise, thsOverRunLogs);
|
||||
//构建告警/预警监测点列表数据
|
||||
this.buildOverRunLog(steady, thsSupervise, monitor, limitRate, limitBoolMap, initType, thsOverRunLogs);
|
||||
return;
|
||||
}
|
||||
if (OperationEnum.OR.getCode().equals(steady.getOperation())) {
|
||||
for (Map.Entry<String, Object> entry : limitBoolMap.entrySet()) {
|
||||
if (entry.getValue() instanceof Boolean && (boolean) entry.getValue()) {
|
||||
//生成监督数据
|
||||
this.buildSuperviseData(steady, monitor, limitRate, limitBoolMap, initType, thsSupervise, thsOverRunLogs);
|
||||
//生成告警/预警监测点数据
|
||||
this.buildOverRunLog(steady, thsSupervise, monitor, limitRate, limitBoolMap, initType, thsOverRunLogs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void buildSuperviseData(SourceSteadyIndicator steady, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType, ThsSupervise thsSupervise, List<ThsOverRunLog> thsOverRunLogs) {
|
||||
if (thsSupervise != null && StringUtils.isBlank(thsSupervise.getSupIndex())) {
|
||||
thsSupervise.setSupIndex(IdUtil.simpleUUID());
|
||||
thsSupervise.setDeptId(steady.getDeptId());
|
||||
thsSupervise.setCreateTime(new Date());
|
||||
thsSupervise.setType(steady.getType());
|
||||
thsSupervise.setCreateUser(RequestUtil.getUsername());
|
||||
thsSupervise.setProgress(ProgressEnum.START.getCode());
|
||||
thsSupervise.setCreateType(initType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void buildOverRunLog(SourceSteadyIndicator steady, ThsSupervise thsSupervise, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType, List<ThsOverRunLog> thsOverRunLogs) {
|
||||
ThsOverRunLog thsOverRunLog = new ThsOverRunLog();
|
||||
thsOverRunLog.setId(IdUtil.simpleUUID());
|
||||
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
|
||||
thsOverRunLog.setLineIndex(monitor.getId());
|
||||
thsOverRunLog.setName(monitor.getPowerrName());
|
||||
thsOverRunLog.setUpdateTime(limitRate.getCreatTime());
|
||||
thsOverRunLog.setCreateTime(new Date());
|
||||
thsOverRunLog.setCompanyName(monitor.getOrgName());
|
||||
thsOverRunLog.setLineIndexName(monitor.getName());
|
||||
List<String> descriptionList = (List) limitBoolMap.get(DESCRIPTION);
|
||||
thsOverRunLog.setDescription(StringUtils.join(descriptionList, ","));
|
||||
|
||||
thsOverRunLogs.add(thsOverRunLog);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@DS("pms")
|
||||
public LimitRate queryLimitTargetData(String monitorId) {
|
||||
LimitRate limitRate = limitRateMapper.selectOne(new LambdaQueryWrapper<LimitRate>().eq(LimitRate::getLineId, monitorId)
|
||||
.between(LimitRate::getCreatTime,
|
||||
DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)),
|
||||
DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1))).last("limit 1"));
|
||||
return limitRate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重复执行删除旧数据
|
||||
*
|
||||
* @param depId
|
||||
*/
|
||||
@Override
|
||||
@DS("process")
|
||||
public void deleteTodayData(String depId, Integer initType) {
|
||||
ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getDeptId, depId)
|
||||
.eq(ThsSupervise::getCreateType, initType)
|
||||
.between(ThsSupervise::getCreateTime,
|
||||
DateUtil.beginOfDay(new Date()),
|
||||
DateUtil.endOfDay(new Date())).last("limit 1"));
|
||||
if (thsSupervise != null) {
|
||||
thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, thsSupervise.getSupIndex()));
|
||||
thsSuperviseMapper.delete(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, thsSupervise.getSupIndex()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断监测数据是否超标
|
||||
*
|
||||
* @param limitRate
|
||||
* @param steady
|
||||
*/
|
||||
private Map<String, Object> verifyLimit(LimitRate limitRate, SourceSteadyIndicator steady) {
|
||||
if (limitRate != null) {
|
||||
List<String> steadyIndicator = steady.getSteadyIndicator();
|
||||
Map<String, Object> limitBoolMap = new HashedMap();
|
||||
List<String> descriptionList = new ArrayList<>();
|
||||
steadyIndicator.forEach(id -> {
|
||||
HttpResult<DictData> dicDataById = dicDataFeignClient.getDicDataById(id);
|
||||
if (CommonResponseEnum.SUCCESS.getCode().equals(dicDataById.getCode()) && dicDataById.getData() != null) {
|
||||
SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dicDataById.getData().getCode());
|
||||
if (null != steadyIndicatorEnum) {
|
||||
switch (steadyIndicatorEnum) {
|
||||
case Negative_Voltage://负序电压不平衡度
|
||||
if (limitRate.getUbalanceOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Negative_Voltage.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Negative_Voltage.getMessage().concat(limitRate.getUbalanceOvertime() + "次"));
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Negative_Voltage.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Interhar_Voltage://间谐波电压
|
||||
Integer interharVoltageOvertime = this.maxOverTime(limitRate, InterharVoltage.class);
|
||||
if (interharVoltageOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + "次"));
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Neg_Current://负序电流
|
||||
if (limitRate.getINegOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(limitRate.getINegOvertime() + "次"));
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Fre_Deviation://频率偏差
|
||||
if (limitRate.getFreqDevOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(limitRate.getFreqDevOvertime() + "次"));
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Voltage_Dev://电压偏差
|
||||
if (limitRate.getVoltageDevOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(limitRate.getVoltageDevOvertime() + "次"));
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Har_Current://谐波电流
|
||||
Integer harCurrentOvertime = this.maxOverTime(limitRate, HarCurrent.class);
|
||||
if (harCurrentOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + "次"));
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Voltage_Fluc://电压波动与闪变
|
||||
if (limitRate.getFlickerOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(limitRate.getFlickerOvertime() + "次"));
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Har_Voltage://谐波电压
|
||||
Integer harVoltageOvertime = this.maxOverTime(limitRate, HarVoltage.class);
|
||||
if (harVoltageOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + "次"));
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
limitBoolMap.put(DESCRIPTION, descriptionList);
|
||||
return limitBoolMap;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取越限最大值
|
||||
* @param object
|
||||
* @param annotation
|
||||
* @return
|
||||
*/
|
||||
private Integer maxOverTime(Object object, Class annotation) {
|
||||
Integer maxValue = 0;
|
||||
try {
|
||||
Class objClass = object.getClass();
|
||||
Field[] fields = objClass.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
boolean isAnon = field.isAnnotationPresent(annotation);
|
||||
if (isAnon) {
|
||||
Object objValue = field.get(object);
|
||||
if (objValue instanceof Integer) {
|
||||
if ((Integer) objValue > maxValue) {
|
||||
maxValue = (Integer) objValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取越限最大值异常:{}", e.toString());
|
||||
}
|
||||
return maxValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.njcn.process.utils;
|
||||
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author lee
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ReadPatientExcelUtil {
|
||||
//总行数
|
||||
private static int totalRows = 0;
|
||||
//总条数
|
||||
private static int totalCells = 0;
|
||||
//错误信息接收器
|
||||
private static String errorMsg;
|
||||
|
||||
/**
|
||||
* 读EXCEL文件,获取信息集合
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<ThsOverRunLog> getExcelInfo(MultipartFile mFile) {
|
||||
String fileName = mFile.getOriginalFilename();//获取文件名
|
||||
try {
|
||||
if (!validateExcel(fileName)) {// 验证文件名是否合格
|
||||
return null;
|
||||
}
|
||||
boolean isExcel2003 = true;// 根据文件名判断文件是2003版本还是2007版本
|
||||
if (isExcel2007(fileName)) {
|
||||
isExcel2003 = false;
|
||||
}
|
||||
List<ThsOverRunLog> userList = createExcel(mFile.getInputStream(), isExcel2003);
|
||||
return userList;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据excel里面的内容读取客户信息
|
||||
*
|
||||
* @param is 输入流
|
||||
* @param isExcel2003 excel是2003还是2007版本
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static List<ThsOverRunLog> createExcel(InputStream is, boolean isExcel2003) {
|
||||
try {
|
||||
Workbook wb = null;
|
||||
if (isExcel2003) {// 当excel是2003时,创建excel2003
|
||||
wb = new HSSFWorkbook(is);
|
||||
} else {// 当excel是2007时,创建excel2007
|
||||
wb = new XSSFWorkbook(is);
|
||||
}
|
||||
List<ThsOverRunLog> thsOverRunLogList = readExcelValue(wb);// 读取Excel里面客户的信息
|
||||
return thsOverRunLogList;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取Excel里面客户的信息
|
||||
*
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
private static List<ThsOverRunLog> readExcelValue(Workbook wb) {
|
||||
//默认会跳过第一行标题
|
||||
// 得到第一个shell
|
||||
Sheet sheet = wb.getSheetAt(0);
|
||||
// 得到Excel的行数
|
||||
totalRows = sheet.getPhysicalNumberOfRows();
|
||||
// 得到Excel的列数(前提是有行数)
|
||||
if (totalRows > 1 && sheet.getRow(1) != null) {
|
||||
totalCells = sheet.getRow(1).getPhysicalNumberOfCells();
|
||||
}
|
||||
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<ThsOverRunLog>();
|
||||
// 循环Excel行数
|
||||
for (int r = 1; r < totalRows; r++) {
|
||||
Row row = sheet.getRow(r);
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
ThsOverRunLog ThsOverRunLog = new ThsOverRunLog();
|
||||
// 循环Excel的列
|
||||
for (int c = 0; c < totalCells; c++) {
|
||||
Cell cell = row.getCell(c);
|
||||
if (null != cell) {
|
||||
if (c == 0) { //第一列
|
||||
//如果是纯数字,将单元格类型转为String
|
||||
if (cell.getCellTypeEnum() == CellType.NUMERIC) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
}
|
||||
ThsOverRunLog.setCompanyName(cell.getStringCellValue());//将单元格数据赋值给ThsOverRunLog
|
||||
} else if (c == 1) {
|
||||
if (cell.getCellTypeEnum() == CellType.NUMERIC) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
}
|
||||
ThsOverRunLog.setName(cell.getStringCellValue());
|
||||
} else if (c == 2) {
|
||||
if (cell.getCellTypeEnum() == CellType.NUMERIC) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
}
|
||||
String stringCellValue = cell.getStringCellValue();
|
||||
ThsOverRunLog.setLineIndexName(stringCellValue);
|
||||
} else if (c == 3) {
|
||||
if (cell.getCellTypeEnum() == CellType.NUMERIC) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
}
|
||||
String stringCellValue = cell.getStringCellValue();
|
||||
ThsOverRunLog.setDescription(stringCellValue);
|
||||
} else if (c == 4) {
|
||||
if (cell.getCellTypeEnum() == CellType.NUMERIC) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
}
|
||||
String stringCellValue = cell.getStringCellValue();
|
||||
ThsOverRunLog.setFileName(stringCellValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
//将excel解析出来的数据赋值给对象添加到list中
|
||||
// 添加到list
|
||||
thsOverRunLogList.add(ThsOverRunLog);
|
||||
}
|
||||
return thsOverRunLogList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证EXCEL文件
|
||||
*
|
||||
* @param filePath
|
||||
* @return
|
||||
*/
|
||||
public static boolean validateExcel(String filePath) {
|
||||
if (filePath == null || !(isExcel2003(filePath) || isExcel2007(filePath))) {
|
||||
errorMsg = "文件名不是excel格式";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// @描述:是否是2003的excel,返回true是2003
|
||||
public static boolean isExcel2003(String filePath) {
|
||||
return filePath.matches("^.+\\.(?i)(xls)$");
|
||||
}
|
||||
|
||||
//@描述:是否是2007的excel,返回true是2007
|
||||
public static boolean isExcel2007(String filePath) {
|
||||
return filePath.matches("^.+\\.(?i)(xlsx)$");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user