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

jni
18616268358 2 years ago
parent 3306be9b64
commit dce66641d5

@ -31,12 +31,25 @@ public class SystemConfigController extends BaseController {
@Autowired @Autowired
SystemConfigService configService; SystemConfigService configService;
@ApiOperation(value = "获取全局配置触发", notes = "获取全局配置触发接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getSystemConfigGet")
@Log(title = "获取全局配置触发接口", type = "查询")
public ResponseReult<Integer> getSystemConfigGet(@RequestParam("id") String id) {
ServiceBody<Integer> serviceBody = configService.getSystemConfig(id);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
@ApiOperation(value = "获取全局配置", notes = "获取全局配置表接口", httpMethod = "POST") @ApiOperation(value = "获取全局配置", notes = "获取全局配置表接口", 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("/getSystemConfig") @RequestMapping("/getSystemConfig")
@Log(title = "获取线路列表", type = "查询") @Log(title = "获取全局配置", type = "查询")
public ResponseReult<SystemConfigModel> getSystemConfig(@RequestParam("id") String id) { public ResponseReult<SystemConfigModel> getSystemConfig(@RequestBody @Validated SystemConfigReqVo vo) {
ServiceBody<SystemConfigModel> serviceBody = configService.getSystemConfig(id); ServiceBody<SystemConfigModel> serviceBody = configService.getSystemConfigDetail(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {

@ -75,8 +75,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<String> selectPhotoTimeGet(@RequestBody @Validated TerminalReqPhotoTimeVo vo) { public ResponseReult<Integer> selectPhotoTimeGet(@RequestBody @Validated TerminalReqPhotoTimeVo vo) {
ServiceBody<String> serviceBody = terminalPhotoService.selectPhotoTimeGet(vo); ServiceBody<Integer> 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 {

@ -18,4 +18,8 @@ public class TerminalScheduleRuleTimeListModel implements Serializable {
@ApiModelProperty(value = "任务名称", example = "123456") @ApiModelProperty(value = "任务名称", example = "123456")
private List<String> list; private List<String> list;
@ApiModelProperty(value = "是否最新", example = "123456")
private Boolean isNew;
} }

@ -0,0 +1,26 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "通道对象", description = "通道对象描述")
public class SystemConfigReqVo {
@NotNull(message = "通道ID")
@ApiModelProperty(value = "通道ID", example = "123455")
private Integer termId;
@NotNull(message = "装置ID")
@ApiModelProperty(value = "装置ID", example = "123455")
private Integer cmdId;
@NotNull(message = "请求ID")
@ApiModelProperty(value = "请求ID", example = "123455")
private Integer requestId;
}

@ -15,6 +15,10 @@ public class SystemConfigVo {
@ApiModelProperty(value = "通道ID", example = "123455") @ApiModelProperty(value = "通道ID", example = "123455")
private Integer termId; private Integer termId;
@NotNull(message = "装置ID")
@ApiModelProperty(value = "装置ID", example = "123455")
private Integer cmdId;
@NotNull(message = "参数值") @NotNull(message = "参数值")
@ApiModelProperty(value = "参数值", example = "123455") @ApiModelProperty(value = "参数值", example = "123455")
private Integer heartBeatTime; private Integer heartBeatTime;

@ -12,7 +12,7 @@ public interface SystemConfigDao {
Integer getTerminalParams(String id); Integer getTerminalParams(String id);
String getGlobalTime(String key); String getGlobalTime(Integer key);
void updateSystemConfig(TerminalParams vo); void updateSystemConfig(TerminalParams vo);

@ -12,7 +12,7 @@
where param_name = #{key,jdbcType=VARCHAR} where param_name = #{key,jdbcType=VARCHAR}
</select> </select>
<select id="getGlobalTime" parameterType="java.lang.String"> <select id="getGlobalTime" parameterType="java.lang.Integer">
select select
heartbeat_time as heartbeatTime heartbeat_time as heartbeatTime
from terminal_params from terminal_params

@ -1,14 +1,22 @@
package com.shxy.xymanager_service.impl; package com.shxy.xymanager_service.impl;
import com.alibaba.fastjson.JSONObject;
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.PhotoParamsDto;
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.SystemConfigModel; import com.shxy.xymanager_common.model.SystemConfigModel;
import com.shxy.xymanager_common.model.TerminalPhotosParamsModel;
import com.shxy.xymanager_common.util.ProcessExecUtils;
import com.shxy.xymanager_common.util.StringUtils;
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_dao.dao.SystemConfigDao; import com.shxy.xymanager_dao.dao.SystemConfigDao;
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
import com.shxy.xymanager_service.service.SystemConfigService; import com.shxy.xymanager_service.service.SystemConfigService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -23,15 +31,21 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Autowired @Autowired
SystemConfigDao systemConfigDao; SystemConfigDao systemConfigDao;
@Autowired
TerminalPhotoDao terminalPhotoDao;
@Override @Override
public ServiceBody<SystemConfigModel> getSystemConfig(String id) { public ServiceBody<Integer> 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));*/
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=termid --cmdid=DSH10H00000000001 --flag=0"; String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=sampling --flag=0 --cmdid="+cmdId+ "\t"+"--reqid="+Constants.REQUEST_ID;
return Asserts.success(model); ProcessExecUtils.exec(cmd);
Constants.REQUEST_ID.addAndGet(1);
return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString()));
} }
@Override @Override
@ -40,7 +54,28 @@ public class SystemConfigServiceImpl implements SystemConfigService {
param.setTermId(vo.getTermId()); param.setTermId(vo.getTermId());
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=termid --cmdid=DSH10H00000000001 --newcmdid=DSH10H00000000002";
return null; 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);
if(retCode==0){
return Asserts.success("修改成功");
}
return Asserts.error("修改失败");
}
@Override
public ServiceBody<SystemConfigModel> getSystemConfigDetail(SystemConfigReqVo vo) {
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());
SystemConfigModel model = new SystemConfigModel();
if(StringUtils.isNotBlank(result)) {
JSONObject resultObj = JSONObject.parseObject(result);
model = JSONObject.parseObject(resultObj.get("groupData").toString(), SystemConfigModel.class);
}else{
Integer beatHeartTime = systemConfigDao.getTerminalParams(Constants.GLOBAL_TIME);
model.setHeartBeatTime(beatHeartTime);
String globalTime = systemConfigDao.getGlobalTime(vo.getTermId());
model.setGlobalTime(Integer.parseInt(globalTime));
}
return Asserts.success(model);
} }
} }

