Browse Source

代码修改

liubing 3 years ago
parent
commit
1af9ad8cc2

+ 1 - 1
common/common-entity/sql记录

@ -1388,4 +1388,4 @@ CREATE TABLE `base_yxdevice_index` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='云芯拐杖设备上传记录';
-- 20210828
ALTER table base_patient_sos_contacts add column update_info VARCHAR(50) default null comment '同步信息 1成功,-1失败'
ALTER table base_patient_sos_contacts add column update_info VARCHAR(1000) default null comment '同步信息 1成功,-1失败'

+ 6 - 5
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/PatientSosContactsJob.java

@ -45,7 +45,7 @@ public class PatientSosContactsJob implements Job {
        String sql = " select pd.device_sn,pd.category_code,wd.sim,sc.* from  wlyy_patient_device pd inner join wlyy_devices wd " +
                " on pd.device_sn = wd.device_code and pd.del=0 " +
                "INNER JOIN base_patient_sos_contacts sc on sc.patient = pd.user and sc.del=1 " +
                "where  sc.success_flag=0  group by wd.device_code ";
                "where  sc.success_flag=0 and pd.category_code in('7','4','16')  group by wd.device_code ";
        List<Map<String,Object>> sims = jdbcTemplate.queryForList(sql);
        List<PatientSosContactsDO> modify = new ArrayList<>();
        for(Map<String,Object> tmp:sims){//添加白名单,添加设备联系人
@ -59,7 +59,9 @@ public class PatientSosContactsJob implements Job {
            String phone_seqid = tmp.get("phone_seqid").toString() ;
            try {
                PatientSosContactsDO sosContactsDO = sosContactsDao.findOne(Long.parseLong(id));
                if (StringUtils.isBlank(sosContactsDO.getUpdateInfo())){
                    sosContactsDO.setUpdateInfo(" ");
                }
                if(null!=sosContactsDO){
                    if (StringUtils.isNotBlank(sim)){
                        JSONObject response = cardService.setPatientContacts(sim, null, null, "1", sos_phone, null);//移动白名单
@ -102,15 +104,14 @@ public class PatientSosContactsJob implements Job {
                        yunXunDeviceService.setSos(device_sn,phone1,phone2,phone3);
                        sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":unknow}");
                    }
                    modify.add(sosContactsDO);
                    sosContactsDao.save(sosContactsDO);
                }
            }catch (Exception e){
                logger.info(sim+"--同步失败--"+sos_phone);
                e.printStackTrace();
            }
        }
        sosContactsDao.save(modify);
//        sosContactsDao.save(modify);
        logger.info("PATIENT_SOS_CONTACTS_JOB end");
    }
}