|
@ -14,10 +14,12 @@ import com.yihu.jw.entity.a1entity.Mediicinewarray;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.print.DocFlavor;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@ -49,7 +51,7 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
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 " +
|
|
|
"d.abnormal as abnormal,d.network_status as networkStatus,DATE_FORMAT(d.log_time,'%Y-%m-%d %H:%i:%S') as logTime " +
|
|
|
"FROM t_mediicine_device d where d.belong_community is not NULL ";
|
|
|
|
|
|
String conditionSql = "";
|
|
@ -62,7 +64,19 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
|
|
|
List<Map<String,Object>> list=null;
|
|
|
list = hibenateUtils.createSQLQuery(sql,page,size);
|
|
|
|
|
|
for (Map<String,Object> maps:list){
|
|
|
String equNum = maps.get("equNum").toString();
|
|
|
String networkSql = "select network_status as networkStatus,log_time as logTime,type as type from t_mediicine_warray where type like'%网络%' and equ_num = '"+equNum+"' order by log_time desc ";
|
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(networkSql);
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
if (mapList!=null&&mapList.size()!=0){
|
|
|
map = mapList.get(0);
|
|
|
}else {
|
|
|
map.put("networkStatus",null);
|
|
|
map.put("logTime",null);
|
|
|
map.put("type",null);
|
|
|
}
|
|
|
}
|
|
|
String countSql = " select " +
|
|
|
" COUNT(DISTINCT (d.id)) as count " +
|
|
|
" from " +
|
|
@ -271,8 +285,7 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public JSONObject getOffline(
|
|
|
String idDevice, String equClass, String netStatus, String content,
|
|
|
public JSONObject getOffline(String equNum, String equClass, String netStatus, String content,
|
|
|
String startTime, String endTime, int page, int size,String wechatId) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
String sql = "SELECT\n" +
|
|
@ -290,7 +303,7 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
" t.equ_type as equType,\n" +
|
|
|
" t.fbelong_community as fbelongCommunity,\n" +
|
|
|
" t.id_device as idDevice,\n" +
|
|
|
" t.log_time as logTime,\n" +
|
|
|
" DATE_FORMAT(t.log_time,'%Y-%m-%d %H:%i:%S') as logTime,\n" +
|
|
|
" t.machine_code as machineCode,\n" +
|
|
|
" t.network_status as networkStatus,\n" +
|
|
|
" t.poweron_test as poweronTest,\n" +
|
|
@ -319,13 +332,10 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
|
|
|
String conditionSql = "";
|
|
|
|
|
|
conditionSql += " and t.type='offline'";
|
|
|
conditionSql += " and t.type LIKE '%网络%'";
|
|
|
|
|
|
if (!StringUtils.isEmpty(idDevice)){
|
|
|
conditionSql += " and t.id_device = '" + idDevice + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(equClass)){
|
|
|
conditionSql += " and t.equ_class = '" + equClass + "'";
|
|
|
if (!StringUtils.isEmpty(equNum)){
|
|
|
conditionSql += " and t.equ_num = '" + equNum + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(netStatus)){
|
|
|
conditionSql += " and t.network_status = '" + netStatus + "'";
|
|
@ -361,7 +371,7 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
}
|
|
|
|
|
|
public JSONObject getFault(
|
|
|
String idDevice, String equClass, String netStatus, String content,
|
|
|
String equNum, String equClass, String netStatus, String content,
|
|
|
String startTime, String endTime, int page, int size,String wechatId) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
String sql = "SELECT\n" +
|
|
@ -379,7 +389,7 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
" t.equ_type as equType,\n" +
|
|
|
" t.fbelong_community as fbelongCommunity,\n" +
|
|
|
" t.id_device as idDevice,\n" +
|
|
|
" t.log_time as logTime,\n" +
|
|
|
" DATE_FORMAT(t.log_time,'%Y-%m-%d %H:%i:%S') as logTime,\n" +
|
|
|
" t.machine_code as machineCode,\n" +
|
|
|
" t.network_status as networkStatus,\n" +
|
|
|
" t.poweron_test as poweronTest,\n" +
|
|
@ -392,6 +402,7 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
" t.duration as duration,\n" +
|
|
|
" t.exceed as exceed,\n" +
|
|
|
" t.humidity as humidity,\n" +
|
|
|
" sum(t.other_couont+t.plus_couont+t.ship_couont) as total,"+
|
|
|
" t.other_couont as otherCouont,\n" +
|
|
|
" t.plus_couont as plusCouont,\n" +
|
|
|
" t.ship_couont as shipCouont,\n" +
|
|
@ -408,10 +419,10 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
|
|
|
String conditionSql = "";
|
|
|
|
|
|
conditionSql += " and t.type='fault'";
|
|
|
conditionSql += " and (t.type LIKE '%故障%' OR 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(equClass)){
|
|
|
conditionSql += " and t.equ_class = '" + equClass + "'";
|