Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
daf5388a
由
厉元元
编写于
2024-11-11 09:55:52 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
自定义分析功能扩展
1 个父辈
07dd7323
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
40 行增加
和
7 行删除
sk-module-biz/src/main/java/com/skua/modules/dataAnalysis/service/impl/CustomConsumeServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/dataAnalysis/service/impl/CustomConsumeServiceImpl.java
查看文件 @
daf5388
...
...
@@ -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"
))
{
t
empMap
.
put
(
index
+
"_tb"
,
DoubleOperaUtils
.
bigDecimalRound
(
ConvertUtils
.
getDouble
(
tb
.
get
(
realKey
),
0.0
),
2
)
);
t
b_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
{
tempMap
.
put
(
index
+
"_hb"
,
DoubleOperaUtils
.
bigDecimalRound
(
ConvertUtils
.
getDouble
(
hb
.
get
(
realKey
),
0.0
)/
ConvertUtils
.
getDouble
(
hb
.
get
(
realKey
+
"_tag"
),
1.0
),
2
));
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
{
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!
Cancel
请
注册
或
登录
后发表评论