liuguijing 2 years ago
commit ef3eb7ab28

@ -5,7 +5,7 @@ import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus; import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.CmaBackModel; import com.shxy.xymanager_common.model.GetModel;
import com.shxy.xymanager_common.model.SystemConfigModel; import com.shxy.xymanager_common.model.SystemConfigModel;
import com.shxy.xymanager_common.model.UpperComputerInfoModel; import com.shxy.xymanager_common.model.UpperComputerInfoModel;
import com.shxy.xymanager_common.vo.SystemConfigReqVo; import com.shxy.xymanager_common.vo.SystemConfigReqVo;
@ -37,8 +37,8 @@ public class SystemConfigController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getSystemConfigGet") @RequestMapping("/getSystemConfigGet")
@Log(title = "获取全局配置触发接口", type = "查询") @Log(title = "获取全局配置触发接口", type = "查询")
public ResponseReult<CmaBackModel> getSystemConfigGet(@RequestParam("id") String id) { public ResponseReult<GetModel> getSystemConfigGet(@RequestParam("id") String id) {
ServiceBody<CmaBackModel> serviceBody = configService.getSystemConfig(id); ServiceBody<GetModel> serviceBody = configService.getSystemConfig(id);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {
@ -76,8 +76,8 @@ public class SystemConfigController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/upperComputerGet") @RequestMapping("/upperComputerGet")
@Log(title = "获取上位机信息触发", type = "查询") @Log(title = "获取上位机信息触发", type = "查询")
public ResponseReult<Integer> upperComputerGet(@RequestParam("cmdId") String cmdId) { public ResponseReult<GetModel> upperComputerGet(@RequestParam("cmdId") String cmdId) {
ServiceBody<Integer> serviceBody = configService.upperComputerGet(cmdId); ServiceBody<GetModel> serviceBody = configService.upperComputerGet(cmdId);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {

@ -130,12 +130,25 @@ public class TerminalController extends BaseController {
} }
} }
@ApiOperation(value = "图像装置ID查询", notes = "图像装置ID查询接口", httpMethod = "POST") @ApiOperation(value = "图像装置ID查询触发", notes = "图像装置ID查询触发接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/selectTerminalId") @RequestMapping("/terminalIdGet")
@Log(title = "图像装置ID查询触发", type = "修改")
public ResponseReult<GetModel> terminalIdGet(@RequestBody @Validated TerminalIdUpdateVo vo) {
ServiceBody<GetModel> serviceBody = terminalService.terminalIdGet(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
@ApiOperation(value = "图像装置ID查询", notes = "图像装置ID查询触发", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/terminalIdGet")
@Log(title = "图像装置ID查询", type = "修改") @Log(title = "图像装置ID查询", type = "修改")
public ResponseReult<TerminalUpdateModel> selectTerminalId(@RequestBody @Validated TerminalIdUpdateVo vo) { public ResponseReult<TerminalIdModel> terminalIdGet(@RequestParam("requestId")Integer requestId) {
ServiceBody<TerminalUpdateModel> serviceBody = terminalService.updateTerminalId(vo); ServiceBody<TerminalIdModel> serviceBody = terminalService.selectTerminalId(requestId);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {

@ -5,6 +5,7 @@ import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus; import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.GetModel;
import com.shxy.xymanager_common.model.TerminalGpsModel; import com.shxy.xymanager_common.model.TerminalGpsModel;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TerminalGpsService; import com.shxy.xymanager_service.service.TerminalGpsService;
@ -59,8 +60,8 @@ public class TerminalGPSController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getTermGPSPosition") @RequestMapping("/getTermGPSPosition")
@Log(title = "获取GPS位置触发", type = "查询") @Log(title = "获取GPS位置触发", type = "查询")
public ResponseReult<Integer> getReturnedTermGPS(@RequestBody @Validated TerminalGpsVo vo) { public ResponseReult<GetModel> getReturnedTermGPS(@RequestBody @Validated TerminalGpsVo vo) {
ServiceBody<Integer> serviceBody = terminalGpsService.getReturnedGPS(vo); ServiceBody<GetModel> serviceBody = terminalGpsService.getReturnedGPS(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {

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

@ -1,6 +1,8 @@
package com.shxy.xymanager_common.constant; package com.shxy.xymanager_common.constant;
import org.springframework.beans.factory.annotation.Value;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
/** /**
@ -10,6 +12,14 @@ import java.util.concurrent.atomic.AtomicInteger;
*/ */
public class Constants public class Constants
{ {
@Value("${cma.server}")
private static String server;
@Value("${cma.port}")
private static int port;
/** /**
* UTF-8 * UTF-8
*/ */
@ -165,4 +175,7 @@ public class Constants
* JNIID * JNIID
*/ */
public static AtomicInteger REQUEST_ID = new AtomicInteger((int) (System.currentTimeMillis()/1000)); public static AtomicInteger REQUEST_ID = new AtomicInteger((int) (System.currentTimeMillis()/1000));
public static String CMD = "/usr/local/bin/xympadmn --server="+server+"\t" +"--port="+port+"\t" +"--act=";
} }

@ -5,16 +5,15 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* * ID
*/ */
@Data @Data
@ApiModel(value = "Cma返回信息", description = "Cma返回信息") @ApiModel(value = "触发查询信息", description = "触发查询信息")
public class CmaBackModel implements Serializable { public class GetModel implements Serializable {
@ApiModelProperty(value = "请求ID", example = "1233") @ApiModelProperty(value = "请求ID", example = "123456")
private Integer requestId; private Integer requestId;

@ -0,0 +1,22 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
*
*/
@Data
@ApiModel(value = "设备ID信息", description = "获取设备ID信息")
public class TerminalIdModel implements Serializable {
@ApiModelProperty(value = "装置编号", example = "123456")
private String cmdId;
@ApiModelProperty(value = "是否最新", example = "123456")
private Boolean isNew = false;
}

@ -1,21 +0,0 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
*
*/
@Data
@ApiModel(value = "触发获取设备状态信息", description = "触发获取设备状态信息")
public class TerminalStatusGetModel implements Serializable {
@ApiModelProperty(value = "请求Id", example = "123456")
private Integer requestId;
}

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

@ -7,10 +7,7 @@ import com.shxy.xymanager_common.dto.PhotoParamsDto;
import com.shxy.xymanager_common.dto.UpperComputerInfoDto; import com.shxy.xymanager_common.dto.UpperComputerInfoDto;
import com.shxy.xymanager_common.entity.TerminalParams; import com.shxy.xymanager_common.entity.TerminalParams;
import com.shxy.xymanager_common.exception.Asserts; import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.CmaBackModel; import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.model.SystemConfigModel;
import com.shxy.xymanager_common.model.TerminalPhotosParamsModel;
import com.shxy.xymanager_common.model.UpperComputerInfoModel;
import com.shxy.xymanager_common.util.ProcessExecUtils; import com.shxy.xymanager_common.util.ProcessExecUtils;
import com.shxy.xymanager_common.util.StringUtils; import com.shxy.xymanager_common.util.StringUtils;
import com.shxy.xymanager_common.vo.SystemConfigReqVo; import com.shxy.xymanager_common.vo.SystemConfigReqVo;
@ -40,14 +37,14 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Override @Override
public ServiceBody<CmaBackModel> getSystemConfig(String cmdId) { public ServiceBody<GetModel> getSystemConfig(String cmdId) {
/* SystemConfigModel model = new SystemConfigModel(); /* SystemConfigModel model = new SystemConfigModel();
Integer beatHeartTime = systemConfigDao.getTerminalParams(id); Integer beatHeartTime = systemConfigDao.getTerminalParams(id);
model.setHeartBeatTime(beatHeartTime); model.setHeartBeatTime(beatHeartTime);
String globalTime = systemConfigDao.getGlobalTime(Constants.GLOBAL_TIME); String globalTime = systemConfigDao.getGlobalTime(Constants.GLOBAL_TIME);
model.setGlobalTime(Integer.parseInt(globalTime));*/ model.setGlobalTime(Integer.parseInt(globalTime));*/
CmaBackModel model = new CmaBackModel(); GetModel model = new GetModel();
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --clientid=10 --act=sampling --flag=0 --cmdid="+cmdId+ "\t"+"--reqid="+Constants.REQUEST_ID; String cmd = Constants.CMD+"sampling --clientid=10 --flag=0 --cmdid="+cmdId+ "\t"+"--reqid="+Constants.REQUEST_ID;
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString())); model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1); Constants.REQUEST_ID.addAndGet(1);
@ -61,7 +58,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
param.setHeartbeatTime(vo.getHeartBeatTime()); param.setHeartbeatTime(vo.getHeartBeatTime());
systemConfigDao.updateSystemConfig(param); systemConfigDao.updateSystemConfig(param);
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=sampling --cmdid="+vo.getCmdId()+ "\t"+ "--heartbeat=" + vo.getHeartBeatTime(); String cmd =Constants.CMD+"sampling --flag =1 --cmdid="+vo.getCmdId()+ "\t"+ "--heartbeat=" + vo.getHeartBeatTime();
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
return Asserts.success("修改成功"); return Asserts.success("修改成功");
} }
@ -82,11 +79,13 @@ public class SystemConfigServiceImpl implements SystemConfigService {
} }
@Override @Override
public ServiceBody<Integer> upperComputerGet(String cmdId) { public ServiceBody<GetModel> upperComputerGet(String cmdId) {
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --clientid=10 --act=cma --flag=0 --cmdid="+cmdId+ "\t"+"--reqid="+Constants.REQUEST_ID; GetModel model = new GetModel();
String cmd = Constants.CMD+"cma --clientid=10 --flag=0 --cmdid="+cmdId+ "\t"+"--reqid="+Constants.REQUEST_ID;
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
model.setRequestId(Integer.parseInt( Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1); Constants.REQUEST_ID.addAndGet(1);
return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString())); return Asserts.success(model);
} }
@Override @Override

@ -34,14 +34,14 @@ public class TermSetServiceImpl implements TermSetService {
@Override @Override
public ServiceBody<Integer> alarmMark(TerminalIdVo vo) { public ServiceBody<Integer> alarmMark(TerminalIdVo vo) {
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=imgparams --cmdid="+vo.getCmdId()+ "\t" + "--reqid="+ Constants.REQUEST_ID+ "\t"+ "--clientid=10--flag=1 --rf=7"; String cmd =Constants.CMD+"imgparams --cmdid="+vo.getCmdId()+ "\t" + "--reqid="+ Constants.REQUEST_ID+ "\t"+ "--clientid=10--flag=0 --rf=7";
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString())); return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString()));
} }
@Override @Override
public ServiceBody<Integer> selectPhotoTimeGet(TerminalIdVo vo) { public ServiceBody<Integer> selectPhotoTimeGet(TerminalIdVo vo) {
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=alarmMark --cmdid="+vo.getCmdId()+ "\t" + "--reqid="+Constants.REQUEST_ID+ "\t"+ "--clientid=10--flag=1 --rf=7"; String cmd = Constants.CMD+"alarmMark --cmdid="+vo.getCmdId()+ "\t" + "--reqid="+Constants.REQUEST_ID+ "\t"+ "--clientid=10 --flag=1 --rf=7";
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString())); return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString()));
} }

@ -14,10 +14,7 @@ import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus; import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.exception.Asserts; import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.SystemConfigModel; import com.shxy.xymanager_common.model.*;
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.page.PageUtils;
import com.shxy.xymanager_common.util.MyDateUtils; import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.ProcessExecUtils; import com.shxy.xymanager_common.util.ProcessExecUtils;
@ -79,7 +76,7 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
} else { } else {
status = CommonStatus.DELETE.value(); status = CommonStatus.DELETE.value();
} }
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=gpsctrl --cmdid="+vo.getCmdId() +"\t" +"--ctrl="+ status; String cmd = Constants.CMD+"gpsctrl --flag=1 --cmdid="+vo.getCmdId() +"\t" +"--ctrl="+ status;
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
if (set) { if (set) {
TerminalStatus record = new TerminalStatus(); TerminalStatus record = new TerminalStatus();
@ -107,24 +104,18 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
TerminalGpsModel model = new TerminalGpsModel(); TerminalGpsModel model = new TerminalGpsModel();
// Cma cma = new Cma("47.96.238.157", 6891); // Cma cma = new Cma("47.96.238.157", 6891);
// boolean b = cma.requestGpsInfo(vo.getTermid().toString()); // boolean b = cma.requestGpsInfo(vo.getTermid().toString());
String result = terminalPhotoDao.getRequestResult(5);//待修改
DateTime now = DateTime.now();
if(StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, 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()));
}
DateTime now = DateTime.now();
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 (null!=model) { if (null!=model) {
return Asserts.success(model); return Asserts.success(model);
@ -135,10 +126,13 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
} }
@Override @Override
public ServiceBody<Integer> getReturnedGPS(TerminalGpsVo vo) { public ServiceBody<GetModel> getReturnedGPS(TerminalGpsVo vo) {
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; GetModel model = new GetModel();
String cmd = Constants.CMD+"gpsinfo --flag=0 --cmdid="+vo.getCmdId()+ "\t" +"--clientid=10 --reqid="+ Constants.REQUEST_ID;
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
return Asserts.success(Constants.REQUEST_ID.addAndGet(1)); model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1);
return Asserts.success(model);
} }
} }

