整合OpenFeign,增加rtcm-api模块
This commit is contained in:
parent
8ddb6a0af6
commit
6e82c17f72
56
pom.xml
56
pom.xml
@ -3,12 +3,6 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.5</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>com.imdroid</groupId>
|
||||
<artifactId>security-monitor</artifactId>
|
||||
@ -19,13 +13,61 @@
|
||||
<module>sec-beidou</module>
|
||||
<module>sec-beidou-rtcm</module>
|
||||
<module>sec-api</module>
|
||||
<module>sec-beidou-rtcm-api</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<sec.version>1.0-SNAPSHOT</sec.version>
|
||||
<moyu.version>1.0.0</moyu.version>
|
||||
<spring-boot.version>2.7.5</spring-boot.version>
|
||||
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>8</java.version>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud 微服务 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- module sec-beidou-rtcm-api -->
|
||||
<dependency>
|
||||
<groupId>com.imdroid</groupId>
|
||||
<artifactId>sec-beidou-rtcm-api</artifactId>
|
||||
<version>${sec.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
32
sec-beidou-rtcm-api/pom.xml
Normal file
32
sec-beidou-rtcm-api/pom.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>security-monitor</artifactId>
|
||||
<groupId>com.imdroid</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>sec-beidou-rtcm-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud OpenFeign -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,16 @@
|
||||
package com.imdroid.sideslope.api;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author LiGang
|
||||
* @date 2023/10/22 19:40
|
||||
*/
|
||||
@FeignClient(name = "rtcm-server", url = "http://localhost:9904/gnss")
|
||||
public interface BeidouRtcmApi {
|
||||
|
||||
@GetMapping("/clean-tilt")
|
||||
String cleanTilt(@RequestParam(name = "deviceId") String deviceId);
|
||||
}
|
||||
@ -18,22 +18,9 @@
|
||||
<logback.version>1.2.3</logback.version>
|
||||
<dt20.common.version>1.0-SNAPSHOT</dt20.common.version>
|
||||
<dt20.util.version>1.0-SNAPSHOT</dt20.util.version>
|
||||
<java.version>8</java.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>Greenwich.SR2</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -59,11 +46,6 @@
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
|
||||
@ -16,14 +16,10 @@
|
||||
<description>beidou</description>
|
||||
|
||||
<properties>
|
||||
<java.version>8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
@ -43,6 +39,11 @@
|
||||
<version>1.4.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
@ -83,11 +84,7 @@
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.76</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>4.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
@ -126,6 +123,12 @@
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- module sec-beidou-rtcm-api -->
|
||||
<dependency>
|
||||
<groupId>com.imdroid</groupId>
|
||||
<artifactId>sec-beidou-rtcm-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -3,10 +3,14 @@ package com.imdroid.beidou;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"com.imdroid"})
|
||||
@ComponentScan({"com.imdroid.*"})
|
||||
@MapperScan({"com.imdroid.secapi","com.imdroid.beidou.entity"})
|
||||
@EnableFeignClients(basePackages = "com.imdroid.*")
|
||||
public class BeidouApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@ -23,7 +23,12 @@ public class AuthInterceptor implements HandlerInterceptor {
|
||||
if (!StringUtils.isEmpty(username)) {
|
||||
return true;
|
||||
}
|
||||
String clientType = request.getHeader("x-imdroid-type");
|
||||
if ("mini".equals(clientType)) {
|
||||
response.setStatus(404);
|
||||
} else {
|
||||
response.sendRedirect("/login");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,6 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(authInterceptor)
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns("/**/*.js","/**/*.css","/**/*.jpg","/**/*.png", "/do_login", "/mini-register", "/login");
|
||||
.excludePathPatterns("/**/*.js","/**/*.css","/**/*.jpg","/**/*.png", "/do_login", "/mini-register", "/login", "/test/**");
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.imdroid.beidou.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author LiGang
|
||||
* @date 2023/10/19 19:42
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return interceptor;
|
||||
}
|
||||
}
|
||||
@ -1,23 +1,25 @@
|
||||
package com.imdroid.beidou.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.StringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.imdroid.beidou.common.HttpResult;
|
||||
import com.imdroid.beidou.data.vo.device.DeviceInstallVO;
|
||||
import com.imdroid.beidou.data.vo.device.DeviceListVO;
|
||||
import com.imdroid.beidou.data.vo.device.DeviceStatusVO;
|
||||
import com.imdroid.beidou.entity.*;
|
||||
import com.imdroid.secapi.dto.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@ -63,7 +65,7 @@ public class GnssDeviceController extends BasicController{
|
||||
@RequestMapping("/gnss/device/list")
|
||||
@ResponseBody
|
||||
public JSONObject list(HttpSession session, int page, int limit, String searchParams) {
|
||||
PageHelper.startPage(page, limit);
|
||||
Page<GnssDevice> pageable = new Page<>(page, limit);
|
||||
QueryWrapper<GnssDevice> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 条件查询
|
||||
@ -71,12 +73,12 @@ public class GnssDeviceController extends BasicController{
|
||||
JSONObject search = (JSONObject) JSONObject.parse(searchParams);
|
||||
//设备号
|
||||
String deviceid = search.getString("deviceid");
|
||||
if (StringUtil.isNotEmpty(deviceid)) {
|
||||
if (!StringUtils.isEmpty(deviceid)) {
|
||||
queryWrapper.like("deviceid", deviceid);
|
||||
}
|
||||
//父设备号
|
||||
String parentid = search.getString("parentid");
|
||||
if (StringUtil.isNotEmpty(parentid)) {
|
||||
if (!StringUtils.isEmpty(parentid)) {
|
||||
queryWrapper.like("parentid", parentid);
|
||||
}
|
||||
//设备类型
|
||||
@ -86,14 +88,13 @@ public class GnssDeviceController extends BasicController{
|
||||
}
|
||||
}
|
||||
|
||||
List<GnssDevice> cs = gnssDeviceMapper.selectList(queryWrapper);
|
||||
PageInfo<GnssDevice> pageInfo = new PageInfo<>(cs);
|
||||
IPage<GnssDevice> cs = gnssDeviceMapper.selectPage(pageable, queryWrapper);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code", 0);
|
||||
jsonObject.put("msg", "");
|
||||
jsonObject.put("count", pageInfo.getTotal());
|
||||
jsonObject.put("data", pageInfo.getList());
|
||||
jsonObject.put("count", cs.getTotal());
|
||||
jsonObject.put("data", cs.getRecords());
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@ -157,16 +158,15 @@ public class GnssDeviceController extends BasicController{
|
||||
wrapper.eq("deviceid",deviceInstallVO.getDeviceId());
|
||||
GnssDevice gnssDevice = gnssDeviceMapper.selectOne(wrapper);
|
||||
if (gnssDevice == null) {
|
||||
return HttpResult.fail("");
|
||||
return HttpResult.fail("设备不存在");
|
||||
}
|
||||
GnssDevice tempDevice = new GnssDevice();
|
||||
tempDevice.setId(gnssDevice.getId());
|
||||
//安装位置通过GNSS坐标自动获取
|
||||
//tempDevice.setLocation(deviceInstallVO.getLocation());
|
||||
tempDevice.setPictures(deviceInstallVO.getPictures());
|
||||
gnssDeviceMapper.updateById(tempDevice);
|
||||
|
||||
return HttpResult.success(null);
|
||||
return HttpResult.success(new DeviceListVO(gnssDevice.getId(), gnssDevice.getDeviceid(), gnssDevice.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,15 +175,66 @@ public class GnssDeviceController extends BasicController{
|
||||
* @param id 主键id
|
||||
* @return 设备信息 DeviceStatusVO
|
||||
*/
|
||||
@PostMapping("/gnss/device/status")
|
||||
@GetMapping("/gnss/device/status")
|
||||
@ResponseBody
|
||||
public HttpResult findById(Long id) {
|
||||
GnssDevice gnssDevice = gnssDeviceMapper.selectById(id);
|
||||
if (gnssDevice == null) {
|
||||
return HttpResult.fail("");
|
||||
return HttpResult.fail("设备不存在");
|
||||
}
|
||||
GnssStatusJoin gnssStatus = gnssStatusMapper.queryByDeviceId(gnssDevice.getDeviceid());
|
||||
GnssStatus gnssStatus = gnssStatusMapper.getByDeviceId(gnssDevice.getDeviceid());
|
||||
DeviceStatusVO deviceStatusVO = new DeviceStatusVO(gnssDevice, gnssStatus);
|
||||
return HttpResult.success(deviceStatusVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备列表
|
||||
*
|
||||
* @param session HttpSession
|
||||
* @param page page
|
||||
* @param limit limit
|
||||
* @param searchParams searchParams
|
||||
* @return JSONObject
|
||||
*/
|
||||
@GetMapping("/gnss/device/simple-list")
|
||||
@ResponseBody
|
||||
public JSONObject simpleList(HttpSession session, Integer page, Integer limit, String searchParams) {
|
||||
System.out.println(page + "," + limit);
|
||||
Page<GnssDevice> pageable = new Page<>(page, limit);
|
||||
QueryWrapper<GnssDevice> queryWrapper = new QueryWrapper<>();
|
||||
System.out.println("searchParams:" + searchParams);
|
||||
// 条件查询
|
||||
if(searchParams != null) {
|
||||
JSONObject search = (JSONObject) JSONObject.parse(searchParams);
|
||||
//设备号
|
||||
String deviceid = search.getString("deviceid");
|
||||
if (!StringUtils.isEmpty(deviceid)) {
|
||||
queryWrapper.like("deviceid", deviceid);
|
||||
}
|
||||
//父设备号
|
||||
String parentid = search.getString("parentid");
|
||||
if (!StringUtils.isEmpty(parentid)) {
|
||||
queryWrapper.like("parentid", parentid);
|
||||
}
|
||||
//设备类型
|
||||
Integer devicetype = search.getInteger("devicetype");
|
||||
if (devicetype != null && devicetype != QUERY_ALL) {
|
||||
queryWrapper.eq("devicetype", devicetype);
|
||||
}
|
||||
}
|
||||
|
||||
IPage<GnssDevice> cs = gnssDeviceMapper.selectPage(pageable, queryWrapper);
|
||||
List<DeviceListVO> deviceListVOList = new ArrayList<>(cs.getRecords().size());
|
||||
for (GnssDevice device : cs.getRecords()) {
|
||||
DeviceListVO deviceListVO = new DeviceListVO(device.getId(), device.getDeviceid(), device.getName());
|
||||
deviceListVOList.add(deviceListVO);
|
||||
}
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code", 0);
|
||||
jsonObject.put("msg", "");
|
||||
jsonObject.put("count", cs.getTotal());
|
||||
jsonObject.put("data", deviceListVOList);
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.imdroid.beidou.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.imdroid.beidou.common.HttpResult;
|
||||
import com.imdroid.beidou.entity.*;
|
||||
import com.imdroid.secapi.dto.GnssGroup;
|
||||
@ -47,15 +47,14 @@ public class GnssGroupController {
|
||||
@RequestMapping("/gnss/group/list")
|
||||
@ResponseBody
|
||||
public JSONObject list(int page, int limit) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<GnssGroup> cs = gnssGroupMapper.selectList(null);
|
||||
PageInfo<GnssGroup> pageInfo = new PageInfo<>(cs);
|
||||
Page<GnssGroup> pageable = new Page<>(page, limit);
|
||||
IPage<GnssGroup> cs = gnssGroupMapper.selectPage(pageable, null);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code", 0);
|
||||
jsonObject.put("msg", "");
|
||||
jsonObject.put("count", pageInfo.getTotal());
|
||||
jsonObject.put("data", pageInfo.getList());
|
||||
jsonObject.put("count", cs.getTotal());
|
||||
jsonObject.put("data", cs.getRecords());
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@ -88,15 +87,14 @@ public class GnssGroupController {
|
||||
@RequestMapping("/gnss/group/list_calc")
|
||||
@ResponseBody
|
||||
public JSONObject listCalc(int page, int limit) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<GnssGroupCalc> cs = gnssGroupCalcMapper.selectList(null);
|
||||
PageInfo<GnssGroupCalc> pageInfo = new PageInfo<>(cs);
|
||||
Page<GnssGroupCalc> pageable = new Page<>(page, limit);
|
||||
IPage<GnssGroupCalc> cs = gnssGroupCalcMapper.selectPage(pageable, null);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code", 0);
|
||||
jsonObject.put("msg", "");
|
||||
jsonObject.put("count", pageInfo.getTotal());
|
||||
jsonObject.put("data", pageInfo.getList());
|
||||
jsonObject.put("count", cs.getTotal());
|
||||
jsonObject.put("data", cs.getRecords());
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@ -129,15 +127,14 @@ public class GnssGroupController {
|
||||
@RequestMapping("/gnss/group/list_fwd")
|
||||
@ResponseBody
|
||||
public JSONObject listFwd(int page, int limit) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<GnssGroupFwd> cs = gnssGroupFwdMapper.selectList(null);
|
||||
PageInfo<GnssGroupFwd> pageInfo = new PageInfo<>(cs);
|
||||
Page<GnssGroupFwd> pageable = new Page<>(page, limit);
|
||||
IPage<GnssGroupFwd> cs = gnssGroupFwdMapper.selectPage(pageable, null);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code", 0);
|
||||
jsonObject.put("msg", "");
|
||||
jsonObject.put("count", pageInfo.getTotal());
|
||||
jsonObject.put("data", pageInfo.getList());
|
||||
jsonObject.put("count", cs.getTotal());
|
||||
jsonObject.put("data", cs.getRecords());
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
package com.imdroid.beidou.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.StringUtil;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.imdroid.secapi.dto.GnssStatus;
|
||||
import com.imdroid.secapi.dto.GnssStatusJoin;
|
||||
import com.imdroid.secapi.dto.GnssStatusMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
@ -33,41 +32,36 @@ public class GnssStatusController extends BasicController{
|
||||
@RequestMapping("/gnss/status/list")
|
||||
@ResponseBody
|
||||
public JSONObject list(HttpSession session, int page, int limit, String searchParams) {
|
||||
PageHelper.startPage(page, limit);
|
||||
|
||||
MPJQueryWrapper wrapper = new MPJQueryWrapper<GnssStatus>()
|
||||
.selectAll(GnssStatus.class)
|
||||
.select("d.devicetype as devicetype","d.tenantid as tenantid")
|
||||
.leftJoin("gnssdevices d on t.deviceid = d.deviceid");
|
||||
Page<GnssStatus> pageable = new Page<>(page, limit);
|
||||
QueryWrapper<GnssStatus> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 条件查询
|
||||
if(searchParams != null) {
|
||||
JSONObject search = (JSONObject) JSONObject.parse(searchParams);
|
||||
//设备号
|
||||
String deviceid = search.getString("deviceid");
|
||||
if (StringUtil.isNotEmpty(deviceid)) {
|
||||
wrapper.like("deviceid", deviceid);
|
||||
if (!StringUtils.isEmpty(deviceid)) {
|
||||
queryWrapper.like("deviceid", deviceid);
|
||||
}
|
||||
//状态
|
||||
Integer state = search.getInteger("state");
|
||||
if(state!=null && state != QUERY_ALL){
|
||||
wrapper.eq("state", state);
|
||||
queryWrapper.eq("state", state);
|
||||
}
|
||||
//告警
|
||||
Integer warning = search.getInteger("warning");
|
||||
if(warning!=null && warning != QUERY_ALL){
|
||||
wrapper.eq("warning", warning);
|
||||
queryWrapper.eq("warning", warning);
|
||||
}
|
||||
}
|
||||
|
||||
//分页查询 (需要启用 mybatis plus 分页插件)
|
||||
Page<GnssStatusJoin> listPage = gnssStatusMapper.selectJoinPage(new Page<>(page, limit), GnssStatusJoin.class, wrapper);
|
||||
IPage<GnssStatus> cs = gnssStatusMapper.selectPage(pageable, queryWrapper);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code", 0);
|
||||
jsonObject.put("msg", "");
|
||||
jsonObject.put("count", listPage.getTotal());
|
||||
jsonObject.put("data", listPage.getRecords());
|
||||
jsonObject.put("count", cs.getTotal());
|
||||
jsonObject.put("data", cs.getRecords());
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.imdroid.beidou.controller;
|
||||
import com.imdroid.beidou.common.HttpResult;
|
||||
import com.imdroid.beidou.utils.AliyunOssUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -47,6 +48,11 @@ public class OssFileController {
|
||||
*/
|
||||
@RequestMapping("/upload-device-image")
|
||||
public HttpResult upload(@RequestParam("file") MultipartFile multipartFile, String deviceId) throws Exception {
|
||||
System.out.println("upload device image:" + multipartFile.getOriginalFilename());
|
||||
if (StringUtils.isEmpty(deviceId)) {
|
||||
HttpResult.fail("设备编号不能为空");
|
||||
}
|
||||
|
||||
String filename = deviceId + "_" + UUID.randomUUID().toString().replace("-", "") + ".jpg";
|
||||
String url = aliyunOssUtils.uploadFile(multipartFile, filename, "device-img");
|
||||
return HttpResult.success(url);
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
package com.imdroid.beidou.controller;
|
||||
|
||||
import com.imdroid.sideslope.api.BeidouRtcmApi;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author LiGang
|
||||
* @date 2023/10/22 21:26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test")
|
||||
public class TestController {
|
||||
|
||||
@Autowired
|
||||
private BeidouRtcmApi beidouRtcmApi;
|
||||
|
||||
@GetMapping("/clean-tilt")
|
||||
public String cleanTilt(@RequestParam(name = "deviceId") String deviceId) {
|
||||
return beidouRtcmApi.cleanTilt(deviceId);
|
||||
}
|
||||
}
|
||||
@ -17,9 +17,6 @@ public class DeviceInstallVO {
|
||||
@NotBlank(message = "设备编号不能为空")
|
||||
private String deviceId;
|
||||
|
||||
@NotBlank(message = "设备安装位置的经纬度不能为空")
|
||||
private String location;
|
||||
|
||||
@NotBlank(message = "现场图片不能为空")
|
||||
private String pictures;
|
||||
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.imdroid.beidou.data.vo.device;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 设备列表VO
|
||||
*
|
||||
* @author LiGang
|
||||
* @date 2023/10/17 21:37
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DeviceListVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String deviceId;
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
||||
@ -2,7 +2,7 @@ package com.imdroid.beidou.data.vo.device;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.imdroid.secapi.dto.GnssDevice;
|
||||
import com.imdroid.secapi.dto.GnssStatusJoin;
|
||||
import com.imdroid.secapi.dto.GnssStatus;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@ -44,8 +44,8 @@ public class DeviceStatusVO {
|
||||
private Integer rxbytes;
|
||||
private Integer b562bytes;
|
||||
private Integer d3xxbytes;
|
||||
private Integer satelliteinview;
|
||||
private Integer satelliteinuse;
|
||||
private Integer satelliteInView;
|
||||
private Integer satelliteInUse;
|
||||
|
||||
private Short dtuState;
|
||||
|
||||
@ -54,14 +54,12 @@ public class DeviceStatusVO {
|
||||
|
||||
}
|
||||
|
||||
public DeviceStatusVO(GnssDevice gnssDevice, GnssStatusJoin gnssStatus) {
|
||||
public DeviceStatusVO(GnssDevice gnssDevice, GnssStatus gnssStatus) {
|
||||
this.id = gnssDevice.getId();
|
||||
this.deviceId = gnssDevice.getDeviceid();
|
||||
this.name = gnssDevice.getName();
|
||||
//this.location = gnssDevice.getLocation();
|
||||
this.pictures = gnssDevice.getPictures();
|
||||
this.tenantName = gnssDevice.getTenantname();
|
||||
//this.latestDataTime = gnssDevice.getLatest_data_time();
|
||||
|
||||
if (gnssStatus != null) {
|
||||
this.latestDataTime = gnssStatus.getUpdatetime();
|
||||
@ -77,8 +75,8 @@ public class DeviceStatusVO {
|
||||
this.rxbytes = gnssStatus.getRxbytes();
|
||||
this.d3xxbytes = gnssStatus.getD3xxbytes();
|
||||
this.b562bytes = gnssStatus.getB562bytes();
|
||||
this.satelliteinview = gnssStatus.getSatelliteinview();
|
||||
this.satelliteinuse = gnssStatus.getSatelliteinuse();
|
||||
this.satelliteInView = gnssStatus.getSatelliteinview();
|
||||
this.satelliteInUse = gnssStatus.getSatelliteinuse();
|
||||
this.dtuState = gnssStatus.getState();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Attention: serverTimezone=Asia/Shanghai !!!
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
|
||||
spring.datasource.username=admin
|
||||
spring.datasource.password=DBMgr_2022
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/bis-device?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.jpa.properties.hibernate.hbm2ddl.auto=update
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MYSQL5InnoDBDialect
|
||||
|
||||
@ -135,8 +135,8 @@ CREATE TABLE IF NOT EXISTS `gnsssinglecalcdata` (
|
||||
`pitch` double DEFAULT NULL,
|
||||
`yaw` double DEFAULT NULL,
|
||||
`shock` double DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `gnssstatusmsg` (
|
||||
`id` bigint AUTO_INCREMENT,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user