新增预警/告警事务的新建、编辑、删除、列表查询、文件上传
This commit is contained in:
@@ -80,4 +80,8 @@ public class BusinessException extends RuntimeException {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public BusinessException(String message) {
|
||||
super(message);
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.prepare.harmonic.pojo.dto;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SuperviseDto extends BaseParam {
|
||||
@ApiModelProperty("删除的技术监督id集合")
|
||||
private List<String> deleteIds;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.njcn.prepare.harmonic.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UploadSuperviceTicketDto {
|
||||
@ApiModelProperty("告警/预警监测点记录id")
|
||||
private String id;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.prepare.harmonic.pojo.param;
|
||||
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -17,4 +18,12 @@ public class SuperviseParam {
|
||||
private String deptId;
|
||||
@ApiModelProperty(name = "overRunLog", value = "监测点集合")
|
||||
private List<ThsOverRunLog> overRunLog;
|
||||
@ApiModelProperty(name = "supIndex", value = "技术监督Guid")
|
||||
private String supIndex;
|
||||
@ApiModelProperty(name = "name", value = "技术监督名称")
|
||||
private String name;
|
||||
@ApiModelProperty(name = "description", value = "描述")
|
||||
private String description;
|
||||
@ApiModelProperty(name = "thsSupervise", value = "技术监督参数")
|
||||
private ThsSupervise thsSupervise;
|
||||
}
|
||||
|
||||
@@ -55,26 +55,31 @@ public class ThsOverRunLog {
|
||||
/**
|
||||
* 预/告警单
|
||||
*/
|
||||
@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)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.prepare.harmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -22,15 +23,18 @@ public class ThsSupervise {
|
||||
/**
|
||||
* 技术监督Guid
|
||||
*/
|
||||
@ApiModelProperty(name = "supIndex", value = "技术监督Guid", required = true)
|
||||
private String supIndex;
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty(name = "deptId", value = "部门id", required = true)
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 技术监督名称
|
||||
*/
|
||||
@ApiModelProperty(name = "name", value = "技术监督名称", required = true)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
@@ -52,6 +56,7 @@ public class ThsSupervise {
|
||||
/**
|
||||
* 类型(0:预警;1:告警)
|
||||
*/
|
||||
@ApiModelProperty(name = "type", value = "类型(0:预警;1:告警)", required = true)
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
@@ -67,11 +72,13 @@ public class ThsSupervise {
|
||||
/**
|
||||
* 进度(0:开始;1:预/告警单下发;2:反馈单上传;3:现场测试;4:整改通知单下发:5:整改通知反馈单;6:完结)默认进度为开始
|
||||
*/
|
||||
@ApiModelProperty(name = "progress", value = "进度(0:开始;1:预/告警单下发;2:反馈单上传;3:现场测试;4:整改通知单下发:5:整改通知反馈单;6:完结)默认进度为开始", required = true)
|
||||
private Integer progress;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(name = "description", value = "描述")
|
||||
private String description;
|
||||
/**
|
||||
* 创建时间
|
||||
@@ -82,7 +89,4 @@ public class ThsSupervise {
|
||||
*/
|
||||
private Integer createType;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.prepare.harmonic.pojo.vo;
|
||||
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class SuperviceRunLogVo {
|
||||
@ApiModelProperty(name = "thsSupervise", value = "技术监督参数", required = true)
|
||||
private ThsSupervise thsSupervise;
|
||||
@ApiModelProperty(name = "overRunLog", value = "监测点集合", required = true)
|
||||
private List<ThsOverRunLog> overRunLog;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.njcn.prepare.harmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SuperviseVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 技术监督Guid
|
||||
*/
|
||||
@ApiModelProperty(name = "supIndex", value = "技术监督Guid")
|
||||
private String supIndex;
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty(name = "deptId", value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 技术监督名称
|
||||
*/
|
||||
@ApiModelProperty(name = "name", value = "技术监督名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 创建用户(pqs_user外键)
|
||||
*/
|
||||
@ApiModelProperty(name = "createUser", value = "创建用户")
|
||||
private String createUser;
|
||||
|
||||
|
||||
/**
|
||||
* 处理用户
|
||||
*/
|
||||
@ApiModelProperty(name = "modifyUser", value = "处理用户")
|
||||
private String modifyUser;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
@ApiModelProperty(name = "modifyTime", value = "处理时间")
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 类型(0:预警;1:告警)
|
||||
*/
|
||||
@ApiModelProperty(name = "type", value = "类型(0:预警;1:告警)")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 上一级处理处理人员
|
||||
*/
|
||||
@ApiModelProperty(name = "upUser", value = "上一级处理处理人员")
|
||||
private String upUser;
|
||||
|
||||
/**
|
||||
* 下一级处理人员
|
||||
*/
|
||||
@ApiModelProperty(name = "nextUser", value = "下一级处理人员")
|
||||
private String nextUser;
|
||||
|
||||
/**
|
||||
* 进度(0:开始;1:预/告警单下发;2:反馈单上传;3:现场测试;4:整改通知单下发:5:整改通知反馈单;6:完结)默认进度为开始
|
||||
*/
|
||||
@ApiModelProperty(name = "progress", value = "进度(0:开始;1:预/告警单下发;2:反馈单上传;3:现场测试;4:整改通知单下发:5:整改通知反馈单;6:完结)默认进度为开始")
|
||||
private Integer progress;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(name = "description", value = "描述")
|
||||
private String description;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(name = "createTime", value = "创建时间")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 创建类型(0:自动;1 手动)
|
||||
*/
|
||||
private Integer createType;
|
||||
|
||||
|
||||
/**
|
||||
* 是否已经上传 预/告警单
|
||||
*/
|
||||
@ApiModelProperty(name = "haveAlarmticket", value = "是否已经上传 预/告警单")
|
||||
private boolean haveAlarmticket;
|
||||
/**
|
||||
* 反馈单
|
||||
*/
|
||||
@ApiModelProperty(name = "haveFeedback", value = "是否已经上传 反馈单")
|
||||
private boolean haveFeedback;
|
||||
/**
|
||||
* 测试报告
|
||||
*/
|
||||
@ApiModelProperty(name = "haveTestReport", value = "是否已经上传 测试报告")
|
||||
private boolean haveTestReport;
|
||||
/**
|
||||
* 整改通知单
|
||||
*/
|
||||
@ApiModelProperty(name = "haveReviseNotice", value = "是否已经上传 整改通知单")
|
||||
private boolean haveReviseNotice;
|
||||
/**
|
||||
* 整改通知反馈单
|
||||
*/
|
||||
@ApiModelProperty(name = "haveReviseFeedback", value = "是否已经上传 整改通知反馈单")
|
||||
private boolean haveReviseFeedback;
|
||||
}
|
||||
@@ -9,14 +9,14 @@ 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", "谐波电压越限");
|
||||
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;
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.prepare.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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +1,27 @@
|
||||
package com.njcn.prepare.harmonic.controller.line;
|
||||
|
||||
|
||||
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.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.ThsOverRunLogService;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -41,18 +43,55 @@ public class ThsSuperviseController extends BaseController {
|
||||
@ApiOperation("预警/告警事务生成")
|
||||
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
|
||||
@PostMapping("/initSupervise")
|
||||
public HttpResult<List<ThsOverRunLog>> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
public HttpResult<SuperviceRunLogVo> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
return thsSuperviseService.initSupervise(superviseParam);
|
||||
}
|
||||
|
||||
@ApiOperation("保存技术监督监测点")
|
||||
@ApiImplicitParam(name = "superviseParam", value = "技术监督监测点参数", required = true)
|
||||
@ApiImplicitParam(name = "superviceRunLogVo", value = "技术监督监测点参数", required = true)
|
||||
@PostMapping("/saveOverRunLog")
|
||||
public HttpResult saveOverRunLog(@RequestBody SuperviseParam superviseParam) {
|
||||
thsOverRunLogService.saveOverRunLog(superviseParam);
|
||||
String methodDescribe = getMethodDescribe("superviseParam");
|
||||
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 = "上传单据类型", value = "ticketType", required = true) @RequestParam("ticketType") String ticketType,
|
||||
HttpServletResponse response) {
|
||||
thsSuperviseService.uploadSuperviseTicket(id, ticketType, files, response);
|
||||
String methodDescribe = getMethodDescribe("uploadSuperviseTicket");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,12 @@ package com.njcn.prepare.harmonic.mapper.mysql.line;
|
||||
|
||||
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>
|
||||
@@ -16,5 +20,11 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@DS("process")
|
||||
@Mapper
|
||||
public interface ThsSuperviseMapper extends BaseMapper<ThsSupervise> {
|
||||
|
||||
/**
|
||||
* 查询技术监督列表
|
||||
*
|
||||
* @param superviseDto
|
||||
* @return
|
||||
*/
|
||||
Page<SuperviseVo> querySuperviseList(Page<SuperviseVo> page, @Param("param") SuperviseDto superviseDto);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.line;
|
||||
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.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategy;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -26,4 +27,5 @@ public interface ThsWarnStrategyMapper extends BaseMapper<ThsWarnStrategy> {
|
||||
*/
|
||||
List<ThsStrategyVo> selectStrategyList(@Param("param") SuperviseParam superviseParam);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +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.prepare.harmonic.mapper.mysql.line.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 ts.name like CONCAT(CONCAT('%', #{param.searchValue}), '%')
|
||||
<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>
|
||||
order by ts.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -29,7 +29,15 @@
|
||||
<if test="param.deptId !=null and param.deptId !=''">
|
||||
and tda.Dept_Id=#{param.deptId}
|
||||
</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>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
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.prepare.harmonic.mapper.mysql.line.ThsOverRunLogMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.ThsSuperviseMapper;
|
||||
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.service.mysql.line.ThsOverRunLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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>
|
||||
* 告警/预警监测点列表 服务实现类
|
||||
@@ -20,12 +32,37 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@DS("process")
|
||||
public class ThsOverRunLogServiceImpl extends ServiceImpl<ThsOverRunLogMapper, ThsOverRunLog> implements ThsOverRunLogService {
|
||||
@Autowired
|
||||
private ThsOverRunLogMapper thsOverRunLogMapper;
|
||||
@Autowired
|
||||
private ThsSuperviseMapper thsSuperviseMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@DS("process")
|
||||
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));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,40 +5,47 @@ 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.dto.SimpleDTO;
|
||||
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.dto.PmsGeneralDeviceDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||
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.enums.*;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.*;
|
||||
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.service.mysql.line.ThsSuperviseService;
|
||||
import com.njcn.process.annotaion.HarCurrent;
|
||||
import com.njcn.process.annotaion.HarVoltage;
|
||||
import com.njcn.process.annotaion.InterharVoltage;
|
||||
import com.njcn.process.pojo.po.LimitRate;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategy;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategyAss;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
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;
|
||||
@@ -74,11 +81,13 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
private ThsOverRunLogMapper thsOverRunLogMapper;
|
||||
@Autowired
|
||||
private DeptFeignClient deptFeignClient;
|
||||
|
||||
@Autowired
|
||||
private FileStorageUtil fileStorageUtil;
|
||||
private static final String DESCRIPTION = "description";
|
||||
|
||||
@Override
|
||||
public HttpResult<List<ThsOverRunLog>> initSupervise(SuperviseParam superviseParam) {
|
||||
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, "");
|
||||
@@ -89,6 +98,8 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
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();
|
||||
ArrayList<ThsOverRunLog> thsOverRunLogs = new ArrayList<>();
|
||||
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<>();
|
||||
@@ -149,8 +160,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(oneSourceSteadyIndicatorList)) {
|
||||
//先删除今天生成的数据
|
||||
this.deleteTodayData(depId, superviseParam.getInitType());
|
||||
oneSourceSteadyIndicatorList.forEach(steady -> {
|
||||
Monitor monitor = pmsMonitorMapper.selectById(steady.getMonitorId());
|
||||
if (monitor != null) {
|
||||
@@ -159,89 +168,146 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
LimitRate limitRate = this.queryLimitTargetData(monitor.getId());
|
||||
//判断指标是否超标
|
||||
Map<String, Object> limitBoolMap = this.verifyLimit(limitRate, steady);
|
||||
//生成监督数据
|
||||
ThsOverRunLog thsOverRunLog = this.creatSuperviseData(steady, limitBoolMap, monitor, limitRate, superviseParam.getInitType());
|
||||
if (thsOverRunLog != null) {
|
||||
overRunLogList.add(thsOverRunLog);
|
||||
}
|
||||
//构建监督数据
|
||||
this.buildData(steady, limitBoolMap, monitor, limitRate, superviseParam.getInitType(), thsSupervise, overRunLogList);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
//生成技术监督数据
|
||||
if (InitTypeEnum.AUTO.getCode().equals(superviseParam.getInitType())) {
|
||||
HttpResult<Dept> deptById = deptFeignClient.getDeptById(depId);
|
||||
Dept dept = deptById.getData();
|
||||
this.creatData(dept, thsSupervise, overRunLogList);
|
||||
} else {
|
||||
superviceRunLogVo.setOverRunLog(overRunLogList);
|
||||
superviceRunLogVo.setThsSupervise(thsSupervise);
|
||||
}
|
||||
}
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, overRunLogList, "");
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, superviceRunLogVo, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门没有绑定策略的走通用策略
|
||||
*/
|
||||
//生成技术监督数据
|
||||
@DS("process")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void initCommonStrategy(List<ThsStrategyVo> thsStrategyList, SuperviseParam superviseParam) {
|
||||
//查询通用策略
|
||||
ThsWarnStrategy thsWarnStrategy = thsWarnStrategyMapper.selectOne(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.eq(ThsWarnStrategy::getBigType, BigTypeEnum.COMMON.getCode())
|
||||
.last("limit 1"));
|
||||
if (null != thsWarnStrategy) {
|
||||
List<String> haveDepIdList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(thsStrategyList)) {
|
||||
List<ThsStrategyVo> verifyList = thsStrategyList.stream().filter(r -> !GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade()))
|
||||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ThsStrategyVo::getDeptId))), ArrayList::new));
|
||||
haveDepIdList = verifyList.stream().map(ThsStrategyVo::getDeptId).collect(Collectors.toList());
|
||||
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();
|
||||
Date date = new Date();
|
||||
thsSupervise.setCreateTime(date);
|
||||
thsSupervise.setCreateUser(RequestUtil.getUsername());
|
||||
thsSupervise.setModifyTime(date);
|
||||
thsSupervise.setSupIndex(IdUtil.simpleUUID());
|
||||
this.thsSuperviseMapper.insert(thsSupervise);
|
||||
for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) {
|
||||
thsOverRunLog.setCreateTime(date);
|
||||
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
|
||||
this.thsOverRunLogMapper.insert(thsOverRunLog);
|
||||
}
|
||||
//获取所有部门信息
|
||||
HttpResult<List<PvTerminalTreeVO>> listHttpResult = deptFeignClient.allDeptList();
|
||||
List<String> allDepIdList = listHttpResult.getData().stream().distinct().map(PvTerminalTreeVO::getId).collect(Collectors.toList());
|
||||
allDepIdList.removeAll(haveDepIdList);
|
||||
//部门没有配置定制策略的走通用策略
|
||||
if (CollectionUtil.isNotEmpty(allDepIdList)) {
|
||||
List<ThsWarnStrategyAss> thsWarnStrategyAsses = thsWarnStrategyAssMapper.selectList(new LambdaQueryWrapper<ThsWarnStrategyAss>()
|
||||
.eq(ThsWarnStrategyAss::getWarnId, thsWarnStrategy.getId()));
|
||||
List<ThsWarnStrategyAss> sourceAssList = thsWarnStrategyAsses.stream().filter(source -> TypeEnum.SOURCE_TYPE.getCode().equals(source.getType()))
|
||||
.collect(Collectors.toList());
|
||||
List<ThsWarnStrategyAss> interAssList = thsWarnStrategyAsses.stream().filter(inter -> TypeEnum.INTERFERENCE_TYPE.getCode().equals(inter.getType()))
|
||||
.collect(Collectors.toList());
|
||||
//封装每一种干扰源和对应的指标
|
||||
List<SourceSteadyIndicator> verifySteadylist = new ArrayList<>();
|
||||
for (ThsWarnStrategyAss oneWarnStrategyAss : sourceAssList) {
|
||||
SourceSteadyIndicator build = SourceSteadyIndicator.builder().id(thsWarnStrategy.getId()).operation(thsWarnStrategy.getOperation())
|
||||
.interferenceSource(oneWarnStrategyAss.getAssId())
|
||||
.steadyIndicator(interAssList.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList()))
|
||||
.type(thsWarnStrategy.getType())
|
||||
.build();
|
||||
verifySteadylist.add(build);
|
||||
}
|
||||
allDepIdList.forEach(depId -> {
|
||||
this.deleteTodayData(depId, superviseParam.getInitType());
|
||||
//查询部门下所有监测点基本信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(depId);
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
HttpResult<List<PmsGeneralDeviceDTO>> httpResult = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam);
|
||||
List<PmsGeneralDeviceDTO> dataList = httpResult.getData();
|
||||
if (CollectionUtil.isNotEmpty(dataList)) {
|
||||
dataList.forEach(r -> {
|
||||
List<String> monitorIdList = r.getMonitorIdList();
|
||||
//查询所有监测点详细信息集合
|
||||
if (CollectionUtil.isNotEmpty(monitorIdList)) {
|
||||
List<Monitor> monitors = pmsMonitorMapper.queryConfigMonitor(monitorIdList, Arrays.stream(InterferenceTypeEnum.values()).map(InterferenceTypeEnum::getCode).collect(Collectors.toList()));
|
||||
monitors.forEach(monitor -> verifySteadylist.forEach(steady -> {
|
||||
if (StringUtils.equals(monitor.getMonitorTag(), steady.getInterferenceSource())) {//匹配该监测点属于的干扰源类型
|
||||
steady.setDeptId(depId);
|
||||
//查询该监测点的检测数据
|
||||
LimitRate limitRate = this.queryLimitTargetData(monitor.getId());
|
||||
//判断指标是否超标
|
||||
Map<String, Object> limitBoolMap = this.verifyLimit(limitRate, steady);
|
||||
//生成监督数据
|
||||
this.creatSuperviseData(steady, limitBoolMap, monitor, limitRate, superviseParam.getInitType());
|
||||
}
|
||||
}));
|
||||
|
||||
@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) {
|
||||
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 ticketType, MultipartFile[] files, HttpServletResponse response) {
|
||||
ThsOverRunLog thsOverRunLog = new ThsOverRunLog();
|
||||
thsOverRunLog.setId(id);
|
||||
if (files != null && files.length > 0) {
|
||||
List<String> pathList = new ArrayList<>();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
String path = fileStorageUtil.uploadMultipart(files[i], OssPath.ELECTRICITY_QUALITY);
|
||||
pathList.add(path);
|
||||
}
|
||||
String pathStr = StringUtils.join(pathList, ",");
|
||||
TicketTypeEnum ticketTypeEnum = TicketTypeEnum.getTicketTypeEnumByCode(ticketType);
|
||||
if (ticketTypeEnum == null) {
|
||||
throw new BusinessException("上传单据参数类型错误!");
|
||||
}
|
||||
switch (ticketTypeEnum) {
|
||||
case ALARM_TICKET:
|
||||
thsOverRunLog.setAlarmTicket(pathStr);
|
||||
break;
|
||||
case FEEDBACK:
|
||||
thsOverRunLog.setFeedback(pathStr);
|
||||
break;
|
||||
case TEST_REPORT:
|
||||
thsOverRunLog.setTestReport(pathStr);
|
||||
break;
|
||||
case REVISE_NOTICE:
|
||||
thsOverRunLog.setTestReport(pathStr);
|
||||
break;
|
||||
case REVISE_FEEDBACK:
|
||||
thsOverRunLog.setReviseFeedback(pathStr);
|
||||
break;
|
||||
}
|
||||
thsOverRunLogMapper.updateById(thsOverRunLog);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,68 +345,51 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
* @param limitBoolMap
|
||||
*/
|
||||
@Override
|
||||
public ThsOverRunLog creatSuperviseData(SourceSteadyIndicator steady, Map<String, Object> limitBoolMap, Monitor monitor, LimitRate limitRate, Integer initType) {
|
||||
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 null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//生成监督数据
|
||||
ThsSupervise thsSupervise = this.insertSuperviseData(steady, monitor, limitRate, limitBoolMap, initType);
|
||||
//生成告警/预警监测点列表数据
|
||||
return this.insertOverRunLog(steady, thsSupervise, monitor, limitRate, limitBoolMap, initType);
|
||||
//构建监督数据
|
||||
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()) {
|
||||
//生成监督数据
|
||||
ThsSupervise thsSupervise = this.insertSuperviseData(steady, monitor, limitRate, limitBoolMap, initType);
|
||||
this.buildSuperviseData(steady, monitor, limitRate, limitBoolMap, initType, thsSupervise, thsOverRunLogs);
|
||||
//生成告警/预警监测点数据
|
||||
return this.insertOverRunLog(steady, thsSupervise, monitor, limitRate, limitBoolMap, initType);
|
||||
this.buildOverRunLog(steady, thsSupervise, monitor, limitRate, limitBoolMap, initType, thsOverRunLogs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@DS("process")
|
||||
|
||||
@Override
|
||||
public ThsSupervise insertSuperviseData(SourceSteadyIndicator steady, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType) {
|
||||
//判断今日是否已经生成了监督数据
|
||||
LambdaQueryWrapper<ThsSupervise> superviseQueryWrapper = new LambdaQueryWrapper<>();
|
||||
superviseQueryWrapper.between(ThsSupervise::getCreateTime,
|
||||
DateUtil.beginOfDay(new Date()),
|
||||
DateUtil.endOfDay(new Date()))
|
||||
.eq(ThsSupervise::getDeptId, steady.getDeptId())
|
||||
.eq(ThsSupervise::getType, steady.getType())
|
||||
.last("limit 1");
|
||||
ThsSupervise supervise = thsSuperviseMapper.selectOne(superviseQueryWrapper);
|
||||
if (supervise != null) {
|
||||
return supervise;
|
||||
}
|
||||
ThsSupervise thsSupervise = new ThsSupervise();
|
||||
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());
|
||||
AlarmTypeEnum alarmTypeEnum = AlarmTypeEnum.getAlarmTypeEnumByCode(steady.getType());
|
||||
thsSupervise.setName(DateUtil.today() + monitor.getPowerrName() + (alarmTypeEnum == null ? "" : "_" + alarmTypeEnum.getMessage()));
|
||||
thsSupervise.setDeptId(steady.getDeptId());
|
||||
thsSupervise.setCreateTime(new Date());
|
||||
thsSupervise.setType(steady.getType());
|
||||
thsSupervise.setCreateUser(RequestUtil.getUsername());
|
||||
thsSupervise.setProgress(ProgressEnum.START.getCode());
|
||||
List<String> descriptionList = (List) limitBoolMap.get(DESCRIPTION);
|
||||
thsSupervise.setDescription(StringUtils.join(descriptionList, ","));
|
||||
thsSupervise.setCreateType(initType);
|
||||
thsSuperviseMapper.insert(thsSupervise);
|
||||
return thsSupervise;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DS("process")
|
||||
@Override
|
||||
public ThsOverRunLog insertOverRunLog(SourceSteadyIndicator steady, ThsSupervise thsSupervise, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType) {
|
||||
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());
|
||||
@@ -350,10 +399,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsOverRunLog.setCreateTime(new Date());
|
||||
List<String> descriptionList = (List) limitBoolMap.get(DESCRIPTION);
|
||||
thsOverRunLog.setDescription(StringUtils.join(descriptionList, ","));
|
||||
if (InitTypeEnum.AUTO.getCode().equals(initType)) {
|
||||
thsOverRunLogMapper.insert(thsOverRunLog);
|
||||
}
|
||||
return thsOverRunLog;
|
||||
thsOverRunLogs.add(thsOverRunLog);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.line;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -21,4 +25,19 @@ public interface ThsOverRunLogService extends IService<ThsOverRunLog> {
|
||||
* @return
|
||||
*/
|
||||
void saveOverRunLog(SuperviseParam superviseParam);
|
||||
|
||||
/**
|
||||
* 查询技术监督监测点集合
|
||||
*
|
||||
* @param supIndex
|
||||
* @return
|
||||
*/
|
||||
SuperviceRunLogVo superviseDetail(String supIndex);
|
||||
|
||||
/**
|
||||
* 更新技术监督
|
||||
*
|
||||
* @param superviseParam
|
||||
*/
|
||||
HttpResult updateSupervise(SuperviseParam superviseParam);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.line;
|
||||
|
||||
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.enums.TypeEnum;
|
||||
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.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;
|
||||
|
||||
@@ -27,7 +34,7 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
/**
|
||||
* 初始化技术监督
|
||||
*/
|
||||
HttpResult<List<ThsOverRunLog>> initSupervise(SuperviseParam superviseParam);
|
||||
HttpResult<SuperviceRunLogVo> initSupervise(SuperviseParam superviseParam);
|
||||
|
||||
/**
|
||||
* 查新策略集合
|
||||
@@ -49,7 +56,7 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
*
|
||||
* @param limitBoolMap
|
||||
*/
|
||||
ThsOverRunLog creatSuperviseData(SourceSteadyIndicator steady, Map<String, Object> limitBoolMap, Monitor monitor, LimitRate limitRate, Integer initType);
|
||||
void buildData(SourceSteadyIndicator steady, Map<String, Object> limitBoolMap, Monitor monitor, LimitRate limitRate, Integer initType, ThsSupervise thsSupervise, List<ThsOverRunLog> thsOverRunLogs);
|
||||
|
||||
/**
|
||||
* 查询策略绑定的干扰源列表或指标参数列表
|
||||
@@ -67,7 +74,7 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
* @param monitor
|
||||
* @return
|
||||
*/
|
||||
ThsSupervise insertSuperviseData(SourceSteadyIndicator steady, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType);
|
||||
void buildSuperviseData(SourceSteadyIndicator steady, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType, ThsSupervise thsSupervise, List<ThsOverRunLog> thsOverRunLogs);
|
||||
|
||||
/**
|
||||
* 生成 告警/预警监测点列表 数据
|
||||
@@ -76,15 +83,48 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
* @param thsSupervise
|
||||
* @param monitor
|
||||
*/
|
||||
ThsOverRunLog insertOverRunLog(SourceSteadyIndicator steady, ThsSupervise thsSupervise, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType);
|
||||
void buildOverRunLog(SourceSteadyIndicator steady, ThsSupervise thsSupervise, Monitor monitor, LimitRate limitRate, Map<String, Object> limitBoolMap, Integer initType, List<ThsOverRunLog> thsOverRunLogs);
|
||||
|
||||
/**
|
||||
* 部门没有绑定策略的走通用策略
|
||||
*
|
||||
* @param thsStrategyList
|
||||
* @param superviseParam
|
||||
*/
|
||||
void initCommonStrategy(List<ThsStrategyVo> thsStrategyList, SuperviseParam superviseParam);
|
||||
|
||||
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 ticketType, MultipartFile[] files, HttpServletResponse response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user