| | |
| | | package com.moral.service.impl;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.validation.constraints.NotNull;
|
| | |
|
| | | import com.alibaba.fastjson.TypeReference;
|
| | | import com.github.pagehelper.Page;
|
| | | import com.github.pagehelper.PageHelper;
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.validation.constraints.NotNull;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | @Service
|
| | | public class DeviceServiceImpl implements DeviceService {
|
| | |
| | | */
|
| | | @Override
|
| | | public List<Device> query(Map<String, Object> params) {
|
| | | List<Integer> dv = deviceMapper.getHasWindDirAndWindSpeedDeviceVersion();
|
| | | Object orgIdObj = params.get("orgId");
|
| | | List<Device> deviceList = null;
|
| | | if (orgIdObj != null) {
|
| | |
| | | List<Integer> orgIds = orgMapper.selectLowerOrgIds(orgId);
|
| | | params.put("orgIds", orgIds);
|
| | | deviceList = deviceMapper.selectByMap(params);
|
| | | loadDeviceState(deviceList);
|
| | | // loadDeviceState(deviceList);
|
| | | }
|
| | | Example deviceExample = new Example(Device.class);//实例化
|
| | | Example.Criteria deviceCriteria = deviceExample.createCriteria();
|
| | | deviceCriteria.orEqualTo("isDelete", Constants.IS_DELETE_FALSE);
|
| | | List<Device> devicesInfo = deviceMapper.selectByExample(deviceExample);
|
| | | for (Device d : deviceList) {
|
| | | if (dv.contains(d.getDeviceVersionId())) {
|
| | | d.setHasWindInfo(true);
|
| | | } else {
|
| | | d.setHasWindInfo(false);
|
| | | }
|
| | | for (Device temp : devicesInfo) {
|
| | | if (d.getId().equals(temp.getId())) {
|
| | | d.setState(temp.getState());
|
| | | }
|
| | | }
|
| | | }
|
| | | return deviceList;
|
| | | }
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<String> getMacsByOrganizationId(List<Object> organizationIdList) {
|
| | | return deviceMapper.getMacsByOrganizationId(organizationIdList);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Device> getDeviceById1(int id) {
|
| | | return deviceMapper.getDeviceById1(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Device> getDeviceById2(int id) {
|
| | | return deviceMapper.getDeviceById2(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Device> getDeviceById3(int id) {
|
| | | return deviceMapper.getDeviceById3(id);
|
| | | }
|
| | | }
|