|
@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.dao.DataAccessException;
|
|
import org.springframework.dao.DataAccessException;
|
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.ResultSetExtractor;
|
|
import org.springframework.jdbc.core.ResultSetExtractor;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@ -201,7 +202,8 @@ public class IotDeviceService {
|
|
public String upload(JSONObject json){
|
|
public String upload(JSONObject json){
|
|
json.put("access_token",accessToken);
|
|
json.put("access_token",accessToken);
|
|
json.put("data_source",dataSource);
|
|
json.put("data_source",dataSource);
|
|
String url = baseUrl+"/dataInput/input";
|
|
|
|
|
|
// String url = baseUrl+"/dataInput/input";
|
|
|
|
String url = baseUrl+"input";
|
|
String response = httpClientUtil.iotPostBody(url, json.toString());
|
|
String response = httpClientUtil.iotPostBody(url, json.toString());
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
@ -544,13 +546,18 @@ public class IotDeviceService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String initData(){
|
|
public String initData(){
|
|
Integer page = 1;
|
|
|
|
|
|
Integer page = 2;
|
|
Integer size = 1000;
|
|
Integer size = 1000;
|
|
Integer start = (page-1)*size;
|
|
Integer start = (page-1)*size;
|
|
|
|
// String sql = "SELECT i.id,i.user,i.value1,i.value2,i.value3,i.value4,i.type,i.record_date,i.device_sn,i.status,i.del,d.device_name,d.user_type,p.name,p.idcard " +
|
|
|
|
// "from device.wlyy_patient_health_index i " +
|
|
|
|
// "LEFT JOIN wlyy_patient_device d on i.`user` = d.`user` and i.device_sn = d.device_sn " +
|
|
|
|
// "LEFT JOIN wlyy_patient p on i.`user` = p.code order by i.id limit ?,1000";
|
|
|
|
|
|
String sql = "SELECT i.id,i.user,i.value1,i.value2,i.value3,i.value4,i.type,i.record_date,i.device_sn,i.status,i.del,d.device_name,d.user_type,p.name,p.idcard " +
|
|
String sql = "SELECT i.id,i.user,i.value1,i.value2,i.value3,i.value4,i.type,i.record_date,i.device_sn,i.status,i.del,d.device_name,d.user_type,p.name,p.idcard " +
|
|
"from device.wlyy_patient_health_index i " +
|
|
"from device.wlyy_patient_health_index i " +
|
|
"LEFT JOIN wlyy_patient_device d on i.`user` = d.`user` and i.device_sn = d.device_sn " +
|
|
|
|
"LEFT JOIN wlyy_patient p on i.`user` = p.code order by i.id limit ?,1000";
|
|
|
|
|
|
"LEFT JOIN wlyy_patient_device_copy d on i.`user` = d.`user` and i.device_sn = d.device_sn " +
|
|
|
|
"LEFT JOIN wlyy_patient_copy p on i.`user` = p.code order by i.id limit ?,1000";
|
|
List<JSONObject> list = jdbcTemplate.query(sql,new Object[]{start}, new ResultSetExtractor<List<JSONObject>>() {
|
|
List<JSONObject> list = jdbcTemplate.query(sql,new Object[]{start}, new ResultSetExtractor<List<JSONObject>>() {
|
|
@Override
|
|
@Override
|
|
public List<JSONObject> extractData(ResultSet resultSet) throws SQLException, DataAccessException {
|
|
public List<JSONObject> extractData(ResultSet resultSet) throws SQLException, DataAccessException {
|
|
@ -586,7 +593,7 @@ public class IotDeviceService {
|
|
DeviceHealthyInfoMapping info = new DeviceHealthyInfoMapping();
|
|
DeviceHealthyInfoMapping info = new DeviceHealthyInfoMapping();
|
|
info.setCreateTime(new Date());
|
|
info.setCreateTime(new Date());
|
|
info.setIndexId(one.getLong("id"));
|
|
info.setIndexId(one.getLong("id"));
|
|
info.setRid(one.getJSONObject("obj").getJSONArray("rid").getString(0));
|
|
|
|
|
|
info.setRid(re.getJSONObject("obj").getJSONArray("rid").getString(0));
|
|
infos.add(info);
|
|
infos.add(info);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@ -595,7 +602,7 @@ public class IotDeviceService {
|
|
//下一次
|
|
//下一次
|
|
page++;
|
|
page++;
|
|
start = (page-1)*size;
|
|
start = (page-1)*size;
|
|
list = jdbcTemplate.queryForList(sql,new Object[]{start},JSONObject.class);
|
|
|
|
|
|
list = jdbcTemplate.query(sql,new Object[]{start},new BeanPropertyRowMapper(JSONObject.class));
|
|
}
|
|
}
|
|
|
|
|
|
return null;
|
|
return null;
|