Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
87afb058c5
@ -0,0 +1,55 @@
|
||||
package com.inspur.web.controller.bigscreen;
|
||||
|
||||
import com.inspur.bigscreen.service.IOverallDashboardService;
|
||||
import com.inspur.common.core.domain.AjaxResult;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/7/17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bigscreen/overall")
|
||||
public class OverallDashboardController {
|
||||
|
||||
@Autowired
|
||||
private IOverallDashboardService overallDashboardService;
|
||||
|
||||
@GetMapping("/countCompanyEquipNum")
|
||||
public AjaxResult countCompanyEquipNum() {
|
||||
return AjaxResult.success(overallDashboardService.countCompanyEquipNum());
|
||||
}
|
||||
|
||||
@GetMapping("/countWeeklyEquipNum")
|
||||
public AjaxResult countWeeklyEquipNum() {
|
||||
return AjaxResult.success(overallDashboardService.countWeeklyEquipNum());
|
||||
}
|
||||
|
||||
@GetMapping("/countMaintenanceNum")
|
||||
public AjaxResult countMaintenanceNum() {
|
||||
return AjaxResult.success(overallDashboardService.countMaintenanceNum());
|
||||
}
|
||||
|
||||
@GetMapping("/countWeeklyMaintenanceNum")
|
||||
public AjaxResult countWeeklyMaintenanceNum() {
|
||||
return AjaxResult.success(overallDashboardService.countWeeklyMaintenanceNum());
|
||||
}
|
||||
|
||||
@GetMapping("/countCompanyDeptNumByIndustry")
|
||||
public AjaxResult countCompanyDeptNumByIndustry() {
|
||||
return AjaxResult.success(overallDashboardService.countCompanyDeptNumByIndustry());
|
||||
}
|
||||
|
||||
@GetMapping("/countEquipNumByStatus")
|
||||
public AjaxResult countEquipNumByStatus() {
|
||||
return AjaxResult.success(overallDashboardService.countEquipNumByStatus());
|
||||
}
|
||||
|
||||
@GetMapping("/countCompanyDetails")
|
||||
public AjaxResult countCompanyDetails() {
|
||||
return AjaxResult.success(overallDashboardService.countCompanyDetails());
|
||||
}
|
||||
}
|
@ -55,6 +55,11 @@ public class SysDept extends BaseEntity
|
||||
/** 行政区划ID */
|
||||
private String regionId;
|
||||
|
||||
/**
|
||||
* 行业代号
|
||||
*/
|
||||
private String industryCode;
|
||||
|
||||
/** 子部门 */
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
||||
@ -192,6 +197,14 @@ public class SysDept extends BaseEntity
|
||||
this.regionId = regionId;
|
||||
}
|
||||
|
||||
public String getIndustryCode() {
|
||||
return industryCode;
|
||||
}
|
||||
|
||||
public void setIndustryCode(String industryCode) {
|
||||
this.industryCode = industryCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.inspur.bigscreen.constant;
|
||||
|
||||
/**
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/7/17
|
||||
*/
|
||||
public class DeptIndustryCode {
|
||||
|
||||
/**
|
||||
* 造纸
|
||||
*/
|
||||
public static final String PAPER = "0";
|
||||
|
||||
/**
|
||||
* 炼金
|
||||
*/
|
||||
public static final String ALCHEMY = "1";
|
||||
|
||||
/**
|
||||
* 其他
|
||||
*/
|
||||
public static final String OTHER = "2";
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.inspur.bigscreen.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.ibatis.annotations.ConstructorArgs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/7/17
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class OverallDashboardDTO {
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private String deptName;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private Integer data;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String time;
|
||||
|
||||
private List<String> x;
|
||||
|
||||
private List<Object> y;
|
||||
|
||||
private Integer lineNum;
|
||||
|
||||
private Integer equipNum;
|
||||
|
||||
private Integer alarmNum;
|
||||
|
||||
public OverallDashboardDTO() {}
|
||||
|
||||
public OverallDashboardDTO(Integer status, Integer data) {
|
||||
this.status = status;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.inspur.bigscreen.mapper;
|
||||
|
||||
import com.inspur.bigscreen.dto.OverallDashboardDTO;
|
||||
|
||||
/**
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/7/17
|
||||
*/
|
||||
public interface OverallDashboardMapper {
|
||||
|
||||
/**
|
||||
* 统计各个公司设备总数
|
||||
*/
|
||||
public OverallDashboardDTO countCompanyEquipNum(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据公司id统计维修单数量
|
||||
*/
|
||||
public OverallDashboardDTO countMaintenanceNum(Long deptId);
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.inspur.bigscreen.service;
|
||||
|
||||
import com.inspur.bigscreen.dto.OverallDashboardDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/7/17
|
||||
*/
|
||||
public interface IOverallDashboardService {
|
||||
|
||||
/**
|
||||
* 查询各个公司的设备(轴承)数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countCompanyEquipNum();
|
||||
|
||||
/**
|
||||
* 查询一周内总共的各个状态设备数及故障率
|
||||
*/
|
||||
public List<OverallDashboardDTO> countWeeklyEquipNum();
|
||||
|
||||
/**
|
||||
* 查询各个公司维修单数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countMaintenanceNum();
|
||||
|
||||
/**
|
||||
* 统计半年各个公司维修单数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countWeeklyMaintenanceNum();
|
||||
|
||||
/**
|
||||
* 统计各个行业公司数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countCompanyDeptNumByIndustry();
|
||||
|
||||
/**
|
||||
* 统计该公司各个状态设备数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countEquipNumByStatus();
|
||||
|
||||
/**
|
||||
* 查询各个企业相关展示信息,产线数、设备数,告警数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countCompanyDetails();
|
||||
}
|
@ -2,11 +2,8 @@ package com.inspur.bigscreen.service.impl;
|
||||
|
||||
import com.inspur.bigscreen.constant.EquipInfoStatus;
|
||||
import com.inspur.bigscreen.dto.CompanyDashboardDTO;
|
||||
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;
|
||||
@ -14,7 +11,6 @@ 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;
|
||||
|
||||
@ -29,7 +25,7 @@ import java.util.stream.Collectors;
|
||||
* @create 2024/7/15
|
||||
*/
|
||||
@Service
|
||||
public class CompanyDashboardService implements ICompanyDashboardService {
|
||||
public class CompanyDashboardServiceImpl implements ICompanyDashboardService {
|
||||
|
||||
@Autowired
|
||||
private CompanyDashboardMapper companyDashboardMapper;
|
@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
||||
* @create 2024/7/11
|
||||
*/
|
||||
@Service
|
||||
public class FactoryDashboardService implements IFactoryDashboardService {
|
||||
public class FactoryDashboardServiceImpl implements IFactoryDashboardService {
|
||||
|
||||
@Autowired
|
||||
private FactoryDashboardMapper factoryDashboardMapper;
|
@ -0,0 +1,284 @@
|
||||
package com.inspur.bigscreen.service.impl;
|
||||
|
||||
import com.inspur.bigscreen.constant.DeptIndustryCode;
|
||||
import com.inspur.bigscreen.constant.EquipInfoStatus;
|
||||
import com.inspur.bigscreen.dto.CompanyDashboardDTO;
|
||||
import com.inspur.bigscreen.dto.OverallDashboardDTO;
|
||||
import com.inspur.bigscreen.mapper.CompanyDashboardMapper;
|
||||
import com.inspur.bigscreen.mapper.OverallDashboardMapper;
|
||||
import com.inspur.bigscreen.service.ICompanyDashboardService;
|
||||
import com.inspur.bigscreen.service.IOverallDashboardService;
|
||||
import com.inspur.common.core.domain.entity.SysDept;
|
||||
import com.inspur.system.mapper.SysDeptMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author zhangjunwen
|
||||
* @create 2024/7/17
|
||||
*/
|
||||
@Service
|
||||
public class OverallDashboardServiceImpl implements IOverallDashboardService {
|
||||
|
||||
@Autowired
|
||||
private SysDeptMapper sysDeptMapper;
|
||||
|
||||
@Autowired
|
||||
private ICompanyDashboardService companyDashboardService;
|
||||
|
||||
@Autowired
|
||||
private OverallDashboardMapper overallDashboardMapper;
|
||||
|
||||
@Autowired
|
||||
private CompanyDashboardMapper companyDashboardMapper;
|
||||
|
||||
/**
|
||||
* 查询各个公司的设备(轴承)数量
|
||||
*/
|
||||
@Override
|
||||
public List<OverallDashboardDTO> countCompanyEquipNum(){
|
||||
List<SysDept> companyDepts = getCompanyDept();
|
||||
List<OverallDashboardDTO> resultList = new ArrayList<>();
|
||||
for (SysDept companyDept : companyDepts) {
|
||||
OverallDashboardDTO data = overallDashboardMapper.countCompanyEquipNum(companyDept.getDeptId());
|
||||
data.setDeptId(companyDept.getDeptId());
|
||||
data.setDeptName(companyDept.getDeptName());
|
||||
resultList.add(data);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一周内总共的各个状态设备数及故障率
|
||||
*/
|
||||
@Override
|
||||
public List<OverallDashboardDTO> countWeeklyEquipNum(){
|
||||
List<OverallDashboardDTO> resultList = new ArrayList<>();
|
||||
List<CompanyDashboardDTO> companyDashboardDTOList1 = companyDashboardMapper.countWeeklyEquipRunningNumByCompanyDeptId(100L, EquipInfoStatus.RUNNING);
|
||||
List<CompanyDashboardDTO> companyDashboardDTOList2 = companyDashboardMapper.countWeeklyEquipRunningNumByCompanyDeptId(100L,EquipInfoStatus.MAINTENANCE);
|
||||
List<CompanyDashboardDTO> companyDashboardDTOList3 = companyDashboardMapper.countWeeklyEquipRunningNumByCompanyDeptId(100L,EquipInfoStatus.STOP);
|
||||
resultList.add(convertCompanyData(companyDashboardDTOList1,EquipInfoStatus.RUNNING));
|
||||
resultList.add(convertCompanyData(companyDashboardDTOList2,EquipInfoStatus.MAINTENANCE));
|
||||
resultList.add(convertCompanyData(companyDashboardDTOList3,EquipInfoStatus.STOP));
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询各个公司维修单数量
|
||||
*/
|
||||
@Override
|
||||
public List<OverallDashboardDTO> countMaintenanceNum(){
|
||||
List<SysDept> companyDepts = getCompanyDept();
|
||||
List<OverallDashboardDTO> resultList = new ArrayList<>();
|
||||
for (SysDept companyDept : companyDepts) {
|
||||
OverallDashboardDTO data = overallDashboardMapper.countMaintenanceNum(companyDept.getDeptId());
|
||||
data.setDeptId(companyDept.getDeptId());
|
||||
data.setDeptName(companyDept.getDeptName());
|
||||
resultList.add(data);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计半年各个公司维修单数量
|
||||
*/
|
||||
@Override
|
||||
public List<OverallDashboardDTO> countWeeklyMaintenanceNum(){
|
||||
List<SysDept> companyDepts = getCompanyDept();
|
||||
List<OverallDashboardDTO> resultList = new ArrayList<>();
|
||||
for (SysDept companyDept : companyDepts) {
|
||||
OverallDashboardDTO data = getMatenanceDataByHalfYear(companyDept.getDeptId());
|
||||
data.setDeptId(companyDept.getDeptId());
|
||||
data.setDeptName(companyDept.getDeptName());
|
||||
resultList.add(data);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计各个行业公司数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countCompanyDeptNumByIndustry(){
|
||||
|
||||
List<SysDept> companyDepts = getCompanyDept();
|
||||
long paperNum = companyDepts.stream().filter(dept -> dept.getIndustryCode().equals(DeptIndustryCode.PAPER)).count();
|
||||
long alchemyNum = companyDepts.stream().filter(dept -> dept.getIndustryCode().equals(DeptIndustryCode.ALCHEMY)).count();
|
||||
long otherNum = companyDepts.stream().filter(dept -> dept.getIndustryCode().equals(DeptIndustryCode.OTHER)).count();
|
||||
|
||||
return Arrays.asList(
|
||||
new OverallDashboardDTO(Integer.valueOf(DeptIndustryCode.PAPER),(int)paperNum),
|
||||
new OverallDashboardDTO(Integer.valueOf(DeptIndustryCode.ALCHEMY),(int)alchemyNum),
|
||||
new OverallDashboardDTO(Integer.valueOf(DeptIndustryCode.OTHER),(int)otherNum)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计该公司各个状态设备数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countEquipNumByStatus(){
|
||||
List<CompanyDashboardDTO> companyDashboardDTOList =companyDashboardService.countEquipNumByStatus(100L);
|
||||
return companyDashboardDTOList.stream().map(companyDashboardDTO -> {
|
||||
OverallDashboardDTO data = new OverallDashboardDTO();
|
||||
data.setStatus(companyDashboardDTO.getStatus());
|
||||
data.setData(companyDashboardDTO.getData());
|
||||
return data;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询各个企业相关展示信息,产线数、设备数,告警数量
|
||||
*/
|
||||
public List<OverallDashboardDTO> countCompanyDetails(){
|
||||
List<SysDept> companyDepts = getCompanyDept();
|
||||
List<OverallDashboardDTO> resultList = new ArrayList<>();
|
||||
for (SysDept companyDept : companyDepts) {
|
||||
OverallDashboardDTO data = new OverallDashboardDTO();
|
||||
//查询该公司产线数
|
||||
List<SysDept> childDepts = sysDeptMapper.selectChildrenDeptById(companyDept.getDeptId());
|
||||
List<SysDept> lineDepts = childDepts.stream().filter(dept -> dept.getAncestors().split(",").length == 4).collect(Collectors.toList());
|
||||
int lineNum = lineDepts.size();
|
||||
//查询设备数
|
||||
int equipNum = overallDashboardMapper.countCompanyEquipNum(companyDept.getDeptId()).getData();
|
||||
//查询报警数
|
||||
List<CompanyDashboardDTO> alarmList = companyDashboardService.countAlarmNumByCompanyId(companyDept.getDeptId());
|
||||
int alarmNum = alarmList.stream().mapToInt(CompanyDashboardDTO::getData).sum();
|
||||
data.setDeptId(companyDept.getDeptId());
|
||||
data.setDeptName(companyDept.getDeptName());
|
||||
data.setLineNum(lineNum);
|
||||
data.setEquipNum(equipNum);
|
||||
data.setAlarmNum(alarmNum);
|
||||
resultList.add(data);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统重公司部门
|
||||
*/
|
||||
private List<SysDept> getCompanyDept(){
|
||||
SysDept query = new SysDept();
|
||||
query.setParentId(100L);
|
||||
return sysDeptMapper.selectDeptList(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将查询的公司数据转全局数据
|
||||
*/
|
||||
private OverallDashboardDTO convertCompanyData(List<CompanyDashboardDTO> companyList,Integer status){
|
||||
OverallDashboardDTO result = new OverallDashboardDTO();
|
||||
List<String> timeList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
for (CompanyDashboardDTO companyDashboardDTO : companyList) {
|
||||
timeList.add(companyDashboardDTO.getTime());
|
||||
dataList.add(companyDashboardDTO.getData());
|
||||
}
|
||||
Collections.reverse(timeList);
|
||||
Collections.reverse(dataList);
|
||||
result.setStatus(status);
|
||||
result.setX(timeList);
|
||||
result.setY(dataList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间半年内的时间并查询数据
|
||||
*/
|
||||
private OverallDashboardDTO getMatenanceDataByHalfYear(Long deptId){
|
||||
OverallDashboardDTO returnData = new OverallDashboardDTO();
|
||||
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;
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@
|
||||
ipc_equip_info
|
||||
where
|
||||
dept_id in
|
||||
(select dept_id from sys_dept where FIND_IN_SET(#{deptId}, ancestors))
|
||||
(select dept_id from sys_dept where FIND_IN_SET(#{deptId}, ancestors) or dept_id = #{deptId})
|
||||
and status = #{status}
|
||||
</select>
|
||||
|
||||
@ -129,7 +129,7 @@
|
||||
|
||||
<!-- 统计公司内设备报警数量countAlarmNumByCompanyId-->
|
||||
<select id="countAlarmNumByCompanyId" parameterType="Long" resultMap="companyData">
|
||||
select m.status,n.data
|
||||
select m.status,ifnull(n.data,0) as data
|
||||
from
|
||||
(
|
||||
select 0 as status
|
||||
|
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.inspur.bigscreen.mapper.OverallDashboardMapper">
|
||||
|
||||
<resultMap type="com.inspur.bigscreen.dto.OverallDashboardDTO" id="overallData">
|
||||
<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>
|
||||
|
||||
<sql id="selectWeeklyDate">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="countCompanyEquipNum" parameterType="Long" resultMap="overallData">
|
||||
select count(1) as data
|
||||
from ipc_equip_info
|
||||
where dept_id in
|
||||
(select dept_id from sys_dept where FIND_IN_SET(#{deptId}, ancestors) or dept_id = #{deptId})
|
||||
</select>
|
||||
|
||||
<!--根据公司id统计维修单数量countMaintenanceNum(Long deptId);-->
|
||||
<select id="countMaintenanceNum" parameterType="Long" resultMap="overallData">
|
||||
select count(1) as data
|
||||
from ipc_maintenance_record
|
||||
where dept_id in
|
||||
(select dept_id from sys_dept where FIND_IN_SET(#{deptId}, ancestors) or dept_id = #{deptId})
|
||||
</select>
|
||||
</mapper>
|
@ -21,10 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="regionId" column="region_id" />
|
||||
<result property="industryCode" column="industry_code" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeptVo">
|
||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,d.region_id
|
||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,d.region_id,d.industry_code
|
||||
from sys_dept d
|
||||
</sql>
|
||||
|
||||
@ -64,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.region_id,
|
||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.region_id,d.industry_code,
|
||||
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
|
||||
from sys_dept d
|
||||
where d.dept_id = #{deptId}
|
||||
@ -113,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="regionId != null">region_id,</if>
|
||||
<if test="industryCode != null">industry_code,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
@ -126,6 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="regionId != null">#{regionId},</if>
|
||||
<if test="industryCode != null">#{industryCode},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
@ -143,6 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="regionId != null and regionId != ''">region_id = #{regionId},</if>
|
||||
<if test="industryCode != null and industryCode != ''">industry_code = #{industryCode},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
|
57
zfipc-ui/src/api/bigscreen/overall.js
Normal file
57
zfipc-ui/src/api/bigscreen/overall.js
Normal file
@ -0,0 +1,57 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 统计各个公司的设备数
|
||||
export function getCompanyEquipNum() {
|
||||
return request({
|
||||
url: "/bigscreen/overall/countCompanyEquipNum",
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 统计各个设备数量
|
||||
export function getWeeklyEquipNum() {
|
||||
return request({
|
||||
url: "/bigscreen/overall/countWeeklyEquipNum",
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 统计各个公司维修数量
|
||||
export function getMaintenanceNum() {
|
||||
return request({
|
||||
url: "/bigscreen/overall/countMaintenanceNum",
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 统计半年内各个公司维修数量
|
||||
export function getWeeklyMaintenanceNum() {
|
||||
return request({
|
||||
url: "/bigscreen/overall/countWeeklyMaintenanceNum",
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 统计各个行业接入企业数量
|
||||
export function getCompanyDeptNumByIndustry() {
|
||||
return request({
|
||||
url: "/bigscreen/overall/countCompanyDeptNumByIndustry",
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 统计各个不同状态设备数量
|
||||
export function getEquipNumByStatus() {
|
||||
return request({
|
||||
url: "/bigscreen/overall/countEquipNumByStatus",
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 统计各个公司相关统计信息
|
||||
export function getCompanyDetails() {
|
||||
return request({
|
||||
url: "/bigscreen/overall/countCompanyDetails",
|
||||
method: "get",
|
||||
});
|
||||
}
|
@ -468,6 +468,15 @@ import {
|
||||
getWeeklyAlarmNumByCompany,
|
||||
getSparePartsNumByCompany,
|
||||
} from "@/api/bigscreen/company";
|
||||
import {
|
||||
getCompanyEquipNum,
|
||||
getWeeklyEquipNum,
|
||||
getMaintenanceNum,
|
||||
getWeeklyMaintenanceNum,
|
||||
getCompanyDeptNumByIndustry,
|
||||
getEquipNumByStatus,
|
||||
getCompanyDetails,
|
||||
} from "@/api/bigscreen/overall";
|
||||
export default {
|
||||
name: "Category",
|
||||
components: {
|
||||
@ -595,7 +604,7 @@ export default {
|
||||
this.getList();
|
||||
this.getDeptTree();
|
||||
//测试
|
||||
getSparePartsNumByCompany(101).then((response) => {
|
||||
getCompanyDetails().then((response) => {
|
||||
console.log("data:", response.data);
|
||||
});
|
||||
},
|
||||
|
@ -260,7 +260,7 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col
|
||||
:span="24"
|
||||
:span="12"
|
||||
v-if="form.parentId !== 0"
|
||||
>
|
||||
<el-form-item
|
||||
@ -277,6 +277,29 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col
|
||||
:span="12"
|
||||
v-if="form.parentId !== 0"
|
||||
>
|
||||
<el-form-item
|
||||
label="所属行业"
|
||||
prop="industryCode"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.industryCode"
|
||||
placeholder="请选择所属行业"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.industry_code"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div
|
||||
@ -308,7 +331,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
export default {
|
||||
name: "Dept",
|
||||
dicts: ["sys_normal_disable"],
|
||||
dicts: ["sys_normal_disable", "industry_code"],
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
@ -455,6 +478,7 @@ export default {
|
||||
this.reset();
|
||||
getDept(row.deptId).then((response) => {
|
||||
this.form = response.data;
|
||||
console.log("111:", response);
|
||||
this.open = true;
|
||||
this.title = "修改部门";
|
||||
listRegionAll().then((response) => {
|
||||
|
Loading…
Reference in New Issue
Block a user