From a6851ff16af6de136e4c73edd79d27ff72c1986c Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Mon, 15 Jul 2024 14:53:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=82=E5=8C=BA=E7=9C=8B=E6=9D=BF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigscreen/FactoryDashboardController.java | 20 +++ .../bigscreen/dto/FactoryDashboardDTO.java | 1 + .../mapper/FactoryDashboardMapper.java | 18 ++- .../service/IFactoryDashboardService.java | 21 +++ .../service/impl/FactoryDashboardService.java | 144 ++++++++++++++++-- .../inspur/bigscreen/task/StatsDataTask.java | 53 +++++++ .../equip/mapper/IpcEquipInfoMapper.java | 8 + .../mapper/IpcAlarmRecordMapper.java | 7 +- .../mapper/IpcAlarmRulesMapper.java | 8 +- .../mapper/IpcFaultTreeConfigMapper.java | 8 +- .../mapper/IpcMonitorDataInfoMapper.java | 8 +- .../industrial/mapper/IpcSysStatusMapper.java | 8 +- .../mapper/PhmEquAlarmRecordMapper.java | 1 - .../service/IIpcAlarmRecordService.java | 5 + .../impl/IpcAlarmRecordServiceImpl.java | 7 + .../inspur/system/mapper/SysDeptMapper.java | 5 + .../system/service/ISysDeptService.java | 5 + .../service/impl/SysDeptServiceImpl.java | 8 + .../bigscreen/FactoryDashboardMapper.xml | 34 ++++- .../mapper/equip/IpcEquipInfoMapper.xml | 13 ++ .../industrial/IpcAlarmRecordMapper.xml | 18 +++ .../resources/mapper/system/SysDeptMapper.xml | 4 + .../views/eqmanagement/eqcategory/index.vue | 17 +++ 23 files changed, 378 insertions(+), 43 deletions(-) diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java index 59a4062..13a0464 100644 --- a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java @@ -39,4 +39,24 @@ public class FactoryDashboardController { public AjaxResult countWeeklyAlarmNumByLineDeptId(@PathVariable Long deptId) { return AjaxResult.success(factoryDashboardService.countAlarmNumByProductionLine(deptId)); } + + @GetMapping("/countWeeklyEquipRunningNumByLineDeptId/{deptId}") + public AjaxResult countWeeklyEquipRunningNumByLineDeptId(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countWeeklyEquipRunningNumByLineDeptId(deptId)); + } + + @GetMapping("/countMaintenanceRecordNumByProductionLine/{deptId}") + public AjaxResult countMaintenanceRecordNumByProductionLine(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countMaintenanceRecordNumByProductionLine(deptId)); + } + + @GetMapping("/countUpkeepRecordNumByProductionLine/{deptId}") + public AjaxResult countUpkeepRecordNumByProductionLine(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countUpkeepRecordNumByProductionLine(deptId)); + } + + @GetMapping("/listLatestAlarmRecord/{deptId}") + public AjaxResult listLatestAlarmRecord(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.selectLatestIpcAlarmRecordByFactoryId(deptId)); + } } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java index d586237..e67f18b 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java @@ -1,6 +1,7 @@ package com.inspur.bigscreen.dto; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.List; diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java index 9f71829..62e093e 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java @@ -1,8 +1,11 @@ package com.inspur.bigscreen.mapper; import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import net.sf.jsqlparser.expression.DateTimeLiteralExpression; import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; import java.util.Map; @@ -35,5 +38,18 @@ public interface FactoryDashboardMapper { /** * 近一周产线各设备正常运行数量 */ - public List countWeeklyEquipRunningNumByLineDeptId(Long deptId); + public List countWeeklyEquipRunningNumByLineDeptId(@Param("deptId") Long deptId, + @Param("status") Integer status); + + /** + * 统计近半年的维修记录数量 + */ + public FactoryDashboardDTO countMaintenanceRecordNumByProductionLine(@Param("date") Date date, + @Param("deptId")Long deptId); + + /** + * 统计近半年的保养记录数量 + */ + public FactoryDashboardDTO countUpkeepRecordNumByProductionLine(@Param("date") Date date, + @Param("deptId")Long deptId); } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java index b376375..48f3006 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java @@ -1,6 +1,7 @@ package com.inspur.bigscreen.service; import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import com.inspur.industrial.domain.IpcAlarmRecord; import java.util.List; import java.util.Map; @@ -31,4 +32,24 @@ public interface IFactoryDashboardService { * 根据厂区部门id查询各个产线报警数量 */ public List countAlarmNumByProductionLine(Long deptId); + + /** + * 近一周各个产线的运行情况 + */ + public List countWeeklyEquipRunningNumByLineDeptId(Long deptId); + + /** + * 根据厂区id统计近半年各个产线的维修记录数 + */ + public List countMaintenanceRecordNumByProductionLine(Long deptId); + + /** + * 根据厂区id统计近半年各个产线的保养记录数 + */ + public List countUpkeepRecordNumByProductionLine(Long deptId); + + /** + * 根据厂区id查询最新的报警信息 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId); } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java index fd3e5a6..d9dd48a 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java @@ -4,14 +4,15 @@ import com.inspur.bigscreen.dto.FactoryDashboardDTO; import com.inspur.bigscreen.mapper.FactoryDashboardMapper; import com.inspur.bigscreen.service.IFactoryDashboardService; import com.inspur.common.core.domain.entity.SysDept; +import com.inspur.industrial.domain.IpcAlarmRecord; +import com.inspur.industrial.service.IIpcAlarmRecordService; import com.inspur.system.mapper.SysDeptMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.*; import java.util.stream.Collectors; /** @@ -27,6 +28,9 @@ public class FactoryDashboardService implements IFactoryDashboardService { @Autowired private SysDeptMapper sysDeptMapper; + @Autowired + private IIpcAlarmRecordService ipcAlarmRecordService; + /** * @param deptId 厂区的部门id *根据厂区id查询厂区下所有产线设备数量 @@ -71,15 +75,135 @@ public class FactoryDashboardService implements IFactoryDashboardService { List resultList = new ArrayList<>(); List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); for (SysDept sysDept : childDeptList) { - FactoryDashboardDTO data = new FactoryDashboardDTO(); - data.setDeptName(sysDept.getDeptName()); List factoryDashboardDTOList = factoryDashboardMapper.countWeeklyAlarmNumByLineDeptId(sysDept.getDeptId()); - List timeList = factoryDashboardDTOList.stream().map(FactoryDashboardDTO::getTime).collect(Collectors.toList()); - List dataList = factoryDashboardDTOList.stream().map(FactoryDashboardDTO::getData).collect(Collectors.toList()); - data.setX(timeList); - data.setY(dataList); + resultList.add(getResultData(sysDept,factoryDashboardDTOList)); + } + return resultList; + } + + /** + * 近一周各个产线的运行情况 + * @param deptId 厂区id + */ + @Override + public List countWeeklyEquipRunningNumByLineDeptId(Long deptId){ + //根据厂区id查询厂区产线id + List resultList = new ArrayList<>(); + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + for (SysDept sysDept : childDeptList) { + List factoryDashboardDTOList = factoryDashboardMapper.countWeeklyEquipRunningNumByLineDeptId(sysDept.getDeptId(),0); + resultList.add(getResultData(sysDept,factoryDashboardDTOList)); + } + return resultList; + } + + /** + * 根据厂区id统计近半年各个产线的维修记录数 + */ + @Override + public List countMaintenanceRecordNumByProductionLine(Long deptId){ + List resultList = new ArrayList<>(); + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + for (SysDept sysDept : childDeptList) { + FactoryDashboardDTO data = getMatenanceDataByHalfYear(sysDept.getDeptId()); + data.setDeptName(sysDept.getDeptName()); + resultList.add(data); + } + return resultList; + } + + /** + * 根据厂区id统计近半年各个产线的保养记录数 + */ + @Override + public List countUpkeepRecordNumByProductionLine(Long deptId){ + List resultList = new ArrayList<>(); + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + for (SysDept sysDept : childDeptList) { + FactoryDashboardDTO data = getUpkeepDataByHalfYear(sysDept.getDeptId()); + data.setDeptName(sysDept.getDeptName()); resultList.add(data); } return resultList; } + + /** + * 根据厂区id查询最新的报警信息 + */ + @Override + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId){ + return ipcAlarmRecordService.selectLatestIpcAlarmRecordByFactoryId(deptId); + } + + private FactoryDashboardDTO getResultData(SysDept sysDept, List factoryDashboardDTOList){ + FactoryDashboardDTO data = new FactoryDashboardDTO(); + data.setDeptName(sysDept.getDeptName()); + List timeList = factoryDashboardDTOList.stream().map(FactoryDashboardDTO::getTime).collect(Collectors.toList()); + List dataList = factoryDashboardDTOList.stream().map(FactoryDashboardDTO::getData).collect(Collectors.toList()); + data.setX(timeList); + data.setY(dataList); + return data; + } + + /** + * 获取当前时间半年内的保养数据 + */ + private FactoryDashboardDTO getUpkeepDataByHalfYear(Long deptId){ + FactoryDashboardDTO returnData = new FactoryDashboardDTO(); + List timeList = new ArrayList<>(); + List dataList = new ArrayList<>(); + List halfYearDate = getHalfYearDate(); + //修改日期年月日 + for (Date date : halfYearDate) { + FactoryDashboardDTO factoryData = factoryDashboardMapper.countUpkeepRecordNumByProductionLine(date,deptId); + String time = factoryData.getTime(); + timeList.add(time.substring(0,time.lastIndexOf("-"))); + dataList.add(factoryData.getData()); + } + Collections.reverse(timeList); + Collections.reverse(dataList); + returnData.setX(timeList); + returnData.setY(dataList); + return returnData; + } + + /** + * 获取当前时间半年内的时间并查询数据 + */ + private FactoryDashboardDTO getMatenanceDataByHalfYear(Long deptId){ + FactoryDashboardDTO returnData = new FactoryDashboardDTO(); + List timeList = new ArrayList<>(); + List dataList = new ArrayList<>(); + List halfYearDate = getHalfYearDate(); + //修改日期年月日 + for (Date date : halfYearDate) { + FactoryDashboardDTO factoryData = factoryDashboardMapper.countMaintenanceRecordNumByProductionLine(date,deptId); + String time = factoryData.getTime(); + timeList.add(time.substring(0,time.lastIndexOf("-"))); + dataList.add(factoryData.getData()); + } + Collections.reverse(timeList); + Collections.reverse(dataList); + returnData.setX(timeList); + returnData.setY(dataList); + return returnData; + } + + /** + * 获取当前时间内半年月份 + */ + private List getHalfYearDate(){ + LocalDate currentDate = LocalDate.now(); + List halfYearDate = new ArrayList<>(); + + // 遍历当前日期之后的6个月(包括当前月份) + for (int i = 0; i < 6; i++) { + LocalDate firstDayOfMonth = currentDate.withDayOfMonth(1); + Date date = Date.from(firstDayOfMonth.atStartOfDay(ZoneId.systemDefault()).toInstant()); + halfYearDate.add(date); + currentDate = currentDate.minusMonths(1L); + } + return halfYearDate; + } + } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java index 8868a85..04d3612 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java @@ -1,6 +1,22 @@ package com.inspur.bigscreen.task; +import com.inspur.bigscreen.domain.IpcDailyEquipNumByStatus; +import com.inspur.bigscreen.mapper.IpcDailyEquipNumByStatusMapper; +import com.inspur.common.core.domain.entity.SysDept; +import com.inspur.common.utils.spring.SpringUtils; +import com.inspur.equip.mapper.IpcEquipInfoMapper; +import com.inspur.system.mapper.SysDeptMapper; +import com.inspur.system.service.ISysDeptService; +import com.inspur.system.service.impl.SysDeptServiceImpl; +import org.springframework.aop.framework.AopContext; +import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; /** * 大屏数据统计定时任务 @@ -10,11 +26,48 @@ import org.springframework.stereotype.Component; @Component("statsDataTask") public class StatsDataTask { + @Resource + private ISysDeptService sysDeptService; + + @Resource + private IpcDailyEquipNumByStatusMapper ipcDailyEquipNumByStatusMapper; + + @Resource + private IpcEquipInfoMapper ipcEquipInfoMapper; + + private static final Integer RUNNING = 0; + private static final Integer MAINTANANCE = 1; + + private static final Integer STOP = 2; + /** * 每日根据不同状态统计设备数量 */ + @Transactional public void countDailyEquipNumByStatus(){ + List deptList = sysDeptService.selectDeptAll(); + List factoryList = deptList.stream().filter(dept -> dept.getAncestors().split(",").length == 4).collect(Collectors.toList()); + for (SysDept sysDept : factoryList) { + int nums = 0; + //运行状态 + insertIpcDailyEquipNumByStatusAndDeptId(RUNNING,sysDept.getDeptId()); + //维修状态 + insertIpcDailyEquipNumByStatusAndDeptId(MAINTANANCE,sysDept.getDeptId()); + //停机状态 + insertIpcDailyEquipNumByStatusAndDeptId(STOP,sysDept.getDeptId()); + } + } + + private int insertIpcDailyEquipNumByStatusAndDeptId(Integer status,Long deptId){ + IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus = new IpcDailyEquipNumByStatus(); + ipcDailyEquipNumByStatus.setStatus(status); + int nums = ipcEquipInfoMapper.selectIpcEquipInfoNumByStatusAndDeptId(status,deptId); + ipcDailyEquipNumByStatus.setNums(nums); + ipcDailyEquipNumByStatus.setDeptId(deptId); + ipcDailyEquipNumByStatus.setCreateDate(new Date()); + + return ipcDailyEquipNumByStatusMapper.insertIpcDailyEquipNumByStatus(ipcDailyEquipNumByStatus); } } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java index e8a4e21..ee19498 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java @@ -6,6 +6,7 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.equip.domain.EquipTreeSelect; import com.inspur.equip.domain.IpcEquipInfo; +import org.apache.ibatis.annotations.Param; public interface IpcEquipInfoMapper @@ -53,6 +54,13 @@ public interface IpcEquipInfoMapper */ public List selectRunningIpcEquipInfoListByParentId(String parentEquipId); + /** + * 根据厂区id和设备状态查询设备数量 + */ + public Integer selectIpcEquipInfoNumByStatusAndDeptId(@Param("status")Integer status, + @Param("deptId")Long deptId); + + /** * 新增设备信息 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRecordMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRecordMapper.java index 6fae30e..bb0aa81 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRecordMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRecordMapper.java @@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Param; * @Author zhangjunwen * @create 2024/4/10 */ -@DataSource(DataSourceType.SLAVE) + public interface IpcAlarmRecordMapper { /** @@ -33,6 +33,11 @@ public interface IpcAlarmRecordMapper */ public List selectIpcAlarmRecordList(IpcAlarmRecord ipcAlarmRecord); + /** + * 查询厂区id下最新的报警记录 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId); + /** * 新增报警记录 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java index 4f067b8..450095a 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java @@ -6,13 +6,7 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.industrial.domain.IpcAlarmRules; -/** - * 设备报警规则Mapper接口 - * - * @Author zhangjunwen - * @create 2024/4/9 - */ -@DataSource(DataSourceType.SLAVE) + public interface IpcAlarmRulesMapper { /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java index 2fbe93f..73da703 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java @@ -6,13 +6,7 @@ import com.inspur.industrial.domain.IpcFaultTreeConfig; import java.util.List; -/** - * 故障树配置Mapper接口 - * - * @author inspur - * @date 2024-04-02 - */ -@DataSource(DataSourceType.SLAVE) + public interface IpcFaultTreeConfigMapper { /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java index 1888063..ab5621a 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java @@ -6,13 +6,7 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.industrial.domain.IpcMonitorDataInfo; -/** - * 监控数据信息Mapper接口 - * - * @author inspur - * @date 2024-04-09 - */ -@DataSource(DataSourceType.SLAVE) + public interface IpcMonitorDataInfoMapper { /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java index ffb6cd8..9d051b8 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java @@ -6,13 +6,7 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.industrial.domain.IpcSysStatus; -/** - * 系统状态Mapper接口 - * - * @Author zhangjunwen - * @create 2024/4/3 - */ -@DataSource(DataSourceType.SLAVE) + public interface IpcSysStatusMapper { /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/PhmEquAlarmRecordMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/PhmEquAlarmRecordMapper.java index 415f420..de984c3 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/PhmEquAlarmRecordMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/PhmEquAlarmRecordMapper.java @@ -6,7 +6,6 @@ import com.inspur.industrial.domain.PhmEquAlarmRecord; import java.util.List; -@DataSource(DataSourceType.SLAVE) public interface PhmEquAlarmRecordMapper { /** * 查询超压顶缸报警记录列表 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRecordService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRecordService.java index 76a064c..a528e8d 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRecordService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRecordService.java @@ -29,6 +29,11 @@ public interface IIpcAlarmRecordService */ public List selectIpcAlarmRecordList(IpcAlarmRecord ipcAlarmRecord); + /** + * 查询厂区id下最新的报警记录 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId); + /** * 新增报警记录 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRecordServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRecordServiceImpl.java index 35f0f79..82dace4 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRecordServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRecordServiceImpl.java @@ -48,6 +48,13 @@ public class IpcAlarmRecordServiceImpl implements IIpcAlarmRecordService return ipcAlarmRecordMapper.selectIpcAlarmRecordList(ipcAlarmRecord); } + /** + * 查询厂区id下最新的报警记录 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId){ + return ipcAlarmRecordMapper.selectLatestIpcAlarmRecordByFactoryId(deptId); + } + /** * 新增报警记录 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/mapper/SysDeptMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/mapper/SysDeptMapper.java index b426c5c..aa16af9 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/mapper/SysDeptMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/mapper/SysDeptMapper.java @@ -19,6 +19,11 @@ public interface SysDeptMapper */ public List selectDeptList(SysDept dept); + /** + * 查询所有的部门数据 + */ + public List selectDeptAll(); + /** * 根据角色ID查询部门树信息 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/ISysDeptService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/ISysDeptService.java index b593392..95b5e1d 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/ISysDeptService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/ISysDeptService.java @@ -19,6 +19,11 @@ public interface ISysDeptService */ public List selectDeptList(SysDept dept); + /** + * 查询所有部门数据 + */ + public List selectDeptAll(); + /** * 查询部门树结构信息 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/impl/SysDeptServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/impl/SysDeptServiceImpl.java index a870e07..fb0607e 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/impl/SysDeptServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/impl/SysDeptServiceImpl.java @@ -48,6 +48,14 @@ public class SysDeptServiceImpl implements ISysDeptService return deptMapper.selectDeptList(dept); } + + /** + * 查询所有部门数据 + */ + public List selectDeptAll(){ + return deptMapper.selectDeptAll(); + } + /** * 查询部门树结构信息 * diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml index 9c6c9af..927fd6f 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml @@ -74,8 +74,38 @@ - + select a.click_date as time,ifnull(b.nums,0) as data + from + () + a left join + ( + select nums,status,dept_id,DATE(create_date) as create_date + from `ipc_daily_equip_num_by_status` + where dept_id = #{deptId} and + create_date >= CURDATE() - INTERVAL 7 DAY + and `status` = #{status} + ) b + on a.click_date = b.create_date + + + + + \ No newline at end of file diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml index 2199eec..39e3036 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml @@ -144,6 +144,19 @@ WHERE parent_equip_id = #{parentEquipId} and status in ('0') + + + insert into ipc_equip_info diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml index 17cd6fa..02e2897 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml @@ -27,6 +27,7 @@ + @@ -92,6 +93,23 @@ where a.id = #{id} + + + insert into ipc_alarm_record diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/system/SysDeptMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/system/SysDeptMapper.xml index 0110ee2..439f2f8 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -48,6 +48,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by d.parent_id, d.order_num + +