|  | @ -2,21 +2,30 @@ package com.yihu.jw.base.service.a3service;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | import com.fasterxml.jackson.databind.ObjectMapper;
 |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.base.dao.a2dao.MediicinestoreDao;
 | 
												
													
														
															|  | import com.yihu.jw.base.dao.a2dao.MediicinewarrayDao;
 |  | import com.yihu.jw.base.dao.a2dao.MediicinewarrayDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.base.util.JavaBeanUtils;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.a1entity.Mediicinestore;
 | 
												
													
														
															|  | import com.yihu.jw.entity.a1entity.Mediicinewarray;
 |  | import com.yihu.jw.entity.a1entity.Mediicinewarray;
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | import com.yihu.jw.util.date.DateUtil;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
												
													
														
															|  | 
 |  | import com.yihu.mysql.query.BaseJpaService;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | import org.springframework.stereotype.Service;
 |  | import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | 
 |  | import org.springframework.util.StringUtils;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import java.util.Date;
 |  | import java.util.Date;
 | 
												
													
														
															|  | import java.util.List;
 |  | import java.util.List;
 | 
												
													
														
															|  | 
 |  | import java.util.Map;
 | 
												
													
														
															|  | 
 |  | import java.util.logging.Logger;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  |  * Created by Bing on 2021/9/23.
 |  |  * Created by Bing on 2021/9/23.
 | 
												
													
														
															|  |  */
 |  |  */
 | 
												
													
														
															|  | @Service
 |  | @Service
 | 
												
													
														
															|  | public class MedicineWarrayService {
 |  | 
 | 
												
													
														
															|  | 
 |  | public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, MediicinewarrayDao> {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private MediicinewarrayDao warrayDao;
 |  |     private MediicinewarrayDao warrayDao;
 | 
												
											
												
													
														
															|  | @ -24,6 +33,652 @@ public class MedicineWarrayService {
 | 
												
													
														
															|  |     private ObjectMapper objectMapper;
 |  |     private ObjectMapper objectMapper;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private HibenateUtils hibenateUtils;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getTemperature(
 | 
												
													
														
															|  | 
 |  |             String idDevice, String equClass, String netStatus, String lowT, String heightT,
 | 
												
													
														
															|  | 
 |  |                 String content, String startTime, String endTime, int page, int size,String wechatId) throws Exception {
 | 
												
													
														
															|  | 
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id as id,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.belong_community as belongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.community as community,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.del as del,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.delivery_address as deliveryAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.detail_address as detailAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_area as equArea,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_class as equClass,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_info as equInfo,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_name as equName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_num as equNum,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_type as equType,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.fbelong_community as fbelongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id_device as idDevice,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.log_time as logTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.machine_code as machineCode,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.network_status as networkStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.poweron_test as poweronTest,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.reg_date as regDate,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.sale_status as saleStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.signal_intensity as signalIntensity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.`status` as `status`,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.type as type,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.upgr_adesit as upgrAdesit,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.duration as duration,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.exceed as exceed,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.humidity as humidity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.other_couont as otherCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.plus_couont as plusCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.ship_couont as shipCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.temperature as temperature,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_time as createTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user as createUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user_name as createUserName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_time as updateTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user as updateUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user_name as updateUserName\n" +
 | 
												
													
														
															|  | 
 |  |                 "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t_mediicine_warray AS t where 1=1";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String conditionSql = "";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         conditionSql += " and t.type='temperature'";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(idDevice)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.id_device = " + idDevice;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(equClass)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.equ_class = " + equClass;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(netStatus)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.network_status = " + netStatus;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(lowT)) {
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.temperature >= " + lowT;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(heightT)) {
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.temperature <= " + heightT;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(content)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += "  AND  t.log_time >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                     " AND t.log_time <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = sql + conditionSql;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list=null;
 | 
												
													
														
															|  | 
 |  |         list = hibenateUtils.createSQLQuery(sql,page,size);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String countSql = " select " +
 | 
												
													
														
															|  | 
 |  |                 "     COUNT(DISTINCT (t.id)) as count " +
 | 
												
													
														
															|  | 
 |  |                 "   from " +
 | 
												
													
														
															|  | 
 |  |                 "     t_mediicine_warray t " +
 | 
												
													
														
															|  | 
 |  |                 "  where " +
 | 
												
													
														
															|  | 
 |  |                 "  1=1   " +
 | 
												
													
														
															|  | 
 |  |                 conditionSql;
 | 
												
													
														
															|  | 
 |  |         Logger.getAnonymousLogger().info("finalCountSql="+countSql);
 | 
												
													
														
															|  | 
 |  |         int count = jdbcTemplate.queryForObject(countSql,Integer.class);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:list){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         result.put("count", count);
 | 
												
													
														
															|  | 
 |  |         result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getHumidity(
 | 
												
													
														
															|  | 
 |  |             String idDevice, String equClass, String netStatus, String lowT, String heightT,
 | 
												
													
														
															|  | 
 |  |             String content, String startTime, String endTime, int page, int size,String wechatId) throws Exception {
 | 
												
													
														
															|  | 
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id as id,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.belong_community as belongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.community as community,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.del as del,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.delivery_address as deliveryAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.detail_address as detailAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_area as equArea,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_class as equClass,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_info as equInfo,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_name as equName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_num as equNum,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_type as equType,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.fbelong_community as fbelongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id_device as idDevice,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.log_time as logTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.machine_code as machineCode,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.network_status as networkStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.poweron_test as poweronTest,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.reg_date as regDate,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.sale_status as saleStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.signal_intensity as signalIntensity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.`status` as `status`,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.type as type,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.upgr_adesit as upgrAdesit,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.duration as duration,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.exceed as exceed,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.humidity as humidity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.other_couont as otherCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.plus_couont as plusCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.ship_couont as shipCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.temperature as temperature,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_time as createTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user as createUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user_name as createUserName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_time as updateTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user as updateUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user_name as updateUserName\n" +
 | 
												
													
														
															|  | 
 |  |                 "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t_mediicine_warray AS t where 1=1";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String conditionSql = "";
 | 
												
													
														
															|  | 
 |  |         conditionSql += " and t.type='humidity'";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(idDevice)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.id_device = " + idDevice;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(equClass)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.equ_class = " + equClass;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(netStatus)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.network_status = " + netStatus;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(lowT)) {
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.humidity >= " + lowT;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(heightT)) {
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.humidity <= " + heightT;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(content)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += "  AND  t.log_time >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                     " AND t.log_time <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = sql + conditionSql;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list=null;
 | 
												
													
														
															|  | 
 |  |         list = hibenateUtils.createSQLQuery(sql,page,size);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String countSql = " select " +
 | 
												
													
														
															|  | 
 |  |                 "     COUNT(DISTINCT (t.id)) as count " +
 | 
												
													
														
															|  | 
 |  |                 "   from " +
 | 
												
													
														
															|  | 
 |  |                 "     t_mediicine_warray t " +
 | 
												
													
														
															|  | 
 |  |                 "  where " +
 | 
												
													
														
															|  | 
 |  |                 "  1=1   " +
 | 
												
													
														
															|  | 
 |  |                 conditionSql;
 | 
												
													
														
															|  | 
 |  |         Logger.getAnonymousLogger().info("finalCountSql="+countSql);
 | 
												
													
														
															|  | 
 |  |         int count = jdbcTemplate.queryForObject(countSql,Integer.class);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:list){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         result.put("count", count);
 | 
												
													
														
															|  | 
 |  |         result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getOffline(
 | 
												
													
														
															|  | 
 |  |             String idDevice, 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" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id as id,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.belong_community as belongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.community as community,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.del as del,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.delivery_address as deliveryAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.detail_address as detailAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_area as equArea,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_class as equClass,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_info as equInfo,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_name as equName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_num as equNum,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_type as equType,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.fbelong_community as fbelongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id_device as idDevice,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.log_time as logTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.machine_code as machineCode,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.network_status as networkStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.poweron_test as poweronTest,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.reg_date as regDate,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.sale_status as saleStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.signal_intensity as signalIntensity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.`status` as `status`,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.type as type,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.upgr_adesit as upgrAdesit,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.duration as duration,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.exceed as exceed,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.humidity as humidity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.other_couont as otherCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.plus_couont as plusCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.ship_couont as shipCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.temperature as temperature,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_time as createTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user as createUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user_name as createUserName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_time as updateTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user as updateUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user_name as updateUserName\n" +
 | 
												
													
														
															|  | 
 |  |                 "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t_mediicine_warray AS t where 1=1";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String conditionSql = "";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         conditionSql += " and t.type='offline'";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(idDevice)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.id_device = " + idDevice;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(equClass)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.equ_class = " + equClass;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(netStatus)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.network_status = " + netStatus;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(content)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += "  AND  t.log_time >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                     " AND t.log_time <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = sql + conditionSql;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list=null;
 | 
												
													
														
															|  | 
 |  |         list = hibenateUtils.createSQLQuery(sql,page,size);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String countSql = " select " +
 | 
												
													
														
															|  | 
 |  |                 "     COUNT(DISTINCT (t.id)) as count " +
 | 
												
													
														
															|  | 
 |  |                 "   from " +
 | 
												
													
														
															|  | 
 |  |                 "     t_mediicine_warray t " +
 | 
												
													
														
															|  | 
 |  |                 "  where " +
 | 
												
													
														
															|  | 
 |  |                 "  1=1   " +
 | 
												
													
														
															|  | 
 |  |                 conditionSql;
 | 
												
													
														
															|  | 
 |  |         Logger.getAnonymousLogger().info("finalCountSql="+countSql);
 | 
												
													
														
															|  | 
 |  |         int count = jdbcTemplate.queryForObject(countSql,Integer.class);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:list){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         result.put("count", count);
 | 
												
													
														
															|  | 
 |  |         result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getFault(
 | 
												
													
														
															|  | 
 |  |             String idDevice, 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" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id as id,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.belong_community as belongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.community as community,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.del as del,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.delivery_address as deliveryAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.detail_address as detailAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_area as equArea,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_class as equClass,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_info as equInfo,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_name as equName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_num as equNum,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_type as equType,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.fbelong_community as fbelongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id_device as idDevice,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.log_time as logTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.machine_code as machineCode,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.network_status as networkStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.poweron_test as poweronTest,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.reg_date as regDate,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.sale_status as saleStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.signal_intensity as signalIntensity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.`status` as `status`,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.type as type,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.upgr_adesit as upgrAdesit,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.duration as duration,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.exceed as exceed,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.humidity as humidity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.other_couont as otherCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.plus_couont as plusCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.ship_couont as shipCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.temperature as temperature,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_time as createTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user as createUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user_name as createUserName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_time as updateTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user as updateUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user_name as updateUserName\n" +
 | 
												
													
														
															|  | 
 |  |                 "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t_mediicine_warray AS t where 1=1";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String conditionSql = "";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         conditionSql += " and t.type='fault'";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(idDevice)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.id_device = " + idDevice;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(equClass)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.equ_class = " + equClass;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(netStatus)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.network_status = " + netStatus;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(content)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += "  AND  t.log_time >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                     " AND t.log_time <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = sql + conditionSql;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list=null;
 | 
												
													
														
															|  | 
 |  |         list = hibenateUtils.createSQLQuery(sql,page,size);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String countSql = " select " +
 | 
												
													
														
															|  | 
 |  |                 "     COUNT(DISTINCT (t.id)) as count " +
 | 
												
													
														
															|  | 
 |  |                 "   from " +
 | 
												
													
														
															|  | 
 |  |                 "     t_mediicine_warray t " +
 | 
												
													
														
															|  | 
 |  |                 "  where " +
 | 
												
													
														
															|  | 
 |  |                 "  1=1   " +
 | 
												
													
														
															|  | 
 |  |                 conditionSql;
 | 
												
													
														
															|  | 
 |  |         Logger.getAnonymousLogger().info("finalCountSql="+countSql);
 | 
												
													
														
															|  | 
 |  |         int count = jdbcTemplate.queryForObject(countSql,Integer.class);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:list){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         result.put("count", count);
 | 
												
													
														
															|  | 
 |  |         result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getFlow(
 | 
												
													
														
															|  | 
 |  |             String idDevice, 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" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id as id,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.belong_community as belongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.community as community,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.del as del,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.delivery_address as deliveryAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.detail_address as detailAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_area as equArea,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_class as equClass,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_info as equInfo,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_name as equName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_num as equNum,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_type as equType,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.fbelong_community as fbelongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id_device as idDevice,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.log_time as logTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.machine_code as machineCode,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.network_status as networkStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.poweron_test as poweronTest,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.reg_date as regDate,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.sale_status as saleStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.signal_intensity as signalIntensity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.`status` as `status`,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.type as type,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.upgr_adesit as upgrAdesit,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.duration as duration,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.exceed as exceed,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.humidity as humidity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.other_couont as otherCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.plus_couont as plusCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.ship_couont as shipCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.temperature as temperature,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_time as createTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user as createUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user_name as createUserName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_time as updateTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user as updateUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user_name as updateUserName\n" +
 | 
												
													
														
															|  | 
 |  |                 "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t_mediicine_warray AS t where 1=1";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String conditionSql = "";
 | 
												
													
														
															|  | 
 |  |         conditionSql += " and t.type='flow'";
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(idDevice)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.id_device = " + idDevice;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(equClass)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.equ_class = " + equClass;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(netStatus)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.network_status = " + netStatus;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(content)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += "  AND  t.log_time >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                     " AND t.log_time <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = sql + conditionSql;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list=null;
 | 
												
													
														
															|  | 
 |  |         list = hibenateUtils.createSQLQuery(sql,page,size);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String countSql = " select " +
 | 
												
													
														
															|  | 
 |  |                 "     COUNT(DISTINCT (t.id)) as count " +
 | 
												
													
														
															|  | 
 |  |                 "   from " +
 | 
												
													
														
															|  | 
 |  |                 "     t_mediicine_warray t " +
 | 
												
													
														
															|  | 
 |  |                 "  where " +
 | 
												
													
														
															|  | 
 |  |                 "  1=1   " +
 | 
												
													
														
															|  | 
 |  |                 conditionSql;
 | 
												
													
														
															|  | 
 |  |         Logger.getAnonymousLogger().info("finalCountSql="+countSql);
 | 
												
													
														
															|  | 
 |  |         int count = jdbcTemplate.queryForObject(countSql,Integer.class);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:list){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         result.put("count", count);
 | 
												
													
														
															|  | 
 |  |         result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getNetwork(
 | 
												
													
														
															|  | 
 |  |             String idDevice, 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" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id as id,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.belong_community as belongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.community as community,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.del as del,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.delivery_address as deliveryAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.detail_address as detailAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_area as equArea,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_class as equClass,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_info as equInfo,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_name as equName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_num as equNum,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_type as equType,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.fbelong_community as fbelongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id_device as idDevice,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.log_time as logTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.machine_code as machineCode,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.network_status as networkStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.poweron_test as poweronTest,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.reg_date as regDate,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.sale_status as saleStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.signal_intensity as signalIntensity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.`status` as `status`,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.type as type,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.upgr_adesit as upgrAdesit,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.duration as duration,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.exceed as exceed,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.humidity as humidity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.other_couont as otherCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.plus_couont as plusCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.ship_couont as shipCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.temperature as temperature,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_time as createTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user as createUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user_name as createUserName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_time as updateTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user as updateUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user_name as updateUserName\n" +
 | 
												
													
														
															|  | 
 |  |                 "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t_mediicine_warray AS t where 1=1";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String conditionSql = "";
 | 
												
													
														
															|  | 
 |  |         conditionSql += " and t.type='network'";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(idDevice)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.id_device = " + idDevice;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(equClass)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.equ_class = " + equClass;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(netStatus)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.network_status = " + netStatus;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(content)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += "  AND  t.log_time >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                     " AND t.log_time <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = sql + conditionSql;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list=null;
 | 
												
													
														
															|  | 
 |  |         list = hibenateUtils.createSQLQuery(sql,page,size);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String countSql = " select " +
 | 
												
													
														
															|  | 
 |  |                 "     COUNT(DISTINCT (t.id)) as count " +
 | 
												
													
														
															|  | 
 |  |                 "   from " +
 | 
												
													
														
															|  | 
 |  |                 "     t_mediicine_warray t " +
 | 
												
													
														
															|  | 
 |  |                 "  where " +
 | 
												
													
														
															|  | 
 |  |                 "  1=1   " +
 | 
												
													
														
															|  | 
 |  |                 conditionSql;
 | 
												
													
														
															|  | 
 |  |         Logger.getAnonymousLogger().info("finalCountSql="+countSql);
 | 
												
													
														
															|  | 
 |  |         int count = jdbcTemplate.queryForObject(countSql,Integer.class);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:list){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         result.put("count", count);
 | 
												
													
														
															|  | 
 |  |         result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     //到期预警
 | 
												
													
														
															|  | 
 |  |     public JSONObject getExceed(
 | 
												
													
														
															|  | 
 |  |             String idDevice, String equClass, String netStatus, String type, String day,
 | 
												
													
														
															|  | 
 |  |             String content, String startTime, String endTime, int page, int size,String wechatId) throws Exception {
 | 
												
													
														
															|  | 
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id as id,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.belong_community as belongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.community as community,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.del as del,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.delivery_address as deliveryAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.detail_address as detailAddress,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_area as equArea,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_class as equClass,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_info as equInfo,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_name as equName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_num as equNum,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.equ_type as equType,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.fbelong_community as fbelongCommunity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.id_device as idDevice,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.log_time as logTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.machine_code as machineCode,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.network_status as networkStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.poweron_test as poweronTest,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.reg_date as regDate,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.sale_status as saleStatus,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.signal_intensity as signalIntensity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.`status` as `status`,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.type as type,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.upgr_adesit as upgrAdesit,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.duration as duration,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.exceed as exceed,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.humidity as humidity,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.other_couont as otherCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.plus_couont as plusCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.ship_couont as shipCouont,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.temperature as temperature,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_time as createTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user as createUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.create_user_name as createUserName,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_time as updateTime,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user as updateUser,\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t.update_user_name as updateUserName\n" +
 | 
												
													
														
															|  | 
 |  |                 "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                 "    t_mediicine_warray AS t where 1=1";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String conditionSql = "";
 | 
												
													
														
															|  | 
 |  |         conditionSql += " and t.type='exceed'";
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(idDevice)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.id_device = " + idDevice;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(equClass)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.equ_class = " + equClass;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(netStatus)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.network_status = " + netStatus;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(content)){
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(type)) {
 | 
												
													
														
															|  | 
 |  |             if("1".equalsIgnoreCase(type)){
 | 
												
													
														
															|  | 
 |  |                 if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |                     conditionSql += "  AND  t.exceed >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                             " AND t.exceed <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if("2".equalsIgnoreCase(type)){
 | 
												
													
														
															|  | 
 |  |                 if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |                     conditionSql += "  AND  t.reg_date >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                             " AND t.reg_date <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if ("3".equalsIgnoreCase(type)) {
 | 
												
													
														
															|  | 
 |  |                 if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  | 
 |  |                     conditionSql += "  AND  t.log_time >= '" + startTime +"'" +
 | 
												
													
														
															|  | 
 |  |                             " AND t.log_time <= '" + endTime + "'";
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(day)) {
 | 
												
													
														
															|  | 
 |  |             conditionSql += " and t.exceed < date_add(curdate(), interval " + day + " day)";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql = sql + conditionSql;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list=null;
 | 
												
													
														
															|  | 
 |  |         list = hibenateUtils.createSQLQuery(sql,page,size);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String countSql = " select " +
 | 
												
													
														
															|  | 
 |  |                 "     COUNT(DISTINCT (t.id)) as count " +
 | 
												
													
														
															|  | 
 |  |                 "   from " +
 | 
												
													
														
															|  | 
 |  |                 "     t_mediicine_warray t " +
 | 
												
													
														
															|  | 
 |  |                 "  where " +
 | 
												
													
														
															|  | 
 |  |                 "  1=1   " +
 | 
												
													
														
															|  | 
 |  |                 conditionSql;
 | 
												
													
														
															|  | 
 |  |         Logger.getAnonymousLogger().info("finalCountSql="+countSql);
 | 
												
													
														
															|  | 
 |  |         int count = jdbcTemplate.queryForObject(countSql,Integer.class);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:list){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         result.put("count", count);
 | 
												
													
														
															|  | 
 |  |         result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     //温度报警
 |  |     //温度报警
 | 
												
													
														
															|  |     public List<Mediicinewarray> gettemperature(String idDevice, String equClass, float networkStatus, float temperaturebeg, float temperatureend, String codename, String beg, String end) {
 |  |     public List<Mediicinewarray> gettemperature(String idDevice, String equClass, float networkStatus, float temperaturebeg, float temperatureend, String codename, String beg, String end) {
 | 
												
													
														
															|  |         Date startDate = DateUtil.strToDateShort(beg);
 |  |         Date startDate = DateUtil.strToDateShort(beg);
 |