1c291b0e 康伟

kangwei:设备运行台时问题

1、日粒度报表数据单位换算成小时
2、月粒度查询不出数据
3、年粒度单位换算成天
1 个父辈 4246dd0d
...@@ -108,6 +108,10 @@ public class TestMetricInfoController { ...@@ -108,6 +108,10 @@ public class TestMetricInfoController {
108 }else{//获取日数据或月数据 108 }else{//获取日数据或月数据
109 dataList = getDaysAndMonthsData(metricInfoVOList ,pgDataList,startTime, endTime,timeType); 109 dataList = getDaysAndMonthsData(metricInfoVOList ,pgDataList,startTime, endTime,timeType);
110 } 110 }
111
112
113
114
111 realTimeHistoryDataVO.setHeadList( metricInfoVOList); 115 realTimeHistoryDataVO.setHeadList( metricInfoVOList);
112 realTimeHistoryDataVO.setDataList( dataList ); 116 realTimeHistoryDataVO.setDataList( dataList );
113 result.setResult( realTimeHistoryDataVO); 117 result.setResult( realTimeHistoryDataVO);
...@@ -116,6 +120,7 @@ public class TestMetricInfoController { ...@@ -116,6 +120,7 @@ public class TestMetricInfoController {
116 120
117 private List<Map<String, Object>> getHourData( List<MetricInfoVO> metricInfoVOList , List<Map<String, Object>> pgDataList){ 121 private List<Map<String, Object>> getHourData( List<MetricInfoVO> metricInfoVOList , List<Map<String, Object>> pgDataList){
118 List<Map<String, Object>> dataList = new ArrayList<>(); 122 List<Map<String, Object>> dataList = new ArrayList<>();
123 String expression = null;
119 if(pgDataList != null ) { 124 if(pgDataList != null ) {
120 dataList = new ArrayList<>(pgDataList.size()); 125 dataList = new ArrayList<>(pgDataList.size());
121 Map<String, Object> dataMap = null; 126 Map<String, Object> dataMap = null;
...@@ -124,10 +129,11 @@ public class TestMetricInfoController { ...@@ -124,10 +129,11 @@ public class TestMetricInfoController {
124 dataMap = new HashMap<>(); 129 dataMap = new HashMap<>();
125 dataMap.put("time",DateUtils.formatTime(Long.parseLong(paramMap.get("time") + "000")) ); 130 dataMap.put("time",DateUtils.formatTime(Long.parseLong(paramMap.get("time") + "000")) );
126 for(MetricInfoVO metricInfoVO : metricInfoVOList){ 131 for(MetricInfoVO metricInfoVO : metricInfoVOList){
127 dataMap.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.format(paramMap.get(metricInfoVO.getYxExpress()),"0.00"));//运行 132 dataMap.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.divide(paramMap.get(metricInfoVO.getYxExpress()),60));//运行
128 dataMap.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.format(paramMap.get(metricInfoVO.getGzExpress()),"0.00"));//故障 133 dataMap.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.divide(paramMap.get(metricInfoVO.getGzExpress()),60));//故障
129 //时数据 134 //时数据
130 dataMap.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停 135 expression = "(60 - "+paramMap.get(metricInfoVO.getYxExpress())+"- "+paramMap.get(metricInfoVO.getGzExpress()) +")/60";
136 dataMap.put( metricInfoVO.getEquipmentCode()+"_ZT" , JSUtils.executeExpression(expression) );//暂停
131 } 137 }
132 dataList.add( dataMap ); 138 dataList.add( dataMap );
133 } 139 }
...@@ -161,31 +167,43 @@ public class TestMetricInfoController { ...@@ -161,31 +167,43 @@ public class TestMetricInfoController {
161 } 167 }
162 Double doubleValue = 0.00d; 168 Double doubleValue = 0.00d;
163 int daysInMonth = 31; 169 int daysInMonth = 31;
170 String yxTime = "0";
171 String gzTime = "0";
172 String ztTime = "0";
173 String expression = null;
164 if(pgDataList != null ) { 174 if(pgDataList != null ) {
165 for(Map<String, Object> dataMapTemp : dataList){ 175 for(Map<String, Object> dataMapTemp : dataList){
176 if(StringUtils.isNotEmpty(format) ){
177 daysInMonth = DateUtil.getDaysInMonth(dataMapTemp.get("time")+"-01",format);
178 }
166 //select ts as time,nm as monitorId,v as monitorValue 179 //select ts as time,nm as monitorId,v as monitorValue
167 for (Map<String, Object> paramMap : pgDataList) { 180 for (Map<String, Object> paramMap : pgDataList) {
168 if( dataMapTemp.get("time").equals( paramMap.get("time") ) ){ 181 if( dataMapTemp.get("time").equals( paramMap.get("time") ) ){
169 if(format != null ){
170 daysInMonth = DateUtil.getDaysInMonth(dataMapTemp.get("time")+"-01",format);
171 }
172 for(MetricInfoVO metricInfoVO : metricInfoVOList){ 182 for(MetricInfoVO metricInfoVO : metricInfoVOList){
173 dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_YX" , JSUtils.format(paramMap.get(metricInfoVO.getYxExpress()),"0.00"));//运行 183 //时数据 (单位H)
174 dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_GZ" , JSUtils.format(paramMap.get(metricInfoVO.getGzExpress()),"0.00"));//故障 184 if (timeType.equals("1") || timeType.equals("2")) {
175 //时数据 185 yxTime = JSUtils.divide(paramMap.get(metricInfoVO.getYxExpress()),60);
176 if (timeType.equals("1")) dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停 186 gzTime = JSUtils.divide(paramMap.get(metricInfoVO.getGzExpress()),60);
177 //日数据 187 expression = "(60 - "+paramMap.get(metricInfoVO.getYxExpress())+" - "+paramMap.get(metricInfoVO.getGzExpress())+") /60";
188 ztTime = JSUtils.executeExpression(expression,"0.0");
189 }
190 //日数据 (单位H)
178 if (timeType.equals("2")) { 191 if (timeType.equals("2")) {
179 doubleValue = 24*60 - ConvertUtils.getDouble( paramMap.get(metricInfoVO.getYxExpress()), 0.00d) - ConvertUtils.getDouble(paramMap.get(metricInfoVO.getGzExpress()),0.00d ); 192 yxTime = JSUtils.divide(paramMap.get(metricInfoVO.getYxExpress()),60);
180 if(doubleValue.doubleValue() < 0) doubleValue = 0.00d; 193 gzTime = JSUtils.divide(paramMap.get(metricInfoVO.getGzExpress()),60);
181 dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.format(doubleValue) );//暂停 194 expression = "(60*24 - "+paramMap.get(metricInfoVO.getYxExpress())+" - "+paramMap.get(metricInfoVO.getGzExpress())+") /(60)";
195 ztTime = JSUtils.executeExpression(expression,"0.0");
182 } 196 }
183 //月数据 197 //月数据
184 if (timeType.equals("3")){ 198 if (timeType.equals("3")) {//单位是天
185 doubleValue = daysInMonth*24*60 - ConvertUtils.getDouble( paramMap.get(metricInfoVO.getYxExpress()), 0.00d) - ConvertUtils.getDouble(paramMap.get(metricInfoVO.getGzExpress()),0.00d ); 199 yxTime = JSUtils.divide(paramMap.get(metricInfoVO.getYxExpress()),60*24);
186 if(doubleValue.doubleValue() < 0) doubleValue = 0.00d; 200 gzTime = JSUtils.divide(paramMap.get(metricInfoVO.getGzExpress()),60*24);
187 dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.format(doubleValue) );//暂停 201 expression = "("+daysInMonth+"60*24 - "+paramMap.get(metricInfoVO.getYxExpress())+" - "+paramMap.get(metricInfoVO.getGzExpress())+") /(60*24)";
202 ztTime = JSUtils.executeExpression(expression,"0.0");
188 } 203 }
204 dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_YX" , yxTime);//运行
205 dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_GZ" , gzTime);//故障
206 dataMapTemp.put( metricInfoVO.getEquipmentCode()+"_ZT" ,ztTime );//暂停
189 } 207 }
190 break; 208 break;
191 } 209 }
......
...@@ -116,9 +116,9 @@ ...@@ -116,9 +116,9 @@
116 from sys_depart d 116 from sys_depart d
117 left join ( 117 left join (
118 select bbb.depart_id, 118 select bbb.depart_id,
119 ifnull((CASE WHEN equipment_level = '2421538a0286b491ffb863db92fe6cbf' THEN bbb.hour END),0) 'category_value1', 119 ifnull(sum(CASE WHEN equipment_level = '2421538a0286b491ffb863db92fe6cbf' THEN bbb.hour END),0) 'category_value1',
120 ifnull((CASE WHEN equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c' THEN bbb.hour END),0) 'category_value2', 120 ifnull(sum(CASE WHEN equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c' THEN bbb.hour END),0) 'category_value2',
121 ifnull((CASE WHEN equipment_level = 'a64bfc58110d2c105a6026e8bd02c232' THEN bbb.hour END),0) 'category_value3' 121 ifnull(sum(CASE WHEN equipment_level = 'a64bfc58110d2c105a6026e8bd02c232' THEN bbb.hour END),0) 'category_value3'
122 122
123 from ( 123 from (
124 select ei.depart_id , ei.equipment_level , ifnull(COUNT( ei.id ),0) AS'hour' from equipment_info ei 124 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 ...@@ -239,11 +239,11 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
239 BigDecimal bigDecimal3 = new BigDecimal(repairCompleteRing).setScale(2, BigDecimal.ROUND_HALF_UP); 239 BigDecimal bigDecimal3 = new BigDecimal(repairCompleteRing).setScale(2, BigDecimal.ROUND_HALF_UP);
240 productionEquipmentVO.setRepairCompleteRingRate(bigDecimal3.toString() + "%"); 240 productionEquipmentVO.setRepairCompleteRingRate(bigDecimal3.toString() + "%");
241 //维护维修费用 241 //维护维修费用
242 productionEquipmentVO.setRepairMaintainCost(totalCost.toString()); 242 productionEquipmentVO.setRepairMaintainCost(JSUtils.divide(totalCost,10000));
243 //维修费用 243 //维修费用
244 productionEquipmentVO.setRepairCost(repairCost.toString()); 244 productionEquipmentVO.setRepairCost(JSUtils.divide(repairCost,10000));
245 //维护 245 //维护
246 productionEquipmentVO.setMaintainCost(maintainCost.toString()); 246 productionEquipmentVO.setMaintainCost(JSUtils.divide(maintainCost,10000));
247 //环比 247 //环比
248 BigDecimal bigDecimal4 = new BigDecimal(costRing).setScale(2, BigDecimal.ROUND_HALF_UP); 248 BigDecimal bigDecimal4 = new BigDecimal(costRing).setScale(2, BigDecimal.ROUND_HALF_UP);
249 productionEquipmentVO.setRepairMaintainCostRingRate(bigDecimal4.toString() + "%"); 249 productionEquipmentVO.setRepairMaintainCostRingRate(bigDecimal4.toString() + "%");
...@@ -254,14 +254,13 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -254,14 +254,13 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
254 public FaultStatisticsVO getEquipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) { 254 public FaultStatisticsVO getEquipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
255 FaultStatisticsVO faultStatisticsVO = new FaultStatisticsVO(); 255 FaultStatisticsVO faultStatisticsVO = new FaultStatisticsVO();
256 List<ProportionStatisticsVO> levelByTime = productionEquipmentMapper.getLevelByTime(reportStatisticsDTO); 256 List<ProportionStatisticsVO> levelByTime = productionEquipmentMapper.getLevelByTime(reportStatisticsDTO);
257 257 if (levelByTime.size() > 0) {
258 /*if (levelByTime.size() > 0) {
259 levelByTime.forEach(l -> { 258 levelByTime.forEach(l -> {
260 reportStatisticsDTO.setEquipmentLevel(l.getCategory()); 259 reportStatisticsDTO.setEquipmentLevel(l.getCategory());
261 List<ProportionStatisticsVO> typeByTime = productionEquipmentMapper.getTypeByTime(reportStatisticsDTO); 260 List<ProportionStatisticsVO> typeByTime = productionEquipmentMapper.getTypeByTime(reportStatisticsDTO);
262 l.setProportionStatisticsVOList(typeByTime); 261 l.setProportionStatisticsVOList(typeByTime);
263 }); 262 });
264 }*/ 263 }
265 Double equipmentTotal = 0d; 264 Double equipmentTotal = 0d;
266 //获取总记录数 265 //获取总记录数
267 if(levelByTime != null && !levelByTime.isEmpty()){ 266 if(levelByTime != null && !levelByTime.isEmpty()){
...@@ -933,6 +932,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -933,6 +932,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
933 public List<ContrastVO> getContrastCost(ReportStatisticsDTO reportStatisticsDTO) { 932 public List<ContrastVO> getContrastCost(ReportStatisticsDTO reportStatisticsDTO) {
934 List<ContrastVO> list = new ArrayList<>(); 933 List<ContrastVO> list = new ArrayList<>();
935 List<Map> contrastCost = new ArrayList<>(); 934 List<Map> contrastCost = new ArrayList<>();
935
936 if (reportStatisticsDTO.getTimeUnit() == 6) {//半年 936 if (reportStatisticsDTO.getTimeUnit() == 6) {//半年
937 contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(reportStatisticsDTO.getDepartIds()); 937 contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(reportStatisticsDTO.getDepartIds());
938 } else { 938 } else {
......
...@@ -18,10 +18,10 @@ public class EquipmentStatisticsCountVO { ...@@ -18,10 +18,10 @@ public class EquipmentStatisticsCountVO {
18 @ApiModelProperty(value = "厂站编号") 18 @ApiModelProperty(value = "厂站编号")
19 private String departId; 19 private String departId;
20 20
21 @ApiModelProperty(value = "分类1数量") 21 @ApiModelProperty(value = "主要设备(B类)")
22 private String categoryValue1; 22 private String categoryValue1;
23 @ApiModelProperty(value = "分类2数量") 23 @ApiModelProperty(value = "重要设备(A类)")
24 private String categoryValue2; 24 private String categoryValue2;
25 @ApiModelProperty(value = "分类3数量") 25 @ApiModelProperty(value = "一般设备(C类)")
26 private String categoryValue3; 26 private String categoryValue3;
27 } 27 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!