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 242a818..2a1f2c5 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 @@ -31,12 +31,25 @@ public class SystemConfigController extends BaseController { @Autowired 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 getSystemConfigGet(@RequestParam("id") String id) { + ServiceBody 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") @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @RequestMapping("/getSystemConfig") - @Log(title = "获取线路列表", type = "查询") - public ResponseReult getSystemConfig(@RequestParam("id") String id) { - ServiceBody serviceBody = configService.getSystemConfig(id); + @Log(title = "获取全局配置", type = "查询") + public ResponseReult getSystemConfig(@RequestBody @Validated SystemConfigReqVo vo) { + ServiceBody serviceBody = configService.getSystemConfigDetail(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 169a316..0581f94 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 @@ -75,8 +75,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 TerminalReqPhotoTimeVo vo) { - ServiceBody serviceBody = terminalPhotoService.selectPhotoTimeGet(vo); + public ResponseReult selectPhotoTimeGet(@RequestBody @Validated TerminalReqPhotoTimeVo vo) { + ServiceBody serviceBody = terminalPhotoService.selectPhotoTimeGet(vo); if (serviceBody.getCode() == ServiceStatus.SUCCESS) { return ResponseReult.success(serviceBody.getData()); } else { diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalScheduleRuleTimeListModel.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalScheduleRuleTimeListModel.java index 0fc8be7..e073399 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalScheduleRuleTimeListModel.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/TerminalScheduleRuleTimeListModel.java @@ -18,4 +18,8 @@ public class TerminalScheduleRuleTimeListModel implements Serializable { @ApiModelProperty(value = "任务名称", example = "123456") private List list; + + @ApiModelProperty(value = "是否最新", example = "123456") + private Boolean isNew; + } diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/SystemConfigReqVo.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/SystemConfigReqVo.java new file mode 100644 index 0000000..6eccbce --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/SystemConfigReqVo.java @@ -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; + + +} diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/SystemConfigVo.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/SystemConfigVo.java index ca5f523..fbe2927 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/SystemConfigVo.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/SystemConfigVo.java @@ -15,6 +15,10 @@ public class SystemConfigVo { @ApiModelProperty(value = "通道ID", example = "123455") private Integer termId; + @NotNull(message = "装置ID") + @ApiModelProperty(value = "装置ID", example = "123455") + private Integer cmdId; + @NotNull(message = "参数值") @ApiModelProperty(value = "参数值", example = "123455") private Integer heartBeatTime; diff --git a/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/SystemConfigDao.java b/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/SystemConfigDao.java index 8c13f5d..aef8ebf 100644 --- a/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/SystemConfigDao.java +++ b/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/SystemConfigDao.java @@ -12,7 +12,7 @@ public interface SystemConfigDao { Integer getTerminalParams(String id); - String getGlobalTime(String key); + String getGlobalTime(Integer key); void updateSystemConfig(TerminalParams vo); diff --git a/xymanager_dao/src/main/resources/mappers/SystemConfigDao.xml b/xymanager_dao/src/main/resources/mappers/SystemConfigDao.xml index 9ac496c..d7a42ea 100644 --- a/xymanager_dao/src/main/resources/mappers/SystemConfigDao.xml +++ b/xymanager_dao/src/main/resources/mappers/SystemConfigDao.xml @@ -12,7 +12,7 @@ where param_name = #{key,jdbcType=VARCHAR} - select heartbeat_time as heartbeatTime from terminal_params 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 b051677..d6a93dc 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 @@ -1,14 +1,22 @@ package com.shxy.xymanager_service.impl; +import com.alibaba.fastjson.JSONObject; import com.shxy.xymanager_common.bean.ServiceBody; 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.exception.Asserts; 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_dao.dao.SystemConfigDao; +import com.shxy.xymanager_dao.dao.TerminalPhotoDao; import com.shxy.xymanager_service.service.SystemConfigService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -23,15 +31,21 @@ public class SystemConfigServiceImpl implements SystemConfigService { @Autowired SystemConfigDao systemConfigDao; + @Autowired + TerminalPhotoDao terminalPhotoDao; + + @Override - public ServiceBody getSystemConfig(String id) { - SystemConfigModel model = new SystemConfigModel(); + 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)); - String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=termid --cmdid=DSH10H00000000001 --flag=0"; - return Asserts.success(model); + model.setGlobalTime(Integer.parseInt(globalTime));*/ + String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --act=sampling --flag=0 --cmdid="+cmdId+ "\t"+"--reqid="+Constants.REQUEST_ID; + ProcessExecUtils.exec(cmd); + Constants.REQUEST_ID.addAndGet(1); + return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString())); } @Override @@ -40,7 +54,28 @@ public class SystemConfigServiceImpl implements SystemConfigService { param.setTermId(vo.getTermId()); param.setHeartbeatTime(vo.getHeartBeatTime()); 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 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); } } 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 27ca78f..d8d63d8 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 @@ -452,6 +452,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { resultList.add(dateTime); } model.setList(resultList); + model.setIsNew(true); }else { TerminalAndChannelIdVo idVo = new TerminalAndChannelIdVo(); BeanUtils.copyProperties(vo,idVo); @@ -462,10 +463,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { } @Override - public ServiceBody 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"; + public ServiceBody selectPhotoTimeGet(TerminalReqPhotoTimeVo 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"; ProcessExecUtils.exec(cmd); - return Asserts.success("操作成功"); + return Asserts.success(Integer.parseInt(Constants.REQUEST_ID.toString())); } 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 bb3404b..15ca055 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 @@ -2,6 +2,7 @@ package com.shxy.xymanager_service.service; import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.model.SystemConfigModel; +import com.shxy.xymanager_common.vo.SystemConfigReqVo; import com.shxy.xymanager_common.vo.SystemConfigVo; import org.springframework.web.multipart.MultipartFile; @@ -17,7 +18,7 @@ public interface SystemConfigService { * * @return */ - ServiceBody getSystemConfig(String id); + ServiceBody getSystemConfig(String id); /** @@ -27,4 +28,7 @@ public interface SystemConfigService { */ ServiceBody updateSystemConfig(SystemConfigVo vo); + + ServiceBody getSystemConfigDetail(SystemConfigReqVo 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 d64ee41..e6eff87 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 @@ -4,6 +4,7 @@ import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.entity.TerminalPhoto; import com.shxy.xymanager_common.model.*; import com.shxy.xymanager_common.vo.*; +import io.swagger.models.auth.In; import java.util.Date; @@ -77,7 +78,7 @@ public interface TerminalPhotoService { ServiceBody selectPhotoTime(TerminalReqPhotoTimeVo vo); - ServiceBody selectPhotoTimeGet(TerminalReqPhotoTimeVo vo); + ServiceBody selectPhotoTimeGet(TerminalReqPhotoTimeVo vo);