| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.Device; |
| | | import com.moral.api.entity.GovMonitorPoint; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.entity.SysArea; |
| | | import com.moral.api.mapper.DeviceMapper; |
| | | import com.moral.api.mapper.GovMonitorPointMapper; |
| | | import com.moral.api.mapper.SysAreaMapper; |
| | | import com.moral.api.service.DeviceService; |
| | | import com.moral.api.service.GovMonitorPointService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.service.OrganizationService; |
| | | import com.moral.api.util.LogUtils; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.RedisConstants; |
| | |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired |
| | | private LogUtils logUtils; |
| | | |
| | | @Resource |
| | | private OrganizationService organizationService; |
| | | |
| | | @Autowired(required = false) |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | /* |
| | | * 从redis获取设备信息 |
| | |
| | | } |
| | | return govMonitorPointMapper.selectMaps(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<GovMonitorPoint> selectGovMonitorPointsByOrgid(Map map) { |
| | | //根据组织id获取子组织 |
| | | List<Organization> organizations = organizationService.getAllChildrenOrganization(Integer.parseInt(map.get("organization_id").toString())); |
| | | Set<Integer> organization_ids = organizations.stream().map(organization -> organization.getId()).collect(Collectors.toSet()); |
| | | //先获取组织下所有设备 |
| | | QueryWrapper<Device> wrapper_device = new QueryWrapper<>(); |
| | | wrapper_device.in("organization_id",organization_ids).eq("is_delete",Constants.NOT_DELETE); |
| | | List<Device> devices = deviceMapper.selectList(wrapper_device); |
| | | //用集合存放所有设备的id |
| | | Set<String> guids = devices.stream().map(device -> device.getGuid()).collect(Collectors.toSet()); |
| | | //获取所有政府站点信息 |
| | | QueryWrapper<GovMonitorPoint> wrapper_govMonitorPoint = new QueryWrapper<>(); |
| | | wrapper_govMonitorPoint.eq("is_delete",Constants.NOT_DELETE).in("guid",guids); |
| | | List<GovMonitorPoint> govMonitorPointList = govMonitorPointMapper.selectList(wrapper_govMonitorPoint); |
| | | return govMonitorPointList; |
| | | } |
| | | } |