@ -452,6 +452,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
resultList.add(dateTime); resultList.add(dateTime);
} }
model.setList(resultList); model.setList(resultList);
model.setIsNew(true);
}else { }else {
TerminalAndChannelIdVo idVo = new TerminalAndChannelIdVo(); TerminalAndChannelIdVo idVo = new TerminalAndChannelIdVo();
BeanUtils.copyProperties(vo,idVo); BeanUtils.copyProperties(vo,idVo);
@ -462,10 +463,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
} }
@Override @Override
public ServiceBody<String> selectPhotoTimeGet(TerminalReqPhotoTimeVo vo) { public ServiceBody<Integer> selectPhotoTimeGet(TerminalReqPhotoTimeVo vo) {
String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=imgparams --cmdid="+vo.getCmdId()+ "\t" + "--reqid="+vo.getRequestId()+ "\t"+ "--clientid=10--flag=1 --rf=7"; 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";
ProcessExecUtils.exec(cmd); ProcessExecUtils.exec(cmd);
return Asserts.success("操作成功"); return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString()));
} }

@ -2,6 +2,7 @@ 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.SystemConfigModel; import com.shxy.xymanager_common.model.SystemConfigModel;
import com.shxy.xymanager_common.vo.SystemConfigReqVo;
import com.shxy.xymanager_common.vo.SystemConfigVo; import com.shxy.xymanager_common.vo.SystemConfigVo;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -17,7 +18,7 @@ public interface SystemConfigService {
* *
* @return * @return
*/ */
ServiceBody<SystemConfigModel> getSystemConfig(String id); ServiceBody<Integer> getSystemConfig(String id);
/** /**
@ -27,4 +28,7 @@ public interface SystemConfigService {
*/ */
ServiceBody updateSystemConfig(SystemConfigVo vo); ServiceBody updateSystemConfig(SystemConfigVo vo);
ServiceBody<SystemConfigModel> getSystemConfigDetail(SystemConfigReqVo vo);
} }

@ -4,6 +4,7 @@ import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.entity.TerminalPhoto; import com.shxy.xymanager_common.entity.TerminalPhoto;
import com.shxy.xymanager_common.model.*; import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import io.swagger.models.auth.In;
import java.util.Date; import java.util.Date;
@ -77,7 +78,7 @@ public interface TerminalPhotoService {
ServiceBody<TerminalScheduleRuleTimeListModel> selectPhotoTime(TerminalReqPhotoTimeVo vo); ServiceBody<TerminalScheduleRuleTimeListModel> selectPhotoTime(TerminalReqPhotoTimeVo vo);
ServiceBody<String> selectPhotoTimeGet(TerminalReqPhotoTimeVo vo); ServiceBody<Integer> selectPhotoTimeGet(TerminalReqPhotoTimeVo vo);

Loading…
Cancel
Save