@ -289,7 +289,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) { public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) {
/* Cma cma = new Cma(server, port);*/ /* Cma cma = new Cma(server, port);*/
DateTime now = DateTime.now(); DateTime now = DateTime.now();
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=capture --cmdid=" + vo.getCmdid() + "\t" + "--channel=" + vo.getChannel() + "\t" + "--preset=255 --type=" + vo.getCaptureType(); String cmd =Constants.CMD+"capture --cmdid=" + vo.getCmdid() + "\t" + "--channel=" + vo.getChannel() + "\t" + "--preset=255 --type=" + vo.getCaptureType();
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
/* Boolean hasNew = cma.requestCapture(vo.getCmdid(), vo.getChannel(), vo.getPreset(), vo.getCaptureType());*/ /* Boolean hasNew = cma.requestCapture(vo.getCmdid(), vo.getChannel(), vo.getPreset(), vo.getCaptureType());*/
return Asserts.success(now); return Asserts.success(now);
@ -404,7 +404,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
span1 = (short) 0; span1 = (short) 0;
span2 = span; span2 = span;
} }
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=schedule --cmdid=" + dtoList.get(j).getCmid() + "\t" + "--channel=" + vo.getChannel() + "\t" String cmd = Constants.CMD+"schedule --flag=1 --cmdid=" + dtoList.get(j).getCmid() + "\t" + "--channel=" + vo.getChannel() + "\t"
+ "--group=3 --hour1=" + startHour + "\t" + "--min1=" + startMin + "\t" + "--preset1=255 --hour2=" + endTimeHour + "\t" + "--min2=" + endTimeMin + "\t" + "--group=3 --hour1=" + startHour + "\t" + "--min1=" + startMin + "\t" + "--preset1=255 --hour2=" + endTimeHour + "\t" + "--min2=" + endTimeMin + "\t"
+ "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255"; + "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255";
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
@ -414,9 +414,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
} }
@Override @Override
public ServiceBody<TerminalStatusGetModel> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) { public ServiceBody<GetModel> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) {
TerminalStatusGetModel model = new TerminalStatusGetModel(); GetModel model = new GetModel();
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 + "\t" + "--flag=0 --rf=7 --channel=" + vo.getChannelId(); String cmd = Constants.CMD+"act=imgparams --cmdid=" + vo.getCmdId() + "\t" + "--clientid=10 --reqid=" + Constants.REQUEST_ID + "\t" + "--flag=0 --rf=7 --channel=" + vo.getChannelId();
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString())); model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1); Constants.REQUEST_ID.addAndGet(1);
@ -430,7 +430,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Override @Override
public ServiceBody<String> addOrUpdatePhotoParams(PhotoParamsVo vo) { public ServiceBody<String> addOrUpdatePhotoParams(PhotoParamsVo vo) {
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=imgparams --clientid=10 --cmdid=" + vo.getCmdId() + "\t" + "--color=" + vo.getColor() + "\t" + "--resolution=" + vo.getResolution() + "\t" String cmd = Constants.CMD+"imgparams --flag=1 --cmdid=" + vo.getCmdId() + "\t" + "--color=" + vo.getColor() + "\t" + "--resolution=" + vo.getResolution() + "\t"
+ "--luminance=" + vo.getLuminance() + "\t" + "-contrast=" + vo.getContrast() + "\t" + "--saturation=" + vo.getSaturation() + "\t" + "--channel=" + vo.getChannelId(); + "--luminance=" + vo.getLuminance() + "\t" + "-contrast=" + vo.getContrast() + "\t" + "--saturation=" + vo.getSaturation() + "\t" + "--channel=" + vo.getChannelId();
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
return Asserts.success("设置成功"); return Asserts.success("设置成功");
@ -458,20 +458,22 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel(); TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel();
if (StringUtils.isNotBlank(result)) { if (StringUtils.isNotBlank(result)) {
JSONObject resultObj = JSONObject.parseObject(result); JSONObject resultObj = JSONObject.parseObject(result);
List<PhotoTimeResultDto> resultDtoList = JSONArray.parseArray(resultObj.get("groupData").toString(), PhotoTimeResultDto.class); if(null!=resultObj.get("groupData")) {
List<String> resultList = Lists.newArrayList(); List<PhotoTimeResultDto> resultDtoList = JSONArray.parseArray(resultObj.get("groupData").toString(), PhotoTimeResultDto.class);
String startTimeStr = resultDtoList.get(0).getHour() + ":" + resultDtoList.get(0).getMinute() + ":00"; List<String> resultList = Lists.newArrayList();
String endTimeStr = resultDtoList.get(1).getHour() + ":" + resultDtoList.get(1).getMinute() + ":00"; String startTimeStr = resultDtoList.get(0).getHour() + ":" + resultDtoList.get(0).getMinute() + ":00";
Date startTime = DateUtil.parseTime(startTimeStr); String endTimeStr = resultDtoList.get(1).getHour() + ":" + resultDtoList.get(1).getMinute() + ":00";
Date endTime = DateUtil.parseTime(endTimeStr); Date startTime = DateUtil.parseTime(startTimeStr);
Integer span = resultDtoList.get(2).getHour() * 60 + resultDtoList.get(2).getMinute(); Date endTime = DateUtil.parseTime(endTimeStr);
List<DateTime> dateTimes = MyDateUtils.rangeToList(startTime, endTime, DateField.MINUTE, span); Integer span = resultDtoList.get(2).getHour() * 60 + resultDtoList.get(2).getMinute();
for (DateTime data : dateTimes) { List<DateTime> dateTimes = MyDateUtils.rangeToList(startTime, endTime, DateField.MINUTE, span);
String dateTime = DateUtil.formatTime(data); for (DateTime data : dateTimes) {
resultList.add(dateTime); String dateTime = DateUtil.formatTime(data);
resultList.add(dateTime);
}
model.setList(resultList);
model.setIsNew(true);
} }
model.setList(resultList);
model.setIsNew(true);
} else { } else {
TerminalAndChannelIdVo idVo = new TerminalAndChannelIdVo(); TerminalAndChannelIdVo idVo = new TerminalAndChannelIdVo();
BeanUtils.copyProperties(vo, idVo); BeanUtils.copyProperties(vo, idVo);
@ -482,9 +484,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
} }
@Override @Override
public ServiceBody<CmaBackModel> selectPhotoTimeGet(TerminalPhotoTimeGetVo vo) { public ServiceBody<GetModel> selectPhotoTimeGet(TerminalPhotoTimeGetVo vo) {
CmaBackModel model = new CmaBackModel(); GetModel model = new GetModel();
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=schedule --cmdid=" + vo.getCmdId() + "\t" + "--reqid=" + Constants.REQUEST_ID + "\t" + "--clientid=10 --flag=0 --rf=7 --channel=" + vo.getChannel(); String cmd = Constants.CMD+"schedule --cmdid=" + vo.getCmdId() + "\t" + "--reqid=" + Constants.REQUEST_ID + "\t" + "--clientid=10 --flag=0 --rf=7 --channel=" + vo.getChannel();
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
Integer requestId = Integer.parseInt(Constants.REQUEST_ID.toString()); Integer requestId = Integer.parseInt(Constants.REQUEST_ID.toString());
model.setRequestId(requestId); model.setRequestId(requestId);

@ -4,12 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.constant.Constants; import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.dto.*; import com.shxy.xymanager_common.dto.DyLineAndTerminalNoHeartDto;
import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto;
import com.shxy.xymanager_common.entity.TerminalChannelMapper; import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus; import com.shxy.xymanager_common.enums.CommonStatus;
@ -190,7 +191,7 @@ public class TerminalServiceImpl implements TerminalService {
@Override @Override
public ServiceBody<String> resetTerminal(String cmId) { public ServiceBody<String> resetTerminal(String cmId) {
// Cma cma = new Cma("47.96.238.157", 6891); // Cma cma = new Cma("47.96.238.157", 6891);
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=reset --cmdid=" + cmId + "\t" + "--mode=0"; String cmd = Constants.CMD+"reset --flag=1 --cmdid=" + cmId + "\t" + "--mode=0";
Integer retCode = ProcessExecUtils.exec(cmd); Integer retCode = ProcessExecUtils.exec(cmd);
// boolean reset = cma.reset(vo.getTermid().toString(), (short) 0x01); // boolean reset = cma.reset(vo.getTermid().toString(), (short) 0x01);
if (retCode == 0) { if (retCode == 0) {
@ -205,7 +206,7 @@ public class TerminalServiceImpl implements TerminalService {
public ServiceBody<TerminalStatusModel> getTerminalStatus(Integer termId) { public ServiceBody<TerminalStatusModel> getTerminalStatus(Integer termId) {
TerminalStatusModel model = new TerminalStatusModel(); TerminalStatusModel model = new TerminalStatusModel();
String cmdId = terminalsDao.getCmdIdByTermId(termId); String cmdId = terminalsDao.getCmdIdByTermId(termId);
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --flag=0 --act=runningstatus --cmdid=" + cmdId; String cmd = Constants.CMD+"runningstatus --flag=0 --cmdid=" + cmdId;
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
/* TerminalModel model = new TerminalModel();*/ /* TerminalModel model = new TerminalModel();*/
@ -251,11 +252,9 @@ public class TerminalServiceImpl implements TerminalService {
@Override @Override
public ServiceBody<TerminalUpdateModel> updateTerminalId(TerminalIdUpdateVo vo) { public ServiceBody<TerminalUpdateModel> updateTerminalId(TerminalIdUpdateVo vo) {
TerminalUpdateModel model = new TerminalUpdateModel(); TerminalUpdateModel model = new TerminalUpdateModel();
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --act=termid --cmdid=" + vo.getCmdId() + "\t" + "--reqid=" + Constants.REQUEST_ID + "\t" + "--newcmdid=" + vo.getNewCmdId() + "\t" + "--newcmdid=" + vo.getNewCmdId(); String cmd = Constants.CMD+"termid --flag=1 --cmdid=" + vo.getCmdId() + "\t" + "--newcmdid=" + vo.getNewCmdId() ;
Integer retCode = ProcessExecUtils.exec(cmd); Integer retCode = ProcessExecUtils.exec(cmd);
model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString()));
model.setTermId(vo.getTermId()); model.setTermId(vo.getTermId());
Constants.REQUEST_ID.addAndGet(1);
if (retCode == 0) { if (retCode == 0) {
int result = terminalsDao.updateCmd(vo); int result = terminalsDao.updateCmd(vo);
if (result > 0) { if (result > 0) {
@ -286,5 +285,26 @@ public class TerminalServiceImpl implements TerminalService {
} }
return Asserts.success(model); return Asserts.success(model);
} }
@Override
public ServiceBody<GetModel> terminalIdGet(TerminalIdUpdateVo vo) {
String cmd = Constants.CMD+"termid --clientid=10 --flag=0 --cmdid=" + vo.getCmdId() + "\t" + "--reqid=" + Constants.REQUEST_ID;
ProcessExecUtils.exec(cmd);
GetModel model = new GetModel();
model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1);
return Asserts.success(model);
}
@Override
public ServiceBody<TerminalIdModel> selectTerminalId(Integer requestId) {
String result = terminalPhotoDao.getRequestResult(requestId);
TerminalIdModel model = new TerminalIdModel();
if (StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, TerminalIdModel.class);
model.setIsNew(true);
}
return Asserts.success(model);
}
} }

@ -1,13 +1,12 @@
package com.shxy.xymanager_service.service; package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.CmaBackModel; import com.shxy.xymanager_common.model.GetModel;
import com.shxy.xymanager_common.model.SystemConfigModel; import com.shxy.xymanager_common.model.SystemConfigModel;
import com.shxy.xymanager_common.model.UpperComputerInfoModel; import com.shxy.xymanager_common.model.UpperComputerInfoModel;
import com.shxy.xymanager_common.vo.SystemConfigReqVo; import com.shxy.xymanager_common.vo.SystemConfigReqVo;
import com.shxy.xymanager_common.vo.SystemConfigVo; import com.shxy.xymanager_common.vo.SystemConfigVo;
import com.shxy.xymanager_common.vo.TerminalUpperComputerVo; import com.shxy.xymanager_common.vo.TerminalUpperComputerVo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* *
@ -21,7 +20,7 @@ public interface SystemConfigService {
* *
* @return * @return
*/ */
ServiceBody<CmaBackModel> getSystemConfig(String id); ServiceBody<GetModel> getSystemConfig(String id);
/** /**
@ -39,7 +38,7 @@ public interface SystemConfigService {
* *
* @return * @return
*/ */
ServiceBody<Integer> upperComputerGet(String cmdId); ServiceBody<GetModel> upperComputerGet(String cmdId);
ServiceBody<UpperComputerInfoModel> getUpperComputerInfo(TerminalUpperComputerVo vo); ServiceBody<UpperComputerInfoModel> getUpperComputerInfo(TerminalUpperComputerVo vo);

@ -1,6 +1,7 @@
package com.shxy.xymanager_service.service; package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.GetModel;
import com.shxy.xymanager_common.model.TerminalGpsModel; import com.shxy.xymanager_common.model.TerminalGpsModel;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
@ -26,6 +27,6 @@ public interface TerminalGpsService {
*/ */
ServiceBody<TerminalGpsModel> getTermGPS(TerminalIdVo vo); ServiceBody<TerminalGpsModel> getTermGPS(TerminalIdVo vo);
ServiceBody<Integer> getReturnedGPS(TerminalGpsVo vo); ServiceBody<GetModel> getReturnedGPS(TerminalGpsVo vo);
} }

@ -69,7 +69,7 @@ public interface TerminalPhotoService {
* *
* @return * @return
*/ */
ServiceBody<TerminalStatusGetModel> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo); ServiceBody<GetModel> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo);
ServiceBody<String> addOrUpdatePhotoParams(PhotoParamsVo vo); ServiceBody<String> addOrUpdatePhotoParams(PhotoParamsVo vo);
@ -78,7 +78,7 @@ public interface TerminalPhotoService {
ServiceBody<TerminalScheduleRuleTimeListModel> selectPhotoTime(TerminalReqPhotoTimeVo vo); ServiceBody<TerminalScheduleRuleTimeListModel> selectPhotoTime(TerminalReqPhotoTimeVo vo);
ServiceBody<CmaBackModel> selectPhotoTimeGet(TerminalPhotoTimeGetVo vo); ServiceBody<GetModel> selectPhotoTimeGet(TerminalPhotoTimeGetVo vo);

@ -69,5 +69,20 @@ public interface TerminalService {
*/ */
ServiceBody<DyLineAndTermModel> getTermListByChannel(TerminalChannelIdVo vo); ServiceBody<DyLineAndTermModel> getTermListByChannel(TerminalChannelIdVo vo);
/**
* ID
*
* @param vo
* @return
*/
ServiceBody<GetModel> terminalIdGet(TerminalIdUpdateVo vo);
/**
* IDID
*
* @param requestId
* @return
*/
ServiceBody<TerminalIdModel> selectTerminalId(Integer requestId);
} }

Loading…
Cancel
Save