大屏接口及前端对接

This commit is contained in:
xusd 2024-09-26 14:56:15 +08:00
parent 03c743a440
commit cf373ca5fd
19 changed files with 1213 additions and 206 deletions

View File

@ -0,0 +1,93 @@
package com.inspur.module.system.controller.largeScreen;
import com.inspur.framework.common.pojo.CommonResult;
import com.inspur.module.system.controller.largeScreen.vo.*;
import com.inspur.module.system.service.largeScreen.LargeScreenService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
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 javax.annotation.Resource;
import java.util.List;
import static com.inspur.framework.common.pojo.CommonResult.success;
/**
* @Author xusd
* @Date 2024/9/24 16:04
**/
@Tag(name = "大屏")
@RestController
@RequestMapping("/admin-api/imt/largeScreen")
@Validated
public class LargeScreenController {
@Resource
private LargeScreenService largeScreenService;
@GetMapping("/equipInfoList")
@Operation(summary = "设备信息")
public CommonResult<List<LargeScreenEquipInfoListVO>> equipInfoList(){
return success(largeScreenService.equipInfoList());
}
@GetMapping("/dataCount")
@Operation(summary = "规模数量")
public CommonResult<LargeScreenDataCountVO> dataCount(){
return success(largeScreenService.dataCount());
}
@GetMapping("/faultDataList")
@Operation(summary = "故障数据分析")
public CommonResult<List<LargeScreenFaultDataListVO>> faultDataList(){
return success(largeScreenService.faultDataList());
}
@GetMapping("/alarmDataList")
@Operation(summary = "报警数据分析")
public CommonResult<LargeScreenAlarmDataVO> alarmDataList(){
return success(largeScreenService.alarmDataList());
}
@GetMapping("/companyAndEquipCreate")
@Operation(summary = "企业和设备新增趋势")
public CommonResult<List<LargeScreenCompanyAndEquipCreateListVO>> companyAndEquipCreate(){
return success(largeScreenService.companyAndEquipCreate());
}
@GetMapping("/maintenanceOrder")
@Operation(summary = "在途维修工单")
public CommonResult<List<LargeScreenMaintenanceOrderListVO>> maintenanceOrder(){
return success(largeScreenService.maintenanceOrder());
}
@GetMapping("/maintenanceOrderCount")
@Operation(summary = "维修工单统计")
public CommonResult<List<LargeScreenMaintenanceOrderCountListVO>> maintenanceOrderCount(){
return success(largeScreenService.maintenanceOrderCount());
}
@GetMapping("/alarmList")
@Operation(summary = "告警信息")
public CommonResult<List<LargeScreenAlarmListVO>> alarmList(){
return success(largeScreenService.alarmList());
}
@GetMapping("/customerDistribution")
@Operation(summary = "客户分布")
public CommonResult<List<LargeScreenCustomerDistributionVO>> customerDistribution(){
return success(largeScreenService.customerDistribution());
}
@GetMapping("/customerDistributionByProvinceCode/{provinceCode}")
@Operation(summary = "客户分布详情")
public CommonResult<List<LargeScreenCustomerEquipCountVO>> customerDistributionByProvinceCode(@PathVariable("provinceCode") Integer provinceCode){
return success(largeScreenService.customerDistributionByProvinceCode(provinceCode));
}
}

View File

@ -0,0 +1,23 @@
package com.inspur.module.system.controller.largeScreen.dto;
import lombok.Data;
/**
* 各故障类型个数
*
* @Author xusd
* @Date 2024/9/25 9:54
**/
@Data
public class LargeScreenFaultCountDTO {
/**
* 故障类型
*/
private String faultValue;
/**
* 故障类型数量
*/
private Integer faultCount;
}

View File

@ -0,0 +1,22 @@
package com.inspur.module.system.controller.largeScreen.dto;
import lombok.Data;
/**
* 各月份报警次数
*
* @Author xusd
* @Date 2024/9/25 10:38
**/
@Data
public class LargeScreenMonthCountDTO {
/**
* 报警月份
*/
private String month;
/**
* 报警次数
*/
private Integer monthCount;
}

View File

@ -0,0 +1,20 @@
package com.inspur.module.system.controller.largeScreen.vo;
import lombok.Data;
import java.util.List;
/**
* 报警数据分析
*
* @Author xusd
* @Date 2024/9/25 10:05
**/
@Data
public class LargeScreenAlarmDataVO {
private List<String> x;
private List<Integer> y;
}

View File

@ -0,0 +1,29 @@
package com.inspur.module.system.controller.largeScreen.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static com.inspur.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
/**
* 告警信息
*
* @Author xusd
* @Date 2024/9/25 15:45
**/
@Data
public class LargeScreenAlarmListVO {
private String content;
private String customerName;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date lastAlarmTime;
private String equipNo;
}

View File

