Merge remote-tracking branch 'origin/master'
# Conflicts: # pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/ThsWarnStrategy.java
This commit is contained in:
@@ -18,7 +18,9 @@ public enum ProcessResponseEnum {
|
||||
PROCESS_COMMON_ERROR("A00550","监督管理模块异常"),
|
||||
ARCHIVE_ERROR("A00552","不满足归档调节,操作失败!"),
|
||||
PROCESS_ERROR("A00553","当前流程未审核通过,操作失败!"),
|
||||
|
||||
QUERY_IS_EMPTY("A00554","当前未查询到当前策略信息,无法删除!"),
|
||||
ENABLED_CANNOT_BE_DELETED("A00555","策略为启用状态不能删除!"),
|
||||
THERE_IS_ONLY_ONE_STRATEGY("A00556","自动策略或手动策略,通用策略只能有一条!"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -28,6 +28,10 @@ public class ExcessiveParam extends IssuesParam {
|
||||
@NotNull(message = "监测点ID不可为空")
|
||||
private String measurementPointId;
|
||||
|
||||
@ApiModelProperty(name = "measurementPointId",value = "监测点ID")
|
||||
@NotNull(message = "监测点ID不可为空")
|
||||
private String measurementPointName;
|
||||
|
||||
@ApiModelProperty(name = "warnLastTime",value = "告警持续时间")
|
||||
@NotNull(message = "告警持续时间不可为空")
|
||||
private String warnLastTime;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.process.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <策略监测点绑定>
|
||||
*
|
||||
* @author wr
|
||||
* @createTime: 2023-03-22
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class MonitorParam {
|
||||
|
||||
@ApiModelProperty(value = "单位id")
|
||||
@NotBlank(message = "单位id不能为空")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "类型 0.预警策略 1.告警策略")
|
||||
@NotEmpty(message = "类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "预警策略/告警策略id")
|
||||
@NotEmpty(message = "策略id集合不能为空")
|
||||
private List<String> alarmId;
|
||||
|
||||
@ApiModelProperty(value = "监测点id")
|
||||
@NotEmpty(message = "监测点id集合不能为空")
|
||||
private List<String> monitorId;
|
||||
|
||||
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class StrategyParam {
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("等级(0:一级;1:二级;2:三级)")
|
||||
private String grade;
|
||||
private Integer grade;
|
||||
|
||||
@ApiModelProperty(value = "区分预警单/告警单(0:预警单 ;1:告警单)")
|
||||
private Integer type;
|
||||
@@ -57,6 +57,10 @@ public class StrategyParam {
|
||||
@NotNull(message = "等级不能为空")
|
||||
private Integer grade;
|
||||
|
||||
@ApiModelProperty(value = "0.通用策略 1.定值策略")
|
||||
@NotNull(message = "策略选择不能为空")
|
||||
private Integer bigType;
|
||||
|
||||
@ApiModelProperty(value = "区分预警单还是告警单(0:预警单;1:告警单)")
|
||||
@NotNull(message = "区分类别不能为空")
|
||||
private Integer type;
|
||||
@@ -71,7 +75,7 @@ public class StrategyParam {
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "关系(0:与;1:或)只存在于指标类型中")
|
||||
@TableField("Operation")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Integer operation;
|
||||
|
||||
@ApiModelProperty(value = "监测点标签")
|
||||
@@ -84,7 +88,23 @@ public class StrategyParam {
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class StrategyUpdateParam {
|
||||
public static class StrategyUpdateParam extends StrategyUpParam{
|
||||
|
||||
@ApiModelProperty(value = "关系(0:与;1:或)只存在于指标类型中")
|
||||
private Integer operation;
|
||||
|
||||
@ApiModelProperty(value = "监测点标签")
|
||||
@NotBlank(message = "监测点标签不能为空")
|
||||
private List<String> monitorTag;
|
||||
|
||||
@ApiModelProperty(value = "指标类型")
|
||||
@NotEmpty(message = "指标类型集合不能为空")
|
||||
private List<String> indicatorTypes;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class StrategyUpParam {
|
||||
@ApiModelProperty(value = "预警单id")
|
||||
private String id;
|
||||
|
||||
@@ -92,22 +112,14 @@ public class StrategyParam {
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "0.通用策略 1.定值策略")
|
||||
@NotNull(message = "策略选择不能为空")
|
||||
private Integer bigType;
|
||||
|
||||
@ApiModelProperty(value = "等级(0:一级;1:二级;2:三级)")
|
||||
@NotNull(message = "等级不能为空")
|
||||
private Integer grade;
|
||||
|
||||
@ApiModelProperty(value = "关系(0:与;1:或)只存在于指标类型中")
|
||||
@TableField("Operation")
|
||||
private Integer operation;
|
||||
|
||||
@ApiModelProperty(value = "监测点标签")
|
||||
@NotBlank(message = "监测点标签不能为空")
|
||||
private String monitorTag;
|
||||
|
||||
@ApiModelProperty(value = "指标类型")
|
||||
@NotEmpty(message = "指标类型集合不能为空")
|
||||
private List<String> indicatorTypes;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -116,7 +128,7 @@ public class StrategyParam {
|
||||
@NotBlank(message = "id不能为空")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "0.删除 1.正常")
|
||||
@ApiModelProperty(value = "0.删除 1.启用 2.关闭")
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
@@ -130,23 +142,22 @@ public class StrategyParam {
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("变电站信息")
|
||||
private List<Power> childPower;
|
||||
// @ApiModelProperty("变电站信息")
|
||||
// private List<Power> childPower;
|
||||
|
||||
@ApiModelProperty("子节点详细信息")
|
||||
private List<MonitorTree> children;
|
||||
private List<?> children;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Power {
|
||||
public static class Monitor {
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("监测点信息")
|
||||
private List<Power> childMonitor;
|
||||
@ApiModelProperty("标识")
|
||||
private Integer leven=3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,4 +128,7 @@ public class RGeneralSurveyPlanPO {
|
||||
@TableField(value = "upload_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date uploadTime;
|
||||
@TableField(value = "create_person")
|
||||
private String createPerson;
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,11 @@ public class RMpOnlineMonitorOverproofProblem implements Serializable {
|
||||
*/
|
||||
private String measurementPointId;
|
||||
|
||||
/**
|
||||
* 监测点ID
|
||||
*/
|
||||
private String measurementPointName;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.njcn.process.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -41,10 +44,14 @@ public class ThsWarnStrategy extends BaseEntity implements Serializable {
|
||||
@TableField("Operation")
|
||||
private Integer operation;
|
||||
|
||||
@ApiModelProperty(value = "0.通用策略 1.定值策略")
|
||||
@TableField("Big_Type")
|
||||
private Integer bigType;
|
||||
|
||||
@ApiModelProperty(value = "区分预警单还是告警单(0:预警单;1:告警单)")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "0.删除 1.正常")
|
||||
@ApiModelProperty(value = "0.删除 1.启用 2.关闭")
|
||||
@TableField("State")
|
||||
@TableLogic(value = "1",delval = "0")
|
||||
private Integer state;
|
||||
@@ -54,11 +61,6 @@ public class ThsWarnStrategy extends BaseEntity implements Serializable {
|
||||
|
||||
@TableField("Update_By")
|
||||
private String updateBy;
|
||||
/**
|
||||
* 0.通用策略 1.定值策略
|
||||
*/
|
||||
@TableField("Big_Type")
|
||||
private String bigType;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class RGeneralSurveyPlanController extends BaseController {
|
||||
public HttpResult<IPage<RGeneralSurveyPlanVO>> queryPlan(@Validated @RequestBody RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm){
|
||||
String methodDescribe = getMethodDescribe("queryPlan");
|
||||
|
||||
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("0","1","2","3").collect (Collectors.toList ()));
|
||||
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("0","1","2","3").collect (Collectors.toList ()),"1");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVOS, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public class RGeneralSurveyPlanController extends BaseController {
|
||||
public HttpResult<IPage<RGeneralSurveyPlanVO>> queryPlanAudit(@Validated @RequestBody RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm){
|
||||
String methodDescribe = getMethodDescribe("queryPlanAudit");
|
||||
|
||||
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("1","2").collect (Collectors.toList ()));
|
||||
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("1","2").collect (Collectors.toList ()),"2");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVOS, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public class RGeneralSurveyPlanController extends BaseController {
|
||||
public HttpResult<IPage<RGeneralSurveyPlanVO>> queryPlanResult(@Validated @RequestBody RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm){
|
||||
String methodDescribe = getMethodDescribe("queryPlanResult");
|
||||
|
||||
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("3","4").collect (Collectors.toList ()));
|
||||
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("3","4").collect (Collectors.toList ()),"3");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVOS, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ 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.process.pojo.param.MonitorParam;
|
||||
import com.njcn.process.pojo.param.StrategyParam;
|
||||
import com.njcn.process.pojo.po.ThsDeptAlarm;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategy;
|
||||
import com.njcn.process.service.ThsWarnStrategyService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -40,7 +40,7 @@ public class ThsWarnStrategyController extends BaseController {
|
||||
private final ThsWarnStrategyService thsWarnStrategyService;
|
||||
|
||||
@PostMapping("/getStrategyPage")
|
||||
@ApiOperation("预警单/告警单策略分页查询")
|
||||
@ApiOperation("分页查询")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<Page<ThsWarnStrategy>> getStrategyPage(@RequestBody @Validated StrategyParam.StrategyPageParam param) {
|
||||
String methodDescribe = getMethodDescribe("getStrategyPage");
|
||||
@@ -49,7 +49,7 @@ public class ThsWarnStrategyController extends BaseController {
|
||||
}
|
||||
|
||||
@PostMapping("/insertStrategy")
|
||||
@ApiOperation(value = "预警单/告警单单条新增")
|
||||
@ApiOperation(value = "数据添加")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
public HttpResult<Boolean> insertStrategy(@RequestBody @Validated StrategyParam.StrategyInsertParam param) {
|
||||
String methodDescribe = getMethodDescribe("insertStrategy");
|
||||
@@ -58,7 +58,7 @@ public class ThsWarnStrategyController extends BaseController {
|
||||
}
|
||||
|
||||
@PostMapping("/bindStrategy")
|
||||
@ApiOperation(value = "预警单/告警单信息绑定")
|
||||
@ApiOperation(value = "信息绑定")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
public HttpResult<Boolean> bindStrategy(@RequestBody @Validated StrategyParam.BindParam param) {
|
||||
String methodDescribe = getMethodDescribe("bindStrategy");
|
||||
@@ -67,7 +67,7 @@ public class ThsWarnStrategyController extends BaseController {
|
||||
}
|
||||
|
||||
@PostMapping("/getUpdateStrategy")
|
||||
@ApiOperation(value = "预警单/告警单修改详细查询")
|
||||
@ApiOperation(value = "详细查询")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<StrategyParam.StrategyUpdateParam> getUpdateStrategy(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getUpdateStrategy");
|
||||
@@ -76,16 +76,16 @@ public class ThsWarnStrategyController extends BaseController {
|
||||
}
|
||||
|
||||
@PostMapping("/updateStrategy")
|
||||
@ApiOperation(value = "预警单/告警单修改")
|
||||
@ApiOperation(value = "信息修改")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
public HttpResult<Boolean> updateStrategy(@RequestBody @Validated StrategyParam.StrategyUpdateParam param) {
|
||||
public HttpResult<Boolean> updateStrategy(@RequestBody @Validated StrategyParam.StrategyUpParam param) {
|
||||
String methodDescribe = getMethodDescribe("updateStrategy");
|
||||
Boolean flag = thsWarnStrategyService.updateStrategy(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/updateStrategyState")
|
||||
@ApiOperation(value = "预警单/告警单修改状态")
|
||||
@ApiOperation(value = "修改状态")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
public HttpResult<Boolean> updateStrategyState(@RequestBody @Validated StrategyParam.StrategyStateParam param) {
|
||||
String methodDescribe = getMethodDescribe("updateStrategyState");
|
||||
@@ -93,28 +93,36 @@ public class ThsWarnStrategyController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/getMonitor")
|
||||
@GetMapping("/getMonitor")
|
||||
@ApiOperation(value = "监测点查询接口")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<List<StrategyParam.MonitorTree>> getMonitor(@Param("monitorTag") String monitorTag, @Param("orgId") String orgId) {
|
||||
public HttpResult<List<StrategyParam.MonitorTree>> getMonitor(@Param("orgId") String orgId) {
|
||||
String methodDescribe = getMethodDescribe("getMonitor");
|
||||
List<StrategyParam.MonitorTree> monitor = thsWarnStrategyService.getMonitor(monitorTag, orgId);
|
||||
List<StrategyParam.MonitorTree> monitor = thsWarnStrategyService.getMonitor( orgId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitor, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/bindMonitor")
|
||||
@ApiOperation(value = "预警单/告警单监测点绑定")
|
||||
@ApiOperation(value = "监测点绑定")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
public HttpResult<Boolean> bindMonitor(@RequestBody List<ThsDeptAlarm> param) {
|
||||
public HttpResult<Boolean> bindMonitor(@RequestBody MonitorParam param) {
|
||||
String methodDescribe = getMethodDescribe("bindMonitor");
|
||||
Boolean flag = thsWarnStrategyService.bindMonitor(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@GetMapping("/echoMonitor")
|
||||
@ApiOperation(value = "监测点回显")
|
||||
public HttpResult<List<String>> echoMonitor(@Param("deptId") String deptId,@Param("type") Integer type) {
|
||||
String methodDescribe = getMethodDescribe("echoMonitor");
|
||||
List<String> strings = thsWarnStrategyService.echoMonitor(deptId, type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, strings, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/delStrategy")
|
||||
@ApiOperation(value = "预警单/告警单信息删除")
|
||||
@ApiOperation(value = "信息删除")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
public HttpResult<Boolean> bindStrategy(@RequestBody List<String> ids) {
|
||||
public HttpResult<Boolean> delStrategy(String ids) {
|
||||
String methodDescribe = getMethodDescribe("delStrategy");
|
||||
Boolean flag = thsWarnStrategyService.delStrategy(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
|
||||
@@ -37,6 +37,15 @@ public interface ThsWarnStrategyMapper extends BaseMapper<ThsWarnStrategy> {
|
||||
*/
|
||||
List<String> getStrategyDetail(@Param("id") String id);
|
||||
|
||||
/***
|
||||
* 获取监测点标签id
|
||||
* @author wr
|
||||
* @date 2023-03-10 13:46
|
||||
* @param id
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getMonitorTagDetail(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 查询所有部门的策略列表
|
||||
*
|
||||
|
||||
@@ -21,7 +21,11 @@
|
||||
<result column="Name" property="name" />
|
||||
<result column="Grade" property="grade" />
|
||||
<result column="Operation" property="operation" />
|
||||
<result column="monitorTag" property="monitorTag" />
|
||||
<collection
|
||||
property="monitorTag"
|
||||
column="{id = id}"
|
||||
select="com.njcn.process.mapper.ThsWarnStrategyMapper.getMonitorTagDetail">
|
||||
</collection>
|
||||
<collection
|
||||
property="indicatorTypes"
|
||||
column="{id = id}"
|
||||
@@ -33,12 +37,9 @@
|
||||
ts.Id AS id,
|
||||
ts.NAME AS NAME,
|
||||
ts.Grade AS grade,
|
||||
ts.Operation AS operation,
|
||||
ta.Ass_Id AS monitorTag
|
||||
ts.Operation AS operation
|
||||
FROM
|
||||
ths_warn_strategy ts
|
||||
INNER JOIN ths_warn_strategy_ass ta ON ts.Id = ta.Warn_Id
|
||||
AND ta.Type = 0
|
||||
WHERE
|
||||
id = #{id}
|
||||
</select>
|
||||
@@ -67,5 +68,13 @@
|
||||
tws.State = 1 and tws.Grade in(0,2)
|
||||
</select>
|
||||
|
||||
<select id="getMonitorTagDetail" resultType="java.lang.String">
|
||||
SELECT
|
||||
Ass_Id
|
||||
FROM
|
||||
ths_warn_strategy_ass ts
|
||||
WHERE
|
||||
Warn_Id = #{id} and ts.Type=0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -37,7 +37,7 @@ public interface RGeneralSurveyPlanPOService extends IMppService<RGeneralSurveyP
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/15
|
||||
*/
|
||||
IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm,List<String> statusList);
|
||||
IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm,List<String> statusList,String type);
|
||||
/**
|
||||
* @Description: surveyResultUpload
|
||||
* @Param: [surveyResultUploadParam]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.njcn.process.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.process.pojo.param.MonitorParam;
|
||||
import com.njcn.process.pojo.param.StrategyParam;
|
||||
import com.njcn.process.pojo.po.ThsDeptAlarm;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategy;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -63,7 +63,7 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
|
||||
* @param param
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean updateStrategy(StrategyParam.StrategyUpdateParam param);
|
||||
Boolean updateStrategy(StrategyParam.StrategyUpParam param);
|
||||
|
||||
/***
|
||||
* 预警单/告警单修改状态
|
||||
@@ -74,14 +74,14 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
|
||||
*/
|
||||
Boolean updateStrategyState(StrategyParam.StrategyStateParam param);
|
||||
|
||||
/***
|
||||
* 监测点查询接口
|
||||
* @author wr
|
||||
* @date 2023-03-10 14:52
|
||||
* @param monitorTag
|
||||
* @return List<PmsMonitorInfoDTO>
|
||||
*/
|
||||
List<StrategyParam.MonitorTree> getMonitor(String monitorTag, String orgId);
|
||||
/***
|
||||
* 监测点查询接口
|
||||
* @author wr
|
||||
* @date 2023-03-22 17:38
|
||||
* @param orgId
|
||||
* @return List<MonitorTree>
|
||||
*/
|
||||
List<StrategyParam.MonitorTree> getMonitor( String orgId);
|
||||
|
||||
|
||||
/***
|
||||
@@ -91,8 +91,17 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
|
||||
* @param param
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean bindMonitor(List<ThsDeptAlarm> param);
|
||||
Boolean bindMonitor(MonitorParam param);
|
||||
|
||||
/***
|
||||
* 监测点回显
|
||||
* @author wr
|
||||
* @date 2023-03-22 10:44
|
||||
* @param org
|
||||
* @param type
|
||||
* @return List<ThsDeptAlarm>
|
||||
*/
|
||||
List<String> echoMonitor(String org,Integer type);
|
||||
|
||||
/***
|
||||
* 预警单/告警单删除
|
||||
@@ -101,5 +110,5 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
|
||||
* @param ids
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean delStrategy(List<String> ids);
|
||||
Boolean delStrategy(String ids);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class IssuesServiceImpl implements IssuesService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void addExcessiveIssues(ExcessiveParam excessiveParam) {
|
||||
public void addExcessiveIssues(ExcessiveParam excessiveParam) {
|
||||
IssuesParam issuesParam = new IssuesParam();
|
||||
BeanUtil.copyProperties(excessiveParam, issuesParam);
|
||||
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
||||
@@ -284,9 +284,12 @@ public class IssuesServiceImpl implements IssuesService {
|
||||
ExcessiveDetailVO detail = new ExcessiveDetailVO();
|
||||
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo), detail);
|
||||
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
||||
|
||||
|
||||
LambdaQueryWrapper<RMpOnlineMonitorOverproofProblem> excessiveQuery = new LambdaQueryWrapper<>();
|
||||
excessiveQuery.eq(RMpOnlineMonitorOverproofProblem::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||
RMpOnlineMonitorOverproofProblem excessiveOut = excessiveMapper.selectOne(excessiveQuery);
|
||||
|
||||
BeanUtil.copyProperties(excessiveOut, detail);
|
||||
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
||||
BeanUtil.copyProperties(processFlowDetail(flowDetails), detail);
|
||||
@@ -484,7 +487,7 @@ public class IssuesServiceImpl implements IssuesService {
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile(MultipartFile issuesFile) {
|
||||
return fileStorageUtil.uploadMultipart(issuesFile, OssPath.ELECTRICITY_QUALITY);
|
||||
return fileStorageUtil.getFileUrl( fileStorageUtil.uploadMultipart(issuesFile, OssPath.ELECTRICITY_QUALITY));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -661,6 +664,7 @@ public class IssuesServiceImpl implements IssuesService {
|
||||
toMap(PvTerminalTreeVO::getId,
|
||||
PvTerminalTreeVO::getName));
|
||||
List<RStatElectricQualityProblemLogVO> rStatElectricQualityProblemLogVOList = rStatElectricQualityProblemLogMapper.selectByProblemNo(powerQualityProblemNo);
|
||||
|
||||
rStatElectricQualityProblemLogVOList.stream ().forEach (temp->temp.setOrgName (pvTerminalTreeVOMap.get (temp.getOrgName ())));
|
||||
|
||||
return rStatElectricQualityProblemLogVOList;
|
||||
|
||||
@@ -34,7 +34,9 @@ import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -113,7 +115,11 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
||||
RSurveyCyclePO rSurveyCyclePO = rSurveyCycleMapper.selectOne (rSurveyCyclePOQueryWrapper);
|
||||
|
||||
rGeneralSurveyPlanPO.setCycleId (rSurveyCyclePO.getId ( ));
|
||||
boolean b = this.saveOrUpdateByMultiId (rGeneralSurveyPlanPO);
|
||||
String deptIndex = RequestUtil.getDeptIndex ( );
|
||||
Dept data = deptFeignClient.getDeptById (deptIndex).getData ( );
|
||||
rGeneralSurveyPlanPO.setCheckPerson (data.getPid ());
|
||||
rGeneralSurveyPlanPO.setCreatePerson (RequestUtil.getUserIndex ());
|
||||
boolean b = this.saveOrUpdateByMultiId (rGeneralSurveyPlanPO);
|
||||
|
||||
QueryWrapper<RGeneralSurveyPlanDetail> queryWrapper = new QueryWrapper ( );
|
||||
queryWrapper.lambda ( ).eq (RGeneralSurveyPlanDetail::getPlanNo, rGeneralSurveyPlanAddParm.getPlanNo ( ));
|
||||
@@ -149,11 +155,18 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
||||
* @Date: 2022/11/15
|
||||
*/
|
||||
@Override
|
||||
public IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm, List<String> statusList) {
|
||||
public IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm, List<String> statusList,String type) {
|
||||
IPage<RGeneralSurveyPlanPO> page = new Page<> (rGeneralSurveyPlanQueryParm.getCurrentPage ( ), rGeneralSurveyPlanQueryParm.getPageSize ( ));
|
||||
IPage<RGeneralSurveyPlanVO> returnpage = new Page<> (rGeneralSurveyPlanQueryParm.getCurrentPage ( ), rGeneralSurveyPlanQueryParm.getPageSize ( ));
|
||||
|
||||
LambdaQueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new LambdaQueryWrapper<> ( );
|
||||
/*type=1:新建页面:查看自己负责的计划;type=2:审核页面:审核者==当前用户;结果页面:查看自己负责的计划*/
|
||||
if(type=="1"||type=="3"){
|
||||
queryWrapper.eq (RGeneralSurveyPlanPO::getCreatePerson,RequestUtil.getUserIndex ());
|
||||
}
|
||||
if(type=="2"){
|
||||
queryWrapper.eq (RGeneralSurveyPlanPO::getCheckPerson,RequestUtil.getDeptIndex ());
|
||||
}
|
||||
if (!StringUtils.isEmpty (rGeneralSurveyPlanQueryParm.getOrgNo ( ))) {
|
||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId (rGeneralSurveyPlanQueryParm.getOrgNo ( )).getData ( );
|
||||
|
||||
@@ -382,7 +395,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
||||
UpdateWrapper<RGeneralSurveyPlanPO> updateWrapper = new UpdateWrapper ( );
|
||||
updateWrapper.eq ("plan_no", rGeneralSurveyPlanChcekParm.getPlanNo ( ));
|
||||
updateWrapper.set ("check_comment", rGeneralSurveyPlanChcekParm.getCheckComment ( ));
|
||||
updateWrapper.set ("check_person", rGeneralSurveyPlanChcekParm.getCheckPerson ( ));
|
||||
// updateWrapper.set ("check_person", rGeneralSurveyPlanChcekParm.getCheckPerson ( ));
|
||||
updateWrapper.set ("status", Objects.equals ("1", rGeneralSurveyPlanChcekParm.getCheckResult ( )) ? 3 : 2);
|
||||
result = this.update (updateWrapper);
|
||||
return result;
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package com.njcn.process.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
|
||||
import com.njcn.process.enums.ProcessResponseEnum;
|
||||
import com.njcn.process.pojo.param.MonitorParam;
|
||||
import com.njcn.process.pojo.param.StrategyParam;
|
||||
import com.njcn.process.pojo.po.PmsTerminalDetection;
|
||||
import com.njcn.process.pojo.po.ThsDeptAlarm;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategy;
|
||||
import com.njcn.process.mapper.ThsWarnStrategyMapper;
|
||||
@@ -27,6 +28,7 @@ import com.njcn.web.utils.RequestUtil;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -54,32 +56,47 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
, new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.like(StrUtil.isNotBlank(param.getName()), ThsWarnStrategy::getName, param.getName())
|
||||
.eq(param.getGrade() != null, ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.le(param.getType() != null, ThsWarnStrategy::getType, param.getType())
|
||||
.eq(param.getType() != null, ThsWarnStrategy::getType, param.getType())
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean insertStrategy(StrategyParam.StrategyInsertParam param) {
|
||||
int count = this.count(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
ThsWarnStrategy one = this.getOne(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.eq(ThsWarnStrategy::getName, param.getName())
|
||||
.or(wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(ThsWarnStrategy::getBigType, 0)
|
||||
)
|
||||
);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
if(one.getName().equals(param.getName())){
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
throw new BusinessException(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY);
|
||||
}
|
||||
ThsWarnStrategy thsWarnStrategy = BeanUtil.copyProperties(param, ThsWarnStrategy.class);
|
||||
thsWarnStrategy.setCreateBy(RequestUtil.getLoginName());
|
||||
thsWarnStrategy.setState(1);
|
||||
thsWarnStrategy.setCreateBy(RequestUtil.getUserNickname());
|
||||
thsWarnStrategy.setState(2);
|
||||
thsWarnStrategy.setBigType(param.getBigType());
|
||||
return this.save(thsWarnStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean bindStrategy(StrategyParam.BindParam param) {
|
||||
List<ThsWarnStrategyAss> assList = new ArrayList<>();
|
||||
//删除之前绑定信息
|
||||
thsWarnStrategyAssService.removeById(param.getId());
|
||||
|
||||
//监测点标签绑定
|
||||
add(assList,param.getId(),0,param.getMonitorTag());
|
||||
add(assList, param.getId(), 0, param.getMonitorTag());
|
||||
//指标类型绑定
|
||||
add(assList,param.getId(),1,param.getIndicatorTypes());
|
||||
add(assList, param.getId(), 1, param.getIndicatorTypes());
|
||||
|
||||
thsWarnStrategyAssService.saveBatch(assList);
|
||||
ThsWarnStrategy warnStrategy = new ThsWarnStrategy();
|
||||
@@ -88,6 +105,120 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
return this.updateById(warnStrategy);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrategyParam.StrategyUpdateParam getUpdateStrategy(String id) {
|
||||
return this.baseMapper.selectUpdateStrategy(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateStrategy(StrategyParam.StrategyUpParam param) {
|
||||
ThsWarnStrategy one = this.getOne(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.ne(ThsWarnStrategy::getId, param.getId())
|
||||
.and(wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getName, param.getName())
|
||||
)
|
||||
.or(wrapper ->
|
||||
wrapper.eq( ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(ThsWarnStrategy::getBigType, 0)
|
||||
)
|
||||
|
||||
);
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
if(one.getName().equals(param.getName())){
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
throw new BusinessException(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY);
|
||||
}
|
||||
ThsWarnStrategy thsWarnStrategy = BeanUtil.copyProperties(param, ThsWarnStrategy.class);
|
||||
thsWarnStrategy.setUpdateBy(RequestUtil.getUserNickname());
|
||||
thsWarnStrategy.setBigType(param.getBigType());
|
||||
return this.updateById(thsWarnStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean updateStrategyState(StrategyParam.StrategyStateParam param) {
|
||||
ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy();
|
||||
thsWarnStrategy.setId(param.getId());
|
||||
thsWarnStrategy.setState(param.getState());
|
||||
return this.updateById(thsWarnStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StrategyParam.MonitorTree> getMonitor(String orgId) {
|
||||
PmsMonitorParam param = new PmsMonitorParam();
|
||||
List<PmsMonitorDTO> data = monitorClient.getMonitorInfoListByCond(param).getData();
|
||||
//获取部门结构
|
||||
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(orgId, WebUtil.filterDeptType()).getData();
|
||||
|
||||
List<DeptDTO> deptDTOS = deptInfos.stream().filter(org -> org.getId().equals(orgId)).collect(Collectors.toList());
|
||||
//递归监测点信息
|
||||
List<StrategyParam.MonitorTree> monitorTrees = new ArrayList<>();
|
||||
StrategyParam.MonitorTree tree = new StrategyParam.MonitorTree();
|
||||
tree.setId(deptDTOS.get(0).getId());
|
||||
tree.setName(deptDTOS.get(0).getName());
|
||||
List<StrategyParam.MonitorTree> powers = getPowers(deptDTOS.get(0).getCode(), data);
|
||||
powers.addAll(recursionSelectList(orgId, deptInfos, data));
|
||||
tree.setChildren(powers);
|
||||
monitorTrees.add(tree);
|
||||
return monitorTrees;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean bindMonitor(MonitorParam param) {
|
||||
//删除之前数据(根据部门和策略类型)
|
||||
LambdaQueryWrapper<ThsDeptAlarm> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ThsDeptAlarm::getDeptId, param.getDeptId());
|
||||
lambdaQueryWrapper.eq(ThsDeptAlarm::getType, param.getType());
|
||||
thsDeptAlarmService.remove(lambdaQueryWrapper);
|
||||
|
||||
//信息添加
|
||||
List<ThsDeptAlarm> info=new ArrayList();
|
||||
List<String> alarmIds= param.getAlarmId();
|
||||
List<String> monitorIds= param.getMonitorId();
|
||||
String deptId= param.getDeptId();
|
||||
Integer type= param.getType();
|
||||
//便利信息
|
||||
ThsDeptAlarm alarm;
|
||||
for (String s : alarmIds) {
|
||||
for (String monitorId : monitorIds) {
|
||||
alarm=new ThsDeptAlarm();
|
||||
alarm.setDeptId(deptId);
|
||||
alarm.setType(type);
|
||||
alarm.setAlarmId(s);
|
||||
alarm.setMonitorId(monitorId);
|
||||
info.add(alarm);
|
||||
}
|
||||
}
|
||||
return thsDeptAlarmService.saveBatch(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> echoMonitor(String org,Integer type) {
|
||||
List<ThsDeptAlarm> list = thsDeptAlarmService.list(new LambdaQueryWrapper<ThsDeptAlarm>()
|
||||
.eq(ThsDeptAlarm::getDeptId, org)
|
||||
.eq(ThsDeptAlarm::getType, type)
|
||||
);
|
||||
return list.stream().map(ThsDeptAlarm::getMonitorId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean delStrategy(String ids) {
|
||||
Assert.isTrue(StrUtil.isNotBlank(ids), "id为空,不能删除");
|
||||
ThsWarnStrategy byId = this.getById(ids);
|
||||
if(ObjectUtil.isNull(byId)){
|
||||
throw new BusinessException(ProcessResponseEnum.QUERY_IS_EMPTY);
|
||||
}
|
||||
if(byId.getState() == 1){
|
||||
throw new BusinessException(ProcessResponseEnum.ENABLED_CANNOT_BE_DELETED);
|
||||
}
|
||||
thsWarnStrategyAssService.removeById(ids);
|
||||
return this.removeById(ids);
|
||||
}
|
||||
|
||||
/***
|
||||
* 告警单 监测点标签或指标类型绑定
|
||||
* @author wr
|
||||
@@ -97,8 +228,8 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
* @param type 0:监测点标签 1:指标类型
|
||||
* @param ids 监测点标签集合 或 指标类型集合
|
||||
*/
|
||||
private void add( List<ThsWarnStrategyAss> assList,String id,Integer type,List<String> ids){
|
||||
ThsWarnStrategyAss ass ;
|
||||
private void add(List<ThsWarnStrategyAss> assList, String id, Integer type, List<String> ids) {
|
||||
ThsWarnStrategyAss ass;
|
||||
for (String indicatorType : ids) {
|
||||
ass = new ThsWarnStrategyAss();
|
||||
ass.setWarnId(id);
|
||||
@@ -107,54 +238,6 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
assList.add(ass);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public StrategyParam.StrategyUpdateParam getUpdateStrategy(String id) {
|
||||
return this.baseMapper.selectUpdateStrategy(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateStrategy(StrategyParam.StrategyUpdateParam param) {
|
||||
ThsWarnStrategy one = this.getOne(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.ne(ThsWarnStrategy::getId, param.getId())
|
||||
.and(wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getName, param.getName())
|
||||
)
|
||||
|
||||
);
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
ThsWarnStrategy thsWarnStrategy = BeanUtil.copyProperties(param, ThsWarnStrategy.class);
|
||||
return this.updateById(thsWarnStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateStrategyState(StrategyParam.StrategyStateParam param) {
|
||||
ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy();
|
||||
thsWarnStrategy.setId(param.getId());
|
||||
thsWarnStrategy.setState(param.getState());
|
||||
return this.updateById(thsWarnStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StrategyParam.MonitorTree> getMonitor(String monitorTag, String orgId) {
|
||||
PmsMonitorParam param = new PmsMonitorParam();
|
||||
param.setMonitorTags(Arrays.asList(monitorTag));
|
||||
List<PmsMonitorDTO> data = monitorClient.getMonitorInfoListByCond(param).getData();
|
||||
//获取部门结构
|
||||
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(orgId, WebUtil.filterDeptType()).getData();
|
||||
|
||||
List<DeptDTO> deptDTOS = deptInfos.stream().filter(org -> org.getId().equals(orgId)).collect(Collectors.toList());
|
||||
|
||||
List<StrategyParam.MonitorTree> monitorTrees = new ArrayList<>();
|
||||
StrategyParam.MonitorTree tree = new StrategyParam.MonitorTree();
|
||||
tree.setId(deptDTOS.get(0).getId());
|
||||
tree.setName(deptDTOS.get(0).getName());
|
||||
tree.setChildPower(getPowers(deptDTOS.get(0).getCode(), data));
|
||||
tree.setChildren(recursionSelectList(orgId, deptInfos, data));
|
||||
monitorTrees.add(tree);
|
||||
return monitorTrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归生成监测点树
|
||||
@@ -172,8 +255,9 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
StrategyParam.MonitorTree tree = new StrategyParam.MonitorTree();
|
||||
tree.setId(customer.getId());
|
||||
tree.setName(customer.getName());
|
||||
tree.setChildPower(getPowers(customer.getCode(), data));
|
||||
List<StrategyParam.MonitorTree> children = recursionSelectList(customer.getId(), deptInfos, data);
|
||||
List<StrategyParam.MonitorTree> children = new ArrayList<>();
|
||||
children.addAll(getPowers(customer.getCode(), data));
|
||||
children.addAll(recursionSelectList(customer.getId(), deptInfos, data));
|
||||
tree.setChildren(children);
|
||||
menuSelectList.add(tree);
|
||||
}));
|
||||
@@ -188,9 +272,9 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
* @param data
|
||||
* @return List<Power>
|
||||
*/
|
||||
private static List<StrategyParam.Power> getPowers(String orgCode, List<PmsMonitorDTO> data) {
|
||||
private static List<StrategyParam.MonitorTree> getPowers(String orgCode, List<PmsMonitorDTO> data) {
|
||||
//变电站信息初始化
|
||||
List<StrategyParam.Power> powers = new ArrayList<>();
|
||||
List<StrategyParam.MonitorTree> powers = new ArrayList<>();
|
||||
//获取监测点信息
|
||||
List<PmsMonitorDTO> monitorDTOS = data.stream().filter(dept -> dept.getOrgId().equals(orgCode)).collect(Collectors.toList());
|
||||
Map<String, List<PmsMonitorDTO>> collect = monitorDTOS.stream().collect(
|
||||
@@ -198,32 +282,21 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
//获取变电站和监测点信息
|
||||
collect.forEach((key, value) -> {
|
||||
String[] split = key.split("_");
|
||||
StrategyParam.Power power = new StrategyParam.Power();
|
||||
StrategyParam.MonitorTree power = new StrategyParam.MonitorTree();
|
||||
power.setId(split[0]);
|
||||
power.setName(split[1]);
|
||||
power.setName("变电站名称: "+split[1]);
|
||||
//监测点信息
|
||||
List<StrategyParam.Power> monitors = new ArrayList();
|
||||
List<StrategyParam.Monitor> monitors = new ArrayList();
|
||||
for (PmsMonitorDTO dto : value) {
|
||||
StrategyParam.Power childMonitor = new StrategyParam.Power();
|
||||
StrategyParam.Monitor childMonitor = new StrategyParam.Monitor();
|
||||
childMonitor.setId(dto.getId());
|
||||
childMonitor.setName(dto.getName());
|
||||
childMonitor.setName("监测点名称: "+dto.getName());
|
||||
monitors.add(childMonitor);
|
||||
}
|
||||
power.setChildMonitor(monitors);
|
||||
power.setChildren(monitors);
|
||||
powers.add(power);
|
||||
});
|
||||
return powers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean bindMonitor(List<ThsDeptAlarm> param) {
|
||||
return thsDeptAlarmService.saveBatch(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delStrategy(List<String> ids) {
|
||||
Assert.isTrue(CollectionUtil.isNotEmpty(ids), "id为空,不能删除");
|
||||
thsWarnStrategyAssService.removeByIds(ids);
|
||||
return this.removeByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user