设备状态,设备信息---清洗

develop
Angel 11 months ago
parent ecd9a4de0d
commit 45b8476d40

@ -0,0 +1,197 @@
package com.ssf.mysqloracletest.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName devops_device_info
*/
@TableName(value ="devops_device_info")
@Data
public class DevopsDeviceInfo implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
*
*/
private String placeCode;
/**
*
*/
private String placeName;
/**
*
*/
private String deviceName;
/**
*
*/
private String deviceCode;
/**
*
*/
private String gbsChannelNo;
/**
*
*/
private Integer deviceType;
/**
*
*/
private String structuredCameraType;
/**
*
*/
private String deviceAddress;
/**
*
*/
private Integer orientation;
/**
* SN
*/
private String deviceSn;
/**
*
*/
private String deviceBrand;
/**
* ip
*/
private String deviceIp;
/**
*
*/
private Integer devicePort;
/**
* MAC
*/
private String deviceMac;
/**
* IMEI
*/
private String deviceImei;
/**
*
*/
private BigDecimal longitude;
/**
*
*/
private BigDecimal latitude;
/**
* U3D
*/
private BigDecimal u3dLongitude;
/**
* U3D
*/
private BigDecimal u3dLatitude;
/**
*
*/
private String deviceHeight;
/**
*
*/
private String manufactor;
/**
*
*/
private String account;
/**
*
*/
private String password;
/**
*
*/
private Integer direction;
/**
* RTSP
*/
private String rtspAddress;
/**
*
*/
private Integer isDoorwayVideo;
/**
* region_id
*/
private String stRegionId;
/**
* camera_idx
*/
private String stCameraIdx;
/**
*
*/
private Integer channelNo;
/**
*
*/
private Date createTime;
/**
*
*/
private Integer createBy;
/**
*
*/
private Date updateTime;
/**
*
*/
private Integer updateBy;
/**
* 0:,1:
*/
private Integer isActive;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,101 @@
package com.ssf.mysqloracletest.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName devops_device_status
*/
@TableName(value ="devops_device_status")
@Data
public class DevopsDeviceStatus implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
*
*/
private String placeCode;
/**
*
*/
private String placeName;
/**
*
*/
private String deviceCode;
/**
*
*/
private String gbsChannelNo;
/**
*
*/
private String deviceName;
/**
* ip
*/
private String deviceIp;
/**
*
*/
private Integer deviceType;
/**
*
*/
private Long heartbeatTime;
/**
* 线
*/
private Integer isOnline;
/**
*
*/
private Integer isAlarm;
/**
*
*/
private Date createTime;
/**
*
*/
private Integer createBy;
/**
*
*/
private Date updateTime;
/**
*
*/
private Integer updateBy;
/**
* 0:,1:
*/
private Integer isActive;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -16,7 +16,7 @@ import lombok.Data;
@TableName(value = "t_jksbgl")
public class TJksbglMysql {
/**
*
*
*/
@TableField(value = "id")
private String id;
@ -46,25 +46,25 @@ public class TJksbglMysql {
private String macdz;
/**
*
*
*/
@TableField(value = "sbdk")
private String sbdk;
/**
*
*
*/
@TableField(value = "jkdwlx")
private String jkdwlx;
/**
*
*
*/
@TableField(value = "sblx")
private String sblx;
/**
*
*
*/
@TableField(value = "sbxs")
private String sbxs;
@ -82,312 +82,313 @@ public class TJksbglMysql {
private String ywbq;
/**
*
*
*/
@TableField(value = "jcc")
private String jcc;
/**
*
*
*/
@TableField(value = "sbjd")
private String sbjd;
/**
*
*
*/
@TableField(value = "sbwd")
private String sbwd;
/**
*
*
*/
@TableField(value = "azdz")
private String azdz;
/**
*
*
*/
@TableField(value = "cjfx")
private String cjfx;
/**
*
*
*/
@TableField(value = "sbzt")
private String sbzt;
/**
*
*
*/
@TableField(value = "ssgajg")
private String ssgajg;
/**
*
*
*/
@TableField(value = "jrfs")
private String jrfs;
/**
*
*
*/
@TableField(value = "wlbs")
private String wlbs;
/**
*
*
*/
@TableField(value = "sbcs")
private String sbcs;
/**
*
*
*/
@TableField(value = "azsj")
private String azsj;
/**
*
*
*/
@TableField(value = "ssbmhy")
private String ssbmhy;
/**
*
*
*/
@TableField(value = "dwlx")
private String dwlx;
/**
*
*
*/
@TableField(value = "djrxm")
private String djrxm;
/**
*
*
*/
@TableField(value = "djrsfzh")
private String djrsfzh;
/**
*
*
*/
@TableField(value = "djrdwdm")
private String djrdwdm;
/**
*
*
*/
@TableField(value = "djrdwmc")
private String djrdwmc;
/**
*
*
*/
@TableField(value = "djsj")
private String djsj;
/**
*
*
*/
@TableField(value = "jrsjl")
private String jrsjl;
/**
*
*
*/
@TableField(value = "zrsjl")
private String zrsjl;
/**
*
*
*/
@TableField(value = "j30tsjl")
private String j30tsjl;
/**
*
*
*/
@TableField(value = "j30tjl")
private String j30tjl;
/**
*
*
*/
@TableField(value = "zxzpsj")
private String zxzpsj;
/**
*
*
*/
@TableField(value = "zxrksj")
private String zxrksj;
/**
*
*
*/
@TableField(value = "j7tsjl")
private String j7tsjl;
/**
*
*
*/
@TableField(value = "sfzdryj")
private String sfzdryj;
/**
*
*
*/
@TableField(value = "glytbh")
private String glytbh;
/**
*
*
*/
@TableField(value = "glksbh")
private String glksbh;
/**
*
*
*/
@TableField(value = "sfsdryj")
private String sfsdryj;
/**
*
*
*/
@TableField(value = "sbid")
private String sbid;
/**
*
*
*/
@TableField(value = "sbjc")
private String sbjc;
/**
*
*
*/
@TableField(value = "gldl")
private String gldl;
/**
*
*
*/
@TableField(value = "dllx")
private String dllx;
/**
*
*
*/
@TableField(value = "cjqy")
private String cjqy;
/**
*
*
*/
@TableField(value = "cjfxlx")
private String cjfxlx;
/**
*
*
*/
@TableField(value = "sbsybh")
private String sbsybh;
/**
*
*
*/
@TableField(value = "sbbabh")
private String sbbabh;
/**
*
*
*/
@TableField(value = "sbbazt")
private String sbbazt;
/**
*
*
*/
@TableField(value = "sbbzmc")
private String sbbzmc;
/**
*
*
*/
@TableField(value = "lkldmc")
private String lkldmc;
/**
*
*
*/
@TableField(value = "lklddm")
private String lklddm;
/**
*
*
*/
@TableField(value = "glxmmc")
private String glxmmc;
/**
*
*
*/
@TableField(value = "glxmid")
private String glxmid;
/**
*
*
*/
@TableField(value = "jczq")
private String jczq;
/**
*
*
*/
@TableField(value = "jckk")
private String jckk;
/**
*
*
*/
@TableField(value = "zpfx")
private String zpfx;
/**
*
*
*/
@TableField(value = "gldw")
private String gldw;
/**
*
*
*/
@TableField(value = "lxr")
private String lxr;
/**
*
*
*/
@TableField(value = "lxdh")
private String lxdh;
/**
*
*
*/
@TableField(value = "sfjsbryj")
private String sfjsbryj;
/**
*
*
*/
@TableField(value = "sfzzrkyj")
private String sfzzrkyj;
@TableField(value = "status")
private String status;
}

@ -0,0 +1,20 @@
package com.ssf.mysqloracletest.mapper;
import com.ssf.mysqloracletest.domain.DevopsDeviceInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 10503
* @description devops_device_info()Mapper
* @createDate 2023-12-02 17:42:39
* @Entity com.ssf.mysqloracletest.domain.DevopsDeviceInfo
*/
@Mapper
public interface DevopsDeviceInfoMapper extends BaseMapper<DevopsDeviceInfo> {
}

@ -0,0 +1,20 @@
package com.ssf.mysqloracletest.mapper;
import com.ssf.mysqloracletest.domain.DevopsDeviceStatus;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 10503
* @description devops_device_status()Mapper
* @createDate 2023-12-07 17:19:14
* @Entity com.ssf.mysqloracletest.domain.DevopsDeviceStatus
*/
@Mapper
public interface DevopsDeviceStatusMapper extends BaseMapper<DevopsDeviceStatus> {
}

@ -0,0 +1,13 @@
package com.ssf.mysqloracletest.service;
import com.ssf.mysqloracletest.domain.DevopsDeviceInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 10503
* @description devops_device_info()Service
* @createDate 2023-12-02 17:42:39
*/
public interface DevopsDeviceInfoService extends IService<DevopsDeviceInfo> {
}

@ -0,0 +1,13 @@
package com.ssf.mysqloracletest.service;
import com.ssf.mysqloracletest.domain.DevopsDeviceStatus;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 10503
* @description devops_device_status()Service
* @createDate 2023-12-07 17:19:14
*/
public interface DevopsDeviceStatusService extends IService<DevopsDeviceStatus> {
}

@ -0,0 +1,23 @@
package com.ssf.mysqloracletest.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssf.mysqloracletest.domain.DevopsDeviceInfo;
import com.ssf.mysqloracletest.service.DevopsDeviceInfoService;
import com.ssf.mysqloracletest.mapper.DevopsDeviceInfoMapper;
import org.springframework.stereotype.Service;
/**
* @author 10503
* @description devops_device_info()Service
* @createDate 2023-12-02 17:42:39
*/
@Service
@DS("mysql")
public class DevopsDeviceInfoServiceImpl extends ServiceImpl<DevopsDeviceInfoMapper, DevopsDeviceInfo> implements DevopsDeviceInfoService{
}

@ -0,0 +1,24 @@
package com.ssf.mysqloracletest.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssf.mysqloracletest.domain.DevopsDeviceStatus;
import com.ssf.mysqloracletest.service.DevopsDeviceStatusService;
import com.ssf.mysqloracletest.mapper.DevopsDeviceStatusMapper;
import org.springframework.stereotype.Service;
/**
* @author 10503
* @description devops_device_status()Service
* @createDate 2023-12-07 17:19:14
*/
@Service
@DS("mysql")
public class DevopsDeviceStatusServiceImpl extends ServiceImpl<DevopsDeviceStatusMapper, DevopsDeviceStatus>
implements DevopsDeviceStatusService{
}

@ -0,0 +1,113 @@
package com.ssf.mysqloracletest.task;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ssf.mysqloracletest.domain.DevopsDeviceInfo;
import com.ssf.mysqloracletest.domain.DevopsDeviceStatus;
import com.ssf.mysqloracletest.domain.TJksbglMysql;
import com.ssf.mysqloracletest.service.DevopsDeviceInfoService;
import com.ssf.mysqloracletest.service.DevopsDeviceStatusService;
import com.ssf.mysqloracletest.service.TJksbglMysqlService;
import com.ssf.mysqloracletest.utils.ConfigParam;
import com.ssf.mysqloracletest.utils.StringKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Component
public class DevopeDeviceTask {
private static final Logger logger = LoggerFactory.getLogger(RentalHousingTask.class);
@Resource
private TJksbglMysqlService jksbglMysqlService;
@Resource
private DevopsDeviceInfoService devopsDeviceInfoService;
@Resource
private DevopsDeviceStatusService deviceStatusService;
@Scheduled(initialDelay = 100, fixedDelay = 3000)
public void transDevopeDevice() {
if (!"true".equals(ConfigParam.DevopeDeviceSwitch)) {
return;
}
try {
QueryWrapper<TJksbglMysql> queryWrapper = new QueryWrapper<>();
queryWrapper.isNull("STATUS");
Page<TJksbglMysql> page = new Page<>(1, 1000);
List<TJksbglMysql> resultList = jksbglMysqlService.page(page, queryWrapper).getRecords();
CountDownLatch latch = new CountDownLatch(resultList.size());
ExecutorService DevicePool = Executors.newFixedThreadPool(5);
for (TJksbglMysql bean : resultList) {
DevicePool.submit(() -> {
cleanJksbInfo(bean);
logger.info("清洗完成");
latch.countDown();
});
}
try {
//Wait for all threads to complete
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
//关闭线程池
DevicePool.shutdown();
} catch (Exception e) {
logger.info(StringKit.getTrace(e));
}
}
private void cleanJksbInfo(TJksbglMysql bean) {
TJksbglMysql jksbglMysqlCp = new TJksbglMysql();
try {
BeanUtils.copyProperties(bean, jksbglMysqlCp);
DevopsDeviceInfo deviceInfo = new DevopsDeviceInfo();
DevopsDeviceStatus deviceStatus = new DevopsDeviceStatus();
deviceInfo.setDeviceName(jksbglMysqlCp.getSbmc());
deviceStatus.setDeviceName(jksbglMysqlCp.getSbmc());
deviceInfo.setGbsChannelNo(jksbglMysqlCp.getSbbh());
deviceStatus.setGbsChannelNo(jksbglMysqlCp.getSbbh());
deviceInfo.setDeviceIp(jksbglMysqlCp.getIpdz());
deviceStatus.setDeviceIp(jksbglMysqlCp.getIpdz());
deviceInfo.setDeviceMac(jksbglMysqlCp.getMacdz());
deviceInfo.setDeviceSn(jksbglMysqlCp.getId());
deviceStatus.setDeviceCode(jksbglMysqlCp.getId());
if (jksbglMysqlCp.getSbdk() != null && !jksbglMysqlCp.getSbdk().isEmpty()) {
deviceInfo.setDevicePort(Integer.parseInt(jksbglMysqlCp.getSbdk()));
} else {
deviceInfo.setDevicePort(null);
}
deviceInfo.setDeviceType(Integer.parseInt(jksbglMysqlCp.getSblx()));
deviceStatus.setDeviceType(Integer.parseInt(jksbglMysqlCp.getSblx()));
deviceInfo.setLongitude(new BigDecimal(jksbglMysqlCp.getSbjd()));
deviceInfo.setLatitude(new BigDecimal(jksbglMysqlCp.getSbwd()));
deviceStatus.setIsOnline(Integer.parseInt(jksbglMysqlCp.getSbzt()));
deviceInfo.setDeviceAddress(jksbglMysqlCp.getAzdz());
boolean a = devopsDeviceInfoService.save(deviceInfo);
boolean b = deviceStatusService.save(deviceStatus);
if (a && b) {
jksbglMysqlCp.setStatus("1");
jksbglMysqlService.updateTJksbglById(jksbglMysqlCp);
logger.info("状态修改为:1");
}
} catch (Exception e) {
logger.info(StringKit.getTrace(e));
jksbglMysqlCp.setStatus("2");
jksbglMysqlService.updateTJksbglById(jksbglMysqlCp);
logger.info("状态修改为:2");
}
}
}

@ -41,6 +41,8 @@ public class ConfigParam {
public static String RentalHouseSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("RentalHouseSwitch"));
public static String metaRealEstateInfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("metaRealEstateInfoSwitch"));
public static String DevopeDeviceSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("DevopeDeviceSwitch"));
public static String sydzToEstateInfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("sydzToEstateInfoSwitch"));

