Browse Source

# 接站修改

zhongwei
H.X 2 years ago
parent
commit
2aab103928
  1. 3
      hzims-service-api/equipment-api/pom.xml
  2. 7
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java
  3. 30
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java
  4. 20
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java
  5. 4
      hzims-service-api/hzims-operational-api/pom.xml
  6. 7
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/FocusAttributeEntity.java
  7. 13
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java
  8. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java
  9. 4
      hzims-service/equipment/pom.xml
  10. 14
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  11. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpQuestionController.java
  12. 55
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/ModelController.java
  13. 27
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java
  14. 13
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/SubmitAnswerReq.java
  15. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpQuestionService.java
  16. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpQuestionServiceImpl.java
  17. 44
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentInstanceController.java
  18. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/controller/EquipmentLedgerController.java
  19. 29
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IEquipmentInstanceService.java
  20. 38
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/IModelService.java
  21. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/RealTimeDataServer.java
  22. 88
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java
  23. 59
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/ModelServiceImpl.java
  24. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/RealTimeDataServerImpl.java
  25. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/IModelInstanceService.java
  26. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/service/impl/ModelInstanceServiceImpl.java
  27. 18
      hzims-service/operational/pom.xml
  28. 52
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessPlanController.java
  29. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/FocusAttributeController.java
  30. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/mapper/FocusAttributeMapper.xml
  31. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java
  32. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
  33. 48
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  34. 2
      pom.xml

3
hzims-service-api/equipment-api/pom.xml

@ -26,8 +26,7 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<version>4.5.3.RELEASE</version>
<scope>compile</scope>
<version>4.5.8-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

7
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;
}

30
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<Boolean> submitStationInfo(@RequestParam String stationCode, @RequestParam(required = false) String stationDesc);
}

20
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<Boolean> submitStationInfo(String stationCode, String stationDesc) {
return R.fail("智能诊断提交站点失败!");
}
}

4
hzims-service-api/hzims-operational-api/pom.xml

@ -58,7 +58,7 @@
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>${hzinfo.data.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.hnac.hzinfo.data</groupId>-->
@ -69,7 +69,7 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<version>4.5.8.RELEASE</version>
<version>4.5.8-SNAPSHOT</version>
</dependency>
</dependencies>

7
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;
}

13
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"),

8
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;
}

4
hzims-service/equipment/pom.xml

@ -99,9 +99,9 @@
</dependency>
<dependency>
<groupId>com.hnac.hzinfo</groupId>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>${hzinfo.data.version}</version>
</dependency>
<dependency>

14
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<EmInfoEntity> exist = em_infoService.list(Wrappers.<EmInfoEntity>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);
}

2
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<Boolean> submitDeviceAnswer(@RequestBody @Validated SubmitAnswerReq submitAnswerReq) {
return R.data(fdpQuestionService.submitDeviceAnswer(submitAnswerReq));
return R.status(fdpQuestionService.submitDeviceAnswer(submitAnswerReq));
}
@GetMapping("/generateGraphInstance")

55
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<List<ModelGroupVO>> getAllModelGroup() {
return R.data(modelService.getAllModelGroup());
}
@GetMapping("/getAllModelGroup/{modelGroupId}")
@ApiOperation("根据模型分组ID获取模型列表")
@ApiOperationSupport(order = 2)
public R<List<ModelVO>> mGroupByModel(@PathVariable @ApiParam("模型分组ID") Long modelGroupId) {
return R.data(modelService.mGroupByModel(modelGroupId));
}
@GetMapping("/getAttr/{modelSignage}")
@ApiOperation("根据模型标识获取物模型属性")
@ApiOperationSupport(order = 3)
public R<List<ModelAttrVO>> getAttr(@PathVariable @ApiParam("模型标识") String modelSignage) {
return R.data(modelService.getAttr(modelSignage));
}
}

27
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<Boolean> submitStationInfo(@RequestParam String stationCode,@RequestParam String stationDesc) {
return R.status(fdpQuestionService.submitStationInfo(stationCode,stationDesc));
}
}

13
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;

5
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 站点编码

2
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();
}

