|
|
|
@ -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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|