@ -67,6 +67,7 @@
<result property="lxdh" column="LXDH" jdbcType="VARCHAR"/>
<result property="sfjsbryj" column="SFJSBRYJ" jdbcType="VARCHAR"/>
<result property="sfzzrkyj" column="SFZZRKYJ" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectTJksbglById" parameterType="java.lang.String" resultMap="BaseResultMap">
@ -140,6 +141,7 @@
<if test="lxdh != null and lxdh != '' ">lxdh,</if>
<if test="sfjsbryj != null and sfjsbryj != '' ">sfjsbryj,</if>
<if test="sfzzrkyj != null and sfzzrkyj != '' ">sfzzrkyj,</if>
<if test="status != null and status != '' ">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -205,6 +207,7 @@
<if test="lxdh != null and lxdh != '' ">#{lxdh},</if>
<if test="sfjsbryj != null and sfjsbryj != '' ">#{sfjsbryj},</if>
<if test="sfzzrkyj != null and sfzzrkyj != '' ">#{sfzzrkyj},</if>
<if test="status != null and status != '' ">#{status},</if>
</trim>
</insert>
@ -273,6 +276,8 @@
<if test="lxdh != null and lxdh != '' ">lxdh=#{lxdh},</if>
<if test="sfjsbryj != null and sfjsbryj != '' ">sfjsbryj=#{sfjsbryj},</if>
<if test="sfzzrkyj != null and sfzzrkyj != '' ">sfzzrkyj=#{sfzzrkyj},</if>
<if test="status != null and status != '' ">status=#{status},</if>
</trim>
where sbbh = #{sbbh}
</update>

Loading…
Cancel
Save