Commit 40694a4bbc5de5013a9907cb15cab7b2ee280fbb

Authored by 王通
1 parent 3b248615

1.

src/main/java/com/bsth/server_rs/dks/ExternalRestService.java 0 → 100644
  1 +package com.bsth.server_rs.dks;
  2 +
  3 +import com.bsth.common.SystemParamKeys;
  4 +import com.bsth.redis.ElecRedisService;
  5 +import com.bsth.redis.OilRedisService;
  6 +import com.bsth.redis.ScheduleRedisService;
  7 +import com.bsth.repository.SchedulePlanInfoRepository;
  8 +import com.bsth.repository.ScheduleRealInfoRepository;
  9 +import com.bsth.server_rs.AuthorizeInterceptor_IN;
  10 +import com.bsth.server_rs.base_info.car.Car;
  11 +import com.bsth.server_rs.base_info.car.buffer.CarBufferData;
  12 +import com.bsth.server_rs.base_info.line.Line;
  13 +import com.bsth.server_rs.base_info.line.buffer.LineBufferData;
  14 +import com.bsth.server_rs.base_info.station.buffer.StationBufferData;
  15 +import com.bsth.server_rs.base_info.station.entity.StationRotue;
  16 +import com.bsth.server_rs.gps.buffer.GpsRealDataBuffer;
  17 +import com.bsth.server_rs.gps.entity.GpsEntity;
  18 +import com.bsth.service.SystemParamService;
  19 +import org.slf4j.Logger;
  20 +import org.slf4j.LoggerFactory;
  21 +import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.jdbc.core.JdbcTemplate;
  23 +import org.springframework.stereotype.Component;
  24 +import org.springframework.web.bind.annotation.PathVariable;
  25 +
  26 +import javax.ws.rs.GET;
  27 +import javax.ws.rs.Path;
  28 +import javax.ws.rs.PathParam;
  29 +import javax.ws.rs.Produces;
  30 +import javax.ws.rs.core.MediaType;
  31 +import java.util.*;
  32 +
  33 +/**
  34 + * @author Hill
  35 + * @date 2021-09
  36 + */
  37 +@Component
  38 +@Path("/external")
  39 +@Produces({MediaType.APPLICATION_JSON})
  40 +public class ExternalRestService {
  41 +
  42 + private final static Logger log = LoggerFactory.getLogger(ExternalRestService.class);
  43 +
  44 + @Autowired
  45 + private SystemParamService systemParamService;
  46 +
  47 + @GET
  48 + @Path("/{company}/gps/all")
  49 + public List<GpsEntity> findAllGps(@PathParam("company") String company) {
  50 + List<GpsEntity> result = new ArrayList<>();
  51 + String limitDevices = systemParamService.getValue(String.format(SystemParamKeys.LIMIT_DEVICES_EXTERNAL, company));
  52 + if (limitDevices == null) {
  53 + return result;
  54 + }
  55 + for (GpsEntity gps : GpsRealDataBuffer.all()) {
  56 + if (limitDevices.indexOf(String.format("%s,", gps.getNbbm())) > -1) {
  57 + result.add(gps);
  58 + }
  59 + }
  60 +
  61 + return result;
  62 + }
  63 +}