| | |
| | | /** |
| | | * |
| | | */ |
| | | private String gatewayCyc; |
| | | private String time; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String fans; |
| | | private String i00; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String v1run; |
| | | private String i01; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String uv1run; |
| | | private String i02; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String fanrun; |
| | | private String i03; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String uv2run; |
| | | private String i04; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String ssvrun; |
| | | private String i05; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String dp; |
| | | private String i06; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String t; |
| | | private String i07; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String oc; |
| | | private String i10; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String gatew; |
| | | private String i11; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String nxrun; |
| | | private String q00; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String alarm; |
| | | private String q01; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String times; |
| | | private String q02; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String rtcVolt; |
| | | private String q03; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String v2run; |
| | | private String q04; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String dxqvrun; |
| | | private String q05; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String press; |
| | | private String vb0; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String dc; |
| | | private String vb10; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String vb11; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String vb12; |
| | | |
| | | /** |
| | | * This field was generated by MyBatis Generator. |
| | | * This field corresponds to the database table t_data_smock |
| | | * |
| | | * @mbg.generated Wed Oct 18 15:12:02 CST 2023 |
| | | * @mbg.generated Mon Oct 30 13:02:05 CST 2023 |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | } |
| | |
| | | package com.thhy.materials.modules.biz.helmet.smoke; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.thhy.materials.modules.biz.helmet.entity.TDataSmock; |
| | | import com.thhy.materials.modules.biz.helmet.mapper.HelmetMapper; |
| | | import com.thhy.materials.modules.biz.helmet.service.HelmetService; |
| | | import com.thhy.materials.modules.biz.utils.ApplicationContextUtil; |
| | | import io.netty.buffer.ByteBuf; |
| | |
| | | import io.netty.util.CharsetUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | public class SmokeMessage extends SimpleChannelInboundHandler<ByteBuf>{ |
| | |
| | | System.out.println("客户端接收到消息: " + in.toString(CharsetUtil.UTF_8)); |
| | | JSONObject jsonObject11 = JSONObject.parseObject(in.toString(CharsetUtil.UTF_8)); |
| | | System.out.println("客户端接收到消息: " + jsonObject11); |
| | | Object time = jsonObject11.get("time"); |
| | | String parems = jsonObject11.get("params").toString(); |
| | | JSONObject jsonObject = JSONObject.parseObject(parems); |
| | | System.out.println(time+"-------------"+jsonObject); |
| | | TDataSmock tDataSmock = new TDataSmock(); |
| | | tDataSmock.setGatewayCyc(jsonObject11.get("gateway_cyc").toString()); |
| | | tDataSmock.setFans(jsonObject11.get("FanS").toString()); |
| | | tDataSmock.setV1run(jsonObject11.get("V1Run").toString()); |
| | | tDataSmock.setUv1run(jsonObject11.get("UV1Run").toString()); |
| | | tDataSmock.setFanrun(jsonObject11.get("FanRun").toString()); |
| | | tDataSmock.setUv2run(jsonObject11.get("UV2Run").toString()); |
| | | tDataSmock.setSsvrun(jsonObject11.get("SSVRun").toString()); |
| | | tDataSmock.setDp(jsonObject11.get("DP").toString()); |
| | | tDataSmock.setT(jsonObject11.get("T").toString()); |
| | | tDataSmock.setOc(jsonObject11.get("OC").toString()); |
| | | tDataSmock.setGatew(jsonObject11.get("gatew").toString()); |
| | | tDataSmock.setNxrun(jsonObject11.get("NXRun").toString()); |
| | | tDataSmock.setTimes(jsonObject11.get("time").toString()); |
| | | tDataSmock.setRtcVolt(jsonObject11.get("RTC_VOLT").toString()); |
| | | tDataSmock.setV2run(jsonObject11.get("V2Run").toString()); |
| | | tDataSmock.setDxqvrun(jsonObject11.get("DXQVRun").toString()); |
| | | tDataSmock.setPress(jsonObject11.get("Press").toString()); |
| | | tDataSmock.setDc(jsonObject11.get("Dc").toString()); |
| | | System.out.println("-------"+tDataSmock); |
| | | getUserService().smockIn(tDataSmock); |
| | | tDataSmock.setTime(time.toString()); |
| | | tDataSmock.setI00(jsonObject.get("I00").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI01(jsonObject.get("I01").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI02(jsonObject.get("I02").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI03(jsonObject.get("I03").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI04(jsonObject.get("I04").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI05(jsonObject.get("I05").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI06(jsonObject.get("I06").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI07(jsonObject.get("I07").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI10(jsonObject.get("I10").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setI11(jsonObject.get("I11").toString().equals("true")?"开启":"关闭"); |
| | | tDataSmock.setQ00(jsonObject.get("Q00").toString().equals("true")?"运行中":"停止状态"); |
| | | tDataSmock.setQ01(jsonObject.get("Q01").toString().equals("true")?"运行中":"停止状态"); |
| | | tDataSmock.setQ02(jsonObject.get("Q02").toString().equals("true")?"运行中":"停止状态"); |
| | | tDataSmock.setQ03(jsonObject.get("Q03").toString().equals("true")?"运行中":"停止状态"); |
| | | tDataSmock.setQ04(jsonObject.get("Q04").toString().equals("true")?"运行中":"停止状态"); |
| | | tDataSmock.setQ05(jsonObject.get("Q05").toString().equals("true")?"运行中":"停止状态"); |
| | | tDataSmock.setVb0(jsonObject.get("VB0").toString()); |
| | | tDataSmock.setVb10(jsonObject.get("VB10").toString()); |
| | | tDataSmock.setVb11(jsonObject.get("VB11").toString()); |
| | | tDataSmock.setVb12(jsonObject.get("VB12").toString()); |
| | | |
| | | // TDataSmock tDataSmock = new TDataSmock(); |
| | | // tDataSmock.setGatewayCyc(jsonObject11.get("gateway_cyc").toString()); |
| | | // tDataSmock.setFans(jsonObject11.get("FanS").toString()); |
| | | // tDataSmock.setV1run(jsonObject11.get("V1Run").toString()); |
| | | // tDataSmock.setUv1run(jsonObject11.get("UV1Run").toString()); |
| | | // tDataSmock.setFanrun(jsonObject11.get("FanRun").toString()); |
| | | // tDataSmock.setUv2run(jsonObject11.get("UV2Run").toString()); |
| | | // tDataSmock.setSsvrun(jsonObject11.get("SSVRun").toString()); |
| | | // tDataSmock.setDp(jsonObject11.get("DP").toString()); |
| | | // tDataSmock.setT(jsonObject11.get("T").toString()); |
| | | // tDataSmock.setOc(jsonObject11.get("OC").toString()); |
| | | // tDataSmock.setGatew(jsonObject11.get("gatew").toString()); |
| | | // tDataSmock.setNxrun(jsonObject11.get("NXRun").toString()); |
| | | // tDataSmock.setTimes(jsonObject11.get("time").toString()); |
| | | // tDataSmock.setRtcVolt(jsonObject11.get("RTC_VOLT").toString()); |
| | | // tDataSmock.setV2run(jsonObject11.get("V2Run").toString()); |
| | | // tDataSmock.setDxqvrun(jsonObject11.get("DXQVRun").toString()); |
| | | // tDataSmock.setPress(jsonObject11.get("Press").toString()); |
| | | // tDataSmock.setDc(jsonObject11.get("Dc").toString()); |
| | | // System.out.println("-------"+tDataSmock); |
| | | getUserService().smockIn(tDataSmock); |
| | | } |
| | | @Override |
| | | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { |
| | |
| | | <if test="smokeId != null"> |
| | | smoke_id, |
| | | </if> |
| | | <if test="gatewayCyc != null"> |
| | | gateway_cyc, |
| | | <if test="time != null"> |
| | | time, |
| | | </if> |
| | | <if test="fans != null"> |
| | | FanS, |
| | | <if test="i00 != null"> |
| | | I00, |
| | | </if> |
| | | <if test="v1run != null"> |
| | | V1Run, |
| | | <if test="i01 != null"> |
| | | I01, |
| | | </if> |
| | | <if test="uv1run != null"> |
| | | UV1Run, |
| | | <if test="i02 != null"> |
| | | I02, |
| | | </if> |
| | | <if test="fanrun != null"> |
| | | FanRun, |
| | | <if test="i03 != null"> |
| | | I03, |
| | | </if> |
| | | <if test="uv2run != null"> |
| | | UV2Run, |
| | | <if test="i04 != null"> |
| | | I04, |
| | | </if> |
| | | <if test="ssvrun != null"> |
| | | SSVRun, |
| | | <if test="i05 != null"> |
| | | I05, |
| | | </if> |
| | | <if test="dp != null"> |
| | | DP, |
| | | <if test="i06 != null"> |
| | | I06, |
| | | </if> |
| | | <if test="t != null"> |
| | | T, |
| | | <if test="i07 != null"> |
| | | I07, |
| | | </if> |
| | | <if test="oc != null"> |
| | | OC, |
| | | <if test="i10 != null"> |
| | | I10, |
| | | </if> |
| | | <if test="gatew != null"> |
| | | gatew, |
| | | <if test="i11 != null"> |
| | | I11, |
| | | </if> |
| | | <if test="nxrun != null"> |
| | | NXRun, |
| | | <if test="q00 != null"> |
| | | Q00, |
| | | </if> |
| | | <if test="alarm != null"> |
| | | Alarm, |
| | | <if test="q01 != null"> |
| | | Q01, |
| | | </if> |
| | | <if test="times != null"> |
| | | times, |
| | | <if test="q02 != null"> |
| | | Q02, |
| | | </if> |
| | | <if test="rtcVolt != null"> |
| | | RTC_VOLT, |
| | | <if test="q03 != null"> |
| | | Q03, |
| | | </if> |
| | | <if test="v2run != null"> |
| | | V2Run, |
| | | <if test="q04 != null"> |
| | | Q04, |
| | | </if> |
| | | <if test="dxqvrun != null"> |
| | | DXQVRun, |
| | | <if test="q05 != null"> |
| | | Q05, |
| | | </if> |
| | | <if test="press != null"> |
| | | Press, |
| | | <if test="vb0 != null"> |
| | | VB0, |
| | | </if> |
| | | <if test="dc != null"> |
| | | Dc, |
| | | <if test="vb10 != null"> |
| | | VB10, |
| | | </if> |
| | | <if test="vb11 != null"> |
| | | VB11, |
| | | </if> |
| | | <if test="vb12 != null"> |
| | | VB12, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="smokeId != null"> |
| | | #{smokeId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="gatewayCyc != null"> |
| | | #{gatewayCyc,jdbcType=VARCHAR}, |
| | | <if test="time != null"> |
| | | #{time,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="fans != null"> |
| | | #{fans,jdbcType=VARCHAR}, |
| | | <if test="i00 != null"> |
| | | #{i00,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="v1run != null"> |
| | | #{v1run,jdbcType=VARCHAR}, |
| | | <if test="i01 != null"> |
| | | #{i01,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="uv1run != null"> |
| | | #{uv1run,jdbcType=VARCHAR}, |
| | | <if test="i02 != null"> |
| | | #{i02,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="fanrun != null"> |
| | | #{fanrun,jdbcType=VARCHAR}, |
| | | <if test="i03 != null"> |
| | | #{i03,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="uv2run != null"> |
| | | #{uv2run,jdbcType=VARCHAR}, |
| | | <if test="i04 != null"> |
| | | #{i04,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="ssvrun != null"> |
| | | #{ssvrun,jdbcType=VARCHAR}, |
| | | <if test="i05 != null"> |
| | | #{i05,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="dp != null"> |
| | | #{dp,jdbcType=VARCHAR}, |
| | | <if test="i06 != null"> |
| | | #{i06,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="t != null"> |
| | | #{t,jdbcType=VARCHAR}, |
| | | <if test="i07 != null"> |
| | | #{i07,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="oc != null"> |
| | | #{oc,jdbcType=VARCHAR}, |
| | | <if test="i10 != null"> |
| | | #{i10,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="gatew != null"> |
| | | #{gatew,jdbcType=VARCHAR}, |
| | | <if test="i11 != null"> |
| | | #{i11,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="nxrun != null"> |
| | | #{nxrun,jdbcType=VARCHAR}, |
| | | <if test="q00 != null"> |
| | | #{q00,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="alarm != null"> |
| | | #{alarm,jdbcType=VARCHAR}, |
| | | <if test="q01 != null"> |
| | | #{q01,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="times != null"> |
| | | #{times,jdbcType=VARCHAR}, |
| | | <if test="q02 != null"> |
| | | #{q02,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="rtcVolt != null"> |
| | | #{rtcVolt,jdbcType=VARCHAR}, |
| | | <if test="q03 != null"> |
| | | #{q03,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="v2run != null"> |
| | | #{v2run,jdbcType=VARCHAR}, |
| | | <if test="q04 != null"> |
| | | #{q04,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="dxqvrun != null"> |
| | | #{dxqvrun,jdbcType=VARCHAR}, |
| | | <if test="q05 != null"> |
| | | #{q05,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="press != null"> |
| | | #{press,jdbcType=VARCHAR}, |
| | | <if test="vb0 != null"> |
| | | #{vb0,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="dc != null"> |
| | | #{dc,jdbcType=VARCHAR}, |
| | | <if test="vb10 != null"> |
| | | #{vb10,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="vb11 != null"> |
| | | #{vb11,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="vb12 != null"> |
| | | #{vb12,jdbcType=VARCHAR}, |
| | | </if> |
| | | </trim> |
| | | </insert> |