diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/LargeScreenController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/LargeScreenController.java new file mode 100644 index 0000000..5ac63ba --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/LargeScreenController.java @@ -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> equipInfoList(){ + return success(largeScreenService.equipInfoList()); + } + + @GetMapping("/dataCount") + @Operation(summary = "规模数量") + public CommonResult dataCount(){ + return success(largeScreenService.dataCount()); + } + + @GetMapping("/faultDataList") + @Operation(summary = "故障数据分析") + public CommonResult> faultDataList(){ + return success(largeScreenService.faultDataList()); + } + + @GetMapping("/alarmDataList") + @Operation(summary = "报警数据分析") + public CommonResult alarmDataList(){ + return success(largeScreenService.alarmDataList()); + } + + @GetMapping("/companyAndEquipCreate") + @Operation(summary = "企业和设备新增趋势") + public CommonResult> companyAndEquipCreate(){ + return success(largeScreenService.companyAndEquipCreate()); + } + + @GetMapping("/maintenanceOrder") + @Operation(summary = "在途维修工单") + public CommonResult> maintenanceOrder(){ + return success(largeScreenService.maintenanceOrder()); + } + + @GetMapping("/maintenanceOrderCount") + @Operation(summary = "维修工单统计") + public CommonResult> maintenanceOrderCount(){ + return success(largeScreenService.maintenanceOrderCount()); + } + + @GetMapping("/alarmList") + @Operation(summary = "告警信息") + public CommonResult> alarmList(){ + return success(largeScreenService.alarmList()); + } + + @GetMapping("/customerDistribution") + @Operation(summary = "客户分布") + public CommonResult> customerDistribution(){ + return success(largeScreenService.customerDistribution()); + } + + @GetMapping("/customerDistributionByProvinceCode/{provinceCode}") + @Operation(summary = "客户分布详情") + public CommonResult> customerDistributionByProvinceCode(@PathVariable("provinceCode") Integer provinceCode){ + return success(largeScreenService.customerDistributionByProvinceCode(provinceCode)); + } + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/dto/LargeScreenFaultCountDTO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/dto/LargeScreenFaultCountDTO.java new file mode 100644 index 0000000..f6acf4c --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/dto/LargeScreenFaultCountDTO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/dto/LargeScreenMonthCountDTO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/dto/LargeScreenMonthCountDTO.java new file mode 100644 index 0000000..9e2520a --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/dto/LargeScreenMonthCountDTO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenAlarmDataVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenAlarmDataVO.java new file mode 100644 index 0000000..16e40cf --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenAlarmDataVO.java @@ -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 x; + + private List y; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenAlarmListVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenAlarmListVO.java new file mode 100644 index 0000000..4c98fb9 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenAlarmListVO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCompanyAndEquipCreateListVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCompanyAndEquipCreateListVO.java new file mode 100644 index 0000000..f777b41 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCompanyAndEquipCreateListVO.java @@ -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 x; + + private List y; + + private String name; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCustomerDistributionVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCustomerDistributionVO.java new file mode 100644 index 0000000..352a8f9 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCustomerDistributionVO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCustomerEquipCountVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCustomerEquipCountVO.java new file mode 100644 index 0000000..3d0edde --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenCustomerEquipCountVO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenDataCountVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenDataCountVO.java new file mode 100644 index 0000000..008b783 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenDataCountVO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenEquipInfoListVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenEquipInfoListVO.java new file mode 100644 index 0000000..3e817f6 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenEquipInfoListVO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenFaultDataListVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenFaultDataListVO.java new file mode 100644 index 0000000..5b7d8be --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenFaultDataListVO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenMaintenanceOrderCountListVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenMaintenanceOrderCountListVO.java new file mode 100644 index 0000000..14cc676 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenMaintenanceOrderCountListVO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenMaintenanceOrderListVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenMaintenanceOrderListVO.java new file mode 100644 index 0000000..c1f852d --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/largeScreen/vo/LargeScreenMaintenanceOrderListVO.java @@ -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; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/largeScreen/LargeScreenMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/largeScreen/LargeScreenMapper.java new file mode 100644 index 0000000..e3f4651 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/largeScreen/LargeScreenMapper.java @@ -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 + */ + List equipInfoList(); + + /** + * 获取故障类型各类型个数 + * + * @Author xusd + * @Date 9:56 2024/9/25 + * @return java.util.List + */ + List selectFaultCount(); + + /** + * 各月份报警次数 + * + * @Author xusd + * @Date 10:43 2024/9/25 + * @return java.util.List + */ + @TenantIgnore + List getAlarmMonthCount(); + + /** + * 各月份客户创建数 + * + * @Author xusd + * @Date 11:12 2024/9/25 + * @return java.util.List + */ + List getCustomerCreateMonthCount(); + + /** + * 各月份设备创建数 + * + * @Author xusd + * @Date 11:15 2024/9/25 + * @return java.util.List + */ + List getEquipCreateMonthCount(); + + /** + * 维修工单统计 + * + * @Author xusd + * @Date 14:50 2024/9/25 + * @return java.util.List + */ + List maintenanceOrderCount(); + + /** + * 告警信息 + * + * @Author xusd + * @Date 15:57 2024/9/25 + * @return java.util.List + */ + @TenantIgnore + List selectArmListTop4(); + + /** + * 客户分布 + * + * @Author xusd + * @Date 10:35 2024/9/26 + * @return java.util.List + */ + List customerDistribution(); + + /** + * 根据省编号获取客户分布详情 + * + * @Author xusd + * @Date 11:05 2024/9/26 + * @param provinceCode 省标识 + * @return java.util.List + */ + List customerDistributionByProvinceCode(@Param("provinceCode") Integer provinceCode); +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/largeScreen/LargeScreenService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/largeScreen/LargeScreenService.java new file mode 100644 index 0000000..f50ce00 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/largeScreen/LargeScreenService.java @@ -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 + */ + List 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 + */ + List 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 + */ + List companyAndEquipCreate(); + + /** + * 在途维修工单 + * + * @Author xusd + * @Date 14:42 2024/9/25 + * @return java.util.List + */ + List maintenanceOrder(); + + /** + * 维修工单统计 + * + * @Author xusd + * @Date 14:49 2024/9/25 + * @return java.util.List + */ + List maintenanceOrderCount(); + + /** + * 告警信息 + * + * @Author xusd + * @Date 15:45 2024/9/25 + * @return java.util.List + */ + List alarmList(); + + /** + * 客户分布 + * + * @Author xusd + * @Date 10:18 2024/9/26 + * @return java.util.List + */ + List customerDistribution(); + + /** + * 根据省编号获取客户分布详情 + * + * @Author xusd + * @Date 11:02 2024/9/26 + * @param provinceCode 省编号 + * @return java.util.List + */ + List customerDistributionByProvinceCode(Integer provinceCode); +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/largeScreen/LargeScreenServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/largeScreen/LargeScreenServiceImpl.java new file mode 100644 index 0000000..711e78a --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/largeScreen/LargeScreenServiceImpl.java @@ -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 equipInfoList() { + List 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 faultDataList() { + List faultTypeList = dictDataService.getDictDataListByDictType("fault_type"); + if (CollUtil.isEmpty(faultTypeList)) { + return Collections.emptyList(); + } + List dtoList = largeScreenMapper.selectFaultCount(); + Map dtoMap = dtoList.stream().collect(Collectors.toMap(LargeScreenFaultCountDTO::getFaultValue, LargeScreenFaultCountDTO::getFaultCount)); + List 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 x = getFirstSixMonths(); + vo.setX(x); + List list = largeScreenMapper.getAlarmMonthCount(); + if (CollUtil.isNotEmpty(list)) { + List y = new ArrayList<>(); + Map 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 companyAndEquipCreate() { + List list = new ArrayList<>(); + List x = getFirstSixMonths(); + //客户 + LargeScreenCompanyAndEquipCreateListVO customer = new LargeScreenCompanyAndEquipCreateListVO(); + customer.setX(x); + customer.setName("企业"); + List customerList = largeScreenMapper.getCustomerCreateMonthCount(); + if (CollUtil.isNotEmpty(customerList)){ + List y = new ArrayList<>(); + Map 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 equipList = largeScreenMapper.getEquipCreateMonthCount(); + if (CollUtil.isNotEmpty(equipList)){ + List y = new ArrayList<>(); + Map 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 maintenanceOrder() { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.orderByDesc(MaintenanceOrderDO::getCreateTime); + queryWrapper.last("limit 4"); + List maintenanceOrderDOS = maintenanceOrderMapper.selectList(queryWrapper); + if (CollUtil.isEmpty(maintenanceOrderDOS)) { + return Collections.emptyList(); + } + List customerList = customerInfoService.selection(true); + Map 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 maintenanceOrderCount() { + return largeScreenMapper.maintenanceOrderCount(); + } + + @Override + public List alarmList() { + return largeScreenMapper.selectArmListTop4(); + } + + @Override + public List customerDistribution() { + List 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 customerDistributionByProvinceCode(Integer provinceCode) { + return largeScreenMapper.customerDistributionByProvinceCode(provinceCode); + } + + /** + * 获取前六个月的月份 + * + * @return java.util.List + * @Author xusd + * @Date 10:30 2024/9/25 + */ + private List getFirstSixMonths() { + List list = new ArrayList<>(); + DateTime firstSixMonth = DateUtil.offsetMonth(new Date(), -5); + List dateTimes = DateUtil.rangeToList(firstSixMonth, new Date(), DateField.MONTH); + dateTimes.forEach(item -> list.add(DateUtil.format(item, "yyyy-MM"))); + return list; + } +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/resources/mapper/largeScreen/LargeScreenMapper.xml b/imt-server/imt-module-system/imt-module-system-biz/src/main/resources/mapper/largeScreen/LargeScreenMapper.xml new file mode 100644 index 0000000..d381d60 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/resources/mapper/largeScreen/LargeScreenMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + 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 + + + + + \ No newline at end of file diff --git a/imt-ui/src/api/system/largeScreen/largeScreen.js b/imt-ui/src/api/system/largeScreen/largeScreen.js new file mode 100644 index 0000000..329375c --- /dev/null +++ b/imt-ui/src/api/system/largeScreen/largeScreen.js @@ -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", + }); +} diff --git a/imt-ui/src/views/system/bigscreen/index.vue b/imt-ui/src/views/system/bigscreen/index.vue index f28b510..9342bf3 100644 --- a/imt-ui/src/views/system/bigscreen/index.vue +++ b/imt-ui/src/views/system/bigscreen/index.vue @@ -48,22 +48,26 @@
故障数据分析
-
-
-
-
-
- {{ item.name }} -
-
- {{ item.num }} -
-
-
+
+
+ + + + + + + + + + + + + + +
@@ -72,16 +76,16 @@
客户规模
-
28家
+
{{dataCount.customerCount}}家
设备规模
-
1200台
+
{{dataCount.equipCount}}台
在线设备
-
930台
+
{{dataCount.onlineEquipCount}}台
@@ -168,17 +172,26 @@ label="客户名称" /> + > + + + > + + @@ -198,7 +211,7 @@ {{ item.customerName }} @@ -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; + }) } }); });