diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/SystemConfigController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/SystemConfigController.java index 050f552..6b166e3 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/SystemConfigController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/SystemConfigController.java @@ -5,7 +5,7 @@ import com.shxy.xymanager_common.base.BaseController; import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.bean.ServiceBody; 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.UpperComputerInfoModel; 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 = "请求路径没有或页面跳转路径不对")}) @RequestMapping("/getSystemConfigGet") @Log(title = "获取全局配置触发接口", type = "查询") - public ResponseReult getSystemConfigGet(@RequestParam("id") String id) { - ServiceBody serviceBody = configService.getSystemConfig(id); + public ResponseReult getSystemConfigGet(@RequestParam("id") String id) { + ServiceBody serviceBody = configService.getSystemConfig(id); if (serviceBody.getCode() == ServiceStatus.SUCCESS) { return ResponseReult.success(serviceBody.getData()); } else { @@ -76,8 +76,8 @@ public class SystemConfigController extends BaseController { @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @RequestMapping("/upperComputerGet") @Log(title = "获取上位机信息触发", type = "查询") - public ResponseReult upperComputerGet(@RequestParam("cmdId") String cmdId) { - ServiceBody serviceBody = configService.upperComputerGet(cmdId); + public ResponseReult upperComputerGet(@RequestParam("cmdId") String cmdId) { + ServiceBody serviceBody = configService.upperComputerGet(cmdId); if (serviceBody.getCode() == ServiceStatus.SUCCESS) { return ResponseReult.success(serviceBody.getData()); } else { diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalController.java index 07a763e..89c9f53 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalController.java @@ -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 = "请求路径没有或页面跳转路径不对")}) - @RequestMapping("/selectTerminalId") + @RequestMapping("/terminalIdGet") + @Log(title = "图像装置ID查询触发", type = "修改") + public ResponseReult terminalIdGet(@RequestBody @Validated TerminalIdUpdateVo vo) { + ServiceBody 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 = "修改") - public ResponseReult selectTerminalId(@RequestBody @Validated TerminalIdUpdateVo vo) { - ServiceBody serviceBody = terminalService.updateTerminalId(vo); + public ResponseReult terminalIdGet(@RequestParam("requestId")Integer requestId) { + ServiceBody serviceBody = terminalService.selectTerminalId(requestId); if (serviceBody.getCode() == ServiceStatus.SUCCESS) { return ResponseReult.success(serviceBody.getData()); } else { diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalGPSController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalGPSController.java index 4437d11..da83835 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalGPSController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalGPSController.java @@ -5,6 +5,7 @@ import com.shxy.xymanager_common.base.BaseController; import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.bean.ServiceBody; 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.vo.*; 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 = "请求路径没有或页面跳转路径不对")}) @RequestMapping("/getTermGPSPosition") @Log(title = "获取GPS位置触发", type = "查询") - public ResponseReult getReturnedTermGPS(@RequestBody @Validated TerminalGpsVo vo) { - ServiceBody serviceBody = terminalGpsService.getReturnedGPS(vo); + public ResponseReult getReturnedTermGPS(@RequestBody @Validated TerminalGpsVo vo) { + ServiceBody serviceBody = terminalGpsService.getReturnedGPS(vo); if (serviceBody.getCode() == ServiceStatus.SUCCESS) { return ResponseReult.success(serviceBody.getData()); } else { diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalPhotoController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalPhotoController.java index db7659e..8757bb1 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalPhotoController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalPhotoController.java @@ -76,8 +76,8 @@ public class TerminalPhotoController extends BaseController { @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @RequestMapping("/selectPhotoTimeGet") @Log(title = "拍照时间表查询触发", type = "查询") - public ResponseReult selectPhotoTimeGet(@RequestBody @Validated TerminalPhotoTimeGetVo vo) { - ServiceBody serviceBody = terminalPhotoService.selectPhotoTimeGet(vo); + public ResponseReult selectPhotoTimeGet(@RequestBody @Validated TerminalPhotoTimeGetVo vo) { + ServiceBody serviceBody = terminalPhotoService.selectPhotoTimeGet(vo); if (serviceBody.getCode() == ServiceStatus.SUCCESS) { return ResponseReult.success(serviceBody.getData()); } else { @@ -155,8 +155,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 getPhotoQueryParamList(@RequestBody @Validated ReturnedPhotoParamsGetVo vo) { - ServiceBody serviceBody = terminalPhotoService.getPhotoQueryParam(vo); + public ResponseReult getPhotoQueryParamList(@RequestBody @Validated ReturnedPhotoParamsGetVo vo) { + ServiceBody serviceBody = terminalPhotoService.getPhotoQueryParam(vo); if (serviceBody.getCode() == ServiceStatus.SUCCESS) { return ResponseReult.success(serviceBody.getData()); } else { diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/constant/Constants.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/constant/Constants.java index 4af62ee..7fd7954 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/constant/Constants.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/constant/Constants.java @@ -1,6 +1,8 @@ package com.shxy.xymanager_common.constant; +import org.springframework.beans.factory.annotation.Value; + import java.util.concurrent.atomic.AtomicInteger; /** @@ -10,6 +12,14 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class Constants { + @Value("${cma.server}") + private static String server; + + @Value("${cma.port}") + private static int port; + + + /** * UTF-8 字符集 */ @@ -165,4 +175,7 @@ public class Constants * 调用JNI自增ID */ 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="; + } \ No newline at end of file diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/CmaBackModel.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/GetModel.java similarity index 50% rename from xymanager_common/src/main/java/com/shxy/xymanager_common/model/CmaBackModel.java rename to xymanager_common/src/main/java/com/shxy/xymanager_common/model/GetModel.java index 980a94d..993f2c4 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/CmaBackModel.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/GetModel.java @@ -5,16 +5,15 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.util.List; /** - * 所有杆塔列表 + * 设备ID触发查询信息 */ @Data -@ApiModel(value = "Cma返回信息", description = "Cma返回信息") -public class CmaBackModel implements Serializable { +@ApiModel(value = "触发查询信息", description = "触发查询信息") +public class GetModel implements Serializable { - @ApiModelProperty(value = "请求ID", example = "1233") + @ApiModelProperty(value = "请求ID", example = "123456") private Integer requestId; diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalIdModel.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalIdModel.java new file mode 100644 index 0000000..fef28c1 --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalIdModel.java @@ -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; + +} diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalStatusGetModel.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalStatusGetModel.java deleted file mode 100644 index 3dc97e0..0000000 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalStatusGetModel.java +++ /dev/null @@ -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; - - - -} diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/TerminalIdVo.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/TerminalIdVo.java index e397e69..dacb1bd 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/TerminalIdVo.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/TerminalIdVo.java @@ -17,7 +17,4 @@ public class TerminalIdVo { @ApiModelProperty(value = "图像监测装置 ID", example = "123455") private String cmdId; - - @ApiModelProperty(value = "请求 ID", example = "123455") - private Integer requestId; } diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/SystemConfigServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/SystemConfigServiceImpl.java index 28eb4ab..1bfa642 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/SystemConfigServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/SystemConfigServiceImpl.java @@ -7,10 +7,7 @@ import com.shxy.xymanager_common.dto.PhotoParamsDto; import com.shxy.xymanager_common.dto.UpperComputerInfoDto; import com.shxy.xymanager_common.entity.TerminalParams; import com.shxy.xymanager_common.exception.Asserts; -import com.shxy.xymanager_common.model.CmaBackModel; -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.model.*; import com.shxy.xymanager_common.util.ProcessExecUtils; import com.shxy.xymanager_common.util.StringUtils; import com.shxy.xymanager_common.vo.SystemConfigReqVo; @@ -40,14 +37,14 @@ public class SystemConfigServiceImpl implements SystemConfigService { @Override - public ServiceBody getSystemConfig(String cmdId) { + public ServiceBody getSystemConfig(String cmdId) { /* SystemConfigModel model = new SystemConfigModel(); Integer beatHeartTime = systemConfigDao.getTerminalParams(id); model.setHeartBeatTime(beatHeartTime); String globalTime = systemConfigDao.getGlobalTime(Constants.GLOBAL_TIME); model.setGlobalTime(Integer.parseInt(globalTime));*/ - CmaBackModel model = new CmaBackModel(); - 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; + GetModel model = new GetModel(); + String cmd = Constants.CMD+"sampling --clientid=10 --flag=0 --cmdid="+cmdId+ "\t"+"--reqid="+Constants.REQUEST_ID; ProcessExecUtils.exec(cmd); model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString())); Constants.REQUEST_ID.addAndGet(1); @@ -61,7 +58,7 @@ public class SystemConfigServiceImpl implements SystemConfigService { param.setHeartbeatTime(vo.getHeartBeatTime()); 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); return Asserts.success("修改成功"); } @@ -82,11 +79,13 @@ public class SystemConfigServiceImpl implements SystemConfigService { } @Override - public ServiceBody 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; + public ServiceBody upperComputerGet(String cmdId) { + GetModel model = new GetModel(); + String cmd = Constants.CMD+"cma --clientid=10 --flag=0 --cmdid="+cmdId+ "\t"+"--reqid="+Constants.REQUEST_ID; ProcessExecUtils.exec(cmd); + model.setRequestId(Integer.parseInt( Constants.REQUEST_ID.toString())); Constants.REQUEST_ID.addAndGet(1); - return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString())); + return Asserts.success(model); } @Override diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TermSetServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TermSetServiceImpl.java index e68c1fb..0100097 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TermSetServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TermSetServiceImpl.java @@ -34,14 +34,14 @@ public class TermSetServiceImpl implements TermSetService { @Override public ServiceBody 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); return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString())); } @Override public ServiceBody 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); return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString())); } diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalGpsServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalGpsServiceImpl.java index e8ec31a..739bc7a 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalGpsServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalGpsServiceImpl.java @@ -14,10 +14,7 @@ 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.model.*; import com.shxy.xymanager_common.page.PageUtils; import com.shxy.xymanager_common.util.MyDateUtils; import com.shxy.xymanager_common.util.ProcessExecUtils; @@ -79,7 +76,7 @@ public class TerminalGpsServiceImpl implements TerminalGpsService { } else { 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); if (set) { TerminalStatus record = new TerminalStatus(); @@ -107,24 +104,18 @@ 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(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) { return Asserts.success(model); @@ -135,10 +126,13 @@ public class TerminalGpsServiceImpl implements TerminalGpsService { } @Override - public ServiceBody 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; + public ServiceBody getReturnedGPS(TerminalGpsVo vo) { + GetModel model = new GetModel(); + String cmd = Constants.CMD+"gpsinfo --flag=0 --cmdid="+vo.getCmdId()+ "\t" +"--clientid=10 --reqid="+ Constants.REQUEST_ID; 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); } } diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java index 8081564..f68cc11 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java @@ -289,7 +289,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { public ServiceBody getLatestPhoto(TerminalPhotoVo vo) { /* Cma cma = new Cma(server, port);*/ 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); /* Boolean hasNew = cma.requestCapture(vo.getCmdid(), vo.getChannel(), vo.getPreset(), vo.getCaptureType());*/ return Asserts.success(now); @@ -404,7 +404,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { span1 = (short) 0; 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" + "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255"; ProcessExecUtils.exec(cmd); @@ -414,9 +414,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { } @Override - public ServiceBody getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) { - TerminalStatusGetModel model = new TerminalStatusGetModel(); - 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(); + public ServiceBody getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) { + GetModel model = new GetModel(); + 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); model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString())); Constants.REQUEST_ID.addAndGet(1); @@ -430,7 +430,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { @Override public ServiceBody 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(); ProcessExecUtils.exec(cmd); return Asserts.success("设置成功"); @@ -458,20 +458,22 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel(); if (StringUtils.isNotBlank(result)) { JSONObject resultObj = JSONObject.parseObject(result); - List resultDtoList = JSONArray.parseArray(resultObj.get("groupData").toString(), PhotoTimeResultDto.class); - List resultList = Lists.newArrayList(); - String startTimeStr = resultDtoList.get(0).getHour() + ":" + resultDtoList.get(0).getMinute() + ":00"; - String endTimeStr = resultDtoList.get(1).getHour() + ":" + resultDtoList.get(1).getMinute() + ":00"; - Date startTime = DateUtil.parseTime(startTimeStr); - Date endTime = DateUtil.parseTime(endTimeStr); - Integer span = resultDtoList.get(2).getHour() * 60 + resultDtoList.get(2).getMinute(); - List dateTimes = MyDateUtils.rangeToList(startTime, endTime, DateField.MINUTE, span); - for (DateTime data : dateTimes) { - String dateTime = DateUtil.formatTime(data); - resultList.add(dateTime); + if(null!=resultObj.get("groupData")) { + List resultDtoList = JSONArray.parseArray(resultObj.get("groupData").toString(), PhotoTimeResultDto.class); + List resultList = Lists.newArrayList(); + String startTimeStr = resultDtoList.get(0).getHour() + ":" + resultDtoList.get(0).getMinute() + ":00"; + String endTimeStr = resultDtoList.get(1).getHour() + ":" + resultDtoList.get(1).getMinute() + ":00"; + Date startTime = DateUtil.parseTime(startTimeStr); + Date endTime = DateUtil.parseTime(endTimeStr); + Integer span = resultDtoList.get(2).getHour() * 60 + resultDtoList.get(2).getMinute(); + List dateTimes = MyDateUtils.rangeToList(startTime, endTime, DateField.MINUTE, span); + for (DateTime data : dateTimes) { + String dateTime = DateUtil.formatTime(data); + resultList.add(dateTime); + } + model.setList(resultList); + model.setIsNew(true); } - model.setList(resultList); - model.setIsNew(true); } else { TerminalAndChannelIdVo idVo = new TerminalAndChannelIdVo(); BeanUtils.copyProperties(vo, idVo); @@ -482,9 +484,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { } @Override - public ServiceBody selectPhotoTimeGet(TerminalPhotoTimeGetVo vo) { - CmaBackModel model = new CmaBackModel(); - 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(); + public ServiceBody selectPhotoTimeGet(TerminalPhotoTimeGetVo vo) { + GetModel model = new GetModel(); + 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); Integer requestId = Integer.parseInt(Constants.REQUEST_ID.toString()); model.setRequestId(requestId); diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalServiceImpl.java index 86aa601..8322c33 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalServiceImpl.java @@ -4,12 +4,13 @@ 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 cn.hutool.core.date.DateUnit; 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.*; +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.Terminals; import com.shxy.xymanager_common.enums.CommonStatus; @@ -190,7 +191,7 @@ public class TerminalServiceImpl implements TerminalService { @Override public ServiceBody resetTerminal(String cmId) { // 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); // boolean reset = cma.reset(vo.getTermid().toString(), (short) 0x01); if (retCode == 0) { @@ -205,7 +206,7 @@ public class TerminalServiceImpl implements TerminalService { public ServiceBody getTerminalStatus(Integer termId) { TerminalStatusModel model = new TerminalStatusModel(); 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); /* TerminalModel model = new TerminalModel();*/ @@ -251,11 +252,9 @@ public class TerminalServiceImpl implements TerminalService { @Override public ServiceBody updateTerminalId(TerminalIdUpdateVo vo) { 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); - model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString())); model.setTermId(vo.getTermId()); - Constants.REQUEST_ID.addAndGet(1); if (retCode == 0) { int result = terminalsDao.updateCmd(vo); if (result > 0) { @@ -286,5 +285,26 @@ public class TerminalServiceImpl implements TerminalService { } return Asserts.success(model); } + + @Override + public ServiceBody 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 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); + } } diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/SystemConfigService.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/SystemConfigService.java index 5472a5d..cad042b 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/SystemConfigService.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/SystemConfigService.java @@ -1,13 +1,12 @@ package com.shxy.xymanager_service.service; 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.UpperComputerInfoModel; import com.shxy.xymanager_common.vo.SystemConfigReqVo; import com.shxy.xymanager_common.vo.SystemConfigVo; import com.shxy.xymanager_common.vo.TerminalUpperComputerVo; -import org.springframework.web.multipart.MultipartFile; /** * @@ -21,7 +20,7 @@ public interface SystemConfigService { * * @return */ - ServiceBody getSystemConfig(String id); + ServiceBody getSystemConfig(String id); /** @@ -39,7 +38,7 @@ public interface SystemConfigService { * * @return */ - ServiceBody upperComputerGet(String cmdId); + ServiceBody upperComputerGet(String cmdId); ServiceBody getUpperComputerInfo(TerminalUpperComputerVo vo); diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalGpsService.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalGpsService.java index 6141363..1d87be9 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalGpsService.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalGpsService.java @@ -1,6 +1,7 @@ package com.shxy.xymanager_service.service; 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.vo.*; @@ -26,6 +27,6 @@ public interface TerminalGpsService { */ ServiceBody getTermGPS(TerminalIdVo vo); - ServiceBody getReturnedGPS(TerminalGpsVo vo); + ServiceBody getReturnedGPS(TerminalGpsVo vo); } diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java index 62e4450..83e4ac1 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java @@ -69,7 +69,7 @@ public interface TerminalPhotoService { * * @return */ - ServiceBody getPhotoQueryParam(ReturnedPhotoParamsGetVo vo); + ServiceBody getPhotoQueryParam(ReturnedPhotoParamsGetVo vo); ServiceBody addOrUpdatePhotoParams(PhotoParamsVo vo); @@ -78,7 +78,7 @@ public interface TerminalPhotoService { ServiceBody selectPhotoTime(TerminalReqPhotoTimeVo vo); - ServiceBody selectPhotoTimeGet(TerminalPhotoTimeGetVo vo); + ServiceBody selectPhotoTimeGet(TerminalPhotoTimeGetVo vo); diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalService.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalService.java index 46117cd..07b4246 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalService.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalService.java @@ -69,5 +69,20 @@ public interface TerminalService { */ ServiceBody getTermListByChannel(TerminalChannelIdVo vo); + /** + * 根据通道编号触发查询装置ID + * + * @param vo + * @return + */ + ServiceBody terminalIdGet(TerminalIdUpdateVo vo); + + /** + * 根据请求ID查询装置ID + * + * @param requestId + * @return + */ + ServiceBody selectTerminalId(Integer requestId); }