运行策略测试修改
This commit is contained in:
@ -9,6 +9,9 @@ public class ProtectionSettingVo {
|
||||
/** 设备 */
|
||||
private String deviceId;
|
||||
|
||||
/** 设备名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 点位 */
|
||||
private String point;
|
||||
|
||||
@ -44,6 +47,14 @@ public class ProtectionSettingVo {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
@ -65,6 +65,6 @@ public interface EmsPointEnumMatchMapper
|
||||
public int deleteEmsPointEnumMatchByIds(Long[] ids);
|
||||
|
||||
public List<EmsPointEnumMatch> selectList(@Param("siteId") String siteId,
|
||||
@Param("deviceCategory") String deviceCategory,
|
||||
@Param("matchField") String matchField);
|
||||
@Param("deviceCategory") String deviceCategory,
|
||||
@Param("matchField") String matchField);
|
||||
}
|
||||
|
||||
@ -622,8 +622,8 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
|
||||
// 2. 处理枚举值转换
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = pointEnumMatchMap.get(fieldName);
|
||||
if (CollectionUtils.isNotEmpty(pointEnumMatchList)) {
|
||||
Object finalMatchValue = matchValue;
|
||||
if (CollectionUtils.isNotEmpty(pointEnumMatchList) && matchValue != null) {
|
||||
String finalMatchValue = String.valueOf(matchValue).replace(".0", "");
|
||||
Optional<EmsPointEnumMatch> enumMatch = pointEnumMatchList.stream()
|
||||
.filter(data -> data.getDataEnumCode().equals(finalMatchValue)).findFirst();
|
||||
if (enumMatch.isPresent()) {
|
||||
@ -928,7 +928,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
// 点位匹配数据
|
||||
List<EmsPointMatch> pointMatchList = devicePointMatchDataProcessor.getDevicePointMatch(siteId, deviceId, DeviceMatchTable.CLUSTER.getCode());
|
||||
if (CollectionUtils.isEmpty(pointMatchList)) {
|
||||
log.info("未找到匹配的点位数据,无法处理LOAD总表数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
log.info("未找到匹配的点位数据,无法处理电池簇数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.CLUSTER.getCode());
|
||||
@ -969,11 +969,11 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
}
|
||||
|
||||
private void saveDeviceWorkStatus(String deviceId, String siteId, String workStatus) {
|
||||
if (StringUtils.isBlank(workStatus)) {
|
||||
if (StringUtils.isEmpty(workStatus)) {
|
||||
return;
|
||||
}
|
||||
EmsDevicesSetting emsDevicesSetting = emsDevicesSettingMapper.getDeviceBySiteAndDeviceId(deviceId, siteId);
|
||||
emsDevicesSetting.setWorkStatus(String.valueOf(new BigDecimal(workStatus).longValue()));
|
||||
emsDevicesSetting.setWorkStatus(workStatus);
|
||||
emsDevicesSetting.setUpdatedAt(DateUtils.getNowDate());
|
||||
emsDevicesSettingMapper.updateEmsDevicesSetting(emsDevicesSetting);
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
||||
String pointEnumMatchKey = DevicePointMatchDataProcessor.getPointEnumMacthCacheKey(siteId, deviceCategory);
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(siteId, deviceCategory, null);
|
||||
if (!CollectionUtils.isEmpty(pointEnumMatchList)) {
|
||||
if (redisCache.hasKey(pointEnumMatchKey)) {
|
||||
if (Boolean.TRUE.equals(redisCache.hasKey(pointEnumMatchKey))) {
|
||||
redisCache.deleteObject(pointEnumMatchKey);
|
||||
}
|
||||
redisCache.setCacheList(pointEnumMatchKey, pointEnumMatchList);
|
||||
@ -263,8 +263,14 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
||||
if (StringUtils.isAllBlank(matchFieldEnum, dataEnum)) {
|
||||
return;
|
||||
}
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(savePoint.getSiteId(), savePoint.getDeviceCategory(), savePoint.getMatchField());
|
||||
String siteId = savePoint.getSiteId();
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(siteId, savePoint.getDeviceCategory(), savePoint.getMatchField());
|
||||
if (CollectionUtils.isEmpty(pointEnumMatchList)) {
|
||||
siteId = SITE_ID;
|
||||
pointEnumMatchList = emsPointEnumMatchMapper.selectList(siteId, savePoint.getDeviceCategory(), savePoint.getMatchField());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(pointEnumMatchList)) {
|
||||
log.info("未查询到点位点位枚举匹配数据");
|
||||
return;
|
||||
}
|
||||
String[] matchFieldEnums = matchFieldEnum.split(SEPARATOR);
|
||||
@ -272,13 +278,21 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
||||
if (matchFieldEnums.length != dataEnums.length) {
|
||||
return;
|
||||
}
|
||||
String finalSiteId = siteId;
|
||||
for (int i = 0; i < matchFieldEnums.length; i++) {
|
||||
String enumName = matchFieldEnums[i];
|
||||
String dataEnumCode = dataEnums[i];
|
||||
pointEnumMatchList.forEach(pointEnumMatch -> {
|
||||
if (pointEnumMatch.getEnumName().equals(enumName)) {
|
||||
pointEnumMatch.setDataEnumCode(dataEnumCode);
|
||||
emsPointEnumMatchMapper.updateDataEnumCodeById(pointEnumMatch);
|
||||
if (SITE_ID.equals(finalSiteId)) {
|
||||
EmsPointEnumMatch insertPointEnumMatch = new EmsPointEnumMatch();
|
||||
BeanUtils.copyProperties(pointEnumMatch, insertPointEnumMatch);
|
||||
insertPointEnumMatch.setSiteId(savePoint.getSiteId());
|
||||
emsPointEnumMatchMapper.insertEmsPointEnumMatch(insertPointEnumMatch);
|
||||
} else {
|
||||
emsPointEnumMatchMapper.updateDataEnumCodeById(pointEnumMatch);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -35,11 +35,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="startTime != null "> and date_format(start_time, '%H:%i:%s') = date_format(#{startTime}, '%H:%i:%s')</if>
|
||||
<if test="endTime != null "> and date_format(end_time, '%H:%i:%s') = date_format(#{endTime}, '%H:%i:%s')</if>
|
||||
<if test="chargeDischargePower != null "> and charge_discharge_power = #{chargeDischargePower}</if>
|
||||
<if test="chargeStatus != null and chargeStatus != ''"> and charge_status = #{chargeStatus}</if>
|
||||
<if test="executionDate != null "> and execution_date = #{executionDate}</if>
|
||||
<if test="executionDate != null "> and execution_date = date_format(#{executionDate}, '%Y-%m-%d')</if>
|
||||
<if test="antiReverse != null "> and anti_reverse = #{antiReverse}</if>
|
||||
<if test="powerDownType != null "> and power_down_type = #{powerDownType}</if>
|
||||
</where>
|
||||
@ -132,8 +132,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="startTime != null "> and start_time = date_format(#{startTime}, '%H:%i:%s')</if>
|
||||
<if test="endTime != null "> and end_time = date_format(#{endTime}, '%H:%i:%s')</if>
|
||||
<if test="chargeDischargePower != null "> and charge_discharge_power = #{chargeDischargePower}</if>
|
||||
<if test="chargeStatus != null and chargeStatus != ''"> and charge_status = #{chargeStatus}</if>
|
||||
<if test="executionDate != null "> and execution_date = #{executionDate}</if>
|
||||
|
||||
Reference in New Issue
Block a user