daf5388a 厉元元

自定义分析功能扩展

1 个父辈 07dd7323
......@@ -141,25 +141,42 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService {
//获取当天同比数据map
Map<String,Object> tb = tbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.YEAR,-1));
if(tb!=null&&tb.size()>0) {
double value = ConvertUtils.getDouble(map.get(index), 0);
double tb_value = 0;
if(index.contains("JSLL")||index.contains("CSLL")) {
tempMap.put(index+"_tb", DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(tb.get(realKey), 0.0), 2));
tb_value = DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(tb.get(realKey), 0.0), 2);
}else {
tempMap.put(index+"_tb", DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(tb.get(realKey), 0.0)/ConvertUtils.getDouble(tb.get(realKey+"_tag"), 1.0), 2));
tb_value = DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(tb.get(realKey), 0.0)/ConvertUtils.getDouble(tb.get(realKey+"_tag"), 1.0), 2);
}
tempMap.put(index+"_tb", tb_value);
//添加同比比例
if(tb_value==0) {
map.put(index+"_tb_rate", 0);
}else {
map.put(index+"_tb_rate", DoubleOperaUtils.bigDecimalRound((value - tb_value)/tb_value*100, 2));
}
}
}
if(!StringUtils.isEmpty(contrastType)&&contrastType.contains("hb")) {
//获取当天同比数据map
Map<String,Object> hb = hbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.MONTH,-1));
if("hour".equals(granularity)) {
hb = hbMap.get(DateUtils.formatAddTime(time,formatPattern,Calendar.DAY_OF_YEAR,-1));
}
if(hb!=null&&hb.size()>0) {
double value = ConvertUtils.getDouble(map.get(index), 0);
double hb_value = 0;
if(index.contains("JSLL")||index.contains("CSLL")) {
tempMap.put(index+"_hb", DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(hb.get(realKey), 0.0), 2));
hb_value = DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(hb.get(realKey), 0.0), 2);
}else {
hb_value = DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(hb.get(realKey), 0.0)/ConvertUtils.getDouble(hb.get(realKey+"_tag"), 1.0), 2);
}
tempMap.put(index+"_hb", hb_value);
//添加同比比例
if(hb_value==0) {
map.put(index+"_hb_rate", 0);
}else {
tempMap.put(index+"_hb", DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(hb.get(realKey), 0.0)/ConvertUtils.getDouble(hb.get(realKey+"_tag"), 1.0), 2));
map.put(index+"_hb_rate", DoubleOperaUtils.bigDecimalRound((value - hb_value)/hb_value*100, 2));
}
}
}
......@@ -385,7 +402,15 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService {
Map<String,Object> tb = tbMap.get(DateUtils.formatAddTime(time,pattern,Calendar.YEAR,-1)+""+map.get("departId"));
if(tb!=null&&tb.size()>0) {
for(String key : indexArray) {
map.put(key+"_tb", tb.get(key));
double value = ConvertUtils.getDouble(map.get(key), 0);
double tb_value = ConvertUtils.getDouble(tb.get(key), 0);
map.put(key+"_tb", String.valueOf(tb_value));
//添加同比比例
if(tb_value==0) {
map.put(key+"_tb_rate", 0);
}else {
map.put(key+"_tb_rate", DoubleOperaUtils.bigDecimalRound((value - tb_value)/tb_value*100, 2));
}
}
}
}
......@@ -393,7 +418,15 @@ public class CustomConsumeServiceImpl implements ICustomConsumeService {
Map<String,Object> hb = hbMap.get(DateUtils.formatAddTime(time,pattern,Calendar.MONTH,-1)+""+map.get("departId"));
if(hb!=null&&hb.size()>0) {
for(String key : indexArray) {
map.put(key+"_hb", hb.get(key));
double value = ConvertUtils.getDouble(map.get(key), 0);
double hb_value = ConvertUtils.getDouble(hb.get(key), 0);
map.put(key+"_hb", String.valueOf(hb_value));
//添加同比比例
if(hb_value==0) {
map.put(key+"_hb_rate", 0);
}else {
map.put(key+"_hb_rate", DoubleOperaUtils.bigDecimalRound((value - hb_value)/hb_value*100, 2));
}
}
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!