|
|
|
@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.hnac.hzims.fdp.dto.FdpFaultDTO; |
|
|
|
|
import com.hnac.hzims.fdp.entity.FdpFaultEntity; |
|
|
|
@ -14,7 +13,6 @@ import com.hnac.hzims.fdp.service.IFdpFaultService;
|
|
|
|
|
import com.hnac.hzims.fdp.util.HttpRequestUtil; |
|
|
|
|
import com.hnac.hzims.fdp.vo.FdpFaultVO; |
|
|
|
|
import com.hnac.hzims.fdp.wrapper.FdpFaultWrapper; |
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -43,7 +41,7 @@ public class FdpFaultServiceImpl extends BaseServiceImpl<FdpFaultMapper, FdpFaul
|
|
|
|
|
private final ISysClient sysClient; |
|
|
|
|
private final IStationClient stationClient; |
|
|
|
|
|
|
|
|
|
@Value("${url.searchFaultState}") |
|
|
|
|
@Value("${url.searchFaultHistoryState}") |
|
|
|
|
private String url; |
|
|
|
|
@Value("${url.getGraph}") |
|
|
|
|
private String getGraphPath; |
|
|
|
@ -111,11 +109,11 @@ public class FdpFaultServiceImpl extends BaseServiceImpl<FdpFaultMapper, FdpFaul
|
|
|
|
|
throw new ServiceException("获取当前故障站点ID失败"); |
|
|
|
|
} |
|
|
|
|
params.put("faultId",faultId); |
|
|
|
|
params.put("stationId",stationId); |
|
|
|
|
Map<String,Object> history = new HashMap<>(2); |
|
|
|
|
history.put("start",start); |
|
|
|
|
history.put("end",end); |
|
|
|
|
params.put("history",history); |
|
|
|
|
// params.put("stationId",stationId);
|
|
|
|
|
// Map<String,Object> history = new HashMap<>(2);
|
|
|
|
|
params.put("start",start); |
|
|
|
|
params.put("end",end); |
|
|
|
|
// params.put("history",history);
|
|
|
|
|
String result = HttpRequestUtil.postCall(params,url,"POST"); |
|
|
|
|
// HashMap<String, Object> stringObjectHashMap = JSONObject.parseObject(result, new TypeReference<HashMap<String, Object>>() {
|
|
|
|
|
// });
|
|
|
|
@ -127,27 +125,26 @@ public class FdpFaultServiceImpl extends BaseServiceImpl<FdpFaultMapper, FdpFaul
|
|
|
|
|
throw new ServiceException(r.getMsg()); |
|
|
|
|
} |
|
|
|
|
List<FaultStateResp> respList = r.getData(); |
|
|
|
|
/**根据开始时间排序**/ |
|
|
|
|
respList = respList.stream().sorted(Comparator.comparing(FaultStateResp::getCreateTime)).collect(Collectors.toList()); |
|
|
|
|
List<FaultStateResp> addList = new ArrayList<>(); |
|
|
|
|
for(int i=0;i<respList.size()-1;i++){ |
|
|
|
|
/**如果下一条数据的开始时间大于当前数据的结束时间 则造一条数据添加**/ |
|
|
|
|
try{ |
|
|
|
|
if( Func.isNotEmpty(respList.get(i).getDeleteTime()) && respList.get(i).getDeleteTime().isBefore(respList.get(i+1).getCreateTime())){ |
|
|
|
|
FaultStateResp stateResp = BeanUtil.copy(respList.get(i),FaultStateResp.class); |
|
|
|
|
stateResp.setCreateTime(respList.get(i).getDeleteTime()); |
|
|
|
|
stateResp.setDeleteTime(respList.get(i+1).getCreateTime()); |
|
|
|
|
stateResp.setStatus(null); |
|
|
|
|
addList.add(stateResp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch(NullPointerException e){ |
|
|
|
|
log.info("第{}条数据转换失败",i+1); |
|
|
|
|
throw new ServiceException(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(CollectionUtil.isNotEmpty(addList)){ |
|
|
|
|
respList.addAll(addList); |
|
|
|
|
// /**根据开始时间排序**/
|
|
|
|
|
// respList = respList.stream().sorted(Comparator.comparing(FaultStateResp::getCreateTime)).collect(Collectors.toList());
|
|
|
|
|
// List<FaultStateResp> addList = new ArrayList<>();
|
|
|
|
|
// for(int i=0;i<respList.size()-1;i++){
|
|
|
|
|
// /**如果下一条数据的开始时间大于当前数据的结束时间 则造一条数据添加**/
|
|
|
|
|
// try{
|
|
|
|
|
// if( Func.isNotEmpty(respList.get(i).getDeleteTime()) && respList.get(i).getDeleteTime().isBefore(respList.get(i+1).getCreateTime())){
|
|
|
|
|
// FaultStateResp stateResp = BeanUtil.copy(respList.get(i),FaultStateResp.class);
|
|
|
|
|
// stateResp.setCreateTime(respList.get(i).getDeleteTime());
|
|
|
|
|
// stateResp.setDeleteTime(respList.get(i+1).getCreateTime());
|
|
|
|
|
// stateResp.setStatus(null);
|
|
|
|
|
// addList.add(stateResp);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// catch(NullPointerException e){
|
|
|
|
|
// log.info("第{}条数据转换失败",i+1);
|
|
|
|
|
// throw new ServiceException(e.getMessage());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
if(CollectionUtil.isNotEmpty(respList)){ |
|
|
|
|
respList = respList.stream().sorted(Comparator.comparing(FaultStateResp::getCreateTime)).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
return respList; |
|
|
|
|