wsl 2 years ago
parent
commit
60831554ba

+ 22 - 4
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/DeviceSyncService.java

@ -38,7 +38,7 @@ public class DeviceSyncService {
        List<ZhDeviceSyncDO> listset = new ArrayList<>();
        String sql = "SELECT d.device_name as deviceName ,d.device_code as deviceSn,d.contact_status ,d.device_model,d.manufacturer,p.address AS patientAddress,p.lat_lon AS latLon,d.category_code FROM base.wlyy_devices d \n" +
                "    INNER JOIN base.wlyy_patient_device pd ON d.device_code = pd.device_sn INNER JOIN base.base_patient p ON p.id = pd.user where d.category_code NOT in(18,19,20,21) AND contact_status IS NOT NULL";
                "    INNER JOIN base.wlyy_patient_device pd ON d.device_code = pd.device_sn INNER JOIN base.base_patient p ON p.id = pd.user where  contact_status IS NOT NULL";
        List<Map<String, Object>> deviceList = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> deviceS : deviceList) {
            ZhDeviceSyncDO zhDeviceSyncDO = new ZhDeviceSyncDO();
@ -61,9 +61,9 @@ public class DeviceSyncService {
            zhDeviceSyncDO.setProvinceName("浙江省");
            zhDeviceSyncDO.setCityCode("330100");
            zhDeviceSyncDO.setCityName("杭州市");
            zhDeviceSyncDO.setDistrictName("330105");
            zhDeviceSyncDO.setDistrictCode("拱墅区");
            zhDeviceSyncDO.setDistrictName("拱墅区");
            zhDeviceSyncDO.setAddress(deviceS.get("patientAddress").toString());
            zhDeviceSyncDO.setDistrictCode("330105");
            switch (deviceS.get("category_code").toString()) {
                case "14":  //气感
@ -102,14 +102,32 @@ public class DeviceSyncService {
                    zhDeviceSyncDO.setDeviceTypeName("SOS紧急呼叫器");
                    zhDeviceSyncDO.setDeviceTypeCode("J1-001");
                    break;
                case "18":
                    zhDeviceSyncDO.setDeviceTypeName("日常用水监测");
                    zhDeviceSyncDO.setDeviceTypeCode("暂无");
                    break;
                case "19":
                    zhDeviceSyncDO.setDeviceTypeName("人脸识别检测");
                    zhDeviceSyncDO.setDeviceTypeCode("M1-002");
                    break;
                case "20":
                    zhDeviceSyncDO.setDeviceTypeName("日常用电监测");
                    zhDeviceSyncDO.setDeviceTypeCode("暂无");
                    break;
                case "21":
                    zhDeviceSyncDO.setDeviceTypeName("天然气使用监测");
                    zhDeviceSyncDO.setDeviceTypeCode("暂无");
                    break;
                default:
                    break;
            }
            zhDeviceSyncDO.setLat(lat);//维
            zhDeviceSyncDO.setLng(lng);//经
            zhDeviceSyncDO.setState(Integer.parseInt(deviceS.get("contact_status").toString()));//0-离线,1-在线,3-停用(长期离线)
            zhDeviceSyncDO.setState(1);  //1-新增/修改,-1-删除
            zhDeviceSyncDO.setStatus(1);//0-离线,1-在线,3-停用(长期离线)
            if (1!=Integer.parseInt(deviceS.get("contact_status").toString())){
                zhDeviceSyncDO.setStatus(0);
                zhDeviceSyncDO.setDisabledType(4);
                zhDeviceSyncDO.setReason("长时间未连接网络获取最新状态!默认判定离线状态");
            }

+ 11 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhDevice/entity/ZhDeviceSyncDO.java

@ -164,6 +164,9 @@ public class ZhDeviceSyncDO extends IdEntity {
     */
    private Integer state;
    //0-离线,1-在线,3-停用(长期离线)
    private Integer status;
    /**
     * 停用原因
     */
@ -214,6 +217,14 @@ public class ZhDeviceSyncDO extends IdEntity {
     */
    private String unifiedAddressCode;
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "product_key")
    public String getProductKey() {