Commit 554a1b0c authored by wujiang's avatar wujiang

修改采集报错问题

parent 1268801e
......@@ -212,7 +212,7 @@ public class ImasterUtils {
JSONObject jsonObject = JSONObject.parseObject(response);
JSONArray jsonArray = new JSONArray();
JSONArray jsonArrayRet = new JSONArray();
if (ObjectUtil.isNotEmpty(resultResovle)) {
if (ObjectUtil.isNotEmpty(resultResovle)&&ObjectUtil.isNotEmpty(jsonObject)) {
String[] rules = resultResovle.split(",");
if (rules.length > 0) {
for (int i = 0; i < rules.length; i++) {
......@@ -222,9 +222,6 @@ public class ImasterUtils {
}
try {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
if (jsonObject == null) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
} catch (Exception exception) {
try {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
......
......@@ -46,6 +46,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
/**
* @author DELL
*/
......@@ -549,12 +551,13 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
}
}
}
logger.info("-------科士达同步采集器开始" + ts + "------- " + sdf.format(new Date()));
logger.info("-------科士达同步采集器结束" + ts + "------- " + sdf.format(new Date()));
}
@Scheduled(cron = "${dataRequstScheduled.keshida}")
@Override
@Async
@PostConstruct
public void collectorDetail() {
long ts = System.currentTimeMillis();
logger.info("-------科士达同步采集器详情/逆变器开始" + ts + "------- " + sdf.format(new Date()));
......@@ -623,10 +626,9 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter);
} else {
if (StringUtils.isNotEmpty(jpInverter.getSnCode())) {
if (StringUtils.isNotEmpty(jpInverter.getSnCode().trim())) {
jpInverterMapper.insert(jpInverter);
}
}
for (int k1 = 1; k1 < 13; k1++) {
......@@ -734,10 +736,16 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
hygfjpInverterElecHistoryMapper.insert(hygfjpInverterElecHistory);
// 逆变器历史
String today = DateUtil.today();
HYGFJPInverterHistory hygfjpInverterHistory = hygfjpInverterHistoryMapper
.selectOne(new QueryWrapper<HYGFJPInverterHistory>()
.eq("sn_code", jpInverter.getSnCode().trim()).eq("date", today));
String today = DateUtil.today();
HYGFJPInverterHistory hygfjpInverterHistory =null;
try {
hygfjpInverterHistory = hygfjpInverterHistoryMapper
.selectOne(new QueryWrapper<HYGFJPInverterHistory>()
.eq("sn_code", jpInverter.getSnCode().trim()).eq("date", today));
} catch (Exception e) {
e.printStackTrace();
logger.error("科士达逆变器日历史数据错误:"+jpInverter.getSnCode().trim()+","+today);
}
if (ObjectUtils.isEmpty(hygfjpInverterHistory)) {
hygfjpInverterHistory = new HYGFJPInverterHistory();
}
......@@ -764,8 +772,8 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
.eq("third_station_id",
ksolarStationCollectList.getThirdStationId())
.eq("third_code", PVProducerInfoEnum.KSOLAR.getCode())
.like("sn_code", ksolarStationCollectData.getInverterId().trim())
.isNotNull("sn_code").orderByDesc("update_time"));
.eq("sn_code", ksolarStationCollectData.getInverterId().trim())
.orderByDesc("update_time"));
JpInverter jpInverter = new JpInverter();
if (jpInverterList.size() > 0) {
jpInverter = jpInverterList.get(0);
......@@ -812,7 +820,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter);
} else {
if (StringUtils.isNotEmpty(jpInverter.getSnCode())) {
if (StringUtils.isNotEmpty(jpInverter.getSnCode().trim())) {
jpInverterMapper.insert(jpInverter);
}
}
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.JsonObject;
import com.qiniu.util.Json;
......@@ -45,6 +46,8 @@ import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
/**
* @description:
* @author: tw
......@@ -242,13 +245,14 @@ public class SunlightServiceImpl implements SunlightService {
e.printStackTrace();
logger.error("阳光数据错误:" + com.alibaba.fastjson.JSONObject.toJSONString(sunlightDto));
}
// 0离线 1在线
// 1故障 2告警 4正常
// 0离线 1在线
// 1故障 2告警 4正常
if ("0".equals(sunlightDto.getPs_status().toString())) {
jpStation.setState("离线");
} else if ("1".equals(sunlightDto.getPs_status().toString())) {
if ("1".equals(sunlightDto.getPs_fault_status().toString()) || "2".equals(sunlightDto.getPs_fault_status().toString())) {
if ("1".equals(sunlightDto.getPs_fault_status().toString())
|| "2".equals(sunlightDto.getPs_fault_status().toString())) {
jpStation.setState("报警");
} else if ("4".equals(sunlightDto.getPs_fault_status().toString())) {
jpStation.setState("在线");
......@@ -402,17 +406,21 @@ public class SunlightServiceImpl implements SunlightService {
// tdJpStationMapper.insert(tdJpStation);
// }
}
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
JpStation jpStationOld = jpStationMapper.selectOne(
new LambdaQueryWrapper<JpStation>().eq(JpStation::getThirdStationId, jpStation.getThirdStationId())
.eq(JpStation::getThirdCode, PVProducerInfoEnum.YG.getCode()));
if (jpStationOld != null) {
jpStation.setSequenceNbr(jpStationOld.getSequenceNbr());
jpStationMapper.updateById(jpStation);
} else {
jpStationMapper.insert(jpStation);
}
this.setJpInverte(listd, jpStation, listdtx);
this.collectorDetail(listd, jpStation);
// 电站报表
// 户用场站日发电量
Date today1 = new Date();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment