添加水电双计设备瞬时流量,实时流量数据同步
This commit is contained in:
parent
40cf501ddf
commit
a26f00914d
@ -116,9 +116,22 @@ public class DeviceOtherMsgConsumer {
|
|||||||
// if(i<1){
|
// if(i<1){
|
||||||
// System.err.println("--------------------------保存使用记录失败!---------------------------");
|
// System.err.println("--------------------------保存使用记录失败!---------------------------");
|
||||||
// }
|
// }
|
||||||
//同步设备运行状态
|
|
||||||
|
LambdaUpdateChainWrapper<DeviceReportInfo> up = new LambdaUpdateChainWrapper<>(deviceReportInfoMapper)
|
||||||
|
.eq(DeviceReportInfo::getSerialNumber, serialNumber);
|
||||||
|
|
||||||
|
//获取流量计累计用水量/瞬时流量
|
||||||
|
Float meterSum = data1.getFloat("meterSum");
|
||||||
|
Float meterIns = data1.getFloat("meterIns");
|
||||||
//获取设备当前运行状态
|
//获取设备当前运行状态
|
||||||
Integer valveState = data1.getInt("valveState");
|
Integer valveState = data1.getInt("valveState");
|
||||||
|
|
||||||
|
//获取地址值/类型
|
||||||
|
Integer flowModel = data1.getInt("meterType");
|
||||||
|
Integer addr = data1.getInt("meterAddr");
|
||||||
|
|
||||||
|
//获取水单价
|
||||||
|
Float waterFees = data1.getFloat("waterFees");
|
||||||
Integer runStatus = null;
|
Integer runStatus = null;
|
||||||
if(valveState==0){
|
if(valveState==0){
|
||||||
runStatus=2;
|
runStatus=2;
|
||||||
@ -126,23 +139,77 @@ public class DeviceOtherMsgConsumer {
|
|||||||
runStatus=1;
|
runStatus=1;
|
||||||
}
|
}
|
||||||
if(runStatus!=null){
|
if(runStatus!=null){
|
||||||
new LambdaUpdateChainWrapper<>(deviceReportInfoMapper).set(DeviceReportInfo::getRunStatus,runStatus).eq(DeviceReportInfo::getSerialNumber,serialNumber).update();
|
up.set(DeviceReportInfo::getRunStatus,runStatus);
|
||||||
}
|
}
|
||||||
//获取流量计累计用水量/瞬时流量
|
if(flowModel!=null){
|
||||||
Float meterSum = data1.getFloat("meterSum");
|
up.set(DeviceReportInfo::getFlowModel,flowModel);
|
||||||
Float meterIns = data1.getFloat("meterIns");
|
}
|
||||||
|
if(addr!=null){
|
||||||
|
up.set(DeviceReportInfo::getAddr,addr);
|
||||||
|
}
|
||||||
|
if(waterFees!=null){
|
||||||
|
up.set(DeviceReportInfo::getWaterFree,waterFees);
|
||||||
|
}
|
||||||
|
if(meterIns!=null){
|
||||||
|
up.set(DeviceReportInfo::getInsFlow,meterIns);
|
||||||
|
}
|
||||||
|
if(meterSum!=null){
|
||||||
|
up.set(DeviceReportInfo::getSumFlow,meterSum);
|
||||||
|
}
|
||||||
|
//同步数据
|
||||||
|
up.update();
|
||||||
}
|
}
|
||||||
//收到关阀时定时报文
|
//收到关阀时定时报文
|
||||||
else if(JSONUtil.parseObj(data1).get("action").equals("safeMsg")){
|
else if(JSONUtil.parseObj(data1).get("action").equals("safeMsg")){
|
||||||
//续费在线状态
|
|
||||||
updateDeviceOnlineStatus( productId,serialNumber);
|
|
||||||
//保存数据
|
|
||||||
pumpUsageRecords.setMessageContent(JSONUtil.toJsonStr(jsonObject));
|
pumpUsageRecords.setMessageContent(JSONUtil.toJsonStr(jsonObject));
|
||||||
|
|
||||||
// int i = ngWaterPumpUsageRecordsMapper.insertNgWaterPumpUsageRecords(pumpUsageRecords);
|
// int i = ngWaterPumpUsageRecordsMapper.insertNgWaterPumpUsageRecords(pumpUsageRecords);
|
||||||
// if(i<1){
|
// if(i<1){
|
||||||
// System.err.println("--------------------------保存使用记录失败!---------------------------");
|
// System.err.println("--------------------------保存使用记录失败!---------------------------");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
LambdaUpdateChainWrapper<DeviceReportInfo> up = new LambdaUpdateChainWrapper<>(deviceReportInfoMapper)
|
||||||
|
.eq(DeviceReportInfo::getSerialNumber, serialNumber);
|
||||||
|
|
||||||
|
//获取流量计累计用水量/瞬时流量
|
||||||
|
Float meterSum = data1.getFloat("meterSum");
|
||||||
|
Float meterIns = data1.getFloat("meterIns");
|
||||||
|
//获取设备当前运行状态
|
||||||
|
Integer valveState = data1.getInt("valveState");
|
||||||
|
|
||||||
|
//获取地址值/类型
|
||||||
|
Integer flowModel = data1.getInt("meterType");
|
||||||
|
Integer addr = data1.getInt("meterAddr");
|
||||||
|
|
||||||
|
//获取水单价
|
||||||
|
Float waterFees = data1.getFloat("waterFees");
|
||||||
|
Integer runStatus = null;
|
||||||
|
if(valveState==0){
|
||||||
|
runStatus=2;
|
||||||
|
} else if (valveState==1) {
|
||||||
|
runStatus=1;
|
||||||
|
}
|
||||||
|
if(runStatus!=null){
|
||||||
|
up.set(DeviceReportInfo::getRunStatus,runStatus);
|
||||||
|
}
|
||||||
|
if(flowModel!=null){
|
||||||
|
up.set(DeviceReportInfo::getFlowModel,flowModel);
|
||||||
|
}
|
||||||
|
if(addr!=null){
|
||||||
|
up.set(DeviceReportInfo::getAddr,addr);
|
||||||
|
}
|
||||||
|
if(waterFees!=null){
|
||||||
|
up.set(DeviceReportInfo::getWaterFree,waterFees);
|
||||||
|
}
|
||||||
|
if(meterIns!=null){
|
||||||
|
up.set(DeviceReportInfo::getInsFlow,meterIns);
|
||||||
|
}
|
||||||
|
if(meterSum!=null){
|
||||||
|
up.set(DeviceReportInfo::getSumFlow,meterSum);
|
||||||
|
}
|
||||||
|
//同步数据
|
||||||
|
up.update();
|
||||||
|
|
||||||
}
|
}
|
||||||
//开阀门,关阀门
|
//开阀门,关阀门
|
||||||
else if(JSONUtil.parseObj(data1).get("action").equals("startPump")||JSONUtil.parseObj(data1).get("action").equals("stopPump")){
|
else if(JSONUtil.parseObj(data1).get("action").equals("startPump")||JSONUtil.parseObj(data1).get("action").equals("stopPump")){
|
||||||
|
@ -190,6 +190,15 @@ public class DeviceReportInfo extends BaseEntity
|
|||||||
@Excel(name = "水价单位元")
|
@Excel(name = "水价单位元")
|
||||||
@ApiModelProperty("水价单位元")
|
@ApiModelProperty("水价单位元")
|
||||||
private BigDecimal waterFree;
|
private BigDecimal waterFree;
|
||||||
|
/** 实时流量 */
|
||||||
|
@Excel(name = "实时流量")
|
||||||
|
@ApiModelProperty("实时流量")
|
||||||
|
private String insFlow;
|
||||||
|
|
||||||
|
/** 累计流量 */
|
||||||
|
@Excel(name = "累计流量")
|
||||||
|
@ApiModelProperty("累计流量")
|
||||||
|
private String sumFlow;
|
||||||
//----------------------------------------------------------业务字段-----------------------------------------------------------
|
//----------------------------------------------------------业务字段-----------------------------------------------------------
|
||||||
/** 是否自动审核 */
|
/** 是否自动审核 */
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
@ -39,10 +39,12 @@
|
|||||||
<result property="addr" column="addr" />
|
<result property="addr" column="addr" />
|
||||||
<result property="flowModel" column="flow_model" />
|
<result property="flowModel" column="flow_model" />
|
||||||
<result property="waterFree" column="water_free" />
|
<result property="waterFree" column="water_free" />
|
||||||
|
<result property="insFlow" column="ins_flow" />
|
||||||
|
<result property="sumFlow" column="sum_flow" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeviceReportInfoVo">
|
<sql id="selectDeviceReportInfoVo">
|
||||||
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name, lcd_manufacturer_name, voice_manufacturer_name, replace_manufacturer_name, device_id, status, powers_time, type, longitude, latitude,on_line,area_code,dept_id,run_status, addr, flow_model,water_free from iot_device_report_info
|
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name, lcd_manufacturer_name, voice_manufacturer_name, replace_manufacturer_name, device_id, status, powers_time, type, longitude, latitude,on_line,area_code,dept_id,run_status, addr, flow_model,water_free, ins_flow, sum_flow from iot_device_report_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectDeviceReportInfoList" parameterType="DeviceReportInfo" resultMap="DeviceReportInfoResult">
|
<select id="selectDeviceReportInfoList" parameterType="DeviceReportInfo" resultMap="DeviceReportInfoResult">
|
||||||
@ -81,6 +83,8 @@
|
|||||||
<if test="addr != null "> and addr = #{addr}</if>
|
<if test="addr != null "> and addr = #{addr}</if>
|
||||||
<if test="flowModel != null "> and flow_model = #{flowModel}</if>
|
<if test="flowModel != null "> and flow_model = #{flowModel}</if>
|
||||||
<if test="waterFree != null "> and water_free = #{waterFree}</if>
|
<if test="waterFree != null "> and water_free = #{waterFree}</if>
|
||||||
|
<if test="insFlow != null and insFlow != ''"> and ins_flow = #{insFlow}</if>
|
||||||
|
<if test="sumFlow != null and sumFlow != ''"> and sum_flow = #{sumFlow}</if>
|
||||||
</where>
|
</where>
|
||||||
<!-- 添加排序 -->
|
<!-- 添加排序 -->
|
||||||
order by powers_time desc
|
order by powers_time desc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user