| | |
| | | import com.moral.api.service.OrganizationService; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.util.RegionCodeUtils; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.BufferedWriter; |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author moral |
| | |
| | | //取参 |
| | | Integer organizationId = form.getOrganizationId(); |
| | | Integer regionCode = form.getRegionCode(); |
| | | String region = RegionCodeUtils.regionCodeConvertToName(regionCode); |
| | | String region = null; |
| | | if (regionCode != null) { |
| | | region = RegionCodeUtils.regionCodeConvertToName(regionCode); |
| | | } |
| | | |
| | | //查询子组织 |
| | | List<Organization> childrenOrganization = organizationService.getChildrenOrganizationsById(organizationId); |
| | | List<Integer> organizationIds = new ArrayList<>(); |
| | |
| | | organizationIds.add(organizationId); |
| | | //查询站点 |
| | | QueryWrapper<MonitorPoint> queryMonitorPointsWrapper = new QueryWrapper<>(); |
| | | queryMonitorPointsWrapper.eq(region,regionCode); |
| | | queryMonitorPointsWrapper.in("organization_id",organizationIds); |
| | | |
| | | //如果region不为空,就查询当前组织,所选城市下所有站点及设备信息 |
| | | //如果region为空,则查询当前组织下所有的站点和设备 |
| | | if (region != null){ |
| | | queryMonitorPointsWrapper.eq(region, regionCode); |
| | | } |
| | | queryMonitorPointsWrapper.in("organization_id", organizationIds); |
| | | queryMonitorPointsWrapper.eq("is_delete", Constants.NOT_DELETE); |
| | | List<MonitorPoint> monitorPoints = monitorPointMapper.selectList(queryMonitorPointsWrapper); |
| | | //查询站点对应的设备 |
| | |
| | | Organization stateControlStationOrganization = organizationService.getStateControlStation(); |
| | | //获取国控站组织下的所有站点 |
| | | QueryWrapper<MonitorPoint> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_delete",Constants.NOT_DELETE); |
| | | queryWrapper.eq("organization_id",stateControlStationOrganization.getId()); |
| | | queryWrapper.eq(RegionCodeUtils.regionCodeConvertToName(regionCode),regionCode); |
| | | queryWrapper.eq("is_delete", Constants.NOT_DELETE); |
| | | queryWrapper.eq("organization_id", stateControlStationOrganization.getId()); |
| | | queryWrapper.eq(RegionCodeUtils.regionCodeConvertToName(regionCode), regionCode); |
| | | return monitorPointMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | } |
| | | |
| | | |