Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-platform-enterprise
Commits
b45d4b66
Commit
b45d4b66
authored
Nov 03, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
计费中心图标接口优化:服务配置化,如果扩展,减少工厂类的修改,符合开闭
parent
31253d4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
9 deletions
+67
-9
FeeChartUtils.java
...in/java/com/gic/enterprise/utils/chart/FeeChartUtils.java
+5
-9
ReadFeeChartConfig.java
...va/com/gic/enterprise/utils/chart/ReadFeeChartConfig.java
+56
-0
feechart.properties
...ise-service/src/main/resources/config/feechart.properties
+6
-0
No files found.
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/utils/chart/FeeChartUtils.java
View file @
b45d4b66
package
com
.
gic
.
enterprise
.
utils
.
chart
;
package
com
.
gic
.
enterprise
.
utils
.
chart
;
import
com.gic.enterprise.constant.billing.FeeTypeEnum
;
import
com.gic.enterprise.dto.HomeStatisticsDTO
;
import
com.gic.enterprise.qo.HomeStatisticsQO
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.gic.enterprise.dto.HomeStatisticsDTO
;
import
com.gic.enterprise.qo.HomeStatisticsQO
;
/**
/**
* 计费中心首页图表
* 计费中心首页图表
* @ClassName: FeeChartUtils
* @ClassName: FeeChartUtils
...
@@ -16,13 +15,10 @@ import java.util.Map;
...
@@ -16,13 +15,10 @@ import java.util.Map;
* @date 2019/8/23 2:18 PM
* @date 2019/8/23 2:18 PM
*/
*/
public
class
FeeChartUtils
{
public
class
FeeChartUtils
{
private
static
Map
getPageMap
=
new
HashMap
<>(
8
);
private
static
Map
<
Integer
,
IFeeChart
>
getPageMap
=
new
HashMap
<>(
8
);
static
{
static
{
getPageMap
.
put
(
FeeTypeEnum
.
ACCOUNT_BALANCE
.
getCode
(),
new
BillingAccountBalanceRecord
());
getPageMap
=
ReadFeeChartConfig
.
read
();
getPageMap
.
put
(
FeeTypeEnum
.
SMS
.
getCode
(),
new
BillingSmsRecord
());
getPageMap
.
put
(
FeeTypeEnum
.
SMS_PACKAGE
.
getCode
(),
new
BillingSmsPackageRecord
());
getPageMap
.
put
(
FeeTypeEnum
.
INTERNATIONAL_SMS
.
getCode
(),
new
BillingInternationSmsRecord
());
}
}
/**
/**
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/utils/chart/ReadFeeChartConfig.java
0 → 100644
View file @
b45d4b66
package
com
.
gic
.
enterprise
.
utils
.
chart
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Set
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.core.io.support.PropertiesLoaderUtils
;
/**
* 计费中心首页图表 服务配置解读
* @ClassName: ReadFeeChartConfig
* @Description:
* @author guojuxing
* @date 2020/11/3 2:01 PM
*/
public
class
ReadFeeChartConfig
{
private
static
Logger
LOGGER
=
LogManager
.
getLogger
(
ReadFeeChartConfig
.
class
);
/**
* 解读 计费中心首页图表 服务配置
* @return
*/
public
static
Map
<
Integer
,
IFeeChart
>
read
()
{
Map
<
Integer
,
IFeeChart
>
map
=
new
HashMap
<>(
16
);
Properties
properties
=
new
Properties
();
try
{
properties
=
PropertiesLoaderUtils
.
loadAllProperties
(
"config/feechart.properties"
);
Set
<
Map
.
Entry
<
Object
,
Object
>>
entrySet
=
properties
.
entrySet
();
for
(
Map
.
Entry
<
Object
,
Object
>
entry
:
entrySet
)
{
map
.
put
(
Integer
.
parseInt
((
String
)
entry
.
getKey
()),
createClass
((
String
)
entry
.
getValue
()));
}
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"解析config/feechart.properties文件失败:{}"
,
e
.
getMessage
(),
e
);
}
return
map
;
}
private
static
IFeeChart
createClass
(
String
url
)
throws
ClassNotFoundException
,
IllegalAccessException
,
InvocationTargetException
,
InstantiationException
,
NoSuchMethodException
{
Class
clazz
=
Class
.
forName
(
url
);
Constructor
constructor
=
clazz
.
getDeclaredConstructor
();
return
(
IFeeChart
)
constructor
.
newInstance
();
}
public
static
void
main
(
String
[]
args
)
{
}
}
gic-platform-enterprise-service/src/main/resources/config/feechart.properties
0 → 100644
View file @
b45d4b66
###计费中心首页图表 服务配置
7
:
com.gic.enterprise.utils.chart.BillingAccountBalanceRecord
3
:
com.gic.enterprise.utils.chart.BillingSmsRecord
4
:
com.gic.enterprise.utils.chart.BillingSmsPackageRecord
8
:
com.gic.enterprise.utils.chart.BillingInternationSmsRecord
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment