diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/CompanyDashboardController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/CompanyDashboardController.java index 5fa84f9..c4f0a00 100644 --- a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/CompanyDashboardController.java +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/CompanyDashboardController.java @@ -30,4 +30,44 @@ public class CompanyDashboardController { public AjaxResult countEquipNumByDiffCompany(@PathVariable Long deptId) { return AjaxResult.success(factoryDashboardService.countEquipNumByCompanyId(deptId)); } + + @GetMapping("/countWeeklyEquipNumByCompany/{deptId}") + public AjaxResult countWeeklyEquipNumByCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countWeeklyEquipRunningNumByCompanyDeptId(deptId)); + } + + @GetMapping("/countMaintenanceRecordNumByCompany/{deptId}") + public AjaxResult countMaintenanceRecordNumByCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countMaintenanceRecordNumByCompanyId(deptId)); + } + + @GetMapping("/countUpkeepRecordNumByCompany/{deptId}") + public AjaxResult countUpkeepRecordNumByCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countUpkeepRecordNumByCompanyDeptId(deptId)); + } + + @GetMapping("/countPatrolRecordNumByCompany/{deptId}") + public AjaxResult countPatrolRecordNumByCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countPatrolRecordNumByCompanyDeptId(deptId)); + } + + @GetMapping("/countAlarmNumByCompany/{deptId}") + public AjaxResult countAlarmNumByCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countAlarmNumByCompanyId(deptId)); + } + + @GetMapping("/listLatestAlarmRecords/{deptId}") + public AjaxResult listLatestAlarmRecords(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.selectLatestIpcAlarmRecordByFactoryId(deptId)); + } + + @GetMapping("/countWeeklyAlarmNumByCompany/{deptId}") + public AjaxResult countWeeklyAlarmNumByCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countWeeklyAlarmNumByCompanyId(deptId)); + } + + @GetMapping("/countSparePartsNumByCompany/{deptId}") + public AjaxResult countSparePartsNumByCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countSparePartsNumByCompanyId(deptId)); + } } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/CompanyDashboardDTO.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/CompanyDashboardDTO.java index 1f6fad8..feb9ddb 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/CompanyDashboardDTO.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/CompanyDashboardDTO.java @@ -16,6 +16,8 @@ public class CompanyDashboardDTO { private String deptName; + private Integer type; + private Integer data; private Integer status; diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/CompanyDashboardMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/CompanyDashboardMapper.java index 3fec898..d72b027 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/CompanyDashboardMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/CompanyDashboardMapper.java @@ -4,6 +4,7 @@ import com.inspur.bigscreen.dto.CompanyDashboardDTO; import com.inspur.bigscreen.dto.FactoryDashboardDTO; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; /** @@ -24,4 +25,40 @@ public interface CompanyDashboardMapper { */ public CompanyDashboardDTO countEquipNumByCompany(@Param("deptId")Long deptId); + /** + * 根据厂区部门id查询近一周产线正常运行数量 + */ + public List countWeeklyEquipRunningNumByCompanyDeptId(@Param("deptId")Long deptId, + @Param("status") Integer status); + + /** + * 统计近半年的维修记录数量 + */ + public CompanyDashboardDTO countMaintenanceRecordNumByCompanyDeptId(@Param("date") Date date, + @Param("deptId")Long deptId); + + /** + * 统计近半年的保养记录数量 + */ + public CompanyDashboardDTO countUpkeepRecordNumByCompanyDeptId(@Param("date") Date date, + @Param("deptId")Long deptId); + + /** + * 统计近半年巡检工单数量 + */ + public List countPatrolRecordNumByCompanyDeptId(@Param("date") Date date, + @Param("deptId")Long deptId); + + /** + * 统计公司内设备报警数量 + */ + public List countAlarmNumByCompanyId(@Param("deptId")Long deptId); + + /** + * 根据厂区部门id查询一周内各个产线报警数量 + */ + public List countWeeklyAlarmNumByFactoryDeptId(Long deptId); + + + } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/ICompanyDashboardService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/ICompanyDashboardService.java index 2f59fa7..a4d6d1b 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/ICompanyDashboardService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/ICompanyDashboardService.java @@ -2,7 +2,10 @@ package com.inspur.bigscreen.service; import com.inspur.bigscreen.dto.CompanyDashboardDTO; import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import com.inspur.industrial.domain.IpcAlarmRecord; +import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; /** @@ -21,4 +24,44 @@ public interface ICompanyDashboardService { * 根据公司id统计公司设备数 */ public List countEquipNumByCompanyId(Long deptId); + + /** + * 根据公司部门id查询近一周产线正常运行数量 + */ + public List countWeeklyEquipRunningNumByCompanyDeptId(Long deptId); + + /** + * 根据公司id查询各个厂区半年维修单数量 + */ + public List countMaintenanceRecordNumByCompanyId(Long deptId); + + /** + * 根据公司id统计近半年的保养记录数量 + */ + public List countUpkeepRecordNumByCompanyDeptId(Long deptId); + + /** + * 根据公司id统计近半年巡检工单数量 + */ + public List countPatrolRecordNumByCompanyDeptId(Long deptId); + + /** + * 根据公司id统计报警数量 + */ + public List countAlarmNumByCompanyId(Long deptId); + + /** + * 根据公司id查询最新报警条数 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId); + + /** + * 根据公司id查询一周内各个厂区报警数量 + */ + public List countWeeklyAlarmNumByCompanyId(Long deptId); + + /** + * 统计备品备件数据 + */ + public CompanyDashboardDTO countSparePartsNumByCompanyId(Long deptId); } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/CompanyDashboardService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/CompanyDashboardService.java index 60413da..b2aed93 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/CompanyDashboardService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/CompanyDashboardService.java @@ -2,18 +2,25 @@ package com.inspur.bigscreen.service.impl; import com.inspur.bigscreen.constant.EquipInfoStatus; import com.inspur.bigscreen.dto.CompanyDashboardDTO; -import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import com.inspur.bigscreen.dto.CompanyDashboardDTO; +import com.inspur.bigscreen.dto.CompanyDashboardDTO; import com.inspur.bigscreen.mapper.CompanyDashboardMapper; import com.inspur.bigscreen.service.ICompanyDashboardService; 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.spareparts.mapper.IpcSparePartsInboundMapper; +import com.inspur.spareparts.mapper.IpcSparePartsInfoMapper; +import com.inspur.spareparts.mapper.IpcSparePartsOutboundMapper; import com.inspur.system.mapper.SysDeptMapper; import com.inspur.system.service.ISysDeptService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.List; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.*; import java.util.stream.Collectors; /** @@ -30,6 +37,18 @@ public class CompanyDashboardService implements ICompanyDashboardService { @Autowired private SysDeptMapper sysDeptMapper; + @Autowired + private IIpcAlarmRecordService ipcAlarmRecordService; + + @Autowired + private IpcSparePartsInfoMapper ipcSparePartsInfoMapper; + + @Autowired + private IpcSparePartsInboundMapper ipcSparePartsInboundMapper; + + @Autowired + private IpcSparePartsOutboundMapper ipcSparePartsOutboundMapper; + /** * 统计不同状态公司设备数 */ @@ -50,8 +69,7 @@ public class CompanyDashboardService implements ICompanyDashboardService { @Override public List countEquipNumByCompanyId(Long deptId){ //查询给定公司id的厂区id - List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); - List factoryDeptList = childDeptList.stream().filter(dept -> dept.getAncestors().split(",").length == 3 ).collect(Collectors.toList()); + List factoryDeptList = getFactoryDeptListByCompanyId(deptId); List resultList = new ArrayList<>(); factoryDeptList.forEach(factoryDept -> { CompanyDashboardDTO companyDashboardDTO = companyDashboardMapper.countEquipNumByCompany(factoryDept.getDeptId()); @@ -60,4 +78,237 @@ public class CompanyDashboardService implements ICompanyDashboardService { return resultList; } + /** + * 根据公司部门id查询近一周产线正常运行数量 + */ + @Override + public List countWeeklyEquipRunningNumByCompanyDeptId(Long deptId){ + //根据公司id查询各个厂区id + List factoryDeptList = getFactoryDeptListByCompanyId(deptId); + List resultList = new ArrayList<>(); + factoryDeptList.forEach(factoryDept -> { + List factoryWeekData = companyDashboardMapper.countWeeklyEquipRunningNumByCompanyDeptId(factoryDept.getDeptId(),EquipInfoStatus.RUNNING); + CompanyDashboardDTO companyDashboardDTO = new CompanyDashboardDTO(); + companyDashboardDTO.setDeptId(factoryDept.getDeptId()); + companyDashboardDTO.setDeptName(factoryDept.getDeptName()); + List timeList = factoryWeekData.stream().map(CompanyDashboardDTO::getTime).collect(Collectors.toList()); + List dataList = factoryWeekData.stream().map(CompanyDashboardDTO::getData).collect(Collectors.toList()); + Collections.reverse(timeList); + Collections.reverse(dataList); + companyDashboardDTO.setX(timeList); + companyDashboardDTO.setY(dataList); + resultList.add(companyDashboardDTO); + }); + return resultList; + } + + /** + * 根据公司id查询各个厂区半年维修单数量 + */ + public List countMaintenanceRecordNumByCompanyId(Long deptId){ + List resultList = new ArrayList<>(); + //根据公司id查询各个厂区id + List factoryDeptList = getFactoryDeptListByCompanyId(deptId); + for (SysDept sysDept : factoryDeptList) { + CompanyDashboardDTO companyDashboardDTO = getMatenanceDataByHalfYear(sysDept.getDeptId()); + companyDashboardDTO.setDeptId(sysDept.getDeptId()); + companyDashboardDTO.setDeptName(sysDept.getDeptName()); + resultList.add(companyDashboardDTO); + } + return resultList; + } + + /** + * 根据公司id统计近半年的保养记录数量 + */ + public List countUpkeepRecordNumByCompanyDeptId(Long deptId){ + List resultList = new ArrayList<>(); + //根据公司id查询各个厂区id + List factoryDeptList = getFactoryDeptListByCompanyId(deptId); + for (SysDept sysDept : factoryDeptList) { + CompanyDashboardDTO companyDashboardDTO = getUpkeepDataByHalfYear(sysDept.getDeptId()); + companyDashboardDTO.setDeptId(sysDept.getDeptId()); + companyDashboardDTO.setDeptName(sysDept.getDeptName()); + resultList.add(companyDashboardDTO); + } + return resultList; + } + + /** + * 根据公司id统计近半年巡检工单数量 + */ + public List countPatrolRecordNumByCompanyDeptId(Long deptId){ + List resultList = new ArrayList<>(); + //根据公司id查询各个厂区id + List factoryDeptList = getFactoryDeptListByCompanyId(deptId); + for (SysDept sysDept : factoryDeptList) { + List companyDashboardDTOs = getPatrolRecordNumByHalfYear(sysDept.getDeptId()); + companyDashboardDTOs.get(0).setDeptId(sysDept.getDeptId()); + companyDashboardDTOs.get(0).setDeptName(sysDept.getDeptName()); + companyDashboardDTOs.get(1).setDeptId(sysDept.getDeptId()); + companyDashboardDTOs.get(1).setDeptName(sysDept.getDeptName()); + resultList.addAll(companyDashboardDTOs); + } + return resultList; + } + + /** + * 根据公司id统计报警数量 + */ + public List countAlarmNumByCompanyId(Long deptId){ + return companyDashboardMapper.countAlarmNumByCompanyId(deptId); + } + + /** + * 根据公司id查询最新报警条数 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId){ + return ipcAlarmRecordService.selectLatestIpcAlarmRecordByFactoryId(deptId); + } + + /** + * 根据公司id查询一周内各个厂区报警数量 + */ + public List countWeeklyAlarmNumByCompanyId(Long deptId){ + List resultList = new ArrayList<>(); + List factoryDeptList = getFactoryDeptListByCompanyId(deptId); + for (SysDept sysDept : factoryDeptList) { + CompanyDashboardDTO companyData = new CompanyDashboardDTO(); + List factoryDataList = companyDashboardMapper.countWeeklyAlarmNumByFactoryDeptId(sysDept.getDeptId()); + List timeList = factoryDataList.stream().map(CompanyDashboardDTO::getTime).collect(Collectors.toList()); + List dataList = factoryDataList.stream().map(CompanyDashboardDTO::getData).collect(Collectors.toList()); + Collections.reverse(timeList); + Collections.reverse(dataList); + companyData.setDeptId(sysDept.getDeptId()); + companyData.setDeptName(sysDept.getDeptName()); + companyData.setX(timeList); + companyData.setY(dataList); + resultList.add(companyData); + } + return resultList; + } + + /** + * 统计备品备件数据 + */ + public CompanyDashboardDTO countSparePartsNumByCompanyId(Long deptId){ + CompanyDashboardDTO result = new CompanyDashboardDTO(); + List items = new ArrayList<>(); + List data = new ArrayList<>(); + items.add("typeNum"); + data.add(ipcSparePartsInfoMapper.countIpcSparePartsInfo(deptId)); + items.add("inboundNum"); + data.add(ipcSparePartsInboundMapper.countIpcSparePartsInbound(deptId)); + items.add("outboundNum"); + data.add(ipcSparePartsOutboundMapper.countIpcSparePartsOutbound(deptId)); + result.setX(items); + result.setY(data); + result.setDeptId(deptId); + result.setDeptName(sysDeptMapper.selectDeptById(deptId).getDeptName()); + return result; + } + + /** + * 通过公司id获取厂区部门信息 + */ + private List getFactoryDeptListByCompanyId(Long deptId){ + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + List factoryDeptList = childDeptList.stream().filter(dept -> dept.getAncestors().split(",").length == 3 ).collect(Collectors.toList()); + return factoryDeptList; + } + + /** + * 获取当前时间半年内的时间并查询数据 + */ + private CompanyDashboardDTO getMatenanceDataByHalfYear(Long deptId){ + CompanyDashboardDTO returnData = new CompanyDashboardDTO(); + List timeList = new ArrayList<>(); + List dataList = new ArrayList<>(); + List halfYearDate = getHalfYearDate(); + //修改日期年月日 + for (Date date : halfYearDate) { + CompanyDashboardDTO factoryData = companyDashboardMapper.countMaintenanceRecordNumByCompanyDeptId(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 CompanyDashboardDTO getUpkeepDataByHalfYear(Long deptId){ + CompanyDashboardDTO returnData = new CompanyDashboardDTO(); + List timeList = new ArrayList<>(); + List dataList = new ArrayList<>(); + List halfYearDate = getHalfYearDate(); + //修改日期年月日 + for (Date date : halfYearDate) { + CompanyDashboardDTO factoryData = companyDashboardMapper.countUpkeepRecordNumByCompanyDeptId(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 getPatrolRecordNumByHalfYear(Long deptId){ + CompanyDashboardDTO returnData1 = new CompanyDashboardDTO(); + CompanyDashboardDTO returnData2 = new CompanyDashboardDTO(); + List timeList1 = new ArrayList<>(); + List timeList2 = new ArrayList<>(); + List dataList1 = new ArrayList<>(); + List dataList2 = new ArrayList<>(); + List halfYearDate = getHalfYearDate(); + //修改日期年月日 + for (Date date : halfYearDate) { + List factoryData = companyDashboardMapper.countPatrolRecordNumByCompanyDeptId(date,deptId); + returnData1.setType(factoryData.get(0).getType()); + String time1 = factoryData.get(0).getTime(); + timeList1.add(time1.substring(0,time1.lastIndexOf("-"))); + dataList1.add(factoryData.get(0).getData()); + returnData2.setType(factoryData.get(1).getType()); + String time2 = factoryData.get(1).getTime(); + timeList2.add(time2.substring(0,time2.lastIndexOf("-"))); + dataList2.add(factoryData.get(1).getData()); + } + Collections.reverse(timeList1); + Collections.reverse(timeList2); + Collections.reverse(dataList1); + Collections.reverse(dataList2); + returnData1.setX(timeList1); + returnData1.setY(dataList1); + returnData2.setX(timeList2); + returnData2.setY(dataList2); + return Arrays.asList(returnData1,returnData2); + } + + /** + * 获取当前时间内半年月份 + */ + 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/spareparts/mapper/IpcSparePartsInboundMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsInboundMapper.java index e002433..8834322 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsInboundMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsInboundMapper.java @@ -36,6 +36,11 @@ public interface IpcSparePartsInboundMapper */ public List selectIpcSparePartsInboundListForExport(IpcSparePartsInbound ipcSparePartsInbound); + /** + * 查询入库单数量 + */ + public int countIpcSparePartsInbound(Long deptId) ; + /** * 新增备件入库 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsInfoMapper.java index 702d6d1..67e2cec 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsInfoMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsInfoMapper.java @@ -36,6 +36,11 @@ public interface IpcSparePartsInfoMapper */ public List selectIpcSparePartsStockExportList(IpcSparePartsInfo ipcSparePartsInfo); + /** + * 统计备品备件种类数量 + */ + public int countIpcSparePartsInfo(Long deptId); + /** * 新增备品备件信息 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsOutboundMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsOutboundMapper.java index b5db15f..068c0e3 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsOutboundMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/spareparts/mapper/IpcSparePartsOutboundMapper.java @@ -37,6 +37,11 @@ public interface IpcSparePartsOutboundMapper */ public List selectIpcSparePartsOutboundListForExport(IpcSparePartsOutbound ipcSparePartsOutbound); + /** + * 统计出库单数量 + */ + public int countIpcSparePartsOutbound(Long deptId); + /** * 新增备件出库单 * diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/CompanyDashboardMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/CompanyDashboardMapper.xml index c2ab1fb..504720b 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/CompanyDashboardMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/CompanyDashboardMapper.xml @@ -8,6 +8,7 @@ + @@ -28,6 +29,7 @@ select date_sub(curdate(), interval 6 day) as click_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 39e3036..b930d4d 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 @@ -150,11 +150,7 @@ select count(1) from ipc_equip_info where status = #{status} - and dept_id - in ( - select dept_id from sys_dept - where find_in_set(#{deptId}, ancestors) - ) + and dept_id = #{deptId} 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 02e2897..1e20f8f 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 @@ -104,7 +104,8 @@ on b.dept_id = c.dept_id where b.dept_id in ( select dept_id from sys_dept where - find_in_set(103,ancestors) + find_in_set(#{deptId},ancestors) + or dept_id = #{deptId} ) order by a.alarm_time desc limit 5 diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsInboundMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsInboundMapper.xml index f16fcff..f9390a5 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsInboundMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsInboundMapper.xml @@ -126,6 +126,12 @@ order by i.submit_time desc,i.spare_parts_inbound_num desc,id.order_num + + + insert into ipc_spare_parts_inbound diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsInfoMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsInfoMapper.xml index 7e4f941..0bfb2c5 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsInfoMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsInfoMapper.xml @@ -114,6 +114,15 @@ where i.id = #{id} + + + insert into ipc_spare_parts_info diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsOutboundMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsOutboundMapper.xml index c2237cb..88e08c5 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsOutboundMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/spareparts/IpcSparePartsOutboundMapper.xml @@ -143,6 +143,14 @@ order by o.submit_time desc,o.spare_parts_outbound_num desc,od.order_num + + + + insert into ipc_spare_parts_outbound diff --git a/zfipc-ui/src/api/bigscreen/company.js b/zfipc-ui/src/api/bigscreen/company.js new file mode 100644 index 0000000..8a38af0 --- /dev/null +++ b/zfipc-ui/src/api/bigscreen/company.js @@ -0,0 +1,81 @@ +import request from "@/utils/request"; + +// 按照公司id查询设备数量 +export function getEquipNumByCompany(deptId) { + return request({ + url: "/bigscreen/company/countEquipNumByCompany/" + deptId, + method: "get", + }); +} + +// 按照公司id查询不同厂区设备数量 +export function getEquipNumByDiffCompany(deptId) { + return request({ + url: "/bigscreen/company/countEquipNumByDiffCompany/" + deptId, + method: "get", + }); +} + +// 按照公司id查询一周各个厂区部门设备数量 +export function getWeeklyEquipNumByCompany(deptId) { + return request({ + url: "/bigscreen/company/countWeeklyEquipNumByCompany/" + deptId, + method: "get", + }); +} + +// 按照公司id查询近半年各个厂区维修单数量 +export function getHYMaintenanceRecordNumByCompany(deptId) { + return request({ + url: "/bigscreen/company/countMaintenanceRecordNumByCompany/" + deptId, + method: "get", + }); +} + +// 按照公司id查询近半年各个厂区保养单数量 +export function getHYUpkeepRecordNumByCompany(deptId) { + return request({ + url: "/bigscreen/company/countUpkeepRecordNumByCompany/" + deptId, + method: "get", + }); +} + +// 按照公司id查询近半年各个厂区巡检工单数量 +export function getHYPatrolRecordNumByCompany(deptId) { + return request({ + url: "/bigscreen/company/countPatrolRecordNumByCompany/" + deptId, + method: "get", + }); +} + +// 按照公司id查询各状态报警数量 +export function getAlarmNumByCompany(deptId) { + return request({ + url: "/bigscreen/company/countAlarmNumByCompany/" + deptId, + method: "get", + }); +} + +// 按照公司id查询报警数据 +export function getCompanyLatestAlarmRecord(deptId) { + return request({ + url: "/bigscreen/company/listLatestAlarmRecords/" + deptId, + method: "get", + }); +} + +// 按照公司id查询各个厂区一周报警数据 +export function getWeeklyAlarmNumByCompany(deptId) { + return request({ + url: "/bigscreen/company/countWeeklyAlarmNumByCompany/" + deptId, + method: "get", + }); +} + +// 按照公司id查询备件信息 +export function getSparePartsNumByCompany(deptId) { + return request({ + url: "/bigscreen/company/countSparePartsNumByCompany/" + deptId, + method: "get", + }); +} diff --git a/zfipc-ui/src/views/eqmanagement/eqcategory/index.vue b/zfipc-ui/src/views/eqmanagement/eqcategory/index.vue index bbd2737..c55ef4c 100644 --- a/zfipc-ui/src/views/eqmanagement/eqcategory/index.vue +++ b/zfipc-ui/src/views/eqmanagement/eqcategory/index.vue @@ -459,6 +459,14 @@ import { import { getEquipNumByCompany, getEquipNumByDiffCompany, + getWeeklyEquipNumByCompany, + getHYMaintenanceRecordNumByCompany, + getHYUpkeepRecordNumByCompany, + getHYPatrolRecordNumByCompany, + getAlarmNumByCompany, + getCompanyLatestAlarmRecord, + getWeeklyAlarmNumByCompany, + getSparePartsNumByCompany, } from "@/api/bigscreen/company"; export default { name: "Category", @@ -587,7 +595,7 @@ export default { this.getList(); this.getDeptTree(); //测试 - getEquipNumByDiffCompany(101).then((response) => { + getSparePartsNumByCompany(101).then((response) => { console.log("data:", response.data); }); },