@ -0,0 +1,22 @@
package com.inspur.module.system.controller.largeScreen.vo;
import lombok.Data;
import java.util.List;
/**
* 企业和设备新增趋势
*
* @Author xusd
* @Date 2024/9/25 11:02
**/
@Data
public class LargeScreenCompanyAndEquipCreateListVO {
private List<String> x;
private List<Integer> y;
private String name;
}

View File

@ -0,0 +1,27 @@
package com.inspur.module.system.controller.largeScreen.vo;
import lombok.Data;
/**
* 客户分布
*
* @Author xusd
* @Date 2024/9/26 10:14
**/
@Data
public class LargeScreenCustomerDistributionVO {
/**
* 省份code
*/
private Integer provinceCode;
/**
* 省份
*/
private String provinceName;
/**
* 客户总数
*/
private Integer data;
}

View File

@ -0,0 +1,22 @@
package com.inspur.module.system.controller.largeScreen.vo;
import lombok.Data;
/**
* 客户分布详情客户设备数
*
* @Author xusd
* @Date 2024/9/26 11:03
**/
@Data
public class LargeScreenCustomerEquipCountVO {
/**
* 客户名称
*/
private String name;
/**
* 设备数量
*/
private Integer value;
}

View File

@ -0,0 +1,27 @@
package com.inspur.module.system.controller.largeScreen.vo;
import lombok.Data;
/**
* 规模数量
*
* @Author xusd
* @Date 2024/9/25 9:28
**/
@Data
public class LargeScreenDataCountVO {
/**
* 客户规模
*/
private Long customerCount;
/**
* 设备规模
*/
private Long equipCount;
/**
* 在线设备
*/
private Long onlineEquipCount;
}

View File

@ -0,0 +1,35 @@
package com.inspur.module.system.controller.largeScreen.vo;
import lombok.Data;
/**
* 设备信息
*
* @Author xusd
* @Date 2024/9/24 16:11
**/
@Data
public class LargeScreenEquipInfoListVO {
/**
* 客户id
*/
private String customerId;
/**
* 客户名称
*/
private String customerName;
/**
* 设备数
*/
private Integer equipNum;
/**
* 运行中
*/
private Integer equipRun;
/**
* 报警数
*/
private Integer alarmNum;
}

View File

@ -0,0 +1,27 @@
package com.inspur.module.system.controller.largeScreen.vo;
import lombok.Data;
/**
* 故障数据分析
*
* @Author xusd
* @Date 2024/9/25 9:37
**/
@Data
public class LargeScreenFaultDataListVO {
/**
* 故障类型
*/
private String faultValue;
/**
* 故障类型名称
*/
private String faultLabel;
/**
* 故障类型数量
*/
private Integer faultCount;
}

View File

@ -0,0 +1,20 @@
package com.inspur.module.system.controller.largeScreen.vo;
import lombok.Data;
/**
* 维修工单统计
*
* @Author xusd
* @Date 2024/9/25 14:45
**/
@Data
public class LargeScreenMaintenanceOrderCountListVO {
private String customerId;
private String customerName;
private Integer orderCount;
}

View File

@ -0,0 +1,31 @@
package com.inspur.module.system.controller.largeScreen.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static com.inspur.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
/**
* 在途维修工单
*
* @Author xusd
* @Date 2024/9/25 14:40
**/
@Data
public class LargeScreenMaintenanceOrderListVO {
private String customerId;
private String customerName;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date createTime;
private Integer faultType;
private Integer status;
}

View File

@ -0,0 +1,102 @@
package com.inspur.module.system.dal.mysql.largeScreen;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.controller.largeScreen.dto.LargeScreenMonthCountDTO;
import com.inspur.module.system.controller.largeScreen.dto.LargeScreenFaultCountDTO;
import com.inspur.module.system.controller.largeScreen.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author xusd
* @Date 2024/9/24 16:25
**/
@Mapper
public interface LargeScreenMapper {
/**
* 设备信息
*
* @Author xusd
* @Date 16:28 2024/9/24
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenEquipInfoListVO>
*/
List<LargeScreenEquipInfoListVO> equipInfoList();
/**
* 获取故障类型各类型个数
*
* @Author xusd
* @Date 9:56 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.dto.LargeScreenFaultCountDTO>
*/
List<LargeScreenFaultCountDTO> selectFaultCount();
/**
* 各月份报警次数
*
* @Author xusd
* @Date 10:43 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.dto.LargeScreenAlarmDataDTO>
*/
@TenantIgnore
List<LargeScreenMonthCountDTO> getAlarmMonthCount();
/**
* 各月份客户创建数
*
* @Author xusd
* @Date 11:12 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.dto.LargeScreenMonthCountDTO>
*/
List<LargeScreenMonthCountDTO> getCustomerCreateMonthCount();
/**
* 各月份设备创建数
*
* @Author xusd
* @Date 11:15 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.dto.LargeScreenMonthCountDTO>
*/
List<LargeScreenMonthCountDTO> getEquipCreateMonthCount();
/**
* 维修工单统计
*
* @Author xusd
* @Date 14:50 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenMaintenanceOrderCountListVO>
*/
List<LargeScreenMaintenanceOrderCountListVO> maintenanceOrderCount();
/**
* 告警信息
*
* @Author xusd
* @Date 15:57 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenAlarmListVO>
*/
@TenantIgnore
List<LargeScreenAlarmListVO> selectArmListTop4();
/**
* 客户分布
*
* @Author xusd
* @Date 10:35 2024/9/26
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenCustomerDistributionVO>
*/
List<LargeScreenCustomerDistributionVO> customerDistribution();
/**
* 根据省编号获取客户分布详情
*
* @Author xusd
* @Date 11:05 2024/9/26
* @param provinceCode 省标识
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenCustomerEquipCountVO>
*/
List<LargeScreenCustomerEquipCountVO> customerDistributionByProvinceCode(@Param("provinceCode") Integer provinceCode);
}

View File

@ -0,0 +1,103 @@
package com.inspur.module.system.service.largeScreen;
import com.inspur.module.system.controller.largeScreen.vo.*;
import java.util.List;
/**
* @Author xusd
* @Date 2024/9/24 16:13
**/
public interface LargeScreenService {
/**
* 设备信息
*
* @Author xusd
* @Date 16:18 2024/9/24
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenEquipInfoListVO>
*/
List<LargeScreenEquipInfoListVO> equipInfoList();
/**
* 规模数量
*
* @Author xusd
* @Date 9:32 2024/9/25
* @return com.inspur.module.system.controller.largeScreen.vo.LargeScreenDataCountVO
*/
LargeScreenDataCountVO dataCount();
/**
* 故障数据分析
*
* @Author xusd
* @Date 9:40 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenFaultDataListVO>
*/
List<LargeScreenFaultDataListVO> faultDataList();
/**
* 报警数据分析
*
* @Author xusd
* @Date 10:06 2024/9/25
* @return com.inspur.module.system.controller.largeScreen.vo.LargeScreenAlarmDataListVO
*/
LargeScreenAlarmDataVO alarmDataList();
/**
* 企业和设备新增趋势
*
* @Author xusd
* @Date 11:05 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenCompanyAndEquipCreateListVO>
*/
List<LargeScreenCompanyAndEquipCreateListVO> companyAndEquipCreate();
/**
* 在途维修工单
*
* @Author xusd
* @Date 14:42 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenMaintenanceOrderListVO>
*/
List<LargeScreenMaintenanceOrderListVO> maintenanceOrder();
/**
* 维修工单统计
*
* @Author xusd
* @Date 14:49 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenMaintenanceOrderCountListVO>
*/
List<LargeScreenMaintenanceOrderCountListVO> maintenanceOrderCount();
/**
* 告警信息
*
* @Author xusd
* @Date 15:45 2024/9/25
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenAlarmListVO>
*/
List<LargeScreenAlarmListVO> alarmList();
/**
* 客户分布
*
* @Author xusd
* @Date 10:18 2024/9/26
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenCustomerDistributionVO>
*/
List<LargeScreenCustomerDistributionVO> customerDistribution();
/**
* 根据省编号获取客户分布详情
*
* @Author xusd
* @Date 11:02 2024/9/26
* @param provinceCode 省编号
* @return java.util.List<com.inspur.module.system.controller.largeScreen.vo.LargeScreenCustomerEquipCountVO>
*/
List<LargeScreenCustomerEquipCountVO> customerDistributionByProvinceCode(Integer provinceCode);
}

View File

@ -0,0 +1,195 @@
package com.inspur.module.system.service.largeScreen;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.inspur.framework.common.util.object.BeanUtils;
import com.inspur.framework.ip.core.Area;
import com.inspur.framework.ip.core.utils.AreaUtils;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.controller.imtIndex.vo.ImtIndexMaintenanceOrderListVO;
import com.inspur.module.system.controller.largeScreen.dto.LargeScreenMonthCountDTO;
import com.inspur.module.system.controller.largeScreen.dto.LargeScreenFaultCountDTO;
import com.inspur.module.system.controller.largeScreen.vo.*;
import com.inspur.module.system.dal.dataobject.dict.DictDataDO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
import com.inspur.module.system.dal.mysql.baseData.CustomerInfoMapper;
import com.inspur.module.system.dal.mysql.equip.EquipInfoMapper;
import com.inspur.module.system.dal.mysql.largeScreen.LargeScreenMapper;
import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderMapper;
import com.inspur.module.system.service.baseData.CustomerInfoService;
import com.inspur.module.system.service.dict.DictDataService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author xusd
* @Date 2024/9/24 16:14
**/
@Service
public class LargeScreenServiceImpl implements LargeScreenService {
@Resource
private LargeScreenMapper largeScreenMapper;
@Resource
private CustomerInfoMapper customerInfoMapper;
@Resource
private EquipInfoMapper equipInfoMapper;
@Resource
private DictDataService dictDataService;
@Resource
private MaintenanceOrderMapper maintenanceOrderMapper;
@Resource
private CustomerInfoService customerInfoService;
@Override
public List<LargeScreenEquipInfoListVO> equipInfoList() {
List<LargeScreenEquipInfoListVO> list = largeScreenMapper.equipInfoList();
if (CollUtil.isEmpty(list)) {
return Collections.emptyList();
}
return list;
}
@Override
public LargeScreenDataCountVO dataCount() {
LargeScreenDataCountVO vo = new LargeScreenDataCountVO();
vo.setCustomerCount(customerInfoMapper.selectCount());
vo.setEquipCount(equipInfoMapper.selectCount());
vo.setOnlineEquipCount(0L);
return vo;
}
@Override
public List<LargeScreenFaultDataListVO> faultDataList() {
List<DictDataDO> faultTypeList = dictDataService.getDictDataListByDictType("fault_type");
if (CollUtil.isEmpty(faultTypeList)) {
return Collections.emptyList();
}
List<LargeScreenFaultCountDTO> dtoList = largeScreenMapper.selectFaultCount();
Map<String, Integer> dtoMap = dtoList.stream().collect(Collectors.toMap(LargeScreenFaultCountDTO::getFaultValue, LargeScreenFaultCountDTO::getFaultCount));
List<LargeScreenFaultDataListVO> list = new ArrayList<>();
faultTypeList.forEach(item -> {
LargeScreenFaultDataListVO vo = new LargeScreenFaultDataListVO();
vo.setFaultValue(item.getValue());
vo.setFaultLabel(item.getLabel());
vo.setFaultCount(Objects.nonNull(dtoMap.get(item.getValue())) ? dtoMap.get(item.getValue()) : 0);
list.add(vo);
});
return list;
}
@Override
public LargeScreenAlarmDataVO alarmDataList() {
LargeScreenAlarmDataVO vo = new LargeScreenAlarmDataVO();
List<String> x = getFirstSixMonths();
vo.setX(x);
List<LargeScreenMonthCountDTO> list = largeScreenMapper.getAlarmMonthCount();
if (CollUtil.isNotEmpty(list)) {
List<Integer> y = new ArrayList<>();
Map<String, Integer> map = list.stream().collect(Collectors.toMap(LargeScreenMonthCountDTO::getMonth, LargeScreenMonthCountDTO::getMonthCount));
x.forEach(item -> y.add(Objects.nonNull(map.get(item)) ? map.get(item) : 0));
vo.setY(y);
}
return vo;
}
@Override
public List<LargeScreenCompanyAndEquipCreateListVO> companyAndEquipCreate() {
List<LargeScreenCompanyAndEquipCreateListVO> list = new ArrayList<>();
List<String> x = getFirstSixMonths();
//客户
LargeScreenCompanyAndEquipCreateListVO customer = new LargeScreenCompanyAndEquipCreateListVO();
customer.setX(x);
customer.setName("企业");
List<LargeScreenMonthCountDTO> customerList = largeScreenMapper.getCustomerCreateMonthCount();
if (CollUtil.isNotEmpty(customerList)){
List<Integer> y = new ArrayList<>();
Map<String, Integer> customerMap = customerList.stream().collect(Collectors.toMap(LargeScreenMonthCountDTO::getMonth, LargeScreenMonthCountDTO::getMonthCount));
x.forEach(item -> y.add(Objects.nonNull(customerMap.get(item)) ? customerMap.get(item) : 0));
customer.setY(y);
}
list.add(customer);
//设备
LargeScreenCompanyAndEquipCreateListVO equip = new LargeScreenCompanyAndEquipCreateListVO();
equip.setX(x);
equip.setName("设备");
List<LargeScreenMonthCountDTO> equipList = largeScreenMapper.getEquipCreateMonthCount();
if (CollUtil.isNotEmpty(equipList)){
List<Integer> y = new ArrayList<>();
Map<String, Integer> equipMap = equipList.stream().collect(Collectors.toMap(LargeScreenMonthCountDTO::getMonth, LargeScreenMonthCountDTO::getMonthCount));
x.forEach(item -> y.add(Objects.nonNull(equipMap.get(item)) ? equipMap.get(item) : 0));
equip.setY(y);
}
list.add(equip);
return list;
}
@Override
public List<LargeScreenMaintenanceOrderListVO> maintenanceOrder() {
LambdaQueryWrapper<MaintenanceOrderDO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByDesc(MaintenanceOrderDO::getCreateTime);
queryWrapper.last("limit 4");
List<MaintenanceOrderDO> maintenanceOrderDOS = maintenanceOrderMapper.selectList(queryWrapper);
if (CollUtil.isEmpty(maintenanceOrderDOS)) {
return Collections.emptyList();
}
List<CustomerInfoSelectionVO> customerList = customerInfoService.selection(true);
Map<String, String> customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName));
return BeanUtils.toBean(maintenanceOrderDOS, LargeScreenMaintenanceOrderListVO.class, vo -> vo.setCustomerName(customerMap.get(vo.getCustomerId())));
}
@Override
public List<LargeScreenMaintenanceOrderCountListVO> maintenanceOrderCount() {
return largeScreenMapper.maintenanceOrderCount();
}
@Override
public List<LargeScreenAlarmListVO> alarmList() {
return largeScreenMapper.selectArmListTop4();
}
@Override
public List<LargeScreenCustomerDistributionVO> customerDistribution() {
List<LargeScreenCustomerDistributionVO> list = largeScreenMapper.customerDistribution();
if (CollUtil.isNotEmpty(list)) {
list.forEach(item -> {
Area area = AreaUtils.getArea(item.getProvinceCode());
if (Objects.nonNull(area)) {
item.setProvinceName(area.getName());
}
});
}
return list;
}
@Override
public List<LargeScreenCustomerEquipCountVO> customerDistributionByProvinceCode(Integer provinceCode) {
return largeScreenMapper.customerDistributionByProvinceCode(provinceCode);
}
/**
* 获取前六个月的月份
*
* @return java.util.List<java.lang.String>
* @Author xusd
* @Date 10:30 2024/9/25
*/
private List<String> getFirstSixMonths() {
List<String> list = new ArrayList<>();
DateTime firstSixMonth = DateUtil.offsetMonth(new Date(), -5);
List<DateTime> dateTimes = DateUtil.rangeToList(firstSixMonth, new Date(), DateField.MONTH);
dateTimes.forEach(item -> list.add(DateUtil.format(item, "yyyy-MM")));
return list;
}
}

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.module.system.dal.mysql.largeScreen.LargeScreenMapper">
<select id="equipInfoList"
resultType="com.inspur.module.system.controller.largeScreen.vo.LargeScreenEquipInfoListVO">
SELECT
ici.customer_id as customerId,
ici.customer_name as customerName,
COUNT( iei.equip_id ) as equipNum,
0 as equipRun,
0 as alarmNum
FROM
imt_customer_info AS ici
LEFT JOIN imt_equip_info AS iei ON ici.customer_id = iei.customer_id
AND iei.deleted = '0'
WHERE
ici.deleted = '0'
GROUP BY
ici.customer_id
ORDER BY
COUNT( iei.equip_id ) DESC
LIMIT 4
</select>
<select id="selectFaultCount"
resultType="com.inspur.module.system.controller.largeScreen.dto.LargeScreenFaultCountDTO">
SELECT
fault_type as faultValue,
count( maintenance_order_id ) as faultCount
FROM
imt_maintenance_order
GROUP BY
fault_type
</select>
<select id="getAlarmMonthCount"
resultType="com.inspur.module.system.controller.largeScreen.dto.LargeScreenMonthCountDTO">
SELECT
DATE_FORMAT( first_alarm_time, '%Y-%m' ) AS month,
COUNT( alarm_data_id ) AS monthCount
FROM
imt_alarm_data
WHERE
first_alarm_time >= DATE_SUB( CURDATE(), INTERVAL 6 MONTH )
GROUP BY
month
ORDER BY
month
</select>
<select id="getCustomerCreateMonthCount"
resultType="com.inspur.module.system.controller.largeScreen.dto.LargeScreenMonthCountDTO">
SELECT
DATE_FORMAT( create_time, '%Y-%m' ) AS month,
COUNT( customer_id ) AS monthCount
FROM
imt_customer_info
WHERE
create_time >= DATE_SUB( CURDATE(), INTERVAL 6 MONTH )
GROUP BY
month
ORDER BY
month
</select>
<select id="getEquipCreateMonthCount"
resultType="com.inspur.module.system.controller.largeScreen.dto.LargeScreenMonthCountDTO">
SELECT
DATE_FORMAT( create_time, '%Y-%m' ) AS month,
COUNT( equip_id ) AS monthCount
FROM
imt_equip_info
WHERE
create_time >= DATE_SUB( CURDATE(), INTERVAL 6 MONTH )
GROUP BY
month
ORDER BY
month
</select>
<select id="maintenanceOrderCount"
resultType="com.inspur.module.system.controller.largeScreen.vo.LargeScreenMaintenanceOrderCountListVO">
SELECT
imo.customer_id AS customerId,
ici.customer_name AS customerName,
count( imo.maintenance_order_id ) AS orderCount
FROM
imt_maintenance_order AS imo
LEFT JOIN imt_customer_info AS ici ON imo.customer_id = ici.customer_id
WHERE
imo.customer_id IS NOT NULL
GROUP BY
imo.customer_id
ORDER BY
orderCount DESC
LIMIT 4
</select>
<resultMap id="selectListTop4" type="com.inspur.module.system.controller.largeScreen.vo.LargeScreenAlarmListVO">
<result property="content" column="content"/>
<result property="lastAlarmTime" column="last_alarm_time"/>
<result property="customerName" column="customer_name"/>
<result property="equipNo" column="equip_no"/>
</resultMap>
<sql id="selectAlarmDataVo">
select ad.alarm_data_id, ad.alarm_rules_id, ad.equip_id, ad.component_id, ad.name_key, ad.content,
ad.alarm_value, ad.first_alarm_time, ad.last_alarm_time, ad.result, ad.status, ad.operator_id, ad.alarm_level,
ad.reason_description, ad.equip_alarm_id,ad.alarm_type, ei.equip_no, ci.component_name,
cui.customer_name,mi.model_name from imt_alarm_data ad
left join imt_equip_info ei on ad.equip_id = ei.equip_id
left join imt_customer_info cui on ei.customer_id = cui.customer_id
left join imt_component_info ci on ad.component_id = ci.component_id
left join imt_model_info mi on ei.model_id = mi.model_id
</sql>
<select id="selectArmListTop4" resultMap="selectListTop4">
<include refid="selectAlarmDataVo"/>
where ad.status = 0
and ad.deleted = '0'
ORDER BY ad.last_alarm_time desc
limit 4
</select>
<select id="customerDistribution"
resultType="com.inspur.module.system.controller.largeScreen.vo.LargeScreenCustomerDistributionVO">
SELECT
ici.province_code as provinceCode,
COUNT( iei.equip_id ) as data
FROM
imt_customer_info AS ici
LEFT JOIN imt_equip_info AS iei ON ici.customer_id = iei.customer_id
WHERE
ici.province_code IS NOT NULL
GROUP BY
ici.province_code HAVING data > 0
</select>
<select id="customerDistributionByProvinceCode"
resultType="com.inspur.module.system.controller.largeScreen.vo.LargeScreenCustomerEquipCountVO">
SELECT
ici.customer_name AS name,
COUNT( iei.equip_id ) AS value
FROM
imt_customer_info AS ici
LEFT JOIN imt_equip_info AS iei ON ici.customer_id = iei.customer_id
WHERE
ici.province_code = #{provinceCode}
GROUP BY
ici.customer_id
</select>
</mapper>

