From e0db4ee6d09b39c3db4b6a50afb68336d60ac3b6 Mon Sep 17 00:00:00 2001 From: 18616268358 <1440265357@qq.com> Date: Mon, 15 May 2023 14:15:41 +0800 Subject: [PATCH] =?UTF-8?q?#20230510=20=E6=AC=A3=E5=BD=B1=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=B9=B3=E5=8F=B0=E8=A3=85=E7=BD=AE=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SystemConfigController.java | 10 ++++---- .../src/main/resources/application-test.yml | 6 ++--- .../dto/UpperComputerInfoDto.java | 18 ++++++++++++++ .../model/UpperComputerInfoModel.java | 5 +++- .../vo/TerminalUpperComputerVo.java | 24 +++++++++++++++++++ .../xymanager_dao/dao/SystemConfigDao.java | 3 +++ .../resources/mappers/SystemConfigDao.xml | 9 +++++++ .../resources/mappers/TerminalPhotoDao.xml | 2 +- .../resources/mappers/TerminalStatusDao.xml | 2 +- .../impl/SystemConfigServiceImpl.java | 10 +++++--- .../impl/TerminalPhotoServiceImpl.java | 3 +-- .../impl/TerminalServiceImpl.java | 3 +-- .../service/SystemConfigService.java | 3 ++- 13 files changed, 79 insertions(+), 19 deletions(-) create mode 100644 xymanager_common/src/main/java/com/shxy/xymanager_common/dto/UpperComputerInfoDto.java create mode 100644 xymanager_common/src/main/java/com/shxy/xymanager_common/vo/TerminalUpperComputerVo.java 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/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_dao/src/main/resources/mappers/TerminalStatusDao.xml b/xymanager_dao/src/main/resources/mappers/TerminalStatusDao.xml index 5ac06f1..329b5ed 100644 --- a/xymanager_dao/src/main/resources/mappers/TerminalStatusDao.xml +++ b/xymanager_dao/src/main/resources/mappers/TerminalStatusDao.xml @@ -28,7 +28,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..1830059 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; @@ -89,14 +91,16 @@ 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(vo.getRequestId()); UpperComputerInfoModel model = new UpperComputerInfoModel(); if(StringUtils.isNotBlank(result)) { JSONObject resultObj = JSONObject.parseObject(result); model = JSONObject.parseObject(resultObj.get("groupData").toString(), 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/TerminalPhotoServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java index 3cd21b3..5a9752a 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 @@ -426,8 +426,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { String result = terminalPhotoDao.getRequestResult(vo.getRequestId()); 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); 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..5558f41 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 @@ -227,8 +227,7 @@ public class TerminalServiceImpl implements TerminalService { String result = terminalPhotoDao.getRequestResult(vo.getRequestId()); 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); }