diff --git a/aucma-report/src/main/java/com/aucma/report/controller/Board4Controller.java b/aucma-report/src/main/java/com/aucma/report/controller/Board4Controller.java new file mode 100644 index 0000000..6339ef7 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/controller/Board4Controller.java @@ -0,0 +1,103 @@ +package com.aucma.report.controller; + +import com.aucma.common.core.controller.BaseController; +import com.aucma.common.core.domain.AjaxResult; +import com.aucma.report.service.IBoard4Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * Board4看板数据Controller + * 数字化注塑车间管控中心 + * + * @author YinQ + */ +@RestController +@RequestMapping("/board4") +public class Board4Controller extends BaseController { + + @Autowired + private IBoard4Service board4Service; + + /** + * 获取产量统计(年累计、月累计、日累计) + */ + @GetMapping("/productionTotal") + public AjaxResult getProductionTotal() { + return AjaxResult.success(board4Service.getProductionTotal()); + } + + /** + * 获取今日工单统计(计划数、完成数、差异数、完成率) + */ + @GetMapping("/orderStatistics") + public AjaxResult getOrderStatistics() { + return AjaxResult.success(board4Service.getOrderStatistics()); + } + + /** + * 获取今日工单进度列表 + */ + @GetMapping("/orderProgressList") + public AjaxResult getOrderProgressList() { + return AjaxResult.success(board4Service.getOrderProgressList()); + } + + /** + * 获取设备状态统计 + */ + @GetMapping("/deviceStatus") + public AjaxResult getDeviceStatus() { + return AjaxResult.success(board4Service.getDeviceStatus()); + } + + /** + * 获取最新报警信息 + */ + @GetMapping("/alarmInfo") + public AjaxResult getAlarmInfo() { + return AjaxResult.success(board4Service.getAlarmInfo()); + } + + /** + * 获取维修分析列表(按设备聚合) + */ + @GetMapping("/repairAnalysisList") + public AjaxResult getRepairAnalysisList() { + return AjaxResult.success(board4Service.getRepairAnalysisList()); + } + + /** + * 获取报修趋势列表 + */ + @GetMapping("/repairTrendList") + public AjaxResult getRepairTrendList() { + return AjaxResult.success(board4Service.getRepairTrendList()); + } + + /** + * 获取质量统计 + */ + @GetMapping("/qualityStatistics") + public AjaxResult getQualityStatistics() { + return AjaxResult.success(board4Service.getQualityStatistics()); + } + + /** + * 获取质量追溯列表 + */ + @GetMapping("/qualityTraceList") + public AjaxResult getQualityTraceList() { + return AjaxResult.success(board4Service.getQualityTraceList()); + } + + /** + * 获取设备分析/产量列表 + */ + @GetMapping("/deviceProductionList") + public AjaxResult getDeviceProductionList() { + return AjaxResult.success(board4Service.getDeviceProductionList()); + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4AlarmInfoVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4AlarmInfoVo.java new file mode 100644 index 0000000..c19a59f --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4AlarmInfoVo.java @@ -0,0 +1,58 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 报警信息VO + * 是否有报警、报警设备、报警原因、报警时间 + * 数据来源:DMS_RECORD_ALARM_INFO + * + * @author YinQ + */ +public class Board4AlarmInfoVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 是否有报警 */ + private Boolean hasAlarm; + + /** 报警设备名称 */ + private String deviceName; + + /** 报警原因 */ + private String alarmReason; + + /** 报警时间 */ + private String alarmTime; + + public Boolean getHasAlarm() { + return hasAlarm; + } + + public void setHasAlarm(Boolean hasAlarm) { + this.hasAlarm = hasAlarm; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getAlarmReason() { + return alarmReason; + } + + public void setAlarmReason(String alarmReason) { + this.alarmReason = alarmReason; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4DeviceProductionVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4DeviceProductionVo.java new file mode 100644 index 0000000..2ba629a --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4DeviceProductionVo.java @@ -0,0 +1,36 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 设备分析/设备产量VO(列表项) + * 设备名称、实际产量 + * 数据来源:BASE_DEVICE_PARAM_VAL + BASE_DEVICELEDGER + * + * @author YinQ + */ +public class Board4DeviceProductionVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 设备名称 */ + private String deviceName; + + /** 实际产量(当天工艺参数,PARAM_CODE='19') */ + private Long production; + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public Long getProduction() { + return production; + } + + public void setProduction(Long production) { + this.production = production; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4DeviceStatusVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4DeviceStatusVo.java new file mode 100644 index 0000000..1859138 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4DeviceStatusVo.java @@ -0,0 +1,68 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 设备状态统计VO + * 设备正常数、告警数、停机数、总数 + * + * @author YinQ + */ +public class Board4DeviceStatusVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 设备正常数(DEVICE_STATUS='0') */ + private Long normalCount; + + /** 设备告警数(DEVICE_STATUS='1') */ + private Long alarmCount; + + /** 设备停机数(DEVICE_STATUS='2') */ + private Long stopCount; + + /** 设备总数 */ + private Long totalCount; + + /** 总维修次数 */ + private Long repairCount; + + public Long getNormalCount() { + return normalCount; + } + + public void setNormalCount(Long normalCount) { + this.normalCount = normalCount; + } + + public Long getAlarmCount() { + return alarmCount; + } + + public void setAlarmCount(Long alarmCount) { + this.alarmCount = alarmCount; + } + + public Long getStopCount() { + return stopCount; + } + + public void setStopCount(Long stopCount) { + this.stopCount = stopCount; + } + + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + public Long getRepairCount() { + return repairCount; + } + + public void setRepairCount(Long repairCount) { + this.repairCount = repairCount; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4OrderProgressVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4OrderProgressVo.java new file mode 100644 index 0000000..ee40cd1 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4OrderProgressVo.java @@ -0,0 +1,68 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 工单进度VO(列表项) + * 型号、计划数、完成数、差异数、执行进度 + * + * @author YinQ + */ +public class Board4OrderProgressVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 型号/物料名称 */ + private String materialName; + + /** 计划数 */ + private Long planCount; + + /** 完成数 */ + private Long completeCount; + + /** 差异数 */ + private Long diffCount; + + /** 执行进度(如 90%) */ + private String progress; + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public Long getPlanCount() { + return planCount; + } + + public void setPlanCount(Long planCount) { + this.planCount = planCount; + } + + public Long getCompleteCount() { + return completeCount; + } + + public void setCompleteCount(Long completeCount) { + this.completeCount = completeCount; + } + + public Long getDiffCount() { + return diffCount; + } + + public void setDiffCount(Long diffCount) { + this.diffCount = diffCount; + } + + public String getProgress() { + return progress; + } + + public void setProgress(String progress) { + this.progress = progress; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4OrderStatisticsVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4OrderStatisticsVo.java new file mode 100644 index 0000000..db9e5e1 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4OrderStatisticsVo.java @@ -0,0 +1,57 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 工单统计VO + * 今日计划数、今日完成数、今日差异数、今日完成率 + * + * @author YinQ + */ +public class Board4OrderStatisticsVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 今日计划数 */ + private Long planCount; + + /** 今日完成数 */ + private Long completeCount; + + /** 今日差异数(计划-完成) */ + private Long diffCount; + + /** 今日完成率(百分比,不含%) */ + private String completeRate; + + public Long getPlanCount() { + return planCount; + } + + public void setPlanCount(Long planCount) { + this.planCount = planCount; + } + + public Long getCompleteCount() { + return completeCount; + } + + public void setCompleteCount(Long completeCount) { + this.completeCount = completeCount; + } + + public Long getDiffCount() { + return diffCount; + } + + public void setDiffCount(Long diffCount) { + this.diffCount = diffCount; + } + + public String getCompleteRate() { + return completeRate; + } + + public void setCompleteRate(String completeRate) { + this.completeRate = completeRate; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4ProductionTotalVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4ProductionTotalVo.java new file mode 100644 index 0000000..a5b7c1e --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4ProductionTotalVo.java @@ -0,0 +1,46 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 产量统计VO + * 年累计产量、月累计产量、日累计产量 + * + * @author YinQ + */ +public class Board4ProductionTotalVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 年累计产量(去年数据,来源BASE_ORDERINFO) */ + private Long yearTotal; + + /** 月累计产量(当月数据,来源BASE_ORDERINFO) */ + private Long monthTotal; + + /** 日累计产量(当天数据,来源BASE_DEVICE_PARAM_VAL,PARAM_CODE='19') */ + private Long dayTotal; + + public Long getYearTotal() { + return yearTotal; + } + + public void setYearTotal(Long yearTotal) { + this.yearTotal = yearTotal; + } + + public Long getMonthTotal() { + return monthTotal; + } + + public void setMonthTotal(Long monthTotal) { + this.monthTotal = monthTotal; + } + + public Long getDayTotal() { + return dayTotal; + } + + public void setDayTotal(Long dayTotal) { + this.dayTotal = dayTotal; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4QualityStatisticsVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4QualityStatisticsVo.java new file mode 100644 index 0000000..0709b34 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4QualityStatisticsVo.java @@ -0,0 +1,36 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 质量统计VO + * 合格数、不合格数 + * 数据来源:REPORT_QUALITY_INSPECTION + * + * @author YinQ + */ +public class Board4QualityStatisticsVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 合格数(TREATMENT_MEASURE='3') */ + private Long qualifiedCount; + + /** 不合格数(TREATMENT_MEASURE='1') */ + private Long unqualifiedCount; + + public Long getQualifiedCount() { + return qualifiedCount; + } + + public void setQualifiedCount(Long qualifiedCount) { + this.qualifiedCount = qualifiedCount; + } + + public Long getUnqualifiedCount() { + return unqualifiedCount; + } + + public void setUnqualifiedCount(Long unqualifiedCount) { + this.unqualifiedCount = unqualifiedCount; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4QualityTraceVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4QualityTraceVo.java new file mode 100644 index 0000000..acc73f1 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4QualityTraceVo.java @@ -0,0 +1,47 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 质量追溯VO(列表项) + * 产品名、合格率、合格上限 + * 数据来源:REPORT_QUALITY_INSPECTION + * + * @author YinQ + */ +public class Board4QualityTraceVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 产品名/物料名称 */ + private String materialName; + + /** 合格率(百分比数值) */ + private Long passRate; + + /** 合格上限(默认100) */ + private Long passLimit; + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public Long getPassRate() { + return passRate; + } + + public void setPassRate(Long passRate) { + this.passRate = passRate; + } + + public Long getPassLimit() { + return passLimit; + } + + public void setPassLimit(Long passLimit) { + this.passLimit = passLimit; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4RepairAnalysisVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4RepairAnalysisVo.java new file mode 100644 index 0000000..a1dc887 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4RepairAnalysisVo.java @@ -0,0 +1,47 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 维修分析VO(列表项) + * 设备名称、占比、次数 + * 数据来源:DMS_BILLS_FAULT_INSTANCE,按设备聚合 + * + * @author YinQ + */ +public class Board4RepairAnalysisVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 设备名称 */ + private String deviceName; + + /** 占比(百分比数值) */ + private Long percent; + + /** 维修次数 */ + private Long repairCount; + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public Long getPercent() { + return percent; + } + + public void setPercent(Long percent) { + this.percent = percent; + } + + public Long getRepairCount() { + return repairCount; + } + + public void setRepairCount(Long repairCount) { + this.repairCount = repairCount; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4RepairTrendVo.java b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4RepairTrendVo.java new file mode 100644 index 0000000..b86d480 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/vo/Board4RepairTrendVo.java @@ -0,0 +1,36 @@ +package com.aucma.report.domain.vo; + +import java.io.Serializable; + +/** + * Board4 报修趋势VO(列表项) + * 时间、报修次数 + * 数据来源:DMS_BILLS_FAULT_INSTANCE + * + * @author YinQ + */ +public class Board4RepairTrendVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** 时间(小时,如 08:00) */ + private String timeHour; + + /** 报修次数 */ + private Long repairCount; + + public String getTimeHour() { + return timeHour; + } + + public void setTimeHour(String timeHour) { + this.timeHour = timeHour; + } + + public Long getRepairCount() { + return repairCount; + } + + public void setRepairCount(Long repairCount) { + this.repairCount = repairCount; + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/mapper/Board4Mapper.java b/aucma-report/src/main/java/com/aucma/report/mapper/Board4Mapper.java new file mode 100644 index 0000000..3aa3746 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/mapper/Board4Mapper.java @@ -0,0 +1,95 @@ +package com.aucma.report.mapper; + +import com.aucma.report.domain.vo.*; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +/** + * Board4看板数据Mapper接口 + * 数字化注塑车间管控中心 + * + * @author YinQ + */ +@Mapper +public interface Board4Mapper { + + /** + * 查询年累计产量(去年数据) + * 数据来源:BASE_ORDERINFO + */ + Long selectYearProductionTotal(); + + /** + * 查询月累计产量(当月数据) + * 数据来源:BASE_ORDERINFO + */ + Long selectMonthProductionTotal(); + + /** + * 查询日累计产量(当天工艺参数) + * 数据来源:BASE_DEVICE_PARAM_VAL,PARAM_CODE='19'(实际产出数量) + */ + Long selectDayProductionTotal(); + + /** + * 查询今日工单统计(计划数、完成数) + * 数据来源:BASE_ORDERINFO + */ + HashMap selectTodayOrderStatistics(); + + /** + * 查询今日工单进度列表 + * 数据来源:BASE_ORDERINFO + */ + List selectTodayOrderProgressList(); + + /** + * 查询设备状态统计(正常、告警、停机、总数) + * 数据来源:BASE_DEVICELEDGER + */ + HashMap selectDeviceStatusStatistics(); + + /** + * 查询总维修次数 + * 数据来源:DMS_BILLS_FAULT_INSTANCE + */ + Long selectTotalRepairCount(); + + /** + * 查询最新报警信息 + * 数据来源:DMS_RECORD_ALARM_INFO + */ + HashMap selectLatestAlarmInfo(); + + /** + * 查询维修分析列表(按设备聚合) + * 数据来源:DMS_BILLS_FAULT_INSTANCE,以机台设备聚合 + */ + List selectRepairAnalysisByDevice(); + + /** + * 查询报修趋势(按时间段统计) + * 数据来源:DMS_BILLS_FAULT_INSTANCE + */ + List selectRepairTrendList(); + + /** + * 查询质量统计(合格数/不合格数) + * 数据来源:REPORT_QUALITY_INSPECTION + */ + HashMap selectQualityStatistics(); + + /** + * 查询质量追溯列表 + * 数据来源:REPORT_QUALITY_INSPECTION + */ + List selectQualityTraceList(); + + /** + * 查询设备分析列表(各设备机台实际产量) + * 数据来源:BASE_DEVICE_PARAM_VAL + BASE_DEVICELEDGER + */ + List selectDeviceProductionAnalysis(); +} diff --git a/aucma-report/src/main/java/com/aucma/report/service/IBoard4Service.java b/aucma-report/src/main/java/com/aucma/report/service/IBoard4Service.java new file mode 100644 index 0000000..1d02bc0 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/service/IBoard4Service.java @@ -0,0 +1,64 @@ +package com.aucma.report.service; + +import com.aucma.report.domain.vo.*; + +import java.util.List; + +/** + * Board4看板数据Service接口 + * 数字化注塑车间管控中心 + * + * @author YinQ + */ +public interface IBoard4Service { + + /** + * 获取产量统计(年累计、月累计、日累计) + */ + Board4ProductionTotalVo getProductionTotal(); + + /** + * 获取今日工单统计(计划数、完成数、差异数、完成率) + */ + Board4OrderStatisticsVo getOrderStatistics(); + + /** + * 获取今日工单进度列表 + */ + List getOrderProgressList(); + + /** + * 获取设备状态统计 + */ + Board4DeviceStatusVo getDeviceStatus(); + + /** + * 获取最新报警信息 + */ + Board4AlarmInfoVo getAlarmInfo(); + + /** + * 获取维修分析列表(按设备聚合) + */ + List getRepairAnalysisList(); + + /** + * 获取报修趋势列表 + */ + List getRepairTrendList(); + + /** + * 获取质量统计 + */ + Board4QualityStatisticsVo getQualityStatistics(); + + /** + * 获取质量追溯列表 + */ + List getQualityTraceList(); + + /** + * 获取设备分析/产量列表 + */ + List getDeviceProductionList(); +} diff --git a/aucma-report/src/main/java/com/aucma/report/service/impl/Board4ServiceImpl.java b/aucma-report/src/main/java/com/aucma/report/service/impl/Board4ServiceImpl.java new file mode 100644 index 0000000..616a46c --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/service/impl/Board4ServiceImpl.java @@ -0,0 +1,199 @@ +package com.aucma.report.service.impl; + +import com.aucma.report.domain.vo.*; +import com.aucma.report.mapper.Board4Mapper; +import com.aucma.report.service.IBoard4Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * Board4看板数据Service业务层处理 + * 数字化注塑车间管控中心 + * + * @author YinQ + */ +@Service +public class Board4ServiceImpl implements IBoard4Service { + + @Autowired + private Board4Mapper board4Mapper; + + /** + * 获取产量统计(年累计、月累计、日累计) + */ + @Override + public Board4ProductionTotalVo getProductionTotal() { + Board4ProductionTotalVo vo = new Board4ProductionTotalVo(); + Long yearTotal = board4Mapper.selectYearProductionTotal(); + Long monthTotal = board4Mapper.selectMonthProductionTotal(); + Long dayTotal = board4Mapper.selectDayProductionTotal(); + vo.setYearTotal(yearTotal != null ? yearTotal : 0L); + vo.setMonthTotal(monthTotal != null ? monthTotal : 0L); + vo.setDayTotal(dayTotal != null ? dayTotal : 0L); + return vo; + } + + /** + * 获取今日工单统计(计划数、完成数、差异数、完成率) + */ + @Override + public Board4OrderStatisticsVo getOrderStatistics() { + Board4OrderStatisticsVo vo = new Board4OrderStatisticsVo(); + HashMap stats = board4Mapper.selectTodayOrderStatistics(); + if (stats != null) { + Long planCount = getLongValue(stats.get("PLAN_COUNT")); + Long completeCount = getLongValue(stats.get("COMPLETE_COUNT")); + vo.setPlanCount(planCount); + vo.setCompleteCount(completeCount); + vo.setDiffCount(planCount - completeCount); + if (planCount > 0) { + vo.setCompleteRate(String.valueOf(Math.round(completeCount * 100.0 / planCount))); + } else { + vo.setCompleteRate("0"); + } + } else { + vo.setPlanCount(0L); + vo.setCompleteCount(0L); + vo.setDiffCount(0L); + vo.setCompleteRate("0"); + } + return vo; + } + + /** + * 获取今日工单进度列表 + */ + @Override + public List getOrderProgressList() { + List list = board4Mapper.selectTodayOrderProgressList(); + return list != null ? list : new ArrayList<>(); + } + + /** + * 获取设备状态统计 + */ + @Override + public Board4DeviceStatusVo getDeviceStatus() { + Board4DeviceStatusVo vo = new Board4DeviceStatusVo(); + HashMap stats = board4Mapper.selectDeviceStatusStatistics(); + if (stats != null) { + vo.setNormalCount(getLongValue(stats.get("NORMAL_COUNT"))); + vo.setAlarmCount(getLongValue(stats.get("ALARM_COUNT"))); + vo.setStopCount(getLongValue(stats.get("STOP_COUNT"))); + vo.setTotalCount(getLongValue(stats.get("TOTAL_COUNT"))); + } else { + vo.setNormalCount(0L); + vo.setAlarmCount(0L); + vo.setStopCount(0L); + vo.setTotalCount(0L); + } + Long repairCount = board4Mapper.selectTotalRepairCount(); + vo.setRepairCount(repairCount != null ? repairCount : 0L); + return vo; + } + + /** + * 获取最新报警信息 + */ + @Override + public Board4AlarmInfoVo getAlarmInfo() { + Board4AlarmInfoVo vo = new Board4AlarmInfoVo(); + HashMap info = board4Mapper.selectLatestAlarmInfo(); + if (info != null && !info.isEmpty()) { + vo.setHasAlarm(true); + vo.setDeviceName(getStringValue(info.get("DEVICE_NAME"))); + vo.setAlarmReason(getStringValue(info.get("ALARM_REASON"))); + vo.setAlarmTime(getStringValue(info.get("ALARM_TIME"))); + } else { + vo.setHasAlarm(false); + vo.setDeviceName(""); + vo.setAlarmReason(""); + vo.setAlarmTime(""); + } + return vo; + } + + /** + * 获取维修分析列表(按设备聚合) + */ + @Override + public List getRepairAnalysisList() { + List list = board4Mapper.selectRepairAnalysisByDevice(); + return list != null ? list : new ArrayList<>(); + } + + /** + * 获取报修趋势列表 + */ + @Override + public List getRepairTrendList() { + List list = board4Mapper.selectRepairTrendList(); + return list != null ? list : new ArrayList<>(); + } + + /** + * 获取质量统计 + */ + @Override + public Board4QualityStatisticsVo getQualityStatistics() { + Board4QualityStatisticsVo vo = new Board4QualityStatisticsVo(); + HashMap stats = board4Mapper.selectQualityStatistics(); + if (stats != null) { + vo.setQualifiedCount(getLongValue(stats.get("QUALIFIED_COUNT"))); + vo.setUnqualifiedCount(getLongValue(stats.get("UNQUALIFIED_COUNT"))); + } else { + vo.setQualifiedCount(0L); + vo.setUnqualifiedCount(0L); + } + return vo; + } + + /** + * 获取质量追溯列表 + */ + @Override + public List getQualityTraceList() { + List list = board4Mapper.selectQualityTraceList(); + return list != null ? list : new ArrayList<>(); + } + + /** + * 获取设备分析/产量列表 + */ + @Override + public List getDeviceProductionList() { + List list = board4Mapper.selectDeviceProductionAnalysis(); + return list != null ? list : new ArrayList<>(); + } + + /** + * 安全获取Long值 + */ + private Long getLongValue(Object obj) { + if (obj == null) { + return 0L; + } + if (obj instanceof Number) { + return ((Number) obj).longValue(); + } + try { + return Long.parseLong(obj.toString()); + } catch (NumberFormatException e) { + return 0L; + } + } + + /** + * 安全获取String值 + */ + private String getStringValue(Object obj) { + if (obj == null) { + return ""; + } + return obj.toString(); + } +} diff --git a/aucma-report/src/main/resources/mapper/report/Board4Mapper.xml b/aucma-report/src/main/resources/mapper/report/Board4Mapper.xml new file mode 100644 index 0000000..d399e10 --- /dev/null +++ b/aucma-report/src/main/resources/mapper/report/Board4Mapper.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +