liuguijing 2 years ago
commit 83306e772d

@ -1,5 +1,6 @@
package com.shxy.xymanager_admin.controller; package com.shxy.xymanager_admin.controller;
import cn.hutool.core.date.DateTime;
import com.shxy.xymanager_common.annotation.Log; import com.shxy.xymanager_common.annotation.Log;
import com.shxy.xymanager_common.base.BaseController; import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.base.ResponseReult;
@ -60,8 +61,8 @@ public class TerminalGPSController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getTermGPSPosition") @RequestMapping("/getTermGPSPosition")
@Log(title = "获取GPS位置触发", type = "查询") @Log(title = "获取GPS位置触发", type = "查询")
public ResponseReult<GetModel> getReturnedTermGPS(@RequestBody @Validated TerminalGpsVo vo) { public ResponseReult<DateTime> getReturnedTermGPS(@RequestBody @Validated TerminalGpsVo vo) {
ServiceBody<GetModel> serviceBody = terminalGpsService.getReturnedGPS(vo); ServiceBody<DateTime> serviceBody = terminalGpsService.getReturnedGPS(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {

@ -34,4 +34,7 @@ public class TerminalGpsModel implements Serializable {
@ApiModelProperty(value = "请求时间", example = "123456") @ApiModelProperty(value = "请求时间", example = "123456")
private DateTime queryTime; private DateTime queryTime;
@ApiModelProperty(value = "是否最新", example = "123456")
private Boolean hasNew;
} }

@ -1,5 +1,6 @@
package com.shxy.xymanager_common.vo; package com.shxy.xymanager_common.vo;
import cn.hutool.core.date.DateTime;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -17,4 +18,7 @@ public class TerminalIdVo {
@ApiModelProperty(value = "图像监测装置 ID", example = "123455") @ApiModelProperty(value = "图像监测装置 ID", example = "123455")
private String cmdId; private String cmdId;
@ApiModelProperty(value = "请求实际", example = "123455")
private DateTime queryTime;
} }

@ -47,11 +47,6 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<!-- SpringBoot 拦截器 --> <!-- SpringBoot 拦截器 -->
<dependency> <dependency>

@ -107,8 +107,10 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(vo.getTermid()); TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(vo.getTermid());
Boolean hasNew = false;
if (!BeanUtil.isEmpty(bean)) { if (!BeanUtil.isEmpty(bean)) {
model.setRadius(bean.getRadius()); model.setRadius(bean.getRadius());
model.setLongitude(bean.getLongitude()); model.setLongitude(bean.getLongitude());
model.setLatitude(bean.getLatitude()); model.setLatitude(bean.getLatitude());
@ -116,6 +118,9 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
model.setQueryTime(now); model.setQueryTime(now);
BigInteger updatetime = MyDateUtils.TimeSecond2MillSecond(bean.getUpdateTime().longValue()); BigInteger updatetime = MyDateUtils.TimeSecond2MillSecond(bean.getUpdateTime().longValue());
model.setUpdatetime(MyDateUtils.date(updatetime.longValue())); model.setUpdatetime(MyDateUtils.date(updatetime.longValue()));
BigInteger queryTime = MyDateUtils.TimeMillSecond2Second(vo.getQueryTime());
hasNew = updatetime.compareTo(queryTime) < 0 ? false : true;
model.setHasNew(hasNew);
} }
if (null!=model) { if (null!=model) {
return Asserts.success(model); return Asserts.success(model);
@ -126,14 +131,11 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
} }
@Override @Override
public ServiceBody<GetModel> getReturnedGPS(TerminalGpsVo vo) { public ServiceBody<DateTime> getReturnedGPS(TerminalGpsVo vo) {
GetModel model = new GetModel(); String cmd = Constants.CMD+"gpsinfo --flag=0 --cmdid="+vo.getCmdId()+ " --clientid=10";
int requestId = Constants.REQUEST_ID.addAndGet(1);
String cmd = Constants.CMD+"gpsinfo --flag=0 --cmdid="+vo.getCmdId()+ " --clientid=10 --reqid="+ requestId;
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
model.setRequestId(requestId); DateTime now = DateTime.now();
return Asserts.success(now);
return Asserts.success(model);
} }
} }

@ -1,9 +1,11 @@
package com.shxy.xymanager_service.service; package com.shxy.xymanager_service.service;
import cn.hutool.core.date.DateTime;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.GetModel;
import com.shxy.xymanager_common.model.TerminalGpsModel; import com.shxy.xymanager_common.model.TerminalGpsModel;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.TerminalGpsVo;
import com.shxy.xymanager_common.vo.TerminalIdAndGpsVo;
import com.shxy.xymanager_common.vo.TerminalIdVo;
/** /**
* Gps * Gps
@ -27,6 +29,6 @@ public interface TerminalGpsService {
*/ */
ServiceBody<TerminalGpsModel> getTermGPS(TerminalIdVo vo); ServiceBody<TerminalGpsModel> getTermGPS(TerminalIdVo vo);
ServiceBody<GetModel> getReturnedGPS(TerminalGpsVo vo); ServiceBody<DateTime> getReturnedGPS(TerminalGpsVo vo);
} }

Loading…
Cancel
Save