|
|
|
@ -15,6 +15,7 @@ import com.shxy.xymanager_common.constant.Constants;
|
|
|
|
|
import com.shxy.xymanager_common.dto.*;
|
|
|
|
|
import com.shxy.xymanager_common.entity.*;
|
|
|
|
|
import com.shxy.xymanager_common.enums.CommonStatus;
|
|
|
|
|
import com.shxy.xymanager_common.enums.TakePicStatus;
|
|
|
|
|
import com.shxy.xymanager_common.exception.Asserts;
|
|
|
|
|
import com.shxy.xymanager_common.model.*;
|
|
|
|
|
import com.shxy.xymanager_common.page.PageUtils;
|
|
|
|
@ -23,6 +24,7 @@ import com.shxy.xymanager_common.util.xinyin.ProcessExecUtils;
|
|
|
|
|
import com.shxy.xymanager_common.util.xinyin.TerminalUtils;
|
|
|
|
|
import com.shxy.xymanager_common.vo.*;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.*;
|
|
|
|
|
import com.shxy.xymanager_service.interaction.Cma;
|
|
|
|
|
import com.shxy.xymanager_service.service.CacheService;
|
|
|
|
|
import com.shxy.xymanager_service.service.TerminalPhotoService;
|
|
|
|
|
import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
|
|
|
|
@ -33,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -326,9 +329,14 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) {
|
|
|
|
|
Integer termId = vo.getTermId();
|
|
|
|
|
public ServiceBody<TakePIcModel> takePic(TerminalPhotoVo vo) {
|
|
|
|
|
TakePIcModel model = new TakePIcModel();
|
|
|
|
|
int requestId = 0;
|
|
|
|
|
DateTime now = DateTime.now();
|
|
|
|
|
Integer termId = vo.getTermId();
|
|
|
|
|
Integer channel = vo.getChannel();
|
|
|
|
|
Integer preset = vo.getPreset();
|
|
|
|
|
Integer captureType = vo.getCaptureType();
|
|
|
|
|
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
|
|
|
|
|
Terminals terminals = terminalMap.get(termId);
|
|
|
|
|
String cmdid = null;
|
|
|
|
@ -336,20 +344,51 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
cmdid = terminals.getCmdid();
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(cmdid)) {
|
|
|
|
|
String cmd = CmaUtil.takePic(cmdid, vo.getChannel(), vo.getCaptureType());
|
|
|
|
|
requestId = Constants.REQUEST_ID.addAndGet(1);
|
|
|
|
|
String cmd = CmaUtil.takePic(cmdid, channel, preset, captureType, requestId);
|
|
|
|
|
ProcessExecUtils.exec(cmd);
|
|
|
|
|
model.setRequestId(requestId);
|
|
|
|
|
model.setTaketime(MyDateUtils.date(now));
|
|
|
|
|
}
|
|
|
|
|
return Asserts.success(now);
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取主动拍照状态查询
|
|
|
|
|
*
|
|
|
|
|
* @param vo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<Integer> getTakePicStatus(RequestIdVo vo) {
|
|
|
|
|
Integer requestid = vo.getRequestid();
|
|
|
|
|
if (requestid == null) {
|
|
|
|
|
Asserts.fail("请求编号不能为空");
|
|
|
|
|
}
|
|
|
|
|
RequestResults results = requestResultsDao.selectByRequestId(requestid);
|
|
|
|
|
if (BeanUtil.isEmpty(results)) {
|
|
|
|
|
return Asserts.success(TakePicStatus.UNKONW.value());
|
|
|
|
|
} else {
|
|
|
|
|
if (results.getResult() == 255) {
|
|
|
|
|
return Asserts.success(TakePicStatus.SUCCESS.value());
|
|
|
|
|
} else {
|
|
|
|
|
return Asserts.success(TakePicStatus.FAIL.value());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<Boolean> getReturnedPhoto(ReturnedPhotoVo vo) {
|
|
|
|
|
public ServiceBody<Boolean> getTakePicPhotoStatus(ReturnedPhotoVo vo) {
|
|
|
|
|
Boolean hasNew = false;
|
|
|
|
|
TerminalPhoto photo = terminalPhotoDao.getLatestPhoto(vo.getTermId());
|
|
|
|
|
Integer termId = vo.getTermId();
|
|
|
|
|
BigInteger photoTime = vo.getPhotoTime();
|
|
|
|
|
if (photoTime == null) {
|
|
|
|
|
Asserts.fail("查询时间不能缺少");
|
|
|
|
|
}
|
|
|
|
|
TerminalPhoto photo = terminalPhotoDao.getLatestPhoto(termId);
|
|
|
|
|
if (photo != null) {
|
|
|
|
|
long localPhotoTime = MyDateUtils.TimeMillSecond2Second(vo.getPhotoTime());
|
|
|
|
|
long localPhotoTime = MyDateUtils.TimeMillSecond2Second(MyDateUtils.date(photoTime.longValue()));
|
|
|
|
|
log.info("请求时间:{}", localPhotoTime);
|
|
|
|
|
log.info("装置凯斯处理时间:{}", photo.getRecvTime());
|
|
|
|
|
hasNew = photo.getRecvTime().longValue() < localPhotoTime ? false : true;
|
|
|
|
@ -419,7 +458,8 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
String cmdid = terminals.getCmdid();
|
|
|
|
|
GetModel model = new GetModel();
|
|
|
|
|
int requestId = Constants.REQUEST_ID.addAndGet(1);
|
|
|
|
|
String cmd = Constants.CMD + "imgparams --cmdid=" + cmdid + " --clientid=10 --reqid=" + requestId + " --flag=0 --rf=7 --channel=" + vo.getChannelId();
|
|
|
|
|
|
|
|
|
|
String cmd = CmaUtil.getPhotoQueryParam(cmdid, requestId, vo.getChannelId());
|
|
|
|
|
ProcessExecUtils.exec(cmd);
|
|
|
|
|
model.setRequestId(requestId);
|
|
|
|
|
/*
|
|
|
|
@ -433,8 +473,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<String> addOrUpdatePhotoParams(PhotoParamsVo vo) {
|
|
|
|
|
String cmd = Constants.CMD + "imgparams --flag=1 --cmdid=" + vo.getCmdId() + " --rf=7 --color=" + vo.getColor() + " --resolution=" + vo.getResolution()
|
|
|
|
|
+ " --luminance=" + vo.getLuminance() + " -contrast=" + vo.getContrast() + " --saturation=" + vo.getSaturation() + " --channel=" + vo.getChannelId();
|
|
|
|
|
String cmd = CmaUtil.addOrUpdatePhotoParams(vo.getCmdId(), vo.getColor(), vo.getResolution(), vo.getLuminance(), vo.getContrast(), vo.getSaturation(), vo.getChannelId());
|
|
|
|
|
ProcessExecUtils.exec(cmd);
|
|
|
|
|
return Asserts.success("设置成功");
|
|
|
|
|
}
|
|
|
|
@ -492,7 +531,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
public ServiceBody<GetModel> selectPhotoTimeGet(TerminalPhotoTimeGetVo vo) {
|
|
|
|
|
GetModel model = new GetModel();
|
|
|
|
|
int requestId = Constants.REQUEST_ID.addAndGet(1);
|
|
|
|
|
String cmd = Constants.CMD + "schedule --cmdid=" + vo.getCmdId() + " --reqid=" + requestId + " --clientid=10 --flag=0 --rf=7 --channel=" + vo.getChannel();
|
|
|
|
|
String cmd = CmaUtil.selectPhotoTimeGet(vo.getCmdId(), requestId, vo.getChannel());
|
|
|
|
|
ProcessExecUtils.exec(cmd);
|
|
|
|
|
model.setRequestId(requestId);
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|