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