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
32de13c1
Commit
32de13c1
authored
Jun 12, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
ac55e52b
bef3afca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
25 deletions
+48
-25
BillingAccountServiceImpl.java
...ic/enterprise/service/impl/BillingAccountServiceImpl.java
+1
-1
BillingAccountApiServiceImpl.java
...rise/service/outer/impl/BillingAccountApiServiceImpl.java
+40
-23
SmsRecordApiServiceImpl.java
...nterprise/service/outer/impl/SmsRecordApiServiceImpl.java
+7
-1
No files found.
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/BillingAccountServiceImpl.java
View file @
32de13c1
...
@@ -95,7 +95,7 @@ public class BillingAccountServiceImpl implements BillingAccountService{
...
@@ -95,7 +95,7 @@ public class BillingAccountServiceImpl implements BillingAccountService{
record
.
setCreateTime
(
new
Date
());
record
.
setCreateTime
(
new
Date
());
record
.
setUpdateTime
(
new
Date
());
record
.
setUpdateTime
(
new
Date
());
record
.
setEnterpriseId
(
enterpriseId
);
record
.
setEnterpriseId
(
enterpriseId
);
record
.
setCreditLine
(
500
0
);
record
.
setCreditLine
(
0
);
record
.
setAutoRecharge
(
0
);
record
.
setAutoRecharge
(
0
);
record
.
setAccountBalance
(
0
D
);
record
.
setAccountBalance
(
0
D
);
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/BillingAccountApiServiceImpl.java
View file @
32de13c1
...
@@ -231,23 +231,33 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
...
@@ -231,23 +231,33 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
@Override
@Override
public
ServiceResponse
<
Integer
>
deductAccount
(
double
totalFee
,
Integer
enterpriseId
)
{
public
ServiceResponse
<
Integer
>
deductAccount
(
double
totalFee
,
Integer
enterpriseId
)
{
int
i
=
billingAccountService
.
deductAccount
(
totalFee
,
enterpriseId
);
if
(
isNotInWhiteList
(
enterpriseId
))
{
LOGGER
.
info
(
"扣费是否成功:{}"
,
i
>
0
);
TabBillingAccount
billingAccount
=
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
if
(
i
>
0
)
{
Double
accountBalance
=
billingAccount
.
getAccountBalance
();
TabBillingAccount
account
=
this
.
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
if
(
accountBalance
>=
0
)
{
if
(
account
.
getAccountBalance
()
<=
0
){
int
i
=
billingAccountService
.
deductAccount
(
totalFee
,
enterpriseId
);
Object
cache
=
RedisUtil
.
getCache
(
"message:"
+
enterpriseId
);
LOGGER
.
info
(
"扣费是否成功:{}"
,
i
>
0
);
if
(
cache
==
null
){
if
(
i
>
0
)
{
String
content
=
"您的GIC商户余额已欠费"
+(-
account
.
getAccountBalance
())+
"元,为了不影响业务的开展,请及时<a href='"
+
config
.
getHost
()+
"cost-center/billing-center/recharge'>充值</a>"
;
TabBillingAccount
account
=
this
.
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
this
.
pushMessageApiService
.
pushMessage
(
enterpriseId
,
"系统消息"
,
"商户欠费"
,
content
);
if
(
account
.
getAccountBalance
()
<=
0
)
{
// 待办事项
Object
cache
=
RedisUtil
.
getCache
(
"message:"
+
enterpriseId
);
sendTotoItem
(
enterpriseId
);
if
(
cache
==
null
)
{
RedisUtil
.
setCache
(
"message:"
+
enterpriseId
,
1
,
1
l
,
TimeUnit
.
DAYS
);
// String content = "您的GIC商户余额已欠费"+(-account.getAccountBalance())+"元,为了不影响业务的开展,请及时<a href='"+config.getHost()+"cost-center/billing-center/recharge'>充值</a>";
String
content
=
"您的GIC商户余额已不足500元,为了不影响业务的开展,请及时<a href='"
+
config
.
getHost
()
+
"cost-center/billing-center/recharge'>充值</a>"
;
this
.
pushMessageApiService
.
pushMessage
(
enterpriseId
,
"系统消息"
,
"商户欠费"
,
content
);
// 待办事项
sendTotoItem
(
enterpriseId
);
RedisUtil
.
setCache
(
"message:"
+
enterpriseId
,
1
,
1
l
,
TimeUnit
.
DAYS
);
}
}
}
}
return
ServiceResponse
.
success
(
i
);
}
else
{
return
ServiceResponse
.
failure
(
ErrorCode
.
OPERATION_FAILED
.
getCode
(),
"余额不足"
);
}
}
return
ServiceResponse
.
success
(
i
);
}
else
{
}
else
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
OPERATION_FAILED
);
int
i
=
billingAccountService
.
deductAccount
(
totalFee
,
enterpriseId
);
return
ServiceResponse
.
success
(
i
);
}
}
}
}
...
@@ -257,21 +267,28 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
...
@@ -257,21 +267,28 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
List
<
EnterpriseDTO
>
enterpriseDTOList
=
enterpriseService
.
listEnterprise
();
List
<
EnterpriseDTO
>
enterpriseDTOList
=
enterpriseService
.
listEnterprise
();
for
(
EnterpriseDTO
enterpriseDTO
:
enterpriseDTOList
)
{
for
(
EnterpriseDTO
enterpriseDTO
:
enterpriseDTOList
)
{
Integer
enterpriseId
=
enterpriseDTO
.
getEnterpriseId
();
Integer
enterpriseId
=
enterpriseDTO
.
getEnterpriseId
();
TabBillingAccount
account
=
this
.
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
if
(
isNotInWhiteList
(
enterpriseId
))
{
if
(
account
.
getAccountBalance
()
<=
0
)
{
TabBillingAccount
account
=
this
.
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
String
[]
smsArr
=
new
String
[]{
enterpriseDTO
.
getEnterpriseName
(),
String
.
valueOf
(-
account
.
getAccountBalance
())};
if
(
account
.
getAccountBalance
()
<=
500
)
{
ServiceResponse
<
UserDTO
>
userResult
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
);
String
[]
smsArr
=
new
String
[]{
enterpriseDTO
.
getEnterpriseName
(),
String
.
valueOf
(-
account
.
getAccountBalance
())};
UserDTO
userDTO
=
userResult
.
getResult
();
ServiceResponse
<
UserDTO
>
userResult
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
);
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
"GICJFZX001"
,
UserDTO
userDTO
=
userResult
.
getResult
();
enterpriseId
,
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
"GICJFZX001"
,
if
(!
smsSendResult
.
isSuccess
())
{
enterpriseId
,
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
LOGGER
.
warn
(
smsSendResult
.
getMessage
());
if
(!
smsSendResult
.
isSuccess
())
{
LOGGER
.
warn
(
smsSendResult
.
getMessage
());
}
}
}
}
}
}
}
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
();
}
}
private
boolean
isNotInWhiteList
(
Integer
enterpriseId
)
{
// todo 判断商户在不在白名单中
return
true
;
}
private
void
sendTotoItem
(
Integer
enterpriseId
)
{
private
void
sendTotoItem
(
Integer
enterpriseId
)
{
TodoItemDTO
todoItemDTO
=
new
TodoItemDTO
();
TodoItemDTO
todoItemDTO
=
new
TodoItemDTO
();
UserDTO
userDTO
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
).
getResult
();
UserDTO
userDTO
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
).
getResult
();
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/SmsRecordApiServiceImpl.java
View file @
32de13c1
...
@@ -90,7 +90,7 @@ public class SmsRecordApiServiceImpl implements SmsRecordApiService {
...
@@ -90,7 +90,7 @@ public class SmsRecordApiServiceImpl implements SmsRecordApiService {
Integer
unitFee
=
accountStandardService
.
queryUnitFee
(
enterpriseId
,
AccountStandardEnum
.
SMS
.
getCode
());
Integer
unitFee
=
accountStandardService
.
queryUnitFee
(
enterpriseId
,
AccountStandardEnum
.
SMS
.
getCode
());
double
needFee
=
(
double
)
(
missCount
*
unitFee
)
/
1000
;
double
needFee
=
(
double
)
(
missCount
*
unitFee
)
/
1000
;
if
(
needFee
-
accountBalance
>
billingAccount
.
getCreditLine
())
{
if
(
needFee
-
accountBalance
>
billingAccount
.
getCreditLine
()
&&
isNotInWhiteList
(
enterpriseId
)
)
{
logger
.
info
(
"enterpriseId:{}, 余额:{}, 发送条数:{}, 不能发送"
,
enterpriseId
,
accountBalance
,
sendCount
);
logger
.
info
(
"enterpriseId:{}, 余额:{}, 发送条数:{}, 不能发送"
,
enterpriseId
,
accountBalance
,
sendCount
);
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
OPERATION_FAILED
.
getCode
(),
"余额不足, 不能发送"
);
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
OPERATION_FAILED
.
getCode
(),
"余额不足, 不能发送"
);
}
else
{
}
else
{
...
@@ -273,4 +273,9 @@ public class SmsRecordApiServiceImpl implements SmsRecordApiService {
...
@@ -273,4 +273,9 @@ public class SmsRecordApiServiceImpl implements SmsRecordApiService {
}
}
}
}
}
}
private
boolean
isNotInWhiteList
(
Integer
enterpriseId
)
{
// todo 判断商户在不在白名单中
return
true
;
}
}
}
\ 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