R修改为Result
parent
64e0d665c7
commit
8332d53c64
|
@ -22,24 +22,16 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.february</groupId>
|
<groupId>com.february</groupId>
|
||||||
<artifactId>february-vehicle-remote</artifactId>
|
<artifactId>february-vehicle-common</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.february</groupId>
|
|
||||||
<artifactId>february-vehicle-remote</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- RuoYi Common Log -->
|
<!-- RuoYi Common Log -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.february</groupId>
|
<!-- <groupId>com.february</groupId>-->
|
||||||
<artifactId>february-common-log</artifactId>
|
<!-- <artifactId>february-common-log</artifactId>-->
|
||||||
<version>3.6.3</version>
|
<!-- <version>3.6.3</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- RuoYi Common DataScope -->
|
<!-- RuoYi Common DataScope -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -48,13 +40,6 @@
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- RuoYi Common core -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.february</groupId>
|
|
||||||
<artifactId>february-common-core</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- RuoYi Common DataSource -->
|
<!-- RuoYi Common DataSource -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.vehicle.trajectory.controller;
|
package com.vehicle.trajectory.controller;
|
||||||
|
|
||||||
import com.alibaba.nacos.api.model.v2.Result;
|
|
||||||
import com.february.common.core.domain.R;
|
import com.february.common.core.domain.Result;
|
||||||
import com.february.common.domain.Car;
|
import com.february.common.domain.Car;
|
||||||
import com.february.common.domain.RealData;
|
import com.february.common.domain.RealData;
|
||||||
import com.vehicle.trajectory.service.TrajectoryService;
|
import com.vehicle.trajectory.service.TrajectoryService;
|
||||||
|
@ -27,9 +27,9 @@ public class TrajectoryController {
|
||||||
* 实时数据
|
* 实时数据
|
||||||
*/
|
*/
|
||||||
@GetMapping("/realDateList")
|
@GetMapping("/realDateList")
|
||||||
public R<List<RealData>> realDateList() {
|
public Result<List<RealData>> realDateList() {
|
||||||
log.info("功能名称:【实时数据查看】,请求路径:【{}】,请求方式:【{}】", request.getRequestURI(), request.getMethod());
|
log.info("功能名称:【实时数据查看】,请求路径:【{}】,请求方式:【{}】", request.getRequestURI(), request.getMethod());
|
||||||
R<List<RealData>> result = trajectoryService.realDateList();
|
Result<List<RealData>> result = trajectoryService.realDateList();
|
||||||
log.info("请求结果:【{}】", result);
|
log.info("请求结果:【{}】", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,9 @@ public class TrajectoryController {
|
||||||
* 车辆信息
|
* 车辆信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("/carList")
|
@GetMapping("/carList")
|
||||||
public R<List<Car>> carList() {
|
public Result<List<Car>> carList() {
|
||||||
log.info("功能名称:【查看在线车辆】,请求路径:【{}】,请求方式:【{}】", request.getRequestURI(), request.getMethod());
|
log.info("功能名称:【查看在线车辆】,请求路径:【{}】,请求方式:【{}】", request.getRequestURI(), request.getMethod());
|
||||||
R<List<Car>> result = trajectoryService.carList();
|
Result<List<Car>> result = trajectoryService.carList();
|
||||||
log.info("请求结果:【{}】", result);
|
log.info("请求结果:【{}】", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package com.vehicle.trajectory.service;
|
package com.vehicle.trajectory.service;
|
||||||
|
|
||||||
import com.february.common.core.domain.R;
|
import com.february.common.core.domain.Result;
|
||||||
import com.february.common.domain.Car;
|
import com.february.common.domain.Car;
|
||||||
import com.february.common.domain.RealData;
|
import com.february.common.domain.RealData;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface TrajectoryService {
|
public interface TrajectoryService<T, C> {
|
||||||
R<List<RealData>> realDateList();
|
Result<List<RealData>> realDateList();
|
||||||
|
|
||||||
R<List<Car>> carList();
|
Result<List<Car>> carList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,36 +3,34 @@ package com.vehicle.trajectory.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.february.common.core.domain.R;
|
import com.february.common.core.domain.Result;
|
||||||
import com.february.common.domain.Car;
|
import com.february.common.domain.Car;
|
||||||
import com.february.common.domain.RealData;
|
import com.february.common.domain.RealData;
|
||||||
import com.february.common.redis.service.RedisService;
|
import com.february.common.redis.service.RedisService;
|
||||||
import com.vehicle.trajectory.mapper.TrajectoryMapper;
|
import com.vehicle.trajectory.mapper.TrajectoryMapper;
|
||||||
import com.vehicle.trajectory.service.TrajectoryService;
|
import com.vehicle.trajectory.service.TrajectoryService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Configuration
|
|
||||||
public class TrajectoryServiceImpl implements TrajectoryService {
|
public class TrajectoryServiceImpl implements TrajectoryService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TrajectoryMapper mapper;
|
private TrajectoryMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<List<RealData>> realDateList() {
|
public Result<List<RealData>> realDateList() {
|
||||||
List<RealData> realData = mapper.realDateList();
|
List<RealData> realData = mapper.realDateList();
|
||||||
return R.ok(realData);
|
return Result.success(realData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
@Override
|
@Override
|
||||||
public R<List<Car>> carList() {
|
public Result<List<Car>> carList() {
|
||||||
Boolean aBoolean = redisService.hasKey("状态为上线的车辆信息");
|
Boolean aBoolean = redisService.hasKey("状态为上线的车辆信息");//查询redis中是否有此键
|
||||||
if (Boolean.TRUE.equals(aBoolean)){
|
if (Boolean.TRUE.equals(aBoolean)){
|
||||||
List<Object> list = redisService.redisTemplate.opsForList().range("状态为上线的车辆信息", 0, -1);
|
List<Object> list = redisService.redisTemplate.opsForList().range("状态为上线的车辆信息", 0, -1);
|
||||||
ArrayList<Car> carArrayList = new ArrayList<>();
|
ArrayList<Car> carArrayList = new ArrayList<>();
|
||||||
|
@ -42,13 +40,13 @@ public class TrajectoryServiceImpl implements TrajectoryService {
|
||||||
Car notice = JSON.parseObject(o1, Car.class);
|
Car notice = JSON.parseObject(o1, Car.class);
|
||||||
carArrayList.add(notice);
|
carArrayList.add(notice);
|
||||||
}
|
}
|
||||||
return R.ok(carArrayList);
|
return Result.success(carArrayList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Car> carList = mapper.carList(); //上线车辆的信息
|
List<Car> carList = mapper.carList(); //上线车辆的信息
|
||||||
for (Car car : carList) {
|
for (Car car : carList) {
|
||||||
redisService.redisTemplate.opsForList().leftPush("状态为上线的车辆信息", JSONObject.toJSONString(car));
|
redisService.redisTemplate.opsForList().leftPush("状态为上线的车辆信息", JSONObject.toJSONString(car));
|
||||||
}
|
}
|
||||||
return R.ok(carList);
|
return Result.success(carList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue