diff --git a/hzims-service-api/equipment-api/pom.xml b/hzims-service-api/equipment-api/pom.xml index 3e0cc5f..b8e379c 100644 --- a/hzims-service-api/equipment-api/pom.xml +++ b/hzims-service-api/equipment-api/pom.xml @@ -26,8 +26,7 @@ org.springblade blade-system-api - 4.5.3.RELEASE - compile + 4.5.8-SNAPSHOT diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java index bc4aa8d..b8ace93 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java @@ -202,4 +202,11 @@ public class EmInfoEntity extends TenantEntity { @Range(min = 0, max = 1, message = "值必须在0到1之间") private String homePageDisplay; + @ApiModelProperty("设备序号") + private Integer emIndex; + + @ApiModelProperty("设备实例化Id") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Long deviceInstanceId; + } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java new file mode 100644 index 0000000..7227cc2 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.fdp.feign; + +import com.hnac.hzims.EquipmentConstants; +import io.swagger.annotations.ApiParam; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/20 10:17 + */ +@FeignClient(value = EquipmentConstants.APP_NAME,fallback = QuestionClientFallback.class) +public interface IQuestionClient { + + String API_PREFIX = "/feign/fdp/question"; + String SUBMIT_STATION_INFO = API_PREFIX + "/submitStationInfo"; + + /** + * 提交站点信息 + * @param stationCode 站点编码 + * @param stationDesc 站点描述 + * @return + */ + @GetMapping(SUBMIT_STATION_INFO) + R submitStationInfo(@RequestParam String stationCode, @RequestParam(required = false) String stationDesc); + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java new file mode 100644 index 0000000..2be9c95 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.fdp.feign; + +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Component; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/20 10:19 + */ +@Component +public class QuestionClientFallback implements IQuestionClient { + + + @Override + public R submitStationInfo(String stationCode, String stationDesc) { + return R.fail("智能诊断提交站点失败!"); + } +} diff --git a/hzims-service-api/hzims-operational-api/pom.xml b/hzims-service-api/hzims-operational-api/pom.xml index 8e5eb61..323eebf 100644 --- a/hzims-service-api/hzims-operational-api/pom.xml +++ b/hzims-service-api/hzims-operational-api/pom.xml @@ -58,7 +58,7 @@ com.hnac.hzinfo.data hzinfo-data-sdk - 4.6.0-SNAPSHOT + ${hzinfo.data.version} @@ -69,7 +69,7 @@ org.springblade blade-system-api - 4.5.8.RELEASE + 4.5.8-SNAPSHOT diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/FocusAttributeEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/FocusAttributeEntity.java index 8274fb7..73811f6 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/FocusAttributeEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/FocusAttributeEntity.java @@ -33,6 +33,10 @@ public class FocusAttributeEntity extends TenantEntity implements Serializable @QueryField(condition = SqlCondition.LIKE) private String groupName; + @ApiModelProperty("模型名称ID") + @QueryField(condition = SqlCondition.EQUAL) + private Long modelId; + @ApiModelProperty("厂站类型ID") @QueryField(condition = SqlCondition.EQUAL) private Integer domainId; @@ -70,4 +74,7 @@ public class FocusAttributeEntity extends TenantEntity implements Serializable @ApiModelProperty("监测点映射标识") private String signage; + + @ApiModelProperty("物模型属性名称") + private String signageName; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java index e7bba75..f487fcc 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java @@ -8,6 +8,19 @@ public interface StationConstants { //自动添加或修改机构数据 String TASK_VALUE_IMS_DEPT_CREATE = "imsDeptCreate"; + enum DeptCategoryEnum { + STATION(4,"站点") + ; + @Getter + private Integer value; + private String describe; + + DeptCategoryEnum(Integer value, String describe) { + this.value = value; + this.describe = describe; + } + } + /**视频监测秘钥**/ enum VideoMonitorEnum { ZT_YUN("175.6.40.71:443","21815698","QzPHyG2qWgQM8tBJOAJk"), diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java index 4364f2b..ffac6c3 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.SqlCondition; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; import io.swagger.annotations.ApiModelProperty; @@ -58,6 +59,10 @@ public class StationEntity extends TenantEntity implements Serializable { @JsonSerialize(nullsUsing = NullSerializer.class) private Long refDept; + @ApiModelProperty("数据来源") + @QueryField(condition = SqlCondition.EQUAL) + private String dataSource; + @ApiModelProperty("编号(原站点ID)") @QueryField(condition = SqlCondition.LIKE) @NotNull @@ -139,4 +144,7 @@ public class StationEntity extends TenantEntity implements Serializable { @ApiModelProperty("排序") @JsonSerialize(nullsUsing = NullSerializer.class) private Integer sort; + + @ApiModelProperty("实时画面绑定账号秘钥") + private String secretKey; } diff --git a/hzims-service/equipment/pom.xml b/hzims-service/equipment/pom.xml index d2f3d79..f9273e0 100644 --- a/hzims-service/equipment/pom.xml +++ b/hzims-service/equipment/pom.xml @@ -99,9 +99,9 @@ - com.hnac.hzinfo + com.hnac.hzinfo.data hzinfo-data-sdk - 4.6.0-SNAPSHOT + ${hzinfo.data.version} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java index c4c04f1..4b8e93c 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java @@ -2,6 +2,7 @@ package com.hnac.hzims.equipment.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.service.IEmInfoService; @@ -13,11 +14,14 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; +import org.springframework.util.Assert; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -92,7 +96,15 @@ public class EmInfoController extends BladeController { if (CollectionUtil.isNotEmpty(name)) { return R.fail("设备名称已存在"); } - + if(Func.isNotEmpty(em_info.getInfo().getEmIndex())) { + List exist = em_infoService.list(Wrappers.lambdaQuery() + .eq(EmInfoEntity::getCreateDept, AuthUtil.getDeptId()) + .eq(EmInfoEntity::getEmIndex, em_info.getInfo().getEmIndex()) + ); + Assert.isTrue(CollectionUtil.isEmpty(exist),() -> { + throw new ServiceException("该设备序号已存在,设备新增失败"); + }); + } return em_infoService.saveInfo(em_info); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java index a8b7c56..d5ed6a2 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java @@ -55,7 +55,7 @@ public class FdpQuestionController extends BladeController { @ApiOperation("提交设备问题答案") @ApiOperationSupport(order = 4) public R submitDeviceAnswer(@RequestBody @Validated SubmitAnswerReq submitAnswerReq) { - return R.data(fdpQuestionService.submitDeviceAnswer(submitAnswerReq)); + return R.status(fdpQuestionService.submitDeviceAnswer(submitAnswerReq)); } @GetMapping("/generateGraphInstance") diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/ModelController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/ModelController.java new file mode 100644 index 0000000..49be46c --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/ModelController.java @@ -0,0 +1,55 @@ +package com.hnac.hzims.fdp.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.monitor.server.IModelService; +import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO; +import com.hnac.hzinfo.sdk.v5.model.vo.ModelGroupVO; +import com.hnac.hzinfo.sdk.v5.model.vo.ModelVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/18 16:32 + */ +@RestController +@RequestMapping("/model") +@Api(value = "数据平台模型定义管理",tags = "数据平台模型定义管理") +@AllArgsConstructor +public class ModelController extends BladeController { + + private final IModelService modelService; + + @GetMapping("/getAllModelGroup") + @ApiOperation("获取所有模型分组") + @ApiOperationSupport(order = 1) + public R> getAllModelGroup() { + return R.data(modelService.getAllModelGroup()); + } + + @GetMapping("/getAllModelGroup/{modelGroupId}") + @ApiOperation("根据模型分组ID获取模型列表") + @ApiOperationSupport(order = 2) + public R> mGroupByModel(@PathVariable @ApiParam("模型分组ID") Long modelGroupId) { + return R.data(modelService.mGroupByModel(modelGroupId)); + } + + @GetMapping("/getAttr/{modelSignage}") + @ApiOperation("根据模型标识获取物模型属性") + @ApiOperationSupport(order = 3) + public R> getAttr(@PathVariable @ApiParam("模型标识") String modelSignage) { + return R.data(modelService.getAttr(modelSignage)); + } + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java new file mode 100644 index 0000000..6e11a3f --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.fdp.feign; + +import com.hnac.hzims.fdp.service.IFdpQuestionService; +import lombok.AllArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/20 10:28 + */ +@RestController +@AllArgsConstructor +public class QuestionClient implements IQuestionClient { + + private final IFdpQuestionService fdpQuestionService; + + @GetMapping(SUBMIT_STATION_INFO) + @Override + public R submitStationInfo(@RequestParam String stationCode,@RequestParam String stationDesc) { + return R.status(fdpQuestionService.submitStationInfo(stationCode,stationDesc)); + } + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java index 31986e1..0b1549e 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import javax.xml.soap.Name; import java.io.Serializable; @@ -27,12 +28,20 @@ public class SubmitAnswerReq implements Serializable { private Integer type; + @ApiModelProperty(value = "设备编码",required = true) + @NotEmpty + private String emCode; + + @ApiModelProperty(value = "设备名称",required = true) + @NotEmpty + private String emName; + @ApiModelProperty(value = "站点ID",required = true) @NotNull private String stationId; - @ApiModelProperty(value = "",required = true) - private String index; + @ApiModelProperty(value = "机组序号",required = true) + private Integer index; @ApiModelProperty(value = "物模型ID",required = true) private String instanceId; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java index 2e5f062..5ff9c13 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java @@ -17,6 +17,11 @@ import java.util.List; */ public interface IFdpQuestionService { + /**公用类型**/ + String COMMON_TYPE = "1"; + /**机组类型**/ + String DEVICE_TYPE = "2"; + /** * 提交站点信息 * @param stationCode 站点编码 diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java index 096acbe..4a75276 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java @@ -177,7 +177,7 @@ public class FdpQuestionServiceImpl implements IFdpQuestionService { JSONObject responseObject = JSONObject.parseObject(httpResponse.body()); if(httpResponse.getStatus() == HttpServletResponse.SC_OK && "1".equals(responseObject.getString("success"))) { - return JSONArray.parseArray(JSON.toJSONString(responseObject),JSONObject.class); + return JSONArray.parseArray(responseObject.getString("data"),JSONObject.class); } return Lists.newArrayList(); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentInstanceController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentInstanceController.java new file mode 100644 index 0000000..6bc5fc6 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentInstanceController.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.monitor.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.fdp.request.SubmitAnswerReq; +import com.hnac.hzims.monitor.server.IEquipmentInstanceService; +import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/17 13:54 + */ +@RestController +@RequestMapping("/equipment/instance") +@AllArgsConstructor +@Api(value = "设备实例化管理",tags = "设备实例化管理") +public class EquipmentInstanceController extends BladeController { + + private final IEquipmentInstanceService equipmentInstanceService; + + @PostMapping("/instanceAndSubmit") + @ApiOperation("实例化设备以及提交答案") + @ApiOperationSupport(order = 1) + public R instanceAndSubmit(@RequestBody @Valid SubmitAnswerReq submitAnswerReq) { + return R.status(equipmentInstanceService.instance(submitAnswerReq)); + } + + @GetMapping("/getOnlineAttr/{emCode}") + @ApiOperation("根据设备code获取设备实例物模型") + @ApiOperationSupport(order = 2) + public R> getOnlineAttr(@PathVariable @ApiParam("设备编码") String emCode) { + return R.data(equipmentInstanceService.getOnlineAttr(emCode)); + } +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentLedgerController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentLedgerController.java index 245f61d..1c44778 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentLedgerController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentLedgerController.java @@ -8,7 +8,6 @@ import com.hnac.hzinfo.dataconfig.entity.*; import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; -import com.hnac.hzinfo.sdk.analyse.vo.AnalyzeModel; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IEquipmentInstanceService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IEquipmentInstanceService.java new file mode 100644 index 0000000..bb0dac7 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IEquipmentInstanceService.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.monitor.server; + +import com.hnac.hzims.fdp.request.SubmitAnswerReq; +import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; + +import java.util.List; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/17 14:08 + */ +public interface IEquipmentInstanceService { + + /** + * 设备实例化 + 提交FDP答案 + * @param submitAnswerReq + * @return + */ + boolean instance(SubmitAnswerReq submitAnswerReq); + + /** + * 根据设备code获取设备实例物模型 + * @param emCode 设备编码 + * @return + */ + List getOnlineAttr(String emCode); + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IModelService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IModelService.java new file mode 100644 index 0000000..bbf199c --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IModelService.java @@ -0,0 +1,38 @@ +package com.hnac.hzims.monitor.server; + +import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO; +import com.hnac.hzinfo.sdk.v5.model.vo.ModelGroupVO; +import com.hnac.hzinfo.sdk.v5.model.vo.ModelVO; + +import java.util.List; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/18 16:13 + */ +public interface IModelService { + + /** + * 获取所有模型分组 + * @return + */ + List getAllModelGroup(); + + /*** + * 根据模型分组ID获取模型列表 + * @param modelGroupId 模型分组ID + * @return + */ + List mGroupByModel(Long modelGroupId); + + /** + * 根据模型标识获取物模型属性 + * @param modelSignage 模型标识 + * @return + */ + List getAttr(String modelSignage); + + + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/RealTimeDataServer.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/RealTimeDataServer.java index 72d1fd3..5e369c1 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/RealTimeDataServer.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/RealTimeDataServer.java @@ -6,7 +6,6 @@ import com.hnac.hzinfo.dataconfig.entity.*; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; -import com.hnac.hzinfo.sdk.analyse.vo.AnalyzeModel; import org.springblade.core.tool.api.R; import java.util.List; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java new file mode 100644 index 0000000..efe336b --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java @@ -0,0 +1,88 @@ +package com.hnac.hzims.monitor.server.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.equipment.entity.EmInfoEntity; +import com.hnac.hzims.equipment.service.IEmInfoService; +import com.hnac.hzims.fdp.request.AnswerFormatReq; +import com.hnac.hzims.fdp.request.SubmitAnswerReq; +import com.hnac.hzims.fdp.service.IFdpQuestionService; +import com.hnac.hzims.monitor.server.IEquipmentInstanceService; +import com.hnac.hzinfo.datasearch.device.IDeviceClient; +import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; +import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; +import com.hnac.hzinfo.sdk.v5.device.vo.VirtualDeviceDTO; +import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.util.List; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/17 14:08 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class EquipmentInstanceServiceImpl implements IEquipmentInstanceService { + private final DeviceClient deviceClient; + private final IFdpQuestionService fdpQuestionService; + private final IEmInfoService emInfoService; + + @Value("${hzinfo.model.commonSignage}") + private String commonSignage; + @Value("${hzinfo.model.deviceSignage}") + private String deviceSignage; + + @Override + public boolean instance(SubmitAnswerReq submitAnswerReq) { + VirtualDeviceDTO virtualDeviceDTO = new VirtualDeviceDTO(); + virtualDeviceDTO.setProjectId(submitAnswerReq.getStationId()); + virtualDeviceDTO.setDeviceCode(submitAnswerReq.getEmCode()); + virtualDeviceDTO.setDeviceName(submitAnswerReq.getEmName()); + // 模型标识根据题目答案获取 + virtualDeviceDTO.setModelSignage(this.getModelSignageByAnswer(submitAnswerReq)); + R saveResult = deviceClient.saveVirtualDevice(virtualDeviceDTO); + Assert.isTrue(saveResult.isSuccess() && Func.isNotEmpty(saveResult.getData()),() -> { + throw new ServiceException(saveResult.getMsg()); + }); + Long instanceId = Long.valueOf(String.valueOf(saveResult.getData())); + LambdaUpdateWrapper luw = Wrappers.lambdaUpdate() + .set(EmInfoEntity::getDeviceInstanceId, instanceId) + .eq(EmInfoEntity::getNumber, submitAnswerReq.getEmCode()); + Assert.isTrue(emInfoService.update(luw),() -> { + throw new ServiceException("保存设备实例ID失败"); + }); + submitAnswerReq.setInstanceId(instanceId.toString()); + return fdpQuestionService.submitDeviceAnswer(submitAnswerReq); + } + + @Override + public List getOnlineAttr(String emCode) { + R> attrListResult = deviceClient.getOnlineAttr(emCode); + Assert.isTrue(attrListResult.isSuccess(),() -> { + throw new ServiceException(attrListResult.getMsg()); + }); + return attrListResult.getData(); + } + + private String getModelSignageByAnswer(SubmitAnswerReq submitAnswerReq) { + if(IFdpQuestionService.COMMON_TYPE.equals(submitAnswerReq.getDeviceType())) { + return commonSignage; + } + else if (IFdpQuestionService.DEVICE_TYPE.equals(submitAnswerReq.getDeviceType())) { + return deviceSignage; + } + else { + throw new ServiceException("设备类型传参错误"); + } + } +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/ModelServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/ModelServiceImpl.java new file mode 100644 index 0000000..4e881f4 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/ModelServiceImpl.java @@ -0,0 +1,59 @@ +package com.hnac.hzims.monitor.server.impl; + +import com.hnac.hzims.monitor.server.IModelService; +import com.hnac.hzinfo.sdk.v5.model.ModelClient; +import com.hnac.hzinfo.sdk.v5.model.ModelGroupClient; +import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO; +import com.hnac.hzinfo.sdk.v5.model.vo.ModelGroupVO; +import com.hnac.hzinfo.sdk.v5.model.vo.ModelVO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.util.List; + +/** + * @author hx + * @version 1.0 + * @date 2023/3/18 16:13 + */ +@Service +@AllArgsConstructor +@Slf4j +public class ModelServiceImpl implements IModelService { + + private final ModelClient modelClient; + + private final ModelGroupClient modelGroupClient; + + @Override + public List getAllModelGroup() { + R> modelGroupList = modelGroupClient.getAllModelGroup(); + Assert.isTrue(modelGroupList.isSuccess(),() -> { + throw new ServiceException(modelGroupList.getMsg()); + }); + return modelGroupList.getData(); + } + + @Override + public List getAttr(String modelSignage) { + R> attrResult = modelClient.getAttr(modelSignage); + Assert.isTrue(attrResult.isSuccess(),() -> { + throw new ServiceException(attrResult.getMsg()); + }); + return attrResult.getData(); + } + + @Override + public List mGroupByModel(Long modelGroupId) { + R> listR = modelClient.mGroupByModel(modelGroupId); + Assert.isTrue(listR.isSuccess(),() -> { + throw new ServiceException(listR.getMsg()); + }); + return listR.getData(); + } + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java index b11e1f3..32a17d3 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.mapper.EmInfoMapper; import com.hnac.hzims.monitor.server.RealTimeDataServer; -import com.hnac.hzinfo.dataconfig.device.IDeviceClient; import com.hnac.hzinfo.dataconfig.deviceInstace.DeviceInstance; import com.hnac.hzinfo.dataconfig.deviceInstace.DeviceInstanceAttr; import com.hnac.hzinfo.dataconfig.entity.*; @@ -13,9 +12,9 @@ import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; +import com.hnac.hzinfo.datasearch.device.IDeviceClient; import com.hnac.hzinfo.datasearch.real.IRealDataSearchClient; import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; -import com.hnac.hzinfo.sdk.analyse.vo.AnalyzeModel; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/IModelInstanceService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/IModelInstanceService.java index 0028e84..13c7b5a 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/IModelInstanceService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/IModelInstanceService.java @@ -1,6 +1,7 @@ package com.hnac.hzims.monitor.service; -import com.hnac.hzinfo.sdk.analyse.dto.AnalyseDataHandlerDTO; + +import com.hnac.hzinfo.sdk.v5.analyse.dto.AnalyseDataHandlerDTO; /** * @author hx diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java index bec8367..a4f847e 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java @@ -1,10 +1,11 @@ package com.hnac.hzims.monitor.service.impl; + import com.hnac.hzims.monitor.service.IModelInstanceService; -import com.hnac.hzinfo.sdk.analyse.AnalyseDataHandlerClient; -import com.hnac.hzinfo.sdk.analyse.dto.AnalyseDataHandlerDTO; import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.core.response.ResultCode; +import com.hnac.hzinfo.sdk.v5.analyse.AnalyseDataHandlerClient; +import com.hnac.hzinfo.sdk.v5.analyse.dto.AnalyseDataHandlerDTO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; diff --git a/hzims-service/operational/pom.xml b/hzims-service/operational/pom.xml index ce5703e..10532bb 100644 --- a/hzims-service/operational/pom.xml +++ b/hzims-service/operational/pom.xml @@ -259,12 +259,12 @@ org.springblade blade-system-api - 4.5.8.RELEASE + 4.5.8-SNAPSHOT - com.hnac.hzinfo + com.hnac.hzinfo.data hzinfo-data-sdk - 4.6.0-SNAPSHOT + ${hzinfo.data.version} org.springblade @@ -274,18 +274,6 @@ org.springblade blade-core-boot - - org.springblade - blade-system-api - 4.5.3.RELEASE - compile - - - org.springblade - blade-system-api - 4.5.8.RELEASE - compile - diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessPlanController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessPlanController.java index cfddef3..0f09231 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessPlanController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessPlanController.java @@ -130,32 +130,32 @@ public class OperAccessPlanController extends BladeController { return service.getMaterialsByTaskId(taskId); } - @GetMapping("/getUserByDept") - @ApiOperationSupport(order = 70) - @ApiOperation(value = "根据创建机构获取人员列表") - public R getUserByDept(@RequestParam("createDept") @ApiParam(value = "创建机构",required = true) Long createDept, - @RequestParam("creator") @ApiParam(value = "创建人",required = true) Long creator - ){ - IUserClient userClient = SpringUtil.getBean(IUserClient.class); - List userList = new ArrayList<>(); - R> userListResult = userClient.userListByDeptAndChildrenWithAuth(createDept); - if(!userListResult.isSuccess()) { - throw new ServiceException(userListResult.getMsg()); - } - - if(CollectionUtil.isNotEmpty(userListResult.getData())){ - //去除数据权限为只看自己的人员 - userList = userListResult.getData().stream().filter( - user-> !OperationalConstants.UserDataScopeTypeEnum.SELT_VISIBLE.getVal().equals(user.getDataScopeType()) - ).collect(Collectors.toList()); - //查看数据创建人数据权限是不是只看自己 - User user = UserCache.getUser(creator); - if(ObjectUtil.isNotEmpty(user) && OperationalConstants.UserDataScopeTypeEnum.SELT_VISIBLE.getVal().equals(user.getDataScopeType())){ - userList.add(user); - } - } - return R.data(userList); - } +// @GetMapping("/getUserByDept") +// @ApiOperationSupport(order = 70) +// @ApiOperation(value = "根据创建机构获取人员列表") +// public R getUserByDept(@RequestParam("createDept") @ApiParam(value = "创建机构",required = true) Long createDept, +// @RequestParam("creator") @ApiParam(value = "创建人",required = true) Long creator +// ){ +// IUserClient userClient = SpringUtil.getBean(IUserClient.class); +// List userList = new ArrayList<>(); +// R> userListResult = userClient.userListByDeptAndChildrenWithAuth(createDept); +// if(!userListResult.isSuccess()) { +// throw new ServiceException(userListResult.getMsg()); +// } +// +// if(CollectionUtil.isNotEmpty(userListResult.getData())){ +// //去除数据权限为只看自己的人员 +// userList = userListResult.getData().stream().filter( +// user-> !OperationalConstants.UserDataScopeTypeEnum.SELT_VISIBLE.getVal().equals(user.getDataScopeType()) +// ).collect(Collectors.toList()); +// //查看数据创建人数据权限是不是只看自己 +// User user = UserCache.getUser(creator); +// if(ObjectUtil.isNotEmpty(user) && OperationalConstants.UserDataScopeTypeEnum.SELT_VISIBLE.getVal().equals(user.getDataScopeType())){ +// userList.add(user); +// } +// } +// return R.data(userList); +// } @GetMapping("/getUserByRoleAlias") @ApiOperationSupport(order = 80) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/FocusAttributeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/FocusAttributeController.java index c0301ce..d8459c5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/FocusAttributeController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/FocusAttributeController.java @@ -19,6 +19,7 @@ import org.springblade.core.mp.support.Condition; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -64,6 +65,9 @@ public class FocusAttributeController extends BladeController { public R> list(@RequestBody FocusAttributeDto focusAttributeDto) { FocusAttributeEntity req = BeanUtil.copy(focusAttributeDto,FocusAttributeEntity.class); LambdaQueryWrapper wrapper = Condition.getQueryWrapper(new FocusAttributeEntity(), req); + if(Func.isNotEmpty(focusAttributeDto.getStatus())) { + wrapper.eq(FocusAttributeEntity::getStatus,focusAttributeDto.getStatus()); + } wrapper.orderByDesc(FocusAttributeEntity::getGroupId); wrapper.orderByAsc(FocusAttributeEntity::getSort); return R.data(attributeService.list(wrapper)); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/mapper/FocusAttributeMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/mapper/FocusAttributeMapper.xml index 1449461..729b5a6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/mapper/FocusAttributeMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/mapper/FocusAttributeMapper.xml @@ -2,7 +2,7 @@