|
@@ -2,16 +2,24 @@ package org.jeecg.modules.equipmentOnoffSection.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.modules.equipmentOnoffSection.entity.EquipmentOnoffSection;
|
|
|
import org.jeecg.modules.equipmentOnoffSection.mapper.EquipmentOnoffSectionMapper;
|
|
|
import org.jeecg.modules.equipmentOnoffSection.service.IEquipmentOnoffSectionService;
|
|
|
+import org.jeecg.modules.jmreport.desreport.util.p;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
+import org.jeecg.modules.tpmEquipment.entity.TpmEquipment;
|
|
|
+import org.jeecg.modules.tpmEquipment.mapper.TpmEquipmentMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description: tpm_equipment_onoff_section
|
|
@@ -25,6 +33,9 @@ public class EquipmentOnoffSectionServiceImpl extends ServiceImpl<EquipmentOnoff
|
|
|
@Autowired
|
|
|
private EquipmentOnoffSectionMapper onoffSectionMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TpmEquipmentMapper equipmentMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 获取设备运行时间段信息(状态横向)
|
|
|
* @param page
|
|
@@ -49,4 +60,100 @@ public class EquipmentOnoffSectionServiceImpl extends ServiceImpl<EquipmentOnoff
|
|
|
return onoffSectionMapper.selectOnoffTransverse(begintime, endtime);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取设备运行时间段信息(按照设备统计开机时长、所有信息等)
|
|
|
+ * @param equipmentids 设备id
|
|
|
+ * @param begintime 开始日期
|
|
|
+ * @param endtime 结束日期
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result selectEfficiency(String[] equipmentids, String begintime, String endtime) {
|
|
|
+ List<String> eqs = Arrays.stream(equipmentids).collect(Collectors.toList());
|
|
|
+ List<EquipmentOnoffSection> sectionList = onoffSectionMapper.selectEfficiency(eqs, begintime, endtime);
|
|
|
+
|
|
|
+ HashMap map = new HashMap();
|
|
|
+ List<SectionCls> sectionClsList = new ArrayList<>();
|
|
|
+ int i = 0;
|
|
|
+ List<String> times = new ArrayList<>();
|
|
|
+ for (String equipmentid : equipmentids) {
|
|
|
+ List<EquipmentOnoffSection> subList = sectionList.stream().filter(p -> p.getEquipmentid().equals(equipmentid)).
|
|
|
+ collect(Collectors.toList());
|
|
|
+ TpmEquipment equipment = equipmentMapper.selectById(equipmentid);
|
|
|
+
|
|
|
+ SectionCls sectionCls = new SectionCls();
|
|
|
+ sectionCls.setEquipmentid(equipmentid);
|
|
|
+ sectionCls.setEquipmentcode(equipment.getEquipmentcode());
|
|
|
+ sectionCls.setEquipmentname(equipment.getEquipmentname());
|
|
|
+
|
|
|
+ List<EquipmentOnoffSection> sections = new ArrayList<>();
|
|
|
+ for (EquipmentOnoffSection section : subList) {
|
|
|
+ if (i == 0) {
|
|
|
+ times.add(section.getDay());
|
|
|
+ }
|
|
|
+ sections.add(section);
|
|
|
+ }
|
|
|
+ sectionCls.setSectionList(sections);
|
|
|
+ sectionClsList.add(sectionCls);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ map.put("times", times);
|
|
|
+ map.put("equipments", sectionClsList);
|
|
|
+
|
|
|
+ return Result.OK(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取设备运行时间段信息(按照设备统计开机时长、所有信息等)
|
|
|
+ * @param equipmentids 设备id
|
|
|
+ * @param begintime 开始日期
|
|
|
+ * @param endtime 结束日期
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<EquipmentOnoffSection> selectEfficiencyTotal(String[] equipmentids, String begintime, String endtime) {
|
|
|
+ List<String> eqs = Arrays.stream(equipmentids).collect(Collectors.toList());
|
|
|
+ List<EquipmentOnoffSection> sectionList = onoffSectionMapper.selectEfficiencyTotal(eqs, begintime, endtime);
|
|
|
+
|
|
|
+ return sectionList;
|
|
|
+ }
|
|
|
+
|
|
|
+ class SectionCls {
|
|
|
+ private String equipmentid;
|
|
|
+ private String equipmentname;
|
|
|
+ private String equipmentcode;
|
|
|
+ private List<EquipmentOnoffSection> sectionList;
|
|
|
+
|
|
|
+ public String getEquipmentid() {
|
|
|
+ return equipmentid;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEquipmentid(String equipmentid) {
|
|
|
+ this.equipmentid = equipmentid;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getEquipmentname() {
|
|
|
+ return equipmentname;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEquipmentname(String equipmentname) {
|
|
|
+ this.equipmentname = equipmentname;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getEquipmentcode() {
|
|
|
+ return equipmentcode;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEquipmentcode(String equipmentcode) {
|
|
|
+ this.equipmentcode = equipmentcode;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<EquipmentOnoffSection> getSectionList() {
|
|
|
+ return sectionList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setSectionList(List<EquipmentOnoffSection> sectionList) {
|
|
|
+ this.sectionList = sectionList;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|