| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询设备运行时间 |
| | | * |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer selectProcessLong(String equipmentId, String validDate) { |
| | | Integer processLong = this.baseMapper.selectProcessLong(equipmentId, validDate); |
| | | if (processLong == null) { |
| | | return 0; |
| | | } else { |
| | | return Integer.parseInt(new BigDecimal(processLong).divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MdcEquipmentStatisticalInfo findMdcEquipmentStatisticalInfo(String equipmentId, String date) { |
| | | return this.baseMapper.findMdcEquipmentStatisticalInfo(equipmentId, date.replaceAll("-", "")); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal computeUtilizationMonth(String productionId, String startDate, String endDate) { |
| | | BigDecimal processLong = this.baseMapper.computeUtilizationMonth(productionId, startDate, endDate); |
| | | if (processLong != null && processLong.compareTo(BigDecimal.ZERO) > 0) { |
| | | return processLong.divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP); |
| | | } else { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal computeUtilizationMonthTotal(String productionId, String startDate, String endDate) { |
| | | BigDecimal processLong = this.baseMapper.computeUtilizationMonthTotal(productionId, startDate, endDate); |
| | | if (processLong != null && processLong.compareTo(BigDecimal.ZERO) > 0) { |
| | | return processLong.divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP); |
| | | } else { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | } |
| | | |
| | | private List<EquipmentStatisticalInfo> dataHandle(List<MdcEquipmentStatisticalInfo> list) { |
| | | List<EquipmentStatisticalInfo> result = new ArrayList<>(); |
| | | list.forEach(item -> { |