|
@ -44,9 +44,44 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
@Autowired
|
|
@Autowired
|
|
private HibenateUtils hibenateUtils;
|
|
private HibenateUtils hibenateUtils;
|
|
|
|
|
|
|
|
|
|
|
|
public JSONObject getDeviceInfo(String condition,int page,int size){
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
String sql = "SELECT d.id as id,d.equ_num as equNum,d.equ_name as equName," +
|
|
|
|
"d.equ_type as equType,d.now_humidity as nowHunidity,d.now_temperature as nowTemperature," +
|
|
|
|
"d.abnormal as abnormal,d.log_time as logTime " +
|
|
|
|
"FROM t_mediicine_device d where d.belong_community is not NULL ";
|
|
|
|
|
|
|
|
String conditionSql = "";
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(condition)){
|
|
|
|
conditionSql += " and CONCAT(IFNULL(d.equ_name,''), IFNULL(d.equ_num,'')) like '%" + condition + "%'";
|
|
|
|
}
|
|
|
|
|
|
|
|
sql = sql + conditionSql+ "order by d.log_time desc ";
|
|
|
|
|
|
|
|
List<Map<String,Object>> list=null;
|
|
|
|
list = hibenateUtils.createSQLQuery(sql,page,size);
|
|
|
|
|
|
|
|
String countSql = " select " +
|
|
|
|
" COUNT(DISTINCT (d.id)) as count " +
|
|
|
|
" from " +
|
|
|
|
" t_mediicine_device d " +
|
|
|
|
" where " +
|
|
|
|
" 1=1 and d.belong_community is not NULL " +
|
|
|
|
conditionSql;
|
|
|
|
Logger.getAnonymousLogger().info("finalCountSql="+countSql);
|
|
|
|
int count = jdbcTemplate.queryForObject(countSql,Integer.class);
|
|
|
|
result.put("total", count);
|
|
|
|
result.put("page",page);
|
|
|
|
result.put("size",size);
|
|
|
|
result.put("list", list);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
public JSONObject getTemperature(
|
|
public JSONObject getTemperature(
|
|
String idDevice, String equType, String netStatus, String lowT, String heightT,
|
|
|
|
String content, String startTime, String endTime, int page, int size,String wechatId) throws Exception {
|
|
|
|
|
|
String equNum, String equType, String netStatus, String lowT, String heightT,
|
|
|
|
String content, String startTime, String endTime, int page, int size) throws Exception {
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
String sql = "SELECT\n" +
|
|
String sql = "SELECT\n" +
|
|
" t.id as id,\n" +
|
|
" t.id as id,\n" +
|
|
@ -76,10 +111,10 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
" t.duration as duration,\n" +
|
|
" t.duration as duration,\n" +
|
|
" t.exceed as exceed,\n" +
|
|
" t.exceed as exceed,\n" +
|
|
" t.humidity as humidity,\n" +
|
|
" t.humidity as humidity,\n" +
|
|
|
|
" t.temperature as temperature,\n" +
|
|
" t.other_couont as otherCouont,\n" +
|
|
" t.other_couont as otherCouont,\n" +
|
|
" t.plus_couont as plusCouont,\n" +
|
|
" t.plus_couont as plusCouont,\n" +
|
|
" t.ship_couont as shipCouont,\n" +
|
|
" t.ship_couont as shipCouont,\n" +
|
|
" t.temperature as temperature,\n" +
|
|
|
|
" t.create_time as createTime,\n" +
|
|
" t.create_time as createTime,\n" +
|
|
" t.create_user as createUser,\n" +
|
|
" t.create_user as createUser,\n" +
|
|
" t.create_user_name as createUserName,\n" +
|
|
" t.create_user_name as createUserName,\n" +
|
|
@ -88,14 +123,14 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
" t.update_user_name as updateUserName,\n" +
|
|
" t.update_user_name as updateUserName,\n" +
|
|
" t.remark as remark\n" +
|
|
" t.remark as remark\n" +
|
|
"FROM\n" +
|
|
"FROM\n" +
|
|
" t_mediicine_warray AS t where 1=1";
|
|
|
|
|
|
" t_mediicine_warray AS t where 1=1 and t.type like '%温度%' ";
|
|
|
|
|
|
String conditionSql = "";
|
|
String conditionSql = "";
|
|
|
|
|
|
// conditionSql += " and t.type like '%温度%'";
|
|
// conditionSql += " and t.type like '%温度%'";
|
|
|
|
|
|
if (!StringUtils.isEmpty(idDevice)){
|
|
|
|
conditionSql += " and t.id_device = '" + idDevice + "'";
|
|
|
|
|
|
if (!StringUtils.isEmpty(equNum)){
|
|
|
|
conditionSql += " and t.equ_num = '" + equNum + "'";
|
|
}
|
|
}
|
|
if (!StringUtils.isEmpty(equType)){
|
|
if (!StringUtils.isEmpty(equType)){
|
|
conditionSql += " and t.equ_type = '" + equType + "'";
|
|
conditionSql += " and t.equ_type = '" + equType + "'";
|
|
@ -117,7 +152,7 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
" AND t.log_time <= '" + endTime + "'";
|
|
" AND t.log_time <= '" + endTime + "'";
|
|
}
|
|
}
|
|
|
|
|
|
sql = sql + conditionSql;
|
|
|
|
|
|
sql = sql + conditionSql+ "order by t.log_time desc ";
|
|
|
|
|
|
List<Map<String,Object>> list=null;
|
|
List<Map<String,Object>> list=null;
|
|
list = hibenateUtils.createSQLQuery(sql,page,size);
|
|
list = hibenateUtils.createSQLQuery(sql,page,size);
|
|
@ -131,9 +166,6 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
conditionSql;
|
|
conditionSql;
|
|
Logger.getAnonymousLogger().info("finalCountSql="+countSql);
|
|
Logger.getAnonymousLogger().info("finalCountSql="+countSql);
|
|
int count = jdbcTemplate.queryForObject(countSql,Integer.class);
|
|
int count = jdbcTemplate.queryForObject(countSql,Integer.class);
|
|
for (Map<String,Object> map:list){
|
|
|
|
|
|
|
|
}
|
|
|
|
result.put("count", count);
|
|
result.put("count", count);
|
|
result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
|
|
result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
|
|
return result;
|
|
return result;
|
|
@ -756,7 +788,7 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
}else {
|
|
}else {
|
|
type="温度正常";
|
|
type="温度正常";
|
|
}
|
|
}
|
|
mediicinedevice.setTemperature(temperature+"");
|
|
|
|
|
|
mediicinedevice.setNowTemperature(temperature+"");
|
|
if (!StringUtils.isEmpty(mediicinedevice.getWaringHumidityHeight())&&!StringUtils.isEmpty(mediicinedevice.getWaringHumidityLow())){
|
|
if (!StringUtils.isEmpty(mediicinedevice.getWaringHumidityHeight())&&!StringUtils.isEmpty(mediicinedevice.getWaringHumidityLow())){
|
|
Float humidityHeight = Float.parseFloat(mediicinedevice.getWaringHumidityHeight());
|
|
Float humidityHeight = Float.parseFloat(mediicinedevice.getWaringHumidityHeight());
|
|
Float humidityLow = Float.parseFloat(mediicinedevice.getWaringHumidityLow());
|
|
Float humidityLow = Float.parseFloat(mediicinedevice.getWaringHumidityLow());
|
|
@ -772,7 +804,9 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
}else {
|
|
}else {
|
|
type+="/湿度正常";
|
|
type+="/湿度正常";
|
|
}
|
|
}
|
|
mediicinedevice.setHumidity(humidity+"");
|
|
|
|
|
|
mediicinedevice.setAbnormal(type);
|
|
|
|
mediicinedevice.setLogTime(new Date());
|
|
|
|
mediicinedevice.setNowHumidity(humidity+"");
|
|
mediicinedevice.setNetworkStatus("1");
|
|
mediicinedevice.setNetworkStatus("1");
|
|
mediicinedevice.setSaleStatus("1");
|
|
mediicinedevice.setSaleStatus("1");
|
|
deviceDao.save(mediicinedevice);
|
|
deviceDao.save(mediicinedevice);
|