aijinhui
2023-09-19 e943a09b6d1e4ff3d9c2589c739f99dba514657e
设备健康列表
已添加1个文件
已修改6个文件
193 ■■■■■ 文件已修改
ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellDeptVo.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellParam.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
}
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
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);
}
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);
}
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);
    }
}
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或者当前及所属下级的所有deptId
        List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
        //根据deptId获取对应所有兴趣点数据
        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")
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>