|
@ -58,7 +58,7 @@ public class IotDeviceSimService extends BaseJpaService<IotDeviceSimDO, IotDevi
|
|
|
@Autowired
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
private final static String jobUrl = "http://localhost:10031/job/reStartById?taskId=data_sim_Balance_remind_job";
|
|
|
private final static String jobUrl = "http://172.26.0.109:10031/job/reStartById?taskId=data_sim_Balance_remind_job";
|
|
|
|
|
|
/**
|
|
|
* 增加SIM卡管理
|
|
@ -122,11 +122,15 @@ public class IotDeviceSimService extends BaseJpaService<IotDeviceSimDO, IotDevi
|
|
|
*/
|
|
|
|
|
|
public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> conditionQueryPage(Integer page, Integer size, String status, String sim, String sn){
|
|
|
StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE del=0 ");
|
|
|
StringBuffer sqlCount = new StringBuffer("SELECT COUNT(c.id) count from iot_device_sim c WHERE del=0 ");
|
|
|
|
|
|
// StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE del=0 ");
|
|
|
StringBuffer sql = new StringBuffer("SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim" +
|
|
|
" LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
|
|
|
StringBuffer sqlCount = new StringBuffer("SELECT COUNT(c.id) count FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim " +
|
|
|
"LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
|
|
|
List<Object> args = new ArrayList<>();
|
|
|
if(StringUtils.isNotBlank(status)){
|
|
|
sql.append(" and c.status=? ");
|
|
|
sql.append(" and c.status=").append(status);
|
|
|
sqlCount.append("and c.status='").append(status).append("' ");
|
|
|
args.add(status);
|
|
|
}
|
|
@ -140,7 +144,30 @@ public class IotDeviceSimService extends BaseJpaService<IotDeviceSimDO, IotDevi
|
|
|
}
|
|
|
sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
|
|
|
|
|
|
List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
|
|
|
// List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
|
|
|
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql.toString());
|
|
|
|
|
|
ArrayList<IotDeviceSimDO> list = new ArrayList<>();
|
|
|
mapList.forEach(one->{
|
|
|
IotDeviceSimDO iotDeviceSimDO = JSONObject.parseObject(JSONObject.toJSONString(one), IotDeviceSimDO.class);
|
|
|
if (one.get("patient_name")!=null){
|
|
|
iotDeviceSimDO.setContactsName(one.get("patient_name").toString());
|
|
|
}
|
|
|
if (one.get("mobile")!=null){
|
|
|
iotDeviceSimDO.setContactsMobile(one.get("mobile").toString());
|
|
|
}
|
|
|
if (one.get("sn")!=null){
|
|
|
iotDeviceSimDO.setDeviceSn(one.get("sn").toString());
|
|
|
}
|
|
|
if (one.get("name")!=null){
|
|
|
iotDeviceSimDO.setDeviceName(one.get("name").toString());
|
|
|
}
|
|
|
//更新表中数据
|
|
|
iotDeviceSimDao.save(iotDeviceSimDO);
|
|
|
list.add(iotDeviceSimDO);
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
|
|
|
long count = Long.valueOf(countList.get(0).get("count").toString());
|