欣影管理平台装置通道表修改
parent
8bf7f8f27c
commit
b0d47bb571
Binary file not shown.
@ -0,0 +1,58 @@
|
||||
package com.shxy.xymanager_admin.controller;
|
||||
|
||||
import com.shxy.xymanager_common.annotation.Log;
|
||||
import com.shxy.xymanager_common.base.BaseController;
|
||||
import com.shxy.xymanager_common.base.ResponseReult;
|
||||
import com.shxy.xymanager_common.bean.ServiceBody;
|
||||
import com.shxy.xymanager_common.bean.ServiceStatus;
|
||||
import com.shxy.xymanager_common.model.TerminalGpsModel;
|
||||
import com.shxy.xymanager_common.vo.*;
|
||||
import com.shxy.xymanager_service.service.TerminalGpsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@Api(value = "设备GPS接口", tags = "设备GPS接口相关")
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class TerminalGPSController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
TerminalGpsService terminalGpsService;
|
||||
|
||||
@ApiOperation(value = "开启关闭GPS", notes = "开启关闭GPS接口", httpMethod = "POST")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
|
||||
@RequestMapping("/setTermGPS")
|
||||
@Log(title = "开启关闭GPS", type = "修改")
|
||||
public ResponseReult<String> setTermGPS(@RequestBody @Validated TerminalIdAndGpsVo vo) {
|
||||
ServiceBody<String> serviceBody = terminalGpsService.setTermGPS(vo);
|
||||
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
||||
return ResponseReult.success(serviceBody.getData());
|
||||
} else {
|
||||
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取GPS位置", notes = "获取GPS位置接口", httpMethod = "POST")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
|
||||
@RequestMapping("/getTermGPS")
|
||||
@Log(title = "获取GPS位置", type = "修改")
|
||||
public ResponseReult<TerminalGpsModel> getTermGPS(@RequestBody @Validated TerminalIdVo vo) {
|
||||
ServiceBody<TerminalGpsModel> serviceBody = terminalGpsService.getTermGPS(vo);
|
||||
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
||||
return ResponseReult.success(serviceBody.getData());
|
||||
} else {
|
||||
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.shxy.xymanager_common.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 装置GPS信息对象
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "装置GPS信息对象", description = "装置GPS信息")
|
||||
public class TerminalGpsModel implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "装置编号", example = "123456")
|
||||
private Integer termid;
|
||||
|
||||
@ApiModelProperty(value = "半径", example = "123456")
|
||||
private double radius;
|
||||
|
||||
@ApiModelProperty(value = "纬度", example = "123456")
|
||||
private double latitude;
|
||||
|
||||
@ApiModelProperty(value = "经度", example = "123456")
|
||||
private double longitude;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.shxy.xymanager_common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "装置编号和开启关闭gps对象", description = "装置编号和开启关闭gps对象描述")
|
||||
public class TerminalIdAndGpsVo {
|
||||
|
||||
@ApiModelProperty(value = "装置编号", example = "123455")
|
||||
private Integer termid;
|
||||
|
||||
@ApiModelProperty(value = "开启关闭", example = "0--关闭 1--开启")
|
||||
private Integer gpsstatus;
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package com.shxy.xymanager_service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.shxy.xymanager_common.bean.ServiceBody;
|
||||
import com.shxy.xymanager_common.entity.TerminalStatus;
|
||||
import com.shxy.xymanager_common.entity.Terminals;
|
||||
import com.shxy.xymanager_common.enums.CommonStatus;
|
||||
import com.shxy.xymanager_common.exception.Asserts;
|
||||
import com.shxy.xymanager_common.model.TerminalGpsModel;
|
||||
import com.shxy.xymanager_common.model.TerminalListModel;
|
||||
import com.shxy.xymanager_common.page.PageUtils;
|
||||
import com.shxy.xymanager_common.vo.*;
|
||||
import com.shxy.xymanager_dao.dao.TerminalStatusDao;
|
||||
import com.shxy.xymanager_dao.dao.TerminalsDao;
|
||||
import com.shxy.xymanager_service.interaction.Cma;
|
||||
import com.shxy.xymanager_service.service.TerminalGpsService;
|
||||
import com.shxy.xymanager_service.service.TerminalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 设备Gps服务实现层
|
||||
*
|
||||
* @author 晶晶
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TerminalGpsServiceImpl implements TerminalGpsService {
|
||||
|
||||
@Autowired
|
||||
private TerminalStatusDao terminalStatusDao;
|
||||
|
||||
// @Autowired
|
||||
// private Cma cma;
|
||||
|
||||
|
||||
/**
|
||||
* 开启关闭Gps
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServiceBody<String> setTermGPS(TerminalIdAndGpsVo vo) {
|
||||
// Cma cma = new Cma("47.96.238.157", 6891);
|
||||
boolean set = true;
|
||||
Integer status;
|
||||
Integer gpsstatus = vo.getGpsstatus();
|
||||
if (gpsstatus == 0) {
|
||||
// set = cma.turnOnGps(vo.getTermid().toString());
|
||||
status = CommonStatus.EFFECTIVE.value();
|
||||
} else {
|
||||
// set = cma.turnOffGps(vo.getTermid().toString());
|
||||
status = CommonStatus.DELETE.value();
|
||||
}
|
||||
if (set) {
|
||||
TerminalStatus record = new TerminalStatus();
|
||||
record.setTermId(vo.getTermid());
|
||||
record.setGpsStatus(status);
|
||||
int i = terminalStatusDao.updateByPrimaryKeySelective(record);
|
||||
if (i != 0) {
|
||||
return Asserts.success("操作成功");
|
||||
} else {
|
||||
return Asserts.error("操作成功,数据库修改失败");
|
||||
}
|
||||
} else {
|
||||
return Asserts.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取GPS位置
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServiceBody<TerminalGpsModel> getTermGPS(TerminalIdVo vo) {
|
||||
TerminalGpsModel model = new TerminalGpsModel();
|
||||
// Cma cma = new Cma("47.96.238.157", 6891);
|
||||
// boolean b = cma.requestGpsInfo(vo.getTermid().toString());
|
||||
model.setLatitude(300);
|
||||
model.setLongitude(200);
|
||||
model.setTermid(vo.getTermid());
|
||||
model.setRadius(10);
|
||||
boolean b = true;
|
||||
if (b) {
|
||||
return Asserts.success(model);
|
||||
} else {
|
||||
return Asserts.error("操作失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.shxy.xymanager_service.service;
|
||||
|
||||
import com.shxy.xymanager_common.bean.ServiceBody;
|
||||
import com.shxy.xymanager_common.model.TerminalGpsModel;
|
||||
import com.shxy.xymanager_common.model.TerminalListModel;
|
||||
import com.shxy.xymanager_common.vo.*;
|
||||
|
||||
/**
|
||||
* 设备Gps接口
|
||||
*
|
||||
* @author 晶晶
|
||||
*/
|
||||
public interface TerminalGpsService {
|
||||
|
||||
/**
|
||||
*
|
||||
* 开启关闭GPS
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
ServiceBody<String> setTermGPS(TerminalIdAndGpsVo vo);
|
||||
|
||||
/**
|
||||
* 获取GPS
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
ServiceBody<TerminalGpsModel> getTermGPS(TerminalIdVo vo);
|
||||
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue