|
@ -42,7 +42,11 @@ public class PatientSosContactsJob implements Job {
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
logger.info("PATIENT_SOS_CONTACTS_JOB start");
|
|
logger.info("PATIENT_SOS_CONTACTS_JOB start");
|
|
|
|
|
|
String sql = " select pd.device_sn,pd.category_code,wd.iccid as sim,sc.* from wlyy_patient_device pd inner join wlyy_devices wd " +
|
|
|
|
|
|
String sql = " UPDATE base_patient_sos_contacts set success_flag=0,update_info = null,error_info=null where \n" +
|
|
|
|
" `success_flag` <> '1' AND `del` = '1' ";
|
|
|
|
jdbcTemplate.execute(sql);
|
|
|
|
|
|
|
|
sql = " select pd.device_sn,pd.category_code,wd.iccid as sim,sc.* from wlyy_patient_device pd inner join wlyy_devices wd " +
|
|
" on pd.device_sn = wd.device_code and pd.del=0 " +
|
|
" 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 " +
|
|
"INNER JOIN base_patient_sos_contacts sc on sc.patient = pd.user and sc.del=1 " +
|
|
"where sc.success_flag=0 and pd.category_code in('7','4','16') group by wd.device_code ";
|
|
"where sc.success_flag=0 and pd.category_code in('7','4','16') group by wd.device_code ";
|
|
@ -108,14 +112,29 @@ public class PatientSosContactsJob implements Job {
|
|
phone2 = nums.get(i);
|
|
phone2 = nums.get(i);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
yunXunDeviceService.setSos(device_sn,phone1,phone2,phone3);
|
|
|
|
if (!sosContactsDO.getUpdateInfo().contains(device_sn)){
|
|
|
|
sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":unknow}");
|
|
|
|
}
|
|
|
|
if (1==sosContactsDO.getSuccessFlag()||0==sosContactsDO.getSuccessFlag()){
|
|
|
|
sosContactsDO.setSuccessFlag(1);
|
|
|
|
}else {
|
|
|
|
|
|
String yxResponse = yunXunDeviceService.setSos(device_sn,phone1,phone2,phone3);
|
|
|
|
if (StringUtils.isBlank(yxResponse)){//请求失败或超时
|
|
|
|
if (!sosContactsDO.getUpdateInfo().contains(device_sn)){
|
|
|
|
sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":error}");
|
|
|
|
}
|
|
sosContactsDO.setSuccessFlag(-1);
|
|
sosContactsDO.setSuccessFlag(-1);
|
|
|
|
}else {
|
|
|
|
JSONObject yxResponseObj = JSONObject.parseObject(yxResponse);
|
|
|
|
if (200==yxResponseObj.getInteger("status")){//返回成功
|
|
|
|
if (!sosContactsDO.getUpdateInfo().contains(device_sn)){
|
|
|
|
sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":success}");
|
|
|
|
}
|
|
|
|
if (1==sosContactsDO.getSuccessFlag()||0==sosContactsDO.getSuccessFlag()){
|
|
|
|
sosContactsDO.setSuccessFlag(1);
|
|
|
|
}else {
|
|
|
|
sosContactsDO.setSuccessFlag(-1);
|
|
|
|
}
|
|
|
|
} else { //返回失败
|
|
|
|
if (!sosContactsDO.getUpdateInfo().contains(device_sn)){
|
|
|
|
sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":error}");
|
|
|
|
}
|
|
|
|
sosContactsDO.setSuccessFlag(-1);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
sosContactsDao.save(sosContactsDO);
|
|
sosContactsDao.save(sosContactsDO);
|