| | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MINUTE, (calendar.get(Calendar.MINUTE) - 2)); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | String time = df.format(calendar.getTime()) + ":00"; |
| | | //String time = df.format(calendar.getTime()) + ":00"; |
| | | int year = calendar.get(Calendar.YEAR); |
| | | int month = calendar.get(Calendar.MONTH) + 1; |
| | | String mon; |
| | |
| | | mon = "" + month; |
| | | } |
| | | String table = "history_minutely_" + year + mon; |
| | | List list = deviceService.byMonitorIdGetDeviceAndWind(monitorPointId, time, table); |
| | | List list = deviceService.byMonitorIdGetDeviceAndWind(monitorPointId,table); |
| | | return list; |
| | | } |
| | | |
| | |
| | | mon = "" + month; |
| | | } |
| | | String table = "history_minutely_" + year + mon; |
| | | List list = deviceService.byMonitorIdGetDeviceAndWindSpecial(monitorPointId, time, table); |
| | | List list = deviceService.byMonitorIdGetDeviceAndWindSpecial(monitorPointId,table); |
| | | return list; |
| | | } |
| | | |
| | |
| | |
|
| | | Device byMacGetDevice(@Param("mac") String mac);
|
| | |
|
| | | DeviceAndWind getDeviceAndWindByMac(@Param("mac") String mac, @Param("time") String time,
|
| | | DeviceAndWind getDeviceAndWindByMac(@Param("mac") String mac,
|
| | | @Param("table") String table);
|
| | |
|
| | | List<DeviceAndWind> byMonitorIdGetDeviceAndWind(@Param("id") int id, @Param("time") String time, @Param("table") String table);
|
| | | List<DeviceAndWind> byMonitorIdGetDeviceAndWind(@Param("id") int id, @Param("table") String table);
|
| | |
|
| | | DeviceAndWind byMacGetDeviceAndWind(@Param("mac") String mac, @Param("time") String time, @Param("table") String table);
|
| | | DeviceAndWind byMacGetDeviceAndWind(@Param("mac") String mac, @Param("table") String table);
|
| | |
|
| | | List<String> getMacsByMonitorPointIds(List<Integer> list);
|
| | |
|
| | |
| | |
|
| | | Device byMacGetDevice(String mac);
|
| | |
|
| | | List<DeviceAndWind> byMonitorIdGetDeviceAndWind(String id,String time,String tab);
|
| | | List<DeviceAndWind> byMonitorIdGetDeviceAndWindSpecial(String id,String time,String tab);
|
| | | List<DeviceAndWind> byMonitorIdGetDeviceAndWind(String id,String tab);
|
| | | List<DeviceAndWind> byMonitorIdGetDeviceAndWindSpecial(String id,String tab);
|
| | |
|
| | | List<Device> getDeviceByCodeAndId(String code,String id);
|
| | |
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List byMonitorIdGetDeviceAndWind(String id,String time,String tab) {
|
| | | List<DeviceAndWind> deviceAndWinds=deviceMapper.byMonitorIdGetDeviceAndWind(Integer.parseInt(id),time,tab);
|
| | | public List byMonitorIdGetDeviceAndWind(String id,String tab) {
|
| | | List<DeviceAndWind> deviceAndWinds=deviceMapper.byMonitorIdGetDeviceAndWind(Integer.parseInt(id),tab);
|
| | | List loList=new ArrayList();
|
| | | List laList=new ArrayList();
|
| | | Double U=0.0;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List byMonitorIdGetDeviceAndWindSpecial(String id, String time, String tab) {
|
| | | public List byMonitorIdGetDeviceAndWindSpecial(String id, String tab) {
|
| | | MonitorPoint monitorPoint=monitorPointMapper.byIdGetMonitorPoint(Integer.parseInt(id));
|
| | | Integer areaCode=monitorPoint.getAreaCode();
|
| | | String townCode= monitorPoint.getTownCode()+"";
|
| | |
| | | List<Device> deviceList=deviceMapper.getDeviceByCode(parm);
|
| | | for (Device d : deviceList) {
|
| | | String mac=d.getMac();
|
| | | DeviceAndWind deviceAndWind = deviceMapper.byMacGetDeviceAndWind(mac,time,tab);
|
| | | DeviceAndWind deviceAndWind = deviceMapper.byMacGetDeviceAndWind(mac,tab);
|
| | | if (deviceAndWind!=null){
|
| | | deviceAndWinds.add(deviceAndWind);
|
| | | }
|
| | |
| | | List<Device> deviceList=deviceMapper.getDeviceByCode(parm);
|
| | | for (Device d : deviceList) {
|
| | | String mac=d.getMac();
|
| | | DeviceAndWind deviceAndWind = deviceMapper.byMacGetDeviceAndWind(mac,time,tab);
|
| | | DeviceAndWind deviceAndWind = deviceMapper.byMacGetDeviceAndWind(mac,tab);
|
| | | if (deviceAndWind!=null){
|
| | | deviceAndWinds.add(deviceAndWind);
|
| | | }
|
| | |
| | | length=2000;
|
| | | perdlen=280;
|
| | | }else if(monitorPointId==35){
|
| | | DeviceAndWind deviceAndWind=deviceMapper.getDeviceAndWindByMac("898607b0101730392253",time,tab);
|
| | | DeviceAndWind deviceAndWind1=deviceMapper.getDeviceAndWindByMac("p5dnd7a0392083",time,tab);
|
| | | DeviceAndWind deviceAndWind=deviceMapper.getDeviceAndWindByMac("898607b0101730392253",tab);
|
| | | DeviceAndWind deviceAndWind1=deviceMapper.getDeviceAndWindByMac("p5dnd7a0392083",tab);
|
| | | deviceAndWinds.add(deviceAndWind);
|
| | | deviceAndWinds.add(deviceAndWind1);
|
| | | length=2000;
|
| | | perdlen=50;
|
| | |
|
| | | }else {
|
| | | deviceAndWinds=deviceMapper.byMonitorIdGetDeviceAndWind(Integer.parseInt(id),time,tab);
|
| | | deviceAndWinds=deviceMapper.byMonitorIdGetDeviceAndWind(Integer.parseInt(id),tab);
|
| | | length=2000;
|
| | | perdlen=80;
|
| | | }
|
| | |
| | | as windSpeed, h.json->"$.e23[0]" as windDir, |
| | | h.json->"$.e17[0]" as tVoc |
| | | from ${table} h ,`device` as d |
| | | where d.mac=h.mac and d.mac=#{mac} and h.time=#{time} |
| | | where d.mac=h.mac and d.mac=#{mac} and h.time=(select max(time) from ${table}) |
| | | </select> |
| | | <select id="byMonitorIdGetDeviceAndWind" resultType="com.moral.entity.DeviceAndWind"> |
| | | select d.longitude as longitude,d.latitude as latitude, |
| | |
| | | as windSpeed, h.json->"$.e23[0]" as windDir, |
| | | h.json->"$.e17[0]" as tVoc |
| | | from ${table} as h ,`device` as d |
| | | where d.mac=h.mac and h.time=#{time} |
| | | where d.mac=h.mac and h.time=(select max(time) from ${table}) |
| | | and d.mac in (select d.mac from device , monitor_point as m where d.monitor_point_id=m.id and m.id=#{id}) |
| | | </select> |
| | | |
| | |
| | | as windSpeed, h.json->"$.e23[0]" as windDir, |
| | | h.json->"$.e17[0]" as tVoc |
| | | from ${table} as h ,`device` as d |
| | | where d.mac=h.mac and h.time=#{time} |
| | | where d.mac=h.mac and h.time=(select max(time) from ${table}) |
| | | and d.mac=#{mac} |
| | | </select> |
| | | <select id="getDeviceByCodeAndId" resultType="com.moral.entity.Device" resultMap="BaseResultMap"> |