1c291b0e 康伟

kangwei:设备运行台时问题

1、日粒度报表数据单位换算成小时
2、月粒度查询不出数据
3、年粒度单位换算成天
1 个父辈 4246dd0d
......@@ -108,6 +108,10 @@ public class TestMetricInfoController {
}else{//获取日数据或月数据
dataList = getDaysAndMonthsData(metricInfoVOList ,pgDataList,startTime, endTime,timeType);
}
realTimeHistoryDataVO.setHeadList( metricInfoVOList);
realTimeHistoryDataVO.setDataList( dataList );
result.setResult( realTimeHistoryDataVO);
......@@ -116,6 +120,7 @@ public class TestMetricInfoController {
private List<Map<String, Object>> getHourData( List<MetricInfoVO> metricInfoVOList , List<Map<String, Object>> pgDataList){
List<Map<String, Object>> dataList = new ArrayList<>();
String expression = null;
if(pgDataList != null ) {
dataList = new ArrayList<>(pgDataList.size());
Map<String, Object> dataMap = null;
......@@ -124,10 +129,11 @@ public class TestMetricInfoController {
dataMap = new HashMap<>();
dataMap.put("time",DateUtils.formatTime(Long.parseLong(paramMap.get("time") + "000")) );
for(MetricInfoVO metricInfoVO : metricInfoVOList){
dataMap.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.format(paramMap.get(metricInfoVO.getYxExpress()),"0.00"));//运行
dataMap.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.format(paramMap.get(metricInfoVO.getGzExpress()),"0.00"));//故障
dataMap.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.divide(paramMap.get(metricInfoVO.getYxExpress()),60));//运行
dataMap.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.divide(paramMap.get(metricInfoVO.getGzExpress()),60));//故障
//时数据
dataMap.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停
expression = "(60 - "+paramMap.get(metricInfoVO.getYxExpress())+"- "+paramMap.get(metricInfoVO.getGzExpress()) +")/60";
dataMap.put( metricInfoVO.getEquipmentCode()+"_ZT" , JSUtils.executeExpression(expression) );//暂停
}
dataList.add( dataMap );
}
......@@ -161,31 +167,43 @@ public class TestMetricInfoController {
}
Double doubleValue = 0.00d;
int daysInMonth = 31;
String yxTime = "0";
String gzTime = "0";
String ztTime = "0";
String expression = null;
if(pgDataList != null ) {
for(Map<String, Object> dataMapTemp : dataList){
if(StringUtils.isNotEmpty(format) ){
daysInMonth = DateUtil.getDaysInMonth(dataMapTemp.get("time")+"-01",format);
}
//select ts as time,nm as monitorId,v as monitorValue
for (Map<String, Object> paramMap : pgDataList) {
if( dataMapTemp.get("time").equals( paramMap.get("time") ) ){
if(format != null ){
daysInMonth = DateUtil.getDaysInMonth(dataMapTemp.get("time")+"-01",format);
}
for(MetricInfoVO metricInfoVO : metricInfoVOList){
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.format(paramMap.get(metricInfoVO.getYxExpress()),"0.00"));//运行
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.format(paramMap.get(metricInfoVO.getGzExpress()),"0.00"));//故障
//时数据
if (timeType.equals("1")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停
//日数据
//时数据 (单位H)
if (timeType.equals("1") || timeType.equals("2")) {
yxTime = JSUtils.divide(paramMap.get(metricInfoVO.getYxExpress()),60);
gzTime = JSUtils.divide(paramMap.get(metricInfoVO.getGzExpress()),60);
expression = "(60 - "+paramMap.get(metricInfoVO.getYxExpress())+" - "+paramMap.get(metricInfoVO.getGzExpress())+") /60";
ztTime = JSUtils.executeExpression(expression,"0.0");
}
//日数据 (单位H)
if (timeType.equals("2")) {
doubleValue = 24*60 - ConvertUtils.getDouble( paramMap.get(metricInfoVO.getYxExpress()), 0.00d) - ConvertUtils.getDouble(paramMap.get(metricInfoVO.getGzExpress()),0.00d );
if(doubleValue.doubleValue() < 0) doubleValue = 0.00d;
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.format(doubleValue) );//暂停
yxTime = JSUtils.divide(paramMap.get(metricInfoVO.getYxExpress()),60);
gzTime = JSUtils.divide(paramMap.get(metricInfoVO.getGzExpress()),60);
expression = "(60*24 - "+paramMap.get(metricInfoVO.getYxExpress())+" - "+paramMap.get(metricInfoVO.getGzExpress())+") /(60)";
ztTime = JSUtils.executeExpression(expression,"0.0");
}
//月数据
if (timeType.equals("3")){
doubleValue = daysInMonth*24*60 - ConvertUtils.getDouble( paramMap.get(metricInfoVO.getYxExpress()), 0.00d) - ConvertUtils.getDouble(paramMap.get(metricInfoVO.getGzExpress()),0.00d );
if(doubleValue.doubleValue() < 0) doubleValue = 0.00d;
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.format(doubleValue) );//暂停
}
if (timeType.equals("3")) {//单位是天
yxTime = JSUtils.divide(paramMap.get(metricInfoVO.getYxExpress()),60*24);
gzTime = JSUtils.divide(paramMap.get(metricInfoVO.getGzExpress()),60*24);
expression = "("+daysInMonth+"60*24 - "+paramMap.get(metricInfoVO.getYxExpress())+" - "+paramMap.get(metricInfoVO.getGzExpress())+") /(60*24)";
ztTime = JSUtils.executeExpression(expression,"0.0");
}
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_YX" , yxTime);//运行
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_GZ" , gzTime);//故障
dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,ztTime );//暂停
}
break;
}
......
......@@ -116,9 +116,9 @@
from sys_depart d
left join (
select bbb.depart_id,
ifnull((CASE WHEN equipment_level = '2421538a0286b491ffb863db92fe6cbf' THEN bbb.hour END),0) 'category_value1',
ifnull((CASE WHEN equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c' THEN bbb.hour END),0) 'category_value2',
ifnull((CASE WHEN equipment_level = 'a64bfc58110d2c105a6026e8bd02c232' THEN bbb.hour END),0) 'category_value3'
ifnull(sum(CASE WHEN equipment_level = '2421538a0286b491ffb863db92fe6cbf' THEN bbb.hour END),0) 'category_value1',
ifnull(sum(CASE WHEN equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c' THEN bbb.hour END),0) 'category_value2',
ifnull(sum(CASE WHEN equipment_level = 'a64bfc58110d2c105a6026e8bd02c232' THEN bbb.hour END),0) 'category_value3'
from (
select ei.depart_id , ei.equipment_level , ifnull(COUNT( ei.id ),0) AS'hour' from equipment_info ei
......
......@@ -239,11 +239,11 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
BigDecimal bigDecimal3 = new BigDecimal(repairCompleteRing).setScale(2, BigDecimal.ROUND_HALF_UP);
productionEquipmentVO.setRepairCompleteRingRate(bigDecimal3.toString() + "%");
//维护维修费用
productionEquipmentVO.setRepairMaintainCost(totalCost.toString());
productionEquipmentVO.setRepairMaintainCost(JSUtils.divide(totalCost,10000));
//维修费用
productionEquipmentVO.setRepairCost(repairCost.toString());
productionEquipmentVO.setRepairCost(JSUtils.divide(repairCost,10000));
//维护
productionEquipmentVO.setMaintainCost(maintainCost.toString());
productionEquipmentVO.setMaintainCost(JSUtils.divide(maintainCost,10000));
//环比
BigDecimal bigDecimal4 = new BigDecimal(costRing).setScale(2, BigDecimal.ROUND_HALF_UP);
productionEquipmentVO.setRepairMaintainCostRingRate(bigDecimal4.toString() + "%");
......@@ -254,14 +254,13 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
public FaultStatisticsVO getEquipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
FaultStatisticsVO faultStatisticsVO = new FaultStatisticsVO();
List<ProportionStatisticsVO> levelByTime = productionEquipmentMapper.getLevelByTime(reportStatisticsDTO);
/*if (levelByTime.size() > 0) {
if (levelByTime.size() > 0) {
levelByTime.forEach(l -> {
reportStatisticsDTO.setEquipmentLevel(l.getCategory());
List<ProportionStatisticsVO> typeByTime = productionEquipmentMapper.getTypeByTime(reportStatisticsDTO);
l.setProportionStatisticsVOList(typeByTime);
});
}*/
}
Double equipmentTotal = 0d;
//获取总记录数
if(levelByTime != null && !levelByTime.isEmpty()){
......@@ -933,6 +932,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
public List<ContrastVO> getContrastCost(ReportStatisticsDTO reportStatisticsDTO) {
List<ContrastVO> list = new ArrayList<>();
List<Map> contrastCost = new ArrayList<>();
if (reportStatisticsDTO.getTimeUnit() == 6) {//半年
contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(reportStatisticsDTO.getDepartIds());
} else {
......
......@@ -18,10 +18,10 @@ public class EquipmentStatisticsCountVO {
@ApiModelProperty(value = "厂站编号")
private String departId;
@ApiModelProperty(value = "分类1数量")
@ApiModelProperty(value = "主要设备(B类)")
private String categoryValue1;
@ApiModelProperty(value = "分类2数量")
@ApiModelProperty(value = "重要设备(A类)")
private String categoryValue2;
@ApiModelProperty(value = "分类3数量")
@ApiModelProperty(value = "一般设备(C类)")
private String categoryValue3;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!