| | |
| | | import com.moral.mapper.OrganizationMapper;
|
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.DeviceService;
|
| | | import com.moral.service.MonitorPointService;
|
| | | import com.moral.util.LatLngTransformation;
|
| | | import com.moral.util.TkMybatisUtils;
|
| | |
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | @Service
|
| | |
| | | OrganizationMapper organizationMapper;
|
| | | @Resource
|
| | | DictionaryDataMapper dictionaryDataMapper;
|
| | | @Resource
|
| | | private MonitorPointService monitorPointService ;
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> getDeviceStatesByAccount(Map<String, Object> parameters) {
|
| | |
| | | public List<Device> query(Map<String, Object> params) {
|
| | | List<Integer> dv = deviceMapper.getHasWindDirAndWindSpeedDeviceVersion();
|
| | | Object orgIdObj = params.get("orgId");
|
| | | String regionCode = params.get("regionCode").toString();
|
| | | List<Device> deviceList = null;
|
| | | if (orgIdObj != null) {
|
| | | Integer orgId = Integer.parseInt(orgIdObj.toString());
|
| | | List<Integer> orgIds = orgMapper.selectLowerOrgIds(orgId);
|
| | | params.put("orgIds", orgIds);
|
| | | System.out.println(params);
|
| | | //剔除沧州地图页面非公司设备图标
|
| | | if (regionCode.startsWith("1309")&&orgIdObj.toString().equals("5")) {
|
| | | orgIds = new ArrayList<>();
|
| | | Collections.addAll(orgIds, 60, 65, 159, 165, 166);
|
| | | deviceList = deviceMapper.selectByMap(params);
|
| | | Iterator<Device> iter = deviceList.iterator();
|
| | | while (iter.hasNext()) {
|
| | | Device device = iter.next();
|
| | | Integer mpId = device.getMonitorPointId();
|
| | | Integer oid = monitorPointService.byIdGetMonitorPoint(mpId).getOrganizationId();
|
| | | if (!orgIds.contains(oid)) {
|
| | | iter.remove();
|
| | | } else {
|
| | | if (orgId == 60) {
|
| | | if (mpId != 56) {
|
| | | iter.remove();
|
| | | }
|
| | | } else if (orgId == 65) {
|
| | | if (mpId != 83 && mpId != 84) {
|
| | | iter.remove();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }else {
|
| | | params.put("orgIds", orgIds);
|
| | | deviceList = deviceMapper.selectByMap(params);
|
| | | }
|
| | | // loadDeviceState(deviceList);
|
| | | }
|
| | | Example deviceExample = new Example(Device.class);//实例化
|
| | |
| | | }
|
| | |
|
| | | @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;
|
| | | }
|
| | |
| | | if (tvoc==null){
|
| | | tvoc=0.0;
|
| | | }
|
| | | Double dir = (270.0 + windDir * Math.PI / 180.0);
|
| | | Double dir = (270.0 - windDir * Math.PI / 180.0);
|
| | |
|
| | | U = windSpeed * Math.cos(dir);
|
| | | V = windSpeed * Math.sin(dir);
|
| | |
| | | return deviceMapper.byMacGetOrgId(mac);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Device> getDevice(String macOrName) {
|
| | | return deviceMapper.getDevice(macOrName);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Device> getDeviceByCode() {
|
| | | return deviceMapper.getDeviceByCityCode();
|
| | | }
|
| | |
|
| | | }
|