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 5af280a..4d7c570 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,11 +5,11 @@ 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.LineListModel; import com.shxy.xymanager_common.model.SystemConfigModel; import com.shxy.xymanager_common.model.UpperComputerInfoModel; -import com.shxy.xymanager_common.vo.*; -import com.shxy.xymanager_service.service.LineService; +import com.shxy.xymanager_common.vo.SystemConfigReqVo; +import com.shxy.xymanager_common.vo.SystemConfigVo; +import com.shxy.xymanager_common.vo.TerminalUpperComputerVo; import com.shxy.xymanager_service.service.SystemConfigService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -88,8 +88,8 @@ public class SystemConfigController extends BaseController { @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @RequestMapping("/getUpperComputerInfo") @Log(title = "获取上位机信息", type = "查询") - public ResponseReult getUpperComputerInfo(@RequestParam("requestId") Integer requestId) { - ServiceBody serviceBody = configService.getUpperComputerInfo(requestId); + public ResponseReult getUpperComputerInfo(@RequestBody @Validated TerminalUpperComputerVo vo) { + ServiceBody serviceBody = configService.getUpperComputerInfo(vo); if (serviceBody.getCode() == ServiceStatus.SUCCESS) { return ResponseReult.success(serviceBody.getData()); } else { diff --git a/xymanager_admin/src/main/resources/application-test.yml b/xymanager_admin/src/main/resources/application-test.yml index 375f587..4e62ec3 100644 --- a/xymanager_admin/src/main/resources/application-test.yml +++ b/xymanager_admin/src/main/resources/application-test.yml @@ -2,9 +2,9 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/xymp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: xymp - password: Xymp@2023 + url: jdbc:mysql://127.0.0.1:13306/test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: 123456 type: com.alibaba.druid.pool.DruidDataSource #spring: # # 数据源配置 diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/dto/UpperComputerInfoDto.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/dto/UpperComputerInfoDto.java new file mode 100644 index 0000000..000ee4e --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/dto/UpperComputerInfoDto.java @@ -0,0 +1,18 @@ +package com.shxy.xymanager_common.dto; + +import lombok.Data; + +@Data +public class UpperComputerInfoDto { + + private Integer termId; + + private String cmdId; + + private String ip; + + private Short port; + + private String domain; + +} diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalStatus.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalStatus.java index ad2933c..fba674f 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalStatus.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalStatus.java @@ -28,15 +28,15 @@ public class TerminalStatus implements Serializable { private Integer gpsStatus; - private Byte connectionState; + private Integer connectionState; - private Byte signalStrength4g; + private Integer signalStrength4g; - private Byte signalStrength2g; + private Integer signalStrength2g; - private Byte remainingRam; + private Integer remainingRam; - private Byte remainingRom; + private Integer remainingRom; private BigInteger bootTime; diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/UpperComputerInfoModel.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/UpperComputerInfoModel.java index 374f659..5368a32 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/UpperComputerInfoModel.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/UpperComputerInfoModel.java @@ -14,7 +14,7 @@ import java.io.Serializable; public class UpperComputerInfoModel implements Serializable { @ApiModelProperty(value = "采集装置ID", example = "120") - private String termId; + private Integer termId; @ApiModelProperty(value = "监测装置ID", example = "120") private String cmdId; @@ -28,5 +28,8 @@ public class UpperComputerInfoModel implements Serializable { @ApiModelProperty(value = "上位机域名", example = "120") private String domain; + @ApiModelProperty(value = "是否最新", example = "120") + private Boolean isNew = false; + } diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/TerminalUpperComputerVo.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/TerminalUpperComputerVo.java new file mode 100644 index 0000000..ff8a8e4 --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/vo/TerminalUpperComputerVo.java @@ -0,0 +1,24 @@ +package com.shxy.xymanager_common.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.util.Date; + +@Data +@Validated +@ApiModel(value = "查询上位机信息对象", description = "查询上位机信息对象描述") +public class TerminalUpperComputerVo { + + @ApiModelProperty(value = "请求ID", example = "123455") + private Integer requestId; + + @ApiModelProperty(value = "装置编号", example = "123455") + private Integer termId; + + +} 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 aef8ebf..dd28590 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 @@ -1,6 +1,7 @@ package com.shxy.xymanager_dao.dao; import com.shxy.xymanager_common.dto.TerminalApkInfoDto; +import com.shxy.xymanager_common.dto.UpperComputerInfoDto; import com.shxy.xymanager_common.entity.TerminalParams; import com.shxy.xymanager_common.entity.TerminalUpload; import com.shxy.xymanager_common.vo.SystemConfigVo; @@ -16,4 +17,6 @@ public interface SystemConfigDao { void updateSystemConfig(TerminalParams vo); + UpperComputerInfoDto getUpperComputerInfo(Integer termId); + } \ No newline at end of file diff --git a/xymanager_dao/src/main/resources/mappers/SystemConfigDao.xml b/xymanager_dao/src/main/resources/mappers/SystemConfigDao.xml index d7a42ea..0ea56d5 100644 --- a/xymanager_dao/src/main/resources/mappers/SystemConfigDao.xml +++ b/xymanager_dao/src/main/resources/mappers/SystemConfigDao.xml @@ -29,4 +29,13 @@ where id = #{termId} + + \ No newline at end of file diff --git a/xymanager_dao/src/main/resources/mappers/TerminalPhotoDao.xml b/xymanager_dao/src/main/resources/mappers/TerminalPhotoDao.xml index 2baccaf..dd17224 100644 --- a/xymanager_dao/src/main/resources/mappers/TerminalPhotoDao.xml +++ b/xymanager_dao/src/main/resources/mappers/TerminalPhotoDao.xml @@ -285,7 +285,7 @@ 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 62b26ac..f6b9727 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 @@ -4,6 +4,7 @@ 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.dto.UpperComputerInfoDto; import com.shxy.xymanager_common.entity.TerminalParams; import com.shxy.xymanager_common.exception.Asserts; import com.shxy.xymanager_common.model.SystemConfigModel; @@ -13,6 +14,7 @@ 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.TerminalUpperComputerVo; import com.shxy.xymanager_dao.dao.SystemConfigDao; import com.shxy.xymanager_dao.dao.TerminalPhotoDao; import com.shxy.xymanager_service.service.SystemConfigService; @@ -66,7 +68,7 @@ public class SystemConfigServiceImpl implements SystemConfigService { @Override public ServiceBody getSystemConfigDetail(SystemConfigReqVo vo) { - String result = terminalPhotoDao.getRequestResult(vo.getRequestId()); + String result = terminalPhotoDao.getRequestResult(5);//待修改 SystemConfigModel model = new SystemConfigModel(); if(StringUtils.isNotBlank(result)) { JSONObject resultObj = JSONObject.parseObject(result); @@ -89,14 +91,15 @@ public class SystemConfigServiceImpl implements SystemConfigService { } @Override - public ServiceBody getUpperComputerInfo(Integer requestId) { - String result = terminalPhotoDao.getRequestResult(requestId); + public ServiceBody getUpperComputerInfo(TerminalUpperComputerVo vo) { + String result = terminalPhotoDao.getRequestResult(5);//待修改 UpperComputerInfoModel model = new UpperComputerInfoModel(); if(StringUtils.isNotBlank(result)) { - JSONObject resultObj = JSONObject.parseObject(result); - model = JSONObject.parseObject(resultObj.get("groupData").toString(), UpperComputerInfoModel.class); + model = JSONObject.parseObject(result, UpperComputerInfoModel.class); + model.setIsNew(true); }else{ - + UpperComputerInfoDto dto = systemConfigDao.getUpperComputerInfo(vo.getTermId()); + BeanUtils.copyProperties(dto,model); } return Asserts.success(model); } 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 8b278a3..e8ec31a 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 @@ -107,11 +107,10 @@ 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(vo.getRequestId()); + String result = terminalPhotoDao.getRequestResult(5);//待修改 DateTime now = DateTime.now(); if(StringUtils.isNotBlank(result)) { - JSONObject resultObj = JSONObject.parseObject(result); - model = JSONObject.parseObject(resultObj.get("groupData").toString(), TerminalGpsModel.class); + model = JSONObject.parseObject(result, TerminalGpsModel.class); }else { TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(vo.getTermid()); 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 3cd21b3..ab887bb 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 @@ -397,7 +397,7 @@ 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+"--flag=1 --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); model.setRequestId(Constants.REQUEST_ID.addAndGet(1)); /* TerminalPhotosParamsModel model = new TerminalPhotosParamsModel(); @@ -410,24 +410,18 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { @Override public ServiceBody addOrUpdatePhotoParams(PhotoParamsVo vo) { - Integer result = terminalPhotoDao.updateOrInsertParams(vo); - if (result>0) { - 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" - + "--luminance=" + vo.getLuminance() + "\t" + "-contrast=" + vo.getContrast() + "\t" + "--saturation=" + vo.getSaturation() + "\t" + "--reqid=" + Constants.REQUEST_ID + "\t" + "--channel=" + vo.getChannelId(); - ProcessExecUtils.exec(cmd); - return Asserts.success(Constants.REQUEST_ID.addAndGet(1)); - } - - return Asserts.error("更新失败"); - } + 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" + + "--luminance=" + vo.getLuminance() + "\t" + "-contrast=" + vo.getContrast() + "\t" + "--saturation=" + vo.getSaturation() + "\t" + "--channel=" + vo.getChannelId(); + ProcessExecUtils.exec(cmd); + return Asserts.success(Constants.REQUEST_ID.addAndGet(1)); + } @Override public ServiceBody getLastedPhotoQueryParam(ReturnedPhotoParamsVo vo) { - String result = terminalPhotoDao.getRequestResult(vo.getRequestId()); + String result = terminalPhotoDao.getRequestResult(5);//待修改 TerminalPhotosParamsModel model = new TerminalPhotosParamsModel(); if (StringUtils.isNotBlank(result)) { - JSONObject resultObj = JSONObject.parseObject(result); - model = JSONObject.parseObject(resultObj.get("groupData").toString(), TerminalPhotosParamsModel.class); + model = JSONObject.parseObject(result, TerminalPhotosParamsModel.class); model.setIsNew(true); } else { PhotoParamsDto dto = terminalPhotoDao.selectPhotoParams(vo); @@ -440,7 +434,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { @Override public ServiceBody selectPhotoTime(TerminalReqPhotoTimeVo vo) { - String result = terminalPhotoDao.getRequestResult(vo.getRequestId()); + String result = terminalPhotoDao.getRequestResult(5);//待修改 TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel(); if (StringUtils.isNotBlank(result)) { JSONObject resultObj = JSONObject.parseObject(result); 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 fa2313c..c09d31f 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 @@ -205,7 +205,7 @@ public class TerminalServiceImpl implements TerminalService { public ServiceBody getTerminalStatus(Integer termId) { TerminalStatusGetModel model = new TerminalStatusGetModel(); String cmdId = terminalsDao.getCmdIdByTermId(termId); - String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --act=runningstatus --clientid=10 --cmdid=" + cmdId + "\t" + "--reqid==" + Constants.REQUEST_ID; + String cmd = "/usr/local/bin/xympadmn --server=127.0.0.1 --port=6891 --flag=0 --act=runningstatus --clientid=10 --cmdid=" + cmdId + "\t" + "--reqid==" + Constants.REQUEST_ID; ProcessExecUtils.exec(cmd); /* TerminalModel model = new TerminalModel();*/ @@ -224,11 +224,10 @@ public class TerminalServiceImpl implements TerminalService { @Override public ServiceBody getLastedTerminalStatus(TerminalStatusVo vo) { - String result = terminalPhotoDao.getRequestResult(vo.getRequestId()); + String result = terminalPhotoDao.getRequestResult(5);//待修改 TerminalModel model = new TerminalModel(); if (StringUtils.isNotBlank(result)) { - JSONObject resultObj = JSONObject.parseObject(result); - model = JSONObject.parseObject(resultObj.get("groupData").toString(), TerminalModel.class); + model = JSONObject.parseObject(result, TerminalModel.class); model.setIsNew(true); } else { TerminalInfoDto dto = terminalsDao.getTerminalInfo(vo.getTermId()); 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 52ee94a..718d58b 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 @@ -5,6 +5,7 @@ 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; /** @@ -39,6 +40,6 @@ public interface SystemConfigService { */ ServiceBody upperComputerGet(String cmdId); - ServiceBody getUpperComputerInfo(Integer requestId); + ServiceBody getUpperComputerInfo(TerminalUpperComputerVo vo); }