#20230510 欣影管理平台装置信息查询代码

jni
18616268358 2 years ago
parent 6ec7a4fb97
commit d67ee0b13f

@ -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.CmaBackModel;
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;
@ -36,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<Integer> getSystemConfigGet(@RequestParam("id") String id) { public ResponseReult<CmaBackModel> getSystemConfigGet(@RequestParam("id") String id) {
ServiceBody<Integer> serviceBody = configService.getSystemConfig(id); ServiceBody<CmaBackModel> 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 {

@ -164,5 +164,5 @@ public class Constants
/** /**
* JNIID * JNIID
*/ */
public static AtomicInteger REQUEST_ID = new AtomicInteger(1); public static AtomicInteger REQUEST_ID = new AtomicInteger((int) (System.currentTimeMillis()/1000));
} }

@ -20,6 +20,6 @@ public class TerminalScheduleRuleTimeListModel implements Serializable {
@ApiModelProperty(value = "是否最新", example = "123456") @ApiModelProperty(value = "是否最新", example = "123456")
private Boolean isNew; private Boolean isNew = false;
} }

@ -7,6 +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.SystemConfigModel; import com.shxy.xymanager_common.model.SystemConfigModel;
import com.shxy.xymanager_common.model.TerminalPhotosParamsModel; import com.shxy.xymanager_common.model.TerminalPhotosParamsModel;
import com.shxy.xymanager_common.model.UpperComputerInfoModel; import com.shxy.xymanager_common.model.UpperComputerInfoModel;
@ -39,16 +40,18 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Override @Override
public ServiceBody<Integer> getSystemConfig(String cmdId) { public ServiceBody<CmaBackModel> 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();
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 = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --clientid=10 --act=sampling --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
@ -59,20 +62,16 @@ public class SystemConfigServiceImpl implements SystemConfigService {
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 = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=sampling --cmdid="+vo.getCmdId()+ "\t"+ "--heartbeat=" + vo.getHeartBeatTime();
Integer retCode = ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
if(retCode==0){
return Asserts.success("修改成功"); return Asserts.success("修改成功");
} }
return Asserts.error("修改失败");
}
@Override @Override
public ServiceBody<SystemConfigModel> getSystemConfigDetail(SystemConfigReqVo vo) { public ServiceBody<SystemConfigModel> getSystemConfigDetail(SystemConfigReqVo vo) {
String result = terminalPhotoDao.getRequestResult(5);//待修改 String result = terminalPhotoDao.getRequestResult(vo.getRequestId());//待修改
SystemConfigModel model = new SystemConfigModel(); SystemConfigModel model = new SystemConfigModel();
if(StringUtils.isNotBlank(result)) { if(StringUtils.isNotBlank(result)) {
JSONObject resultObj = JSONObject.parseObject(result); model = JSONObject.parseObject(result, SystemConfigModel.class);
model = JSONObject.parseObject(resultObj.get("groupData").toString(), SystemConfigModel.class);
}else{ }else{
Integer beatHeartTime = systemConfigDao.getTerminalParams(Constants.GLOBAL_TIME); Integer beatHeartTime = systemConfigDao.getTerminalParams(Constants.GLOBAL_TIME);
model.setHeartBeatTime(beatHeartTime); model.setHeartBeatTime(beatHeartTime);
@ -92,7 +91,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Override @Override
public ServiceBody<UpperComputerInfoModel> getUpperComputerInfo(TerminalUpperComputerVo vo) { public ServiceBody<UpperComputerInfoModel> getUpperComputerInfo(TerminalUpperComputerVo vo) {
String result = terminalPhotoDao.getRequestResult(5);//待修改 String result = terminalPhotoDao.getRequestResult(vo.getRequestId());//待修改
UpperComputerInfoModel model = new UpperComputerInfoModel(); UpperComputerInfoModel model = new UpperComputerInfoModel();
if(StringUtils.isNotBlank(result)) { if(StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, UpperComputerInfoModel.class); model = JSONObject.parseObject(result, UpperComputerInfoModel.class);

@ -399,7 +399,8 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
TerminalStatusGetModel model = new TerminalStatusGetModel(); 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(); 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();
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
model.setRequestId(Constants.REQUEST_ID.addAndGet(1)); model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1);
/* TerminalPhotosParamsModel model = new TerminalPhotosParamsModel(); /* TerminalPhotosParamsModel model = new TerminalPhotosParamsModel();
PhotoParamsDto dto= terminalPhotoDao.selectPhotoParams(termId); PhotoParamsDto dto= terminalPhotoDao.selectPhotoParams(termId);
if(dto!=null) { if(dto!=null) {
@ -418,7 +419,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Override @Override
public ServiceBody<TerminalPhotosParamsModel> getLastedPhotoQueryParam(ReturnedPhotoParamsVo vo) { public ServiceBody<TerminalPhotosParamsModel> getLastedPhotoQueryParam(ReturnedPhotoParamsVo vo) {
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());//待修改 String result = terminalPhotoDao.getRequestResult(vo.getRequestId());
TerminalPhotosParamsModel model = new TerminalPhotosParamsModel(); TerminalPhotosParamsModel model = new TerminalPhotosParamsModel();
if (StringUtils.isNotBlank(result)) { if (StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, TerminalPhotosParamsModel.class); model = JSONObject.parseObject(result, TerminalPhotosParamsModel.class);

@ -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.CmaBackModel;
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;
@ -20,7 +21,7 @@ public interface SystemConfigService {
* *
* @return * @return
*/ */
ServiceBody<Integer> getSystemConfig(String id); ServiceBody<CmaBackModel> getSystemConfig(String id);
/** /**

Loading…
Cancel
Save