44
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<Boolean> instanceAndSubmit(@RequestBody @Valid SubmitAnswerReq submitAnswerReq) {
return R.status(equipmentInstanceService.instance(submitAnswerReq));
}
@GetMapping("/getOnlineAttr/{emCode}")
@ApiOperation("根据设备code获取设备实例物模型")
@ApiOperationSupport(order = 2)
public R<List<DeviceInstanceAttrVO>> getOnlineAttr(@PathVariable @ApiParam("设备编码") String emCode) {
return R.data(equipmentInstanceService.getOnlineAttr(emCode));
}
}

1
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;

29
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<DeviceInstanceAttrVO> getOnlineAttr(String emCode);
}

38
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<ModelGroupVO> getAllModelGroup();
/***
* 根据模型分组ID获取模型列表
* @param modelGroupId 模型分组ID
* @return
*/
List<ModelVO> mGroupByModel(Long modelGroupId);
/**
* 根据模型标识获取物模型属性
* @param modelSignage 模型标识
* @return
*/
List<ModelAttrVO> getAttr(String modelSignage);
}

1
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;

88
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<EmInfoEntity> luw = Wrappers.<EmInfoEntity>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<DeviceInstanceAttrVO> getOnlineAttr(String emCode) {
R<List<DeviceInstanceAttrVO>> 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("设备类型传参错误");
}
}
}

59
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<ModelGroupVO> getAllModelGroup() {
R<List<ModelGroupVO>> modelGroupList = modelGroupClient.getAllModelGroup();
Assert.isTrue(modelGroupList.isSuccess(),() -> {
throw new ServiceException(modelGroupList.getMsg());
});
return modelGroupList.getData();
}
@Override
public List<ModelAttrVO> getAttr(String modelSignage) {
R<List<ModelAttrVO>> attrResult = modelClient.getAttr(modelSignage);
Assert.isTrue(attrResult.isSuccess(),() -> {
throw new ServiceException(attrResult.getMsg());
});
return attrResult.getData();
}
@Override
public List<ModelVO> mGroupByModel(Long modelGroupId) {
R<List<ModelVO>> listR = modelClient.mGroupByModel(modelGroupId);
Assert.isTrue(listR.isSuccess(),() -> {
throw new ServiceException(listR.getMsg());
});
return listR.getData();
}
}

3
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;

3
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

5
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;

18
hzims-service/operational/pom.xml

@ -259,12 +259,12 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<version>4.5.8.RELEASE</version>
<version>4.5.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo</groupId>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
<version>4.6.0-SNAPSHOT</version>
<version>${hzinfo.data.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
@ -274,18 +274,6 @@
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<version>4.5.3.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<version>4.5.8.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

52
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<User> userList = new ArrayList<>();
R<List<User>> 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<User> userList = new ArrayList<>();
// R<List<User>> 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)

4
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<FocusAttributeEntity>> list(@RequestBody FocusAttributeDto focusAttributeDto) {
FocusAttributeEntity req = BeanUtil.copy(focusAttributeDto,FocusAttributeEntity.class);
LambdaQueryWrapper<FocusAttributeEntity> 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));

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/mapper/FocusAttributeMapper.xml

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.operational.config.mapper.FocusAttributeMapper">
<select id="getMainList" resultType="com.hnac.hzims.operational.config.entity.FocusAttributeEntity">
select distinct group_id, group_name, domain_id, domain_name, status
select distinct group_id, group_name, domain_id, domain_name,model_id, status
FROM hzims_focus_attribute
<where>
is_deleted = 0 AND tenant_id = '200000'

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java

@ -97,6 +97,13 @@ public class StationController extends BladeController {
// return list.size()>0 ? R.fail(400,"该站点名/编码已有对应记录,请找到相应记录做修改处理") : R.status(stationService.updateById(req));
}
@PostMapping("/instanceProject")
@ApiOperationSupport(order = 60)
@ApiOperation(value = "实例化实时画面项目", notes = "站点信息")
public R<Boolean> instanceProject(@RequestBody StationEntity req) {
return R.status(stationService.instanceProject(req));
}
@PostMapping("/updateBatch")
@ApiOperationSupport(order = 30)
@ApiOperation(value = "批量修改", notes = "传入站点列表")

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java

@ -29,6 +29,20 @@ public interface IStationService extends BaseService<StationEntity> {
*/
void buildStation(StationEntity req);
/**
* 实例化实时画面项目
* @param req 站点信息
* @return
*/
boolean instanceProject(StationEntity req);
/**
* 删除站点
* @param ids 站点ID按逗号分隔
* @return
*/
boolean removeStation(String ids);
IPage<StationVO> list(StationEntity req, Query query);
List<User> getUsersByStationId(String stationId);

48
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.service.UserAuthDataService;
import com.hnac.hzims.fdp.feign.IQuestionClient;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.data.service.HzimsDataService;
import com.hnac.hzims.operational.main.vo.StationCountVo;
@ -20,7 +21,9 @@ import com.hnac.hzims.operational.station.vo.StationAndDeptVo;
import com.hnac.hzims.operational.station.vo.StationVO;
import com.hnac.hzims.operational.station.wrapper.StationWrapper;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzims.spare.entity.WtSpBasicEntity;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import com.hnac.hzinfo.sdk.v5.project.dto.ProjectDTO;
import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@ -32,6 +35,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.api.ResultCode;
import org.springblade.core.tool.utils.*;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.IDeptClient;
@ -43,6 +47,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
@ -59,6 +64,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
private final IUserClient userClient;
private final ProjectClient projectClient;
private final BladeLogger logger;
private final IQuestionClient questionClient;
@Override
public void buildStation(StationEntity req) {
@ -85,14 +91,35 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
Assert.isTrue(this.saveOrUpdate(req),() -> {
throw new ServiceException("创建/修改站点信息失败!");
});
// 为画面导入创建工程
new Thread(() -> {
// 智能诊断站点推送
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(() -> questionClient.submitStationInfo(req.getCode(), null));
// 新建项目
executor.submit(() -> this.instanceProject(req));
}
@Override
public boolean instanceProject(StationEntity req) {
if(Func.isEmpty(req.getSecretKey()) || Func.isEmpty(req.getDataSource())) {
return true;
}
if(super.updateById(req)) {
ProjectDTO projectDTO = new ProjectDTO();
projectDTO.setName(req.getName());
projectDTO.setSource(1);
projectDTO.setSecretKey(req.getSecretKey());
projectDTO.setListenKind(req.getDataSource());
projectDTO.setId(req.getCode());
Result result = projectClient.saveOrUpdate(projectDTO);
logger.info("operational:station:buildStation:"+req.getCode(), JSON.toJSONString(result));
}).start();
return result.getCode() == ResultCode.SUCCESS.getCode() && result.isSuccess();
}
return false;
}
@Override
public boolean removeStation(String ids) {
return this.deleteLogic(Func.toLongList(ids,","));
}
@Override
@ -562,7 +589,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
request.setParentId(stationEntity.getHigherDept());
request.setDeptCategory(StationConstants.DeptCategoryEnum.STATION.getValue());
request.setSort(1);
R<Boolean> buildResult = deptClient.createOrUpdateDept(request);
R<Void> buildResult = deptClient.createOrUpdateDept(request);
if(buildResult.isSuccess()) {
// 所属机构回传
R<Dept> deptByStation = sysClient.getDeptByStation(request.getStationId(), AuthUtil.getTenantId());
@ -599,4 +626,15 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
);
}
/**
* 删除新建站点时绑定的数据项目智能诊断站点
* @param idList id集合
*/
private void deleteStation(List<Long> idList) {
LambdaQueryWrapper<StationEntity> lqw = Wrappers.<StationEntity>lambdaQuery().in(StationEntity::getId, idList);
List<StationEntity> stationEntityList = this.list(lqw);
// if(CollectionUtil.isNotEmpty(stationEntityList)) {
// stationEntityList.stream().map(StationEntity::getCode).forEach(code -> projectClient.delete());
// }
}
}

2
pom.xml

@ -16,7 +16,7 @@
<maven.plugin.version>3.8.1</maven.plugin.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<hzinfo.data.version>4.6.0-SNAPSHOT</hzinfo.data.version>
<hzinfo.data.version>4.6.1-SNAPSHOT</hzinfo.data.version>
<!-- <hzinfo.data.api.version>4.5.3-SNAPSHOT</hzinfo.data.api.version>-->
<!-- <hzinfo.data.sdk.version>4.5.4-RELEASE</hzinfo.data.sdk.version>-->

Loading…
Cancel
Save