#20230510 欣影管理平台装置信息查询代码

jni
18616268358 2 years ago
parent 9a7637ac38
commit 03aa7f238f

@ -154,8 +154,8 @@ public class TerminalPhotoController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getPhotoQueryParamList")
@Log(title = "最新图片采集参数触发", type = "查询")
public ResponseReult<String> getPhotoQueryParamList(@RequestBody @Validated ReturnedPhotoParamsGetVo vo) {
ServiceBody<String> serviceBody = terminalPhotoService.getPhotoQueryParam(vo);
public ResponseReult<Integer> getPhotoQueryParamList(@RequestBody @Validated ReturnedPhotoParamsGetVo vo) {
ServiceBody<Integer> serviceBody = terminalPhotoService.getPhotoQueryParam(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {

@ -17,4 +17,7 @@ public class TerminalIdVo {
@ApiModelProperty(value = "图像监测装置 ID", example = "123455")
private String cmdId;
@ApiModelProperty(value = "请求 ID", example = "123455")
private Integer requestId;
}

@ -4,21 +4,26 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.entity.TerminalPositions;
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.SystemConfigModel;
import com.shxy.xymanager_common.model.TerminalGpsModel;
import com.shxy.xymanager_common.model.TerminalListModel;
import com.shxy.xymanager_common.model.TerminalModel;
import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.ProcessExecUtils;
import com.shxy.xymanager_common.util.StringUtils;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
import com.shxy.xymanager_dao.dao.TerminalPositionsDao;
import com.shxy.xymanager_dao.dao.TerminalStatusDao;
import com.shxy.xymanager_dao.dao.TerminalsDao;
@ -50,6 +55,9 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
@Autowired
private TerminalPositionsDao terminalPositionsDao;
@Autowired
TerminalPhotoDao terminalPhotoDao;
// @Autowired
// private Cma cma;
@ -99,22 +107,27 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
TerminalGpsModel model = new TerminalGpsModel();
// Cma cma = new Cma("47.96.238.157", 6891);
// boolean b = cma.requestGpsInfo(vo.getTermid().toString());
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());
DateTime now = DateTime.now();
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=gpsinfo --cmdid="+vo.getCmdId();
ProcessExecUtils.exec(cmd);
TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(vo.getTermid());
if (!BeanUtil.isEmpty(bean)) {
model.setRadius(bean.getRadius());
model.setLongitude(bean.getLongitude());
model.setLatitude(bean.getLatitude());
model.setTermid(bean.getTermId());
model.setQueryTime(now);
BigInteger updatetime = MyDateUtils.TimeSecond2MillSecond(bean.getUpdateTime().longValue());
model.setUpdatetime(MyDateUtils.date(updatetime.longValue()));
if(StringUtils.isNotBlank(result)) {
JSONObject resultObj = JSONObject.parseObject(result);
model = JSONObject.parseObject(resultObj.get("groupData").toString(), TerminalGpsModel.class);
}else {
TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(vo.getTermid());
if (!BeanUtil.isEmpty(bean)) {
model.setRadius(bean.getRadius());
model.setLongitude(bean.getLongitude());
model.setLatitude(bean.getLatitude());
model.setTermid(bean.getTermId());
model.setQueryTime(now);
BigInteger updatetime = MyDateUtils.TimeSecond2MillSecond(bean.getUpdateTime().longValue());
model.setUpdatetime(MyDateUtils.date(updatetime.longValue()));
}
}
boolean b = true;
if (b) {
if (null!=model) {
return Asserts.success(model);
} else {
return Asserts.error("操作失败");
@ -124,17 +137,9 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
@Override
public ServiceBody<Integer> getReturnedGPS(TerminalGpsVo vo) {
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --clientid=10 --act=gpsinfo --cmdid="+vo.getCmdId();
BigInteger updatedTime = terminalPositionsDao.getUpdateTime(vo.getTermid());
BigInteger queryTime = MyDateUtils.TimeMillSecond2Second(vo.getQueryTime());
Boolean hasNew =updatedTime.compareTo(queryTime)<0?false:true;
TerminalGpsModel model = new TerminalGpsModel();
if(hasNew) {
TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(vo.getTermid());
BigInteger updatetime = MyDateUtils.TimeSecond2MillSecond(bean.getUpdateTime().longValue());
model.setUpdatetime(MyDateUtils.date(updatetime.longValue()));
}
return Asserts.success(null);
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --clientid=10 --act=gpsinfo --cmdid="+vo.getCmdId()+ "\t" +"--reqid="+ Constants.REQUEST_ID;
ProcessExecUtils.exec(cmd);
return Asserts.success(Constants.REQUEST_ID.addAndGet(1));
}
}

@ -393,7 +393,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
@Override
public ServiceBody<String> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) {
public ServiceBody<Integer> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) {
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=imgparams --cmdid="+vo.getCmdId() +"\t" +"--clientid=10 --reqid="+Constants.REQUEST_ID+"--flag=1 --rf=7 --channel=" + vo.getChannelId();
ProcessExecUtils.exec(cmd);
/* TerminalPhotosParamsModel model = new TerminalPhotosParamsModel();
@ -401,7 +401,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
if(dto!=null) {
BeanUtils.copyProperties(dto, model);
}*/
return Asserts.success("查询成功");
return Asserts.success(Constants.REQUEST_ID.addAndGet(1));
}
@Override

@ -69,7 +69,7 @@ public interface TerminalPhotoService {
*
* @return
*/
ServiceBody<String> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo);
ServiceBody<Integer> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo);
ServiceBody<Integer> addOrUpdatePhotoParams(PhotoParamsVo vo);

Loading…
Cancel
Save