53f2e2fa 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 e9f290b5 daf5388a
...@@ -141,25 +141,42 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService { ...@@ -141,25 +141,42 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService {
141 //获取当天同比数据map 141 //获取当天同比数据map
142 Map<String,Object> tb = tbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.YEAR,-1)); 142 Map<String,Object> tb = tbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.YEAR,-1));
143 if(tb!=null&&tb.size()>0) { 143 if(tb!=null&&tb.size()>0) {
144 double value = ConvertUtils.getDouble(map.get(index), 0);
145 double tb_value = 0;
144 if(index.contains("JSLL")||index.contains("CSLL")) { 146 if(index.contains("JSLL")||index.contains("CSLL")) {
145 tempMap.put(index+"_tb", DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(tb.get(realKey), 0.0), 2)); 147 tb_value = DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(tb.get(realKey), 0.0), 2);
146 }else { 148 }else {
147 tempMap.put(index+"_tb", DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(tb.get(realKey), 0.0)/ConvertUtils.getDouble(tb.get(realKey+"_tag"), 1.0), 2)); 149 tb_value = DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(tb.get(realKey), 0.0)/ConvertUtils.getDouble(tb.get(realKey+"_tag"), 1.0), 2);
150 }
151 tempMap.put(index+"_tb", tb_value);
152 //添加同比比例
153 if(tb_value==0) {
154 map.put(index+"_tb_rate", 0);
155 }else {
156 map.put(index+"_tb_rate", DoubleOperaUtils.bigDecimalRound((value - tb_value)/tb_value*100, 2));
148 } 157 }
149 } 158 }
150 } 159 }
151 if(!StringUtils.isEmpty(contrastType)&&contrastType.contains("hb")) { 160 if(!StringUtils.isEmpty(contrastType)&&contrastType.contains("hb")) {
152 //获取当天同比数据map 161 //获取当天同比数据map
153
154 Map<String,Object> hb = hbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.MONTH,-1)); 162 Map<String,Object> hb = hbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.MONTH,-1));
155 if("hour".equals(granularity)) { 163 if("hour".equals(granularity)) {
156 hb = hbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.DAY_OF_YEAR,-1)); 164 hb = hbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.DAY_OF_YEAR,-1));
157 } 165 }
158 if(hb!=null&&hb.size()>0) { 166 if(hb!=null&&hb.size()>0) {
167 double value = ConvertUtils.getDouble(map.get(index), 0);
168 double hb_value = 0;
159 if(index.contains("JSLL")||index.contains("CSLL")) { 169 if(index.contains("JSLL")||index.contains("CSLL")) {
160 tempMap.put(index+"_hb", DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(hb.get(realKey), 0.0), 2)); 170 hb_value = DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(hb.get(realKey), 0.0), 2);
171 }else {
172 hb_value = DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(hb.get(realKey), 0.0)/ConvertUtils.getDouble(hb.get(realKey+"_tag"), 1.0), 2);
173 }
174 tempMap.put(index+"_hb", hb_value);
175 //添加同比比例
176 if(hb_value==0) {
177 map.put(index+"_hb_rate", 0);
161 }else { 178 }else {
162 tempMap.put(index+"_hb", DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(hb.get(realKey), 0.0)/ConvertUtils.getDouble(hb.get(realKey+"_tag"), 1.0), 2)); 179 map.put(index+"_hb_rate", DoubleOperaUtils.bigDecimalRound((value - hb_value)/hb_value*100, 2));
163 } 180 }
164 } 181 }
165 } 182 }
...@@ -385,7 +402,15 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService { ...@@ -385,7 +402,15 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService {
385 Map<String,Object> tb = tbMap.get(DateUtils.formatAddTime(time,pattern,Calendar.YEAR,-1)+""+map.get("departId")); 402 Map<String,Object> tb = tbMap.get(DateUtils.formatAddTime(time,pattern,Calendar.YEAR,-1)+""+map.get("departId"));
386 if(tb!=null&&tb.size()>0) { 403 if(tb!=null&&tb.size()>0) {
387 for(String key : indexArray) { 404 for(String key : indexArray) {
388 map.put(key+"_tb", tb.get(key)); 405 double value = ConvertUtils.getDouble(map.get(key), 0);
406 double tb_value = ConvertUtils.getDouble(tb.get(key), 0);
407 map.put(key+"_tb", String.valueOf(tb_value));
408 //添加同比比例
409 if(tb_value==0) {
410 map.put(key+"_tb_rate", 0);
411 }else {
412 map.put(key+"_tb_rate", DoubleOperaUtils.bigDecimalRound((value - tb_value)/tb_value*100, 2));
413 }
389 } 414 }
390 } 415 }
391 } 416 }
...@@ -393,7 +418,15 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService { ...@@ -393,7 +418,15 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService {
393 Map<String,Object> hb = hbMap.get(DateUtils.formatAddTime(time,pattern,Calendar.MONTH,-1)+""+map.get("departId")); 418 Map<String,Object> hb = hbMap.get(DateUtils.formatAddTime(time,pattern,Calendar.MONTH,-1)+""+map.get("departId"));
394 if(hb!=null&&hb.size()>0) { 419 if(hb!=null&&hb.size()>0) {
395 for(String key : indexArray) { 420 for(String key : indexArray) {
396 map.put(key+"_hb", hb.get(key)); 421 double value = ConvertUtils.getDouble(map.get(key), 0);
422 double hb_value = ConvertUtils.getDouble(hb.get(key), 0);
423 map.put(key+"_hb", String.valueOf(hb_value));
424 //添加同比比例
425 if(hb_value==0) {
426 map.put(key+"_hb_rate", 0);
427 }else {
428 map.put(key+"_hb_rate", DoubleOperaUtils.bigDecimalRound((value - hb_value)/hb_value*100, 2));
429 }
397 } 430 }
398 } 431 }
399 } 432 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!