From e943a09b6d1e4ff3d9c2589c739f99dba514657e Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 19 九月 2023 14:06:12 +0800
Subject: [PATCH] 设备健康列表
---
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java | 4 +
ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellParam.java | 3
ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java | 102 +++++++++++++++++++++++++
ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml | 13 +++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java | 3
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 6 +
ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java | 62 +++++++++++++++
7 files changed, 190 insertions(+), 3 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java
new file mode 100644
index 0000000..fe4c08d
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java
@@ -0,0 +1,62 @@
+package com.ruoyi.alarmpoints.well.domain;
+
+import com.ruoyi.common.core.domain.entity.SysDept;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ArdAlarmpointsWellDeptVo {
+
+ private String id;
+
+ /** 浜曞彿 */
+ private String wellId;
+
+ /** 浜曞彿缂栫爜 */
+ private String wellNumber;
+
+ /** 閲囨补鏂瑰紡 */
+ private String oilProduction;
+
+ /** 杩涙墍灞炲尯鍧� */
+ private String wellBlock;
+
+ /** 椹辨浛鏂瑰紡 */
+ private String displacementMode;
+
+ /** 鍛ㄨ竟鐜 */
+ private String surroundingEnvironment;
+
+ /** 娌逛簳绫诲瀷 */
+ private String wellType;
+
+ /** 瑁呰浇璐熻嵎 */
+ private String installedLoad;
+
+ /** 鎵�灞炶閲忕珯鎴栭榾缁勫悕绉� */
+ private String meteringStation;
+
+ /** 鎵�灞炶浆鎺ョ珯 */
+ private String transferStation;
+
+ /** 鎵�灞炶劚姘寸珯 */
+ private String dehydrationStation;
+
+ /** 杩愯鐘舵�� */
+ private String runStatus;
+
+ private BigDecimal longitude;
+
+ private BigDecimal latitude;
+
+ private BigDecimal altitude;
+
+ private Integer deptId;
+
+ private Integer parentId;
+
+ private String ancestors;
+
+ private String deptName;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellParam.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellParam.java
index 8a63dd6..0cb5788 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellParam.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellParam.java
@@ -11,9 +11,6 @@
/**
* 浜曠鐞嗗璞� ard_alarmpoints_well
- *
- * @author 鍒樿嫃涔�
- * @date 2023-03-07
*/
@Data
public class ArdAlarmpointsWellParam
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
index 7a26348..d48d616 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo;
import com.ruoyi.common.annotation.DataScope;
@@ -89,4 +90,6 @@
List<ArdAlarmpointsWell> wellByPlanId(String id);
+ List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList);
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
index 7127f2f..747dff2 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
@@ -4,6 +4,7 @@
import com.github.pagehelper.PageInfo;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellParam;
/**
@@ -114,4 +115,7 @@
List<ArdAlarmpointsWell> wellList(List<Long> deptList);
PageInfo<ArdAlarmpointsWell> conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam);
+
+ List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList);
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
index f28238b..7a1d553 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -6,6 +6,7 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellParam;
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
@@ -291,4 +292,9 @@
List<ArdAlarmpointsWell> list = ardAlarmpointsWellMapper.selectList(queryWrapper);
return new PageInfo<>(list);
}
+
+ @Override
+ public List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList) {
+ return ardAlarmpointsWellMapper.wellListDept(deptList);
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java b/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
index b1385a1..f2bc7f7 100644
--- a/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
+++ b/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
@@ -1,13 +1,22 @@
package com.ruoyi.health.controller;
import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo;
+import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
import com.ruoyi.common.core.domain.entity.SysConfig;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.health.client.EquipmentsHealthClient;
import com.ruoyi.health.param.GetEquipmentAlertInfoParam;
import com.ruoyi.health.param.GetFMTrendParam;
import com.ruoyi.health.param.GetTrendParam;
import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.system.service.ISysDeptService;
+import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.utils.result.Results;
import com.ruoyi.utils.soap.ARDSoapUtil;
import io.swagger.annotations.Api;
@@ -18,6 +27,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -36,6 +46,98 @@
@Autowired
ISysConfigService configService;
+ @Resource
+ private IArdAlarmpointsWellService ardAlarmpointsWellService;
+
+ @Autowired
+ private ISysUserService sysUserService;
+
+ @Autowired
+ private ISysDeptService sysDeptService;
+
+ @PreAuthorize("@ss.hasPermi('sy:syCar:getEquipmentListByUser')")
+ @ApiOperation("鏍规嵁鏉冮檺鑾峰彇璁惧鍒楄〃")
+ @GetMapping("getEquipmentListByUser")
+ public Results getEquipmentListByUser(){
+ String usersId = SecurityUtils.getUserId();
+ //鏍规嵁userId鏌ヨ閮ㄩ棬Id
+ SysUser sysUser = sysUserService.selectUserById(usersId);
+ //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId
+ List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+ //鏍规嵁deptId鑾峰彇瀵瑰簲鎵�鏈夊叴瓒g偣鏁版嵁
+ List<ArdAlarmpointsWellDeptVo> list = ardAlarmpointsWellService.wellListDept(deptList);
+ //鏌ヨ鎺ュ彛杩斿洖鐨勮澶囧垪琛�
+ String url = configService.getHealth();
+ Map<String, Object> map = new HashMap();
+ String result = ARDSoapUtil.postSoapResult(url, "GetEquipmentList", map);
+ if ("".equals(result)) {
+ //杩斿洖缁撴灉涓虹┖
+ return Results.succeed("娌℃湁璁惧淇℃伅");
+ }
+ Map<String, Object> mapResult = (Map<String, Object>) JSON.parse((String) result);
+ JSONArray jsonArray = new JSONArray();
+ //ancestors瀛楁鏈�闀跨殑鏁版嵁
+ String longest = "";
+ //绛夌骇
+ int count0 = 0,count1 = 0,count2 = 0;
+ if ((int) mapResult.get("code") == 200) {
+ List<Map<String, Object>> listResult = (List<Map<String, Object>>) JSON.parse((String) mapResult.get("resdata"));
+ for (int i = 0; i < listResult.size(); i++) {
+ JSONObject jsonObject = new JSONObject();
+ String equipNumber = (String) listResult.get(i).get("EquipNumber");
+ if(equipNumber!=null){
+ for (int j = 0; j < list.size(); j++) {
+ String ancestors = list.get(j).getAncestors();
+ if (ancestors.length() > longest.length()) {
+ longest = ancestors;
+ }
+ String wellId = list.get(j).getWellId();
+ if(wellId!=null){
+ if(wellId.equals(equipNumber)){
+ String[] ancestorsArray = ancestors.split(",");
+ int max = ancestorsArray.length;
+ jsonObject.put("id",listResult.get(i).get("id"));
+ jsonObject.put("EquipName",listResult.get(i).get("EquipName"));
+ jsonObject.put("EquipNumber",listResult.get(i).get("EquipNumber"));
+ jsonObject.put("EquipLevel",listResult.get(i).get("EquipLevel"));
+ jsonObject.put("MeasureDate",listResult.get(i).get("MeasureDate"));
+ jsonObject.put("EquipKey",listResult.get(i).get("EquipKey"));
+ jsonObject.put("longitude",list.get(j).getLongitude());
+ jsonObject.put("latitude",list.get(j).getLatitude());
+ jsonObject.put("altitude",list.get(j).getAltitude());
+ jsonObject.put("deptId",list.get(j).getDeptId());
+ jsonObject.put("deptName",list.get(j).getDeptName());
+ jsonObject.put("parentId",list.get(j).getParentId());
+ jsonObject.put("ancestors",list.get(j).getAncestors());
+ jsonObject.put("tier",max);
+ jsonArray.add(jsonObject);
+ if(listResult.get(i).get("EquipLevel").equals("0")){
+ count0++;
+ }else if(listResult.get(i).get("EquipLevel").equals("1")){
+ count1++;
+ }else if(listResult.get(i).get("EquipLevel").equals("2")){
+ count2++;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ //鐢ㄩ�楀彿鍒嗛殧瀛楃鍚庣殑size涓烘渶澶х殑缁撴瀯灞傛暟
+ String[] ancestorsArray = longest.split(",");
+ int max = ancestorsArray.length;
+ JSONObject j = new JSONObject();
+ j.put("count0",count0);
+ j.put("count1",count1);
+ j.put("count2",count2);
+ return Results.succeed(jsonArray);
+ } else {
+ //閿欒鎻愮ず
+ return Results.error((String) mapResult.get("errmsg"));
+ }
+ }
+
@PreAuthorize("@ss.hasPermi('sy:syCar:getEquipmentList')")
@ApiOperation("鑾峰彇璁惧鍒楄〃")
@GetMapping("getEquipmentList")
diff --git a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
index b34868d..7fbd1d1 100644
--- a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
@@ -206,4 +206,17 @@
select ard_app_patrolpoint.alarmpoints_id as id,ard_alarmpoints_well.well_id, ard_app_patrolpoint."type",ard_alarmpoints_well.longitude,ard_alarmpoints_well.latitude from ard_alarmpoints_well LEFT JOIN ard_app_patrolpoint on ard_app_patrolpoint.alarmpoints_id = ard_alarmpoints_well.id where ard_alarmpoints_well.id in (select alarmpoints_id from ard_app_patrolpoint where patrolplan_id = #{id})
GROUP BY ard_app_patrolpoint.alarmpoints_id,ard_alarmpoints_well.well_id,ard_app_patrolpoint."type",ard_alarmpoints_well.longitude,ard_alarmpoints_well.latitude
</select>
+
+ <select id="wellListDept" parameterType="List" resultType="com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo">
+ Select well.id,well.well_id,well.well_number,well.oil_production,well.well_block,well.production_date,
+ well.displacement_mode,well.surrounding_environment,well.well_type,well.installed_load,well.metering_station,
+ well.transfer_station,well.dehydration_station,well.run_status,well.longitude,well.latitude,well.altitude,well.dept_id,
+ dept.parent_id,dept.ancestors,dept.dept_name
+ from ard_alarmpoints_well well
+ left join sys_dept dept on well.dept_id = dept.dept_id
+ where well.dept_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3