|
|
|
|
@ -253,155 +253,6 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
return recordDnbInstantMapper.selectRecordDnbInstantList(dnbInstant);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public void getNhEnergyDetail() {
|
|
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
|
|
params.put("dateType", "mi15");
|
|
|
|
|
Date nowTime = DateUtils.getNowDate();
|
|
|
|
|
String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(nowTime, -20));
|
|
|
|
|
String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(nowTime, -10));
|
|
|
|
|
params.put("startTime", startTime);
|
|
|
|
|
params.put("endTime", endTime);
|
|
|
|
|
// params.put("startTime","2025-07-30 13:40:00");
|
|
|
|
|
// params.put("endTime","2025-07-30 13:50:00");
|
|
|
|
|
params.put("valueType", "SJZ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 电压/电流
|
|
|
|
|
* **/
|
|
|
|
|
AjaxResult voltageRes = remoteOpenService.getVoltageCurrent(params);
|
|
|
|
|
List<RecordDnbInstant> list = new ArrayList<>();
|
|
|
|
|
if (voltageRes.isSuccess()) {
|
|
|
|
|
JSONObject resData = JSONObject.parseObject(JSON.toJSONString(voltageRes.get(AjaxResult.DATA_TAG)));
|
|
|
|
|
JSONArray array = JSONArray.parseArray(resData.get("Data").toString());
|
|
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
|
|
RecordDnbInstant instant = new RecordDnbInstant();
|
|
|
|
|
instant.setVA(getSafeBigDecimal(array.getJSONObject(i), "ADY"));
|
|
|
|
|
instant.setVB(getSafeBigDecimal(array.getJSONObject(i), "BDY"));
|
|
|
|
|
instant.setVC(getSafeBigDecimal(array.getJSONObject(i), "CDY"));
|
|
|
|
|
instant.setIA(getSafeBigDecimal(array.getJSONObject(i), "ADL"));
|
|
|
|
|
instant.setIB(getSafeBigDecimal(array.getJSONObject(i), "BDL"));
|
|
|
|
|
instant.setIC(getSafeBigDecimal(array.getJSONObject(i), "CDL"));
|
|
|
|
|
instant.setMonitorId(array.getJSONObject(i).getString("Address"));
|
|
|
|
|
instant.setRecordTime(nowTime);
|
|
|
|
|
instant.setCollectTime(DateUtils.dateTime("yyyy-MM-dd HH:mm", array.getJSONObject(i).getString("ReadingDate")));
|
|
|
|
|
list.add(instant);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功率
|
|
|
|
|
* **/
|
|
|
|
|
AjaxResult electricPowerRes = remoteOpenService.getElectricPower(params);
|
|
|
|
|
if (electricPowerRes.isSuccess()) {
|
|
|
|
|
JSONObject resData = JSONObject.parseObject(JSON.toJSONString(electricPowerRes.get(AjaxResult.DATA_TAG)));
|
|
|
|
|
JSONArray array = JSONArray.parseArray(resData.get("Data").toString());
|
|
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
|
|
for (RecordDnbInstant item : list) {
|
|
|
|
|
String address = array.getJSONObject(i).getString("Address");
|
|
|
|
|
if (address.equals(item.getMonitorId())) {
|
|
|
|
|
item.setGlys(getSafeBigDecimal(array.getJSONObject(i), "GLYS"));
|
|
|
|
|
item.setActivePower(getSafeBigDecimal(array.getJSONObject(i), "YGGL"));
|
|
|
|
|
item.setReactivePower(getSafeBigDecimal(array.getJSONObject(i), "WGGL"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 电量
|
|
|
|
|
* **/
|
|
|
|
|
AjaxResult electricQuantityRes = remoteOpenService.getElectricQuantity(params);
|
|
|
|
|
if (electricQuantityRes.isSuccess()) {
|
|
|
|
|
JSONObject resData = JSONObject.parseObject(JSON.toJSONString(electricQuantityRes.get(AjaxResult.DATA_TAG)));
|
|
|
|
|
JSONArray array = JSONArray.parseArray(resData.get("Data").toString());
|
|
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
|
|
for (RecordDnbInstant item : list) {
|
|
|
|
|
String address = array.getJSONObject(i).getString("Address");
|
|
|
|
|
if (address.equals(item.getMonitorId())) {
|
|
|
|
|
item.setZxyg(getSafeBigDecimal(array.getJSONObject(i), "ZYGDNSZ"));
|
|
|
|
|
item.setReactivePower(getSafeBigDecimal(array.getJSONObject(i), "ZYGDN"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (RecordDnbInstant item : list) {
|
|
|
|
|
BaseMonitorInfo temp = new BaseMonitorInfo();
|
|
|
|
|
temp.setAddressCode(item.getMonitorId());
|
|
|
|
|
List<BaseMonitorInfo> baseList = baseMonitorInfoMapper.selectBaseMonitorInfoList(temp);
|
|
|
|
|
for (BaseMonitorInfo base : baseList) {
|
|
|
|
|
item.setMonitorId(base.getMonitorId());
|
|
|
|
|
recordDnbInstantMapper.insertRecordDnbInstant(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void getNhEnergy() {
|
|
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
|
|
params.put("dateType", "mi15");
|
|
|
|
|
//获取当前时间的前后5分钟
|
|
|
|
|
Date nowDate = DateUtils.getNowDate();
|
|
|
|
|
//取整点数据
|
|
|
|
|
String nowDateStr = DateUtils.parseDateToStr("yyyy-MM-dd HH", nowDate) + ":00:00";
|
|
|
|
|
String startTime = DateUtils.parseDateToStr("yyyy-MM-dd HH", DateUtils.addHours(nowDate, -1)) + ":00:00";
|
|
|
|
|
params.put("startTime", startTime);
|
|
|
|
|
params.put("endTime", nowDateStr);
|
|
|
|
|
params.put("valueType", "SJZ");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 电量
|
|
|
|
|
* **/
|
|
|
|
|
List<ReportPointDnb> list = new ArrayList<>();
|
|
|
|
|
AjaxResult electricQuantityRes = remoteOpenService.getElectricQuantity(params);
|
|
|
|
|
if (electricQuantityRes.isSuccess()) {
|
|
|
|
|
JSONObject resData = JSONObject.parseObject(JSON.toJSONString(electricQuantityRes.get(AjaxResult.DATA_TAG)));
|
|
|
|
|
JSONArray array = JSONArray.parseArray(resData.get("Data").toString());
|
|
|
|
|
//根据Address分类
|
|
|
|
|
List<String> addressList = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
|
|
addressList.add(array.getJSONObject(i).getString("Address"));
|
|
|
|
|
}
|
|
|
|
|
//addressList去重
|
|
|
|
|
addressList = addressList.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
try {
|
|
|
|
|
for (String address : addressList) {
|
|
|
|
|
ReportPointDnb dnb = new ReportPointDnb();
|
|
|
|
|
BigDecimal electricQuantity = BigDecimal.ZERO;
|
|
|
|
|
for (int i = 0; i < array.size(); i++) {
|
|
|
|
|
if (address.equals(array.getJSONObject(i).getString("Address"))) {
|
|
|
|
|
electricQuantity = electricQuantity.add(getSafeBigDecimal(array.getJSONObject(i), "ZYGDN"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dnb.setMeterValue(array.getJSONObject(0).getBigDecimal("ZYGDNSZ"));
|
|
|
|
|
dnb.setExpend(electricQuantity);
|
|
|
|
|
dnb.setMonitorId(address);
|
|
|
|
|
dnb.setBeginTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, startTime));
|
|
|
|
|
dnb.setEndTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, nowDateStr));
|
|
|
|
|
dnb.setRecordTime(new Date());
|
|
|
|
|
dnb.setPointTime(removeLeadingZeros(DateUtils.parseDateToStr("HH", DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, startTime))));
|
|
|
|
|
BaseMonitorInfo temp = new BaseMonitorInfo();
|
|
|
|
|
temp.setConnCode(dnb.getMonitorId());
|
|
|
|
|
List<BaseMonitorInfo> BaseList = baseMonitorInfoMapper.selectBaseMonitorInfoList(temp);
|
|
|
|
|
for (BaseMonitorInfo base : BaseList) {
|
|
|
|
|
dnb.setMonitorId(base.getMonitorId());
|
|
|
|
|
reportPointDnbMapper.insertReportPointDnb(dnb);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 移除前面的0
|
|
|
|
|
**/
|
|
|
|
|
@ -480,19 +331,4 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService {
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public void fixWwEnergyData(Map<String, String> params) {
|
|
|
|
|
//获取威伟电表
|
|
|
|
|
BaseMonitorInfo query = new BaseMonitorInfo();
|
|
|
|
|
query.setElectricityMeterType("2");
|
|
|
|
|
List<BaseMonitorInfo> list = baseMonitorInfoMapper.selectBaseMonitorInfoList(query);
|
|
|
|
|
|
|
|
|
|
for (BaseMonitorInfo info : list) {
|
|
|
|
|
params.put("monitorId", info.getMonitorId());
|
|
|
|
|
reportPointDnbMapper.fixWwEnergyData(params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|