策略代码提交
This commit is contained in:
@@ -63,7 +63,7 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
|
||||
* @param param
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean updateStrategy(StrategyParam.StrategyUpdateParam param);
|
||||
Boolean updateStrategy(StrategyParam.StrategyUpParam param);
|
||||
|
||||
/***
|
||||
* 预警单/告警单修改状态
|
||||
@@ -81,7 +81,7 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
|
||||
* @param monitorTag
|
||||
* @return List<PmsMonitorInfoDTO>
|
||||
*/
|
||||
List<StrategyParam.MonitorTree> getMonitor(String monitorTag, String orgId);
|
||||
List<StrategyParam.MonitorTree> getMonitor(List<String> monitorTag, String orgId);
|
||||
|
||||
|
||||
/***
|
||||
@@ -101,5 +101,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;
|
||||
|
||||
@@ -7,11 +7,14 @@ 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.device.pms.pojo.po.DistributionMonitor;
|
||||
import com.njcn.process.enums.ProcessResponseEnum;
|
||||
import com.njcn.process.pojo.param.StrategyParam;
|
||||
import com.njcn.process.pojo.po.PmsTerminalDetection;
|
||||
import com.njcn.process.pojo.po.ThsDeptAlarm;
|
||||
@@ -27,6 +30,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,12 +58,14 @@ 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>()
|
||||
.eq(ThsWarnStrategy::getName, param.getName())
|
||||
@@ -68,18 +74,22 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
ThsWarnStrategy thsWarnStrategy = BeanUtil.copyProperties(param, ThsWarnStrategy.class);
|
||||
thsWarnStrategy.setCreateBy(RequestUtil.getLoginName());
|
||||
thsWarnStrategy.setState(1);
|
||||
thsWarnStrategy.setCreateBy(RequestUtil.getUserNickname());
|
||||
thsWarnStrategy.setState(2);
|
||||
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,32 +98,14 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
return this.updateById(warnStrategy);
|
||||
|
||||
}
|
||||
/***
|
||||
* 告警单 监测点标签或指标类型绑定
|
||||
* @author wr
|
||||
* @date 2023-03-20 18:57
|
||||
* @param assList 绑定信息
|
||||
* @param id 告警单id
|
||||
* @param type 0:监测点标签 1:指标类型
|
||||
* @param ids 监测点标签集合 或 指标类型集合
|
||||
*/
|
||||
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);
|
||||
ass.setAssId(indicatorType);
|
||||
ass.setType(type);
|
||||
assList.add(ass);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrategyParam.StrategyUpdateParam getUpdateStrategy(String id) {
|
||||
return this.baseMapper.selectUpdateStrategy(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateStrategy(StrategyParam.StrategyUpdateParam param) {
|
||||
public Boolean updateStrategy(StrategyParam.StrategyUpParam param) {
|
||||
ThsWarnStrategy one = this.getOne(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.ne(ThsWarnStrategy::getId, param.getId())
|
||||
.and(wrapper ->
|
||||
@@ -125,10 +117,12 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
ThsWarnStrategy thsWarnStrategy = BeanUtil.copyProperties(param, ThsWarnStrategy.class);
|
||||
thsWarnStrategy.setUpdateBy(RequestUtil.getUserNickname());
|
||||
return this.updateById(thsWarnStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean updateStrategyState(StrategyParam.StrategyStateParam param) {
|
||||
ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy();
|
||||
thsWarnStrategy.setId(param.getId());
|
||||
@@ -137,15 +131,15 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StrategyParam.MonitorTree> getMonitor(String monitorTag, String orgId) {
|
||||
public List<StrategyParam.MonitorTree> getMonitor(List<String> monitorTag, String orgId) {
|
||||
PmsMonitorParam param = new PmsMonitorParam();
|
||||
param.setMonitorTags(Arrays.asList(monitorTag));
|
||||
param.setMonitorTags(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());
|
||||
@@ -156,6 +150,53 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
return monitorTrees;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean bindMonitor(List<ThsDeptAlarm> param) {
|
||||
//删除之前数据
|
||||
LambdaQueryWrapper<ThsDeptAlarm> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ThsDeptAlarm::getDeptId, param.get(0).getDeptId());
|
||||
lambdaQueryWrapper.in(ThsDeptAlarm::getAlarmId, param.get(0).getDeptId());
|
||||
lambdaQueryWrapper.in(ThsDeptAlarm::getType, param.get(0).getType());
|
||||
thsDeptAlarmService.remove(lambdaQueryWrapper);
|
||||
return thsDeptAlarmService.saveBatch(param);
|
||||
}
|
||||
|
||||
@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
|
||||
* @date 2023-03-20 18:57
|
||||
* @param assList 绑定信息
|
||||
* @param id 告警单id
|
||||
* @param type 0:监测点标签 1:指标类型
|
||||
* @param ids 监测点标签集合 或 指标类型集合
|
||||
*/
|
||||
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);
|
||||
ass.setAssId(indicatorType);
|
||||
ass.setType(type);
|
||||
assList.add(ass);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归生成监测点树
|
||||
*
|
||||
@@ -215,15 +256,4 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
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