|
|
|
@ -1,23 +1,39 @@
|
|
|
|
|
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 cn.hutool.core.date.DateTime;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
|
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.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.vo.*;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalPositionsDao;
|
|
|
|
|
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.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -83,6 +99,9 @@ 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());
|
|
|
|
|
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)) {
|
|
|
|
@ -90,6 +109,7 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
|
|
|
|
|
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()));
|
|
|
|
|
}
|
|
|
|
@ -102,5 +122,19 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalGpsModel> getReturnedGPS(TerminalGpsVo vo) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|