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
79a0c623
Commit
79a0c623
authored
Oct 21, 2020
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
欠费提醒优化
parent
2df022b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
13 deletions
+53
-13
BillingAccountApiServiceImpl.java
...rise/service/outer/impl/BillingAccountApiServiceImpl.java
+53
-13
No files found.
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/BillingAccountApiServiceImpl.java
View file @
79a0c623
...
@@ -206,12 +206,12 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
...
@@ -206,12 +206,12 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
/**
/**
* 获取短信套餐包余额数量
* 获取短信套餐包余额数量
* @Title: getSmsBalanceNumber
* @Title: getSmsBalanceNumber
* @Description:
* @Description:
* @author guojuxing
* @author guojuxing
* @param enterpriseId
* @param enterpriseId
* @return java.lang.Integer
* @return java.lang.Integer
*/
*/
private
Integer
getSmsBalanceNumber
(
Integer
enterpriseId
)
{
private
Integer
getSmsBalanceNumber
(
Integer
enterpriseId
)
{
List
<
BillingEnterpriseSmsPackageDTO
>
list
=
billingEnterpriseSmsPackageService
.
listSmsPackage
(
enterpriseId
);
List
<
BillingEnterpriseSmsPackageDTO
>
list
=
billingEnterpriseSmsPackageService
.
listSmsPackage
(
enterpriseId
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
...
@@ -244,14 +244,25 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
...
@@ -244,14 +244,25 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
LOGGER
.
info
(
"扣费是否成功:{}"
,
i
>
0
);
LOGGER
.
info
(
"扣费是否成功:{}"
,
i
>
0
);
if
(
i
>
0
)
{
if
(
i
>
0
)
{
TabBillingAccount
account
=
this
.
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
TabBillingAccount
account
=
this
.
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
if
(
account
.
getAccountBalance
()
<
=
0
)
{
if
(
account
.
getAccountBalance
()
<
0
)
{
Object
cache
=
RedisUtil
.
getCache
(
"message:"
+
enterpriseId
);
Object
cache
=
RedisUtil
.
getCache
(
"message:"
+
enterpriseId
);
if
(
cache
==
null
)
{
if
(
cache
==
null
)
{
// String content = "您的GIC商户余额已欠费"+(-account.getAccountBalance())+"元,为了不影响业务的开展,请及时<a href='"+config.getHost()+"cost-center/billing-center/recharge'>充值</a>";
String
content
=
"您的达摩账户已欠费, 为避免您的业务受到影响,请及时<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
);
this
.
pushMessageApiService
.
pushMessage
(
enterpriseId
,
"系统消息"
,
"商户欠费"
,
content
);
sendArrearsSms
(
enterpriseId
);
// ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICJFZX001", enterpriseId, userDTO.getPhoneAreaCode(), userDTO.getPhoneNumber(), smsArr);
// 待办事项
// 待办事项
sendTotoItem
(
enterpriseId
);
sendTotoItem
(
enterpriseId
,
"您的达摩账户已欠费"
);
RedisUtil
.
setCache
(
"message:"
+
enterpriseId
,
1
,
1L
,
TimeUnit
.
DAYS
);
}
}
else
if
(
account
.
getAccountBalance
()
<
1000
)
{
Object
cache
=
RedisUtil
.
getCache
(
"message:"
+
enterpriseId
);
if
(
cache
==
null
)
{
String
content
=
"您的达摩账户余额已不足1000元,若账户欠费将中断部分正常业务,请及时<a href='"
+
config
.
getHost
()
+
"cost-center/billing-center/recharge'>充值</a>"
;
this
.
pushMessageApiService
.
pushMessage
(
enterpriseId
,
"系统消息"
,
"商户欠费"
,
content
);
sendAccountNotEnoughSms
(
enterpriseId
);
// 待办事项
sendTotoItem
(
enterpriseId
,
"您的达摩账户余额已不足1000元"
);
RedisUtil
.
setCache
(
"message:"
+
enterpriseId
,
1
,
1L
,
TimeUnit
.
DAYS
);
RedisUtil
.
setCache
(
"message:"
+
enterpriseId
,
1
,
1L
,
TimeUnit
.
DAYS
);
}
}
}
}
...
@@ -266,6 +277,35 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
...
@@ -266,6 +277,35 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
}
}
}
}
private
void
sendArrearsSms
(
Integer
enterpriseId
)
{
//查询所有的商户
TabEnterprise
enterprise
=
enterpriseService
.
getEnterpriseById
(
enterpriseId
);
if
(
isNotInWhiteList
(
enterpriseId
))
{
String
[]
smsArr
=
new
String
[]{
enterprise
.
getEnterpriseName
()};
ServiceResponse
<
UserDTO
>
userResult
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
);
UserDTO
userDTO
=
userResult
.
getResult
();
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
"GICJFZX012"
,
enterpriseId
,
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
if
(!
smsSendResult
.
isSuccess
())
{
LOGGER
.
warn
(
smsSendResult
.
getMessage
());
}
}
}
private
void
sendAccountNotEnoughSms
(
Integer
enterpriseId
)
{
TabEnterprise
enterprise
=
enterpriseService
.
getEnterpriseById
(
enterpriseId
);
if
(
isNotInWhiteList
(
enterpriseId
))
{
String
[]
smsArr
=
new
String
[]{
enterprise
.
getEnterpriseName
()};
ServiceResponse
<
UserDTO
>
userResult
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
);
UserDTO
userDTO
=
userResult
.
getResult
();
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
"GICJFZX001"
,
enterpriseId
,
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
if
(!
smsSendResult
.
isSuccess
())
{
LOGGER
.
warn
(
smsSendResult
.
getMessage
());
}
}
}
@Override
@Override
public
ServiceResponse
<
Void
>
balanceTask
(
String
param
)
{
public
ServiceResponse
<
Void
>
balanceTask
(
String
param
)
{
//查询所有的商户
//查询所有的商户
...
@@ -274,11 +314,11 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
...
@@ -274,11 +314,11 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
Integer
enterpriseId
=
enterpriseDTO
.
getEnterpriseId
();
Integer
enterpriseId
=
enterpriseDTO
.
getEnterpriseId
();
if
(
isNotInWhiteList
(
enterpriseId
))
{
if
(
isNotInWhiteList
(
enterpriseId
))
{
TabBillingAccount
account
=
this
.
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
TabBillingAccount
account
=
this
.
billingAccountService
.
getByEnterpriseId
(
enterpriseId
);
if
(
account
.
getAccountBalance
()
<
=
5
00
)
{
if
(
account
.
getAccountBalance
()
<
10
00
)
{
String
[]
smsArr
=
new
String
[]{
enterpriseDTO
.
getEnterpriseName
(),
String
.
valueOf
(-
account
.
getAccountBalance
())};
String
[]
smsArr
=
new
String
[]{
enterpriseDTO
.
getEnterpriseName
(),
String
.
valueOf
(-
account
.
getAccountBalance
())};
ServiceResponse
<
UserDTO
>
userResult
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
);
ServiceResponse
<
UserDTO
>
userResult
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
);
UserDTO
userDTO
=
userResult
.
getResult
();
UserDTO
userDTO
=
userResult
.
getResult
();
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
"GICJFZX001"
,
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
account
.
getAccountBalance
()
<
0
?
"GICJFZX012"
:
"GICJFZX001"
,
enterpriseId
,
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
enterpriseId
,
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
if
(!
smsSendResult
.
isSuccess
())
{
if
(!
smsSendResult
.
isSuccess
())
{
LOGGER
.
warn
(
smsSendResult
.
getMessage
());
LOGGER
.
warn
(
smsSendResult
.
getMessage
());
...
@@ -294,7 +334,7 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
...
@@ -294,7 +334,7 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
return
this
.
enterpriseWhiteListService
.
getEnterpriseWhiteList
(
enterpriseId
)
==
null
;
return
this
.
enterpriseWhiteListService
.
getEnterpriseWhiteList
(
enterpriseId
)
==
null
;
}
}
private
void
sendTotoItem
(
Integer
enterpriseId
)
{
private
void
sendTotoItem
(
Integer
enterpriseId
,
String
content
)
{
TodoItemDTO
todoItemDTO
=
new
TodoItemDTO
();
TodoItemDTO
todoItemDTO
=
new
TodoItemDTO
();
UserDTO
userDTO
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
).
getResult
();
UserDTO
userDTO
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
).
getResult
();
// 商户
// 商户
...
@@ -302,7 +342,7 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
...
@@ -302,7 +342,7 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
// 待办事项的userId
// 待办事项的userId
todoItemDTO
.
setUserId
(
userDTO
.
getUserId
());
todoItemDTO
.
setUserId
(
userDTO
.
getUserId
());
// 事项详情
// 事项详情
todoItemDTO
.
setItemContent
(
"您的GIC商户余额已欠费"
);
todoItemDTO
.
setItemContent
(
content
);
// 事项code 在运维后台字典配置 类目:待办事项类型
// 事项code 在运维后台字典配置 类目:待办事项类型
todoItemDTO
.
setItemType
(
Constants
.
PRODUCT
);
todoItemDTO
.
setItemType
(
Constants
.
PRODUCT
);
// 跳转地址 待办事项点击后要跳转的地址
// 跳转地址 待办事项点击后要跳转的地址
...
...
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