公司级看板接口功能
This commit is contained in:
parent
b34ee99fee
commit
013ebef9cd
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ public class CompanyDashboardDTO {
|
||||
|
||||
private String deptName;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private Integer data;
|
||||
|
||||
private Integer status;
|
||||
|
@ -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<CompanyDashboardDTO> 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<CompanyDashboardDTO> countPatrolRecordNumByCompanyDeptId(@Param("date") Date date,
|
||||
@Param("deptId")Long deptId);
|
||||
|
||||
/**
|
||||
* 统计公司内设备报警数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countAlarmNumByCompanyId(@Param("deptId")Long deptId);
|
||||
|
||||
/**
|
||||
* 根据厂区部门id查询一周内各个产线报警数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countWeeklyAlarmNumByFactoryDeptId(Long deptId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<CompanyDashboardDTO> countEquipNumByCompanyId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据公司部门id查询近一周产线正常运行数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countWeeklyEquipRunningNumByCompanyDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据公司id查询各个厂区半年维修单数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countMaintenanceRecordNumByCompanyId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据公司id统计近半年的保养记录数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countUpkeepRecordNumByCompanyDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据公司id统计近半年巡检工单数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countPatrolRecordNumByCompanyDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据公司id统计报警数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countAlarmNumByCompanyId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据公司id查询最新报警条数
|
||||
*/
|
||||
public List<IpcAlarmRecord> selectLatestIpcAlarmRecordByFactoryId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据公司id查询一周内各个厂区报警数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countWeeklyAlarmNumByCompanyId(Long deptId);
|
||||
|
||||
/**
|
||||
* 统计备品备件数据
|
||||
*/
|
||||
public CompanyDashboardDTO countSparePartsNumByCompanyId(Long deptId);
|
||||
}
|
||||
|
@ -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<CompanyDashboardDTO> countEquipNumByCompanyId(Long deptId){
|
||||
//查询给定公司id的厂区id
|
||||
List<SysDept> childDeptList = sysDeptMapper.selectChildrenDeptById(deptId);
|
||||
List<SysDept> factoryDeptList = childDeptList.stream().filter(dept -> dept.getAncestors().split(",").length == 3 ).collect(Collectors.toList());
|
||||
List<SysDept> factoryDeptList = getFactoryDeptListByCompanyId(deptId);
|
||||
List<CompanyDashboardDTO> 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<CompanyDashboardDTO> countWeeklyEquipRunningNumByCompanyDeptId(Long deptId){
|
||||
//根据公司id查询各个厂区id
|
||||
List<SysDept> factoryDeptList = getFactoryDeptListByCompanyId(deptId);
|
||||
List<CompanyDashboardDTO> resultList = new ArrayList<>();
|
||||
factoryDeptList.forEach(factoryDept -> {
|
||||
List<CompanyDashboardDTO> factoryWeekData = companyDashboardMapper.countWeeklyEquipRunningNumByCompanyDeptId(factoryDept.getDeptId(),EquipInfoStatus.RUNNING);
|
||||
CompanyDashboardDTO companyDashboardDTO = new CompanyDashboardDTO();
|
||||
companyDashboardDTO.setDeptId(factoryDept.getDeptId());
|
||||
companyDashboardDTO.setDeptName(factoryDept.getDeptName());
|
||||
List<String> timeList = factoryWeekData.stream().map(CompanyDashboardDTO::getTime).collect(Collectors.toList());
|
||||
List<Object> 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<CompanyDashboardDTO> countMaintenanceRecordNumByCompanyId(Long deptId){
|
||||
List<CompanyDashboardDTO> resultList = new ArrayList<>();
|
||||
//根据公司id查询各个厂区id
|
||||
List<SysDept> 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<CompanyDashboardDTO> countUpkeepRecordNumByCompanyDeptId(Long deptId){
|
||||
List<CompanyDashboardDTO> resultList = new ArrayList<>();
|
||||
//根据公司id查询各个厂区id
|
||||
List<SysDept> 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<CompanyDashboardDTO> countPatrolRecordNumByCompanyDeptId(Long deptId){
|
||||
List<CompanyDashboardDTO> resultList = new ArrayList<>();
|
||||
//根据公司id查询各个厂区id
|
||||
List<SysDept> factoryDeptList = getFactoryDeptListByCompanyId(deptId);
|
||||
for (SysDept sysDept : factoryDeptList) {
|
||||
List<CompanyDashboardDTO> 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<CompanyDashboardDTO> countAlarmNumByCompanyId(Long deptId){
|
||||
return companyDashboardMapper.countAlarmNumByCompanyId(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据公司id查询最新报警条数
|
||||
*/
|
||||
public List<IpcAlarmRecord> selectLatestIpcAlarmRecordByFactoryId(Long deptId){
|
||||
return ipcAlarmRecordService.selectLatestIpcAlarmRecordByFactoryId(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据公司id查询一周内各个厂区报警数量
|
||||
*/
|
||||
public List<CompanyDashboardDTO> countWeeklyAlarmNumByCompanyId(Long deptId){
|
||||
List<CompanyDashboardDTO> resultList = new ArrayList<>();
|
||||
List<SysDept> factoryDeptList = getFactoryDeptListByCompanyId(deptId);
|
||||
for (SysDept sysDept : factoryDeptList) {
|
||||
CompanyDashboardDTO companyData = new CompanyDashboardDTO();
|
||||
List<CompanyDashboardDTO> factoryDataList = companyDashboardMapper.countWeeklyAlarmNumByFactoryDeptId(sysDept.getDeptId());
|
||||
List<String> timeList = factoryDataList.stream().map(CompanyDashboardDTO::getTime).collect(Collectors.toList());
|
||||
List<Object> 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<String> items = new ArrayList<>();
|
||||
List<Object> 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<SysDept> getFactoryDeptListByCompanyId(Long deptId){
|
||||
List<SysDept> childDeptList = sysDeptMapper.selectChildrenDeptById(deptId);
|
||||
List<SysDept> 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<String> timeList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
List<Date> 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<String> timeList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
List<Date> 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<CompanyDashboardDTO> getPatrolRecordNumByHalfYear(Long deptId){
|
||||
CompanyDashboardDTO returnData1 = new CompanyDashboardDTO();
|
||||
CompanyDashboardDTO returnData2 = new CompanyDashboardDTO();
|
||||
List<String> timeList1 = new ArrayList<>();
|
||||
List<String> timeList2 = new ArrayList<>();
|
||||
List<Object> dataList1 = new ArrayList<>();
|
||||
List<Object> dataList2 = new ArrayList<>();
|
||||
List<Date> halfYearDate = getHalfYearDate();
|
||||
//修改日期年月日
|
||||
for (Date date : halfYearDate) {
|
||||
List<CompanyDashboardDTO> 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<Date> getHalfYearDate(){
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
List<Date> 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;
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,11 @@ public interface IpcSparePartsInboundMapper
|
||||
*/
|
||||
public List<IpcSparePartsInbound> selectIpcSparePartsInboundListForExport(IpcSparePartsInbound ipcSparePartsInbound);
|
||||
|
||||
/**
|
||||
* 查询入库单数量
|
||||
*/
|
||||
public int countIpcSparePartsInbound(Long deptId) ;
|
||||
|
||||
/**
|
||||
* 新增备件入库
|
||||
*
|
||||
|
@ -36,6 +36,11 @@ public interface IpcSparePartsInfoMapper
|
||||
*/
|
||||
public List<IpcSparePartsStockExport> selectIpcSparePartsStockExportList(IpcSparePartsInfo ipcSparePartsInfo);
|
||||
|
||||
/**
|
||||
* 统计备品备件种类数量
|
||||
*/
|
||||
public int countIpcSparePartsInfo(Long deptId);
|
||||
|
||||
/**
|
||||
* 新增备品备件信息
|
||||
*
|
||||
|
@ -37,6 +37,11 @@ public interface IpcSparePartsOutboundMapper
|
||||
*/
|
||||
public List<IpcSparePartsOutbound> selectIpcSparePartsOutboundListForExport(IpcSparePartsOutbound ipcSparePartsOutbound);
|
||||
|
||||
/**
|
||||
* 统计出库单数量
|
||||
*/
|
||||
public int countIpcSparePartsOutbound(Long deptId);
|
||||
|
||||
/**
|
||||
* 新增备件出库单
|
||||
*
|
||||
|
@ -8,6 +8,7 @@
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="deptName" column="dept_name"/>
|
||||
<result property="data" column="data"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="time" column="time"/>
|
||||
</resultMap>
|
||||
@ -28,6 +29,7 @@
|
||||
select date_sub(curdate(), interval 6 day) as click_date
|
||||
</sql>
|
||||
|
||||
|
||||
<!--查询公司设备数量-->
|
||||
<select id="countDiffStatusCompanyEquipNumByDeptId" resultMap="companyData">
|
||||
select
|
||||
@ -56,4 +58,111 @@
|
||||
and status in (0,1,2)-- 0:离线 1:在线 2:故障
|
||||
</select>
|
||||
|
||||
<!--根据厂区部门id查询近一周产线正常运行数量 countWeeklyEquipRunningNumByCompanyDeptId-->
|
||||
<select id="countWeeklyEquipRunningNumByCompanyDeptId" resultMap="companyData">
|
||||
select a.click_date as time,ifnull(b.nums,0) as data
|
||||
from
|
||||
( select curdate() as click_date
|
||||
union all
|
||||
select date_sub(curdate(), interval 1 day) as click_date
|
||||
union all
|
||||
select date_sub(curdate(), interval 2 day) as click_date
|
||||
union all
|
||||
select date_sub(curdate(), interval 3 day) as click_date
|
||||
union all
|
||||
select date_sub(curdate(), interval 4 day) as click_date
|
||||
union all
|
||||
select date_sub(curdate(), interval 5 day) as click_date
|
||||
union all
|
||||
select date_sub(curdate(), interval 6 day) as click_date)
|
||||
a left join
|
||||
(
|
||||
select SUM(nums) as nums,status,DATE(create_date) as create_date
|
||||
from `ipc_daily_equip_num_by_status`
|
||||
where dept_id in (select dept_id from sys_dept where find_in_set (#{deptId},ancestors))
|
||||
and `status` = #{status} and
|
||||
create_date >= CURDATE() - INTERVAL 7 DAY
|
||||
group by DATE(create_date)
|
||||
) b
|
||||
on a.click_date = b.create_date
|
||||
</select>
|
||||
|
||||
<!--统计近半年的维修记录数量-->
|
||||
<select id="countMaintenanceRecordNumByCompanyDeptId" resultMap="companyData">
|
||||
select #{date} as time,count(1) as data
|
||||
from ipc_maintenance_record
|
||||
where
|
||||
MONTH(maintenance_start_time) = MONTH(#{date})
|
||||
and YEAR(maintenance_start_time) = YEAR(#{date})
|
||||
and dept_id in (select dept_id from sys_dept where find_in_set (#{deptId},ancestors) or dept_id = #{deptId})
|
||||
</select>
|
||||
|
||||
<!-- 统计近半年的保养记录数量-->
|
||||
<select id="countUpkeepRecordNumByCompanyDeptId" resultMap="companyData">
|
||||
select #{date} as time,count(1) as data
|
||||
from ipc_upkeep_plan
|
||||
where
|
||||
MONTH(plan_start_time) = MONTH(#{date})
|
||||
and YEAR(plan_start_time) = YEAR(#{date})
|
||||
and dept_id in (select dept_id from sys_dept where find_in_set (#{deptId},ancestors) or dept_id = #{deptId})
|
||||
</select>
|
||||
|
||||
<!-- 统计近半年巡检工单数量countPatrolRecordNumByCompanyDeptId-->
|
||||
<select id="countPatrolRecordNumByCompanyDeptId" resultMap="companyData">
|
||||
select #{date} as time,a.type,ifnull(b.data,0) as data from
|
||||
(
|
||||
select 0 as type
|
||||
union all
|
||||
select 1 as type
|
||||
) a left join
|
||||
(
|
||||
select type,count(1) as data
|
||||
from ipc_patrol_task
|
||||
where
|
||||
MONTH(create_time) = MONTH(#{date})
|
||||
and YEAR(create_time) = YEAR(#{date})
|
||||
and dept_id in (select dept_id from sys_dept where find_in_set (#{deptId},ancestors) or dept_id = #{deptId})
|
||||
group by type
|
||||
) b
|
||||
on a.type = b.type
|
||||
</select>
|
||||
|
||||
<!-- 统计公司内设备报警数量countAlarmNumByCompanyId-->
|
||||
<select id="countAlarmNumByCompanyId" parameterType="Long" resultMap="companyData">
|
||||
select m.status,n.data
|
||||
from
|
||||
(
|
||||
select 0 as status
|
||||
union all
|
||||
select 1 as status
|
||||
) m
|
||||
left join (
|
||||
select a.status,count(1) as data from `ipc_alarm_record` a
|
||||
left join ipc_equip_info b
|
||||
on a.equip_id = b.id
|
||||
where b.dept_id in (select dept_id from sys_dept where find_in_set(#{deptId},ancestors) or dept_id = #{deptId} ) group by a.`status`
|
||||
) n
|
||||
on m.status = n.status
|
||||
</select>
|
||||
|
||||
<!--根据产线部门id查询一周内各个产线报警数量
|
||||
public List<FactoryDashboardDTO> countAlarmNumByProductionLine(Long deptId);-->
|
||||
<select id="countWeeklyAlarmNumByFactoryDeptId" parameterType="Long" resultMap="companyData">
|
||||
select a.click_date as time,ifnull(b.alarm_data,0) as data
|
||||
from
|
||||
(<include refid="selectWeeklyDate"/>)
|
||||
a left join
|
||||
(
|
||||
select DATE(alarm_time) as alarm_time,count(1) as alarm_data
|
||||
from ipc_alarm_record
|
||||
where alarm_time >= CURDATE() - INTERVAL 7 DAY
|
||||
and equip_id in (select id from ipc_equip_info where dept_id in
|
||||
(select dept_id from sys_dept where find_in_set(#{deptId},ancestors) or dept_id = #{deptId})
|
||||
)
|
||||
group by DATE(alarm_time)
|
||||
) b
|
||||
on a.click_date = b.alarm_time
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -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}
|
||||
</select>
|
||||
|
||||
<insert id="insertIpcEquipInfo" parameterType="IpcEquipInfo">
|
||||
|
@ -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
|
||||
|
@ -126,6 +126,12 @@
|
||||
order by i.submit_time desc,i.spare_parts_inbound_num desc,id.order_num
|
||||
</select>
|
||||
|
||||
<!-- 查询入库单数量-->
|
||||
<select id="countIpcSparePartsInbound" resultType="int">
|
||||
select count(1) from ipc_spare_parts_inbound
|
||||
where dept_id in (select dept_id from sys_dept where find_in_set( #{deptId} , ancestors ) or dept_id = #{deptId})
|
||||
</select>
|
||||
|
||||
<insert id="insertIpcSparePartsInbound" parameterType="com.inspur.spareparts.domain.IpcSparePartsInbound">
|
||||
insert into ipc_spare_parts_inbound
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
@ -114,6 +114,15 @@
|
||||
where i.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- /**
|
||||
* 统计备品备件种类数量
|
||||
*/
|
||||
public int countIpcSparePartsInfo();-->
|
||||
<select id="countIpcSparePartsInfo" resultType="int">
|
||||
select count(1) from ipc_spare_parts_info
|
||||
where dept_id in (select dept_id from sys_dept where find_in_set( #{deptId} , ancestors ) or dept_id = #{deptId})
|
||||
</select>
|
||||
|
||||
<insert id="insertIpcSparePartsInfo" parameterType="com.inspur.spareparts.domain.IpcSparePartsInfo">
|
||||
insert into ipc_spare_parts_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
@ -143,6 +143,14 @@
|
||||
</where>
|
||||
order by o.submit_time desc,o.spare_parts_outbound_num desc,od.order_num
|
||||
</select>
|
||||
|
||||
<!--统计出库单数量 countIpcSparePartsOutbound()-->
|
||||
<select id="countIpcSparePartsOutbound" resultType="int">
|
||||
select count(1)
|
||||
from ipc_spare_parts_outbound
|
||||
where dept_id in (select dept_id from sys_dept where find_in_set( #{deptId} , ancestors ) or dept_id = #{deptId})
|
||||
</select>
|
||||
|
||||
<insert id="insertIpcSparePartsOutbound" parameterType="com.inspur.spareparts.domain.IpcSparePartsOutbound">
|
||||
insert into ipc_spare_parts_outbound
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
81
zfipc-ui/src/api/bigscreen/company.js
Normal file
81
zfipc-ui/src/api/bigscreen/company.js
Normal file
@ -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",
|
||||
});
|
||||
}
|
@ -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);
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user