jinpengyong
2020-11-12 824762785fb717317550127684efb4f7b792cc8b
src/main/java/com/moral/service/impl/DeviceServiceImpl.java
@@ -29,6 +29,7 @@
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;
@@ -39,6 +40,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import tk.mybatis.mapper.entity.Example;
@Service
@@ -78,6 +80,8 @@
    OrganizationMapper organizationMapper;
    @Resource
    DictionaryDataMapper dictionaryDataMapper;
    @Resource
    private MonitorPointService monitorPointService ;
    @Override
    public Map<String, Object> getDeviceStatesByAccount(Map<String, Object> parameters) {
@@ -207,13 +211,39 @@
    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")) {
                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);//实例化