View File

@ -0,0 +1,81 @@
import request from "@/utils/request";
// 设备信息
export function getEquipInfoList() {
return request({
url: "/imt/largeScreen/equipInfoList",
method: "get",
});
}
// 规模数量
export function getDataCount() {
return request({
url: "/imt/largeScreen/dataCount",
method: "get",
});
}
// 故障数据分析
export function getFaultDataList() {
return request({
url: "/imt/largeScreen/faultDataList",
method: "get",
});
}
// 报警数据分析
export function getAlarmDataList() {
return request({
url: "/imt/largeScreen/alarmDataList",
method: "get",
});
}
// 企业和设备新增趋势
export function getCompanyAndEquipCreate() {
return request({
url: "/imt/largeScreen/companyAndEquipCreate",
method: "get",
});
}
// 在途维修工单
export function getMaintenanceOrder() {
return request({
url: "/imt/largeScreen/maintenanceOrder",
method: "get",
});
}
// 维修工单统计
export function getMaintenanceOrderCount() {
return request({
url: "/imt/largeScreen/maintenanceOrderCount",
method: "get",
});
}
// 告警信息
export function getAlarmList() {
return request({
url: "/imt/largeScreen/alarmList",
method: "get",
});
}
// 客户分布
export function getCustomerDistribution() {
return request({
url: "/imt/largeScreen/customerDistribution",
method: "get",
});
}
// 客户分布详情
export function getCustomerDistributionByProvinceCode(provinceCode) {
return request({
url: "/imt/largeScreen/customerDistributionByProvinceCode/" + provinceCode,
method: "get",
});
}

View File

@ -48,22 +48,26 @@
<div class="item-title">
<span class="title-font">故障数据分析</span>
</div>
<div class="item-content fault-data">
<div class="fault-icon"></div>
<div class="fault-content">
<div
v-for="(item, index) in faultList"
:key="index"
class="fault-item"
>
<div :class="changeMark(index)">
<span style="font-size:14px;font-weight:600;margin-left:11px">{{ item.name }}</span>
</div>
<div class="fault-num">
<span style="font-family:'BIAOTI';font-size:24px"> {{ item.num }}</span>
</div>
</div>
</div>
<div class="item-content">
<div
ref="faultChart"
style="height:100%;margin-left: -100px"
></div>
<!-- <div class="fault-icon"></div>-->
<!-- <div class="fault-content">-->
<!-- <div-->
<!-- v-for="(item, index) in faultList"-->
<!-- :key="index"-->
<!-- class="fault-item"-->
<!-- >-->
<!-- <div :class="changeMark(index)">-->
<!-- <span style="font-size:14px;font-weight:600;margin-left:11px">{{ item.faultLabel }}</span>-->
<!-- </div>-->
<!-- <div class="fault-num">-->
<!-- <span style="font-family:'BIAOTI';font-size:24px"> {{ item.faultCount }}</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</div>
@ -72,16 +76,16 @@
<div class="middle-header">
<div class="customer-overall">
<div class="head-info">客户规模</div>
<div class="head-value">28</div>
<div class="head-value">{{dataCount.customerCount}}</div>
</div>
<div class="equip-num-overall">
<div class="head-info">设备规模</div>
<div class="head-value">1200</div>
<div class="head-value">{{dataCount.equipCount}}</div>
</div>
<div class="equip-online-overall">
<div class="head-info">在线设备</div>
<div class="head-value">930</div>
<div class="head-value">{{dataCount.onlineEquipCount}}</div>
</div>
</div>
<div
@ -119,23 +123,23 @@
<div class="item-content alarm-lists">
<el-table
v-loading="loading2"
:data="maintenanceList"
:data="alarmList"
>
<el-table-column
prop="customerName"
label="客户名称"
/>
<el-table-column
prop="maintenanceTime"
label="维修时间"
prop="equipNo"
label="设备编号"
/>
<el-table-column
prop="type"
label="故障类型"
prop="content"
label="报警信息"
/>
<el-table-column
prop="progress"
label="进度"
prop="lastAlarmTime"
label="最后报警时间"
/>
</el-table>
</div>
@ -168,17 +172,26 @@
label="客户名称"
/>
<el-table-column
prop="maintenanceTime"
label="维修时间"
prop="createTime"
label="工单创建时间"
width="140px"
/>
<el-table-column
prop="type"
prop="faultType"
label="故障类型"
/>
>
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.FAULT_TYPE" :value="scope.row.faultType"/>
</template>
</el-table-column>
<el-table-column
prop="progress"
prop="status"
label="进度"
/>
>
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MAINTENANCE_STATUS" :value="scope.row.status"/>
</template>
</el-table-column>
</el-table>
</div>
</div>
@ -198,7 +211,7 @@
{{ item.customerName }}
</div>
<el-progress
:percentage="Number(item.orderNum)"
:percentage="Number(item.orderCount)"
:format="progressFormat"
define-back-color="#1A3050"
></el-progress>
@ -213,152 +226,151 @@
import * as echarts from "echarts";
import _ from "lodash";
import chinaMap from "../../../assets/map/china.json";
import {
getEquipInfoList,
getDataCount,
getFaultDataList,
getAlarmDataList,
getCompanyAndEquipCreate,
getMaintenanceOrder,
getMaintenanceOrderCount,
getAlarmList,
getCustomerDistribution,
getCustomerDistributionByProvinceCode
} from '@/api/system/largeScreen/largeScreen';
import {DICT_TYPE} from "@/utils/dict";
export default {
computed: {
DICT_TYPE() {
return DICT_TYPE
}
},
data() {
return {
alarmList:[],
companyAndEquipCreate:[],
alarmData:{},
dataCount: {
customerCount: 0,
equipCount: 0,
onlineEquipCount: 0
},
loading1: false,
equipList: [
{
customerName: "客户1",
equipNum: 2,
equipRun: 2,
alarmNum: 2,
},
{
customerName: "客户2",
equipNum: 5,
equipRun: 3,
alarmNum: 3,
},
{
customerName: "客户3",
equipNum: 10,
equipRun: 2,
alarmNum: 2,
},
{
customerName: "客户4",
equipNum: 6,
equipRun: 3,
alarmNum: 2,
},
// {
// customerName: "5",
// equipNum: 7,
// equipRun: 2,
// alarmNum: 2,
// },
],
faultList: [
{
name: "故障1",
num: 55,
},
{
name: "故障2",
num: 80,
},
{
name: "故障3",
num: 32,
},
{
name: "故障4",
num: 17,
},
],
equipList: [],
faultList: [],
loading2: false,
maintenanceList: [
{
customerName: "客户1",
maintenanceTime: "2024-01-18",
type: "传感器损坏",
progress: "报工",
},
{
customerName: "客户2",
maintenanceTime: "2024-03-15",
type: "轴承磨损",
progress: "维修中",
},
{
customerName: "客户3",
maintenanceTime: "2024-01-05",
type: "轴承不对称",
progress: "维修中",
},
{
customerName: "客户4",
maintenanceTime: "2024-01-05",
type: "轴承底座不稳",
progress: "待确认",
},
],
orderList: [
{
customerName: "客户1",
orderNum: 150,
},
{
customerName: "客户2",
orderNum: 78,
},
{
customerName: "客户3",
orderNum: 180,
},
{
customerName: "客户4",
orderNum: 220,
},
],
maintenanceList: [],
orderList: [],
myChart: null,
provinceName: [],
selectedProvince: "",
series: [],
customerEquNumList: [
{
name: "客户1",
value: 12,
},
{
name: "客户2",
value: 34,
},
{
name: "客户3",
value: 27,
},
],
customerEquNumList: [],
showPanel: false,
firstMark: false,
};
},
created() {
this.getAlarmCharts();
this.getFaultChart();
this.getCompanyAndEquipGrowTrend();
this.mapRender();
this.initData();
},
methods: {
initData(){
getEquipInfoList().then(res=>{
this.equipList = res.data;
})
getDataCount().then(res=>{
this.dataCount = res.data;
})
getMaintenanceOrder().then(res => {
this.maintenanceList = res.data;
})
getMaintenanceOrderCount().then(res=>{
this.orderList = res.data
})
getAlarmList().then(res=>{
this.alarmList = res.data
})
},
closePanel() {
this.showPanel = false;
},
progressFormat(count) {
return `${count}`;
return `${count}`;
},
changeMark(index) {
return "fault-mark" + (index + 1);
},
async getFaultChart(){
await getFaultDataList().then(res=>{
this.faultList = res.data;
})
this.initFaultChart(this.faultList);
},
initFaultChart(data){
let p = new Promise((resolve) => {
resolve();
});
let chartData = []
data.forEach(item=>{
const fault = {
name: item.faultLabel,
value: item.faultCount
};
chartData.push(fault)
})
p.then(() => {
this.faultChart = echarts.init(this.$refs.faultChart);
let option = {
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
right: 10,
top: 'center',
textStyle: {
color:'#fff'
}
},
series: [
{
name: 'Access From',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: false,
fontSize: 40,
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: chartData
}
]
};
this.faultChart.setOption(option);
});
},
/**报警数据分析echart */
getAlarmCharts() {
async getAlarmCharts() {
// let chart1 = echarts.init(this.$refs.chart1);
// chart1.showLoading();
//
var data = {
x: ["1月", "2月", "3月", "4月", "5月", "6月"],
y: [12, 5, 11, 24, 18, 19],
};
this.initAlarmCharts(data);
await getAlarmDataList().then(res=>{
this.alarmData = res.data;
})
this.initAlarmCharts(this.alarmData);
},
initAlarmCharts(data) {
let p = new Promise((resolve) => {
@ -392,7 +404,7 @@ export default {
},
yAxis: {
type: "value",
name: "单位:",
name: "单位:",
nameLocation: "end",
interval: 5,
nameTextStyle: {
@ -436,20 +448,11 @@ export default {
this.chart1.hideLoading();
});
},
getCompanyAndEquipGrowTrend() {
let data = [
{
x: ["1月", "2月", "3月", "4月", "5月", "6月"],
y: [1, 2, 3, 4, 5, 6],
name: "企业",
},
{
x: ["1月", "2月", "3月", "4月", "5月", "6月"],
y: [15, 45, 55, 60, 70, 88],
name: "设备",
},
];
this.initTrendChart(data);
async getCompanyAndEquipGrowTrend() {
await getCompanyAndEquipCreate().then(res => {
this.companyAndEquipCreate = res.data;
})
this.initTrendChart(this.companyAndEquipCreate);
},
initTrendChart(data) {
let p = new Promise((resolve) => {
@ -608,41 +611,29 @@ export default {
let p = new Promise((resolve) => {
resolve();
});
p.then(() => {
p.then(async () => {
const _this = this;
echarts.registerMap("china", { geoJSON: chinaMap });
echarts.registerMap("china", {geoJSON: chinaMap});
this.myChart = echarts.init(this.$refs.mapChart);
// getEquNumByProvince().then((res) => {
let showdata = [];
let provinceData = [
{
provinceName: "山东省",
data: 120,
},
{
provinceName: "上海市",
data: 55,
},
{
provinceName: "广东省",
data: 89,
},
];
if (provinceData != null && provinceData.length > 0) {
let mapData = chinaMap.features;
provinceData.forEach((e) => {
let selectData = mapData.filter(
(md) => md.properties.name === e.provinceName
);
showdata.push({
name: e.provinceName,
value: selectData[0].properties.center,
num: e.data,
await getCustomerDistribution().then((res) => {
let provinceData = res.data;
if (provinceData != null && provinceData.length > 0) {
let mapData = chinaMap.features;
provinceData.forEach((e) => {
let selectData = mapData.filter(
(md) => md.properties.name === e.provinceName
);
showdata.push({
name: e.provinceName,
code: e.provinceCode,
value: selectData[0].properties.center,
num: e.data,
});
this.provinceName.push(e.provinceName);
});
this.provinceName.push(e.provinceName);
});
}
}
})
// // console.log("selectData:", selectData);
// // console.log("showdata:", showdata);
// });
@ -786,7 +777,7 @@ export default {
this.myChart.on("click", (e) => {
if (this.provinceName.includes(e.name)) {
console.log("ddd:", e);
// this.customerEquNumList = [];
this.customerEquNumList = [];
this.selectedProvince = e.name;
//
this.showPanel = true;
@ -796,16 +787,9 @@ export default {
var panel = document.getElementById("popPanel");
panel.style.left = dx + "px";
panel.style.top = dy + "px";
// getEquNumByCity(e.name).then((res) => {
// let citydata = res.data;
// citydata.forEach((e) => {
// this.customerEquNumList.push({
// name: e.regionName,
// value: e.data,
// });
// this.eqpNums += e.data;
// });
// });
getCustomerDistributionByProvinceCode(e.data.code).then(res=>{
this.customerEquNumList = res.data;
})
}
});
});