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
201c4e3a
Commit
201c4e3a
authored
Apr 29, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
3d4f8891
8779ff55
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
111 additions
and
49 deletions
+111
-49
BillingPayInfoApiServiceImpl.java
...rise/service/outer/impl/BillingPayInfoApiServiceImpl.java
+1
-1
BillingRechargeApiServiceImpl.java
...ise/service/outer/impl/BillingRechargeApiServiceImpl.java
+8
-15
OfflineStrategy.java
...ic/enterprise/service/outer/impl/pay/OfflineStrategy.java
+57
-19
WxPayStrategy.java
.../gic/enterprise/service/outer/impl/pay/WxPayStrategy.java
+43
-13
dubbo-gic-platform-enterprise-service.xml
.../main/resources/dubbo-gic-platform-enterprise-service.xml
+1
-0
BillingRecordController.java
...ic/enterprise/web/controller/BillingRecordController.java
+1
-1
No files found.
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/BillingPayInfoApiServiceImpl.java
View file @
201c4e3a
...
...
@@ -126,8 +126,8 @@ public class BillingPayInfoApiServiceImpl implements BillingPayInfoApiService {
@Override
public
ServiceResponse
<
Void
>
offlineCallBack
(
String
resDataStr
)
{
logger
.
info
(
"财务审批回调"
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
resDataStr
);
logger
.
info
(
"财务审批回调:{}"
,
resDataStr
);
ApprovalCallBackDTO
approvalCallBackDTO
=
new
ApprovalCallBackDTO
();
approvalCallBackDTO
.
setOrderSerialNumber
(
jsonObject
.
getString
(
"orderNumber"
));
approvalCallBackDTO
.
setEnterpriseId
(
jsonObject
.
getInteger
(
"enterpriseId"
));
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/BillingRechargeApiServiceImpl.java
View file @
201c4e3a
package
com
.
gic
.
enterprise
.
service
.
outer
.
impl
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.constant.BuyTypeEnum
;
...
...
@@ -21,10 +12,16 @@ import com.gic.enterprise.error.ErrorCode;
import
com.gic.enterprise.service.BillingPayInfoApiService
;
import
com.gic.enterprise.service.BillingRechargeApiService
;
import
com.gic.enterprise.service.BillingRechargeRecordService
;
import
com.gic.enterprise.service.EnterpriseService
;
import
com.gic.enterprise.utils.CreateRandomUtils
;
import
com.gic.finance.service.TransferAccountsApprovalApiService
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Map
;
/**
*
...
...
@@ -40,10 +37,6 @@ public class BillingRechargeApiServiceImpl implements BillingRechargeApiService
private
BillingRechargeRecordService
billingRechargeRecordService
;
@Autowired
private
BillingPayInfoApiService
billingPayInfoApiService
;
@Autowired
private
TransferAccountsApprovalApiService
transferAccountsApprovalApiService
;
@Autowired
private
EnterpriseService
enterpriseService
;
@Override
@Transactional
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/pay/OfflineStrategy.java
View file @
201c4e3a
package
com
.
gic
.
enterprise
.
service
.
outer
.
impl
.
pay
;
import
java.util.Date
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.UserDTO
;
import
com.gic.auth.service.UserApiService
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.enterprise.constant.BillingPayResultEnum
;
import
com.gic.enterprise.constant.BuyTypeEnum
;
import
com.gic.enterprise.constant.PayTypeEnum
;
import
com.gic.enterprise.constant.*
;
import
com.gic.enterprise.dto.ApprovalCallBackDTO
;
import
com.gic.enterprise.dto.BillingPayInfoDTO
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.dto.OutPayDTO
;
import
com.gic.enterprise.entity.TabBillingPayInfo
;
import
com.gic.enterprise.entity.TabBillingRechargeRecord
;
import
com.gic.enterprise.entity.TabEnterprise
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.service.BillingOrderService
;
import
com.gic.enterprise.service.BillingPayInfoService
;
import
com.gic.enterprise.service.BillingRechargeRecordService
;
import
com.gic.enterprise.service.EnterpriseService
;
import
com.gic.enterprise.service.*
;
import
com.gic.enterprise.utils.CreateRandomUtils
;
import
com.gic.finance.constant.InitiatorTypeEnum
;
import
com.gic.finance.dto.TransferAccountsApprovalDTO
;
import
com.gic.finance.service.TransferAccountsApprovalApiService
;
import
com.gic.marketing.process.api.service.sms.SmsSendApiService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
java.util.Date
;
/**
*
...
...
@@ -52,6 +51,12 @@ public class OfflineStrategy implements PayStrategy {
private
EnterpriseService
enterpriseService
;
@Autowired
private
TransferAccountsApprovalApiService
transferAccountsApprovalApiService
;
@Autowired
private
SmsSendApiService
smsSendApiService
;
@Autowired
private
UserApiService
userApiService
;
@Autowired
private
EnterpriseApiService
enterpriseApiService
;
@Override
public
ServiceResponse
<
BillingPayInfoDTO
>
savePrePayInfo
(
OutPayDTO
outPayDTO
)
{
...
...
@@ -139,6 +144,8 @@ public class OfflineStrategy implements PayStrategy {
public
ServiceResponse
<
Void
>
callBack
(
ApprovalCallBackDTO
resData
)
{
logger
.
info
(
"银行线下支付回调结果:{}"
,
JSON
.
toJSONString
(
resData
));
sendApprovalSms
(
resData
);
String
orderSerialNumber
=
resData
.
getOrderSerialNumber
();
TabBillingPayInfo
billingPayInfo
=
billingPayInfoService
.
getByOrderSerialNumber
(
orderSerialNumber
,
PayTypeEnum
.
OFFLINE_PAY
.
getCode
());
resData
.
setPaySerialNumber
(
billingPayInfo
.
getSerialNumber
());
...
...
@@ -147,8 +154,10 @@ public class OfflineStrategy implements PayStrategy {
Integer
i
=
billingPayInfoService
.
updatePayInfoBySerialNumber
(
resData
);
switch
(
resData
.
getBuyType
())
{
case
1
:
billingRechargeRecordService
.
updateBySerialNumber
(
billingPayInfo
.
getEnterpriseId
(),
resData
.
getOrderSerialNumber
(),
resData
.
getTotalFee
(),
resData
.
getTotalFeePaid
(),
resData
.
getAuditStatus
(),
resData
.
getTimeEnd
());
// 商户余额充值
billingRechargeRecordService
.
updateBySerialNumber
(
billingPayInfo
.
getEnterpriseId
(),
resData
.
getOrderSerialNumber
(),
resData
.
getTotalFee
(),
resData
.
getTotalFeePaid
(),
resData
.
getAuditStatus
(),
resData
.
getTimeEnd
());
sendRechargeSuccessSms
(
resData
,
billingPayInfo
.
getEnterpriseId
());
break
;
case
2
:
// 短信套餐包购买
...
...
@@ -163,6 +172,35 @@ public class OfflineStrategy implements PayStrategy {
return
ServiceResponse
.
success
();
}
private
void
sendRechargeSuccessSms
(
ApprovalCallBackDTO
resData
,
Integer
enterpriseId
)
{
UserDTO
userDTO
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
).
getResult
();
sendSms
(
resData
,
userDTO
,
"GICJFZX005"
);
}
private
void
sendApprovalSms
(
ApprovalCallBackDTO
resData
)
{
TabBillingRechargeRecord
rechargeRecord
=
billingRechargeRecordService
.
getRechargeRecordBySerialNumber
(
resData
.
getOrderSerialNumber
());
Integer
initiator
=
rechargeRecord
.
getInitiator
();
UserDTO
userDTO
=
userApiService
.
getUserById
(
initiator
).
getResult
();
sendSms
(
resData
,
userDTO
,
"GICJFZX008"
);
}
private
void
sendSms
(
ApprovalCallBackDTO
resData
,
UserDTO
userDTO
,
String
code
)
{
try
{
if
(
StringUtils
.
isBlank
(
userDTO
.
getPhoneAreaCode
()))
{
userDTO
.
setPhoneAreaCode
(
"+86"
);
}
EnterpriseDTO
enterpriseDTO
=
enterpriseApiService
.
getEnterpriseById
(
userDTO
.
getEnterpriseId
()).
getResult
();
String
[]
smsArr
=
new
String
[]{
enterpriseDTO
.
getEnterpriseName
(),
resData
.
getOrderSerialNumber
(),
BillingAuditStatusEnum
.
PASS
.
getCode
().
equals
(
resData
.
getAuditStatus
())
?
"成功"
:
"失败"
};
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
code
,
userDTO
.
getEnterpriseId
(),
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
if
(!
smsSendResult
.
isSuccess
())
{
logger
.
warn
(
smsSendResult
.
getMessage
());
}
}
catch
(
Exception
e
)
{
logger
.
info
(
"发送短信失败"
,
e
);
}
}
private
void
initiateApproval
(
OutPayDTO
outPayDTO
)
{
TransferAccountsApprovalDTO
approvalDTO
=
new
TransferAccountsApprovalDTO
();
...
...
@@ -183,7 +221,7 @@ public class OfflineStrategy implements PayStrategy {
//com.gic.enterprise.service.BillingPayInfoApiService.offlineCallBack()
logger
.
info
(
"调用财务模块接口:{}"
,
JSON
.
toJSONString
(
approvalDTO
));
ServiceResponse
<
Void
>
serviceResponse
=
n
ull
;
ServiceResponse
<
Void
>
serviceResponse
=
n
ew
ServiceResponse
<>()
;
if
(
approvalDTO
.
getOrderType
()
==
BuyTypeEnum
.
BALANCE_RECHARGE
.
getCode
())
{
serviceResponse
=
transferAccountsApprovalApiService
.
rechargeInitiateApproval
(
approvalDTO
);
}
else
if
(
approvalDTO
.
getOrderType
()
==
BuyTypeEnum
.
BUY_SHORT_MESSAGE_PACKAGE
.
getCode
())
{
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/pay/WxPayStrategy.java
View file @
201c4e3a
package
com
.
gic
.
enterprise
.
service
.
outer
.
impl
.
pay
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.UserDTO
;
import
com.gic.auth.service.UserApiService
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GlobalInfo
;
...
...
@@ -18,16 +11,23 @@ import com.gic.enterprise.constant.BillingAuditStatusEnum;
import
com.gic.enterprise.constant.PayTypeEnum
;
import
com.gic.enterprise.dto.ApprovalCallBackDTO
;
import
com.gic.enterprise.dto.BillingPayInfoDTO
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.dto.OutPayDTO
;
import
com.gic.enterprise.entity.TabBillingPayInfo
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.service.BillingOrderService
;
import
com.gic.enterprise.service.BillingPayInfoService
;
import
com.gic.enterprise.service.BillingRechargeRecordService
;
import
com.gic.enterprise.service.PushMessageApiService
;
import
com.gic.enterprise.service.*
;
import
com.gic.enterprise.utils.CreateRandomUtils
;
import
com.gic.marketing.process.api.service.sms.SmsSendApiService
;
import
com.gic.thirdparty.api.dto.ScanPayReqDataDTO
;
import
com.gic.thirdparty.api.service.Pay4WXService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
*
...
...
@@ -49,6 +49,12 @@ public class WxPayStrategy implements PayStrategy {
private
BillingOrderService
billingOrderService
;
@Autowired
private
PushMessageApiService
pushMessageApiService
;
@Autowired
private
UserApiService
userApiService
;
@Autowired
private
EnterpriseApiService
enterpriseApiService
;
@Autowired
SmsSendApiService
smsSendApiService
;
@Override
public
ServiceResponse
<
BillingPayInfoDTO
>
savePrePayInfo
(
OutPayDTO
outPayDTO
)
{
...
...
@@ -114,6 +120,7 @@ public class WxPayStrategy implements PayStrategy {
// 商户余额充值
billingRechargeRecordService
.
updateBySerialNumber
(
resData
.
getEnterpriseId
(),
billingPayInfo
.
getOrderSerialNumber
(),
resData
.
getTotalFeePaid
(),
resData
.
getTotalFeePaid
(),
BillingAuditStatusEnum
.
PASS
.
getCode
(),
resData
.
getTimeEnd
());
this
.
pushMessageApiService
.
pushMessage
(
resData
.
getEnterpriseId
(),
"系统通知"
,
"余额充值"
,
"您的商户成功充值"
+
resData
.
getTotalFeePaid
()+
"元!感谢您的支持和使用!"
);
sendRechargeSuccessSms
(
resData
,
billingPayInfo
.
getEnterpriseId
());
break
;
case
2
:
// 短信套餐包购买
...
...
@@ -168,4 +175,27 @@ public class WxPayStrategy implements PayStrategy {
}
}
private
void
sendRechargeSuccessSms
(
ApprovalCallBackDTO
resData
,
Integer
enterpriseId
)
{
UserDTO
userDTO
=
userApiService
.
getUserByEnterpriseId
(
enterpriseId
).
getResult
();
sendSms
(
resData
,
userDTO
,
"GICJFZX005"
);
}
private
void
sendSms
(
ApprovalCallBackDTO
resData
,
UserDTO
userDTO
,
String
code
)
{
try
{
if
(
StringUtils
.
isBlank
(
userDTO
.
getPhoneAreaCode
()))
{
userDTO
.
setPhoneAreaCode
(
"+86"
);
}
EnterpriseDTO
enterpriseDTO
=
enterpriseApiService
.
getEnterpriseById
(
userDTO
.
getEnterpriseId
()).
getResult
();
String
[]
smsArr
=
new
String
[]{
enterpriseDTO
.
getEnterpriseName
(),
resData
.
getOrderSerialNumber
(),
BillingAuditStatusEnum
.
PASS
.
getCode
().
equals
(
resData
.
getAuditStatus
())
?
"成功"
:
"失败"
};
ServiceResponse
<
Void
>
smsSendResult
=
smsSendApiService
.
sendPlatformSms
(
code
,
userDTO
.
getEnterpriseId
(),
userDTO
.
getPhoneAreaCode
(),
userDTO
.
getPhoneNumber
(),
smsArr
);
if
(!
smsSendResult
.
isSuccess
())
{
logger
.
warn
(
smsSendResult
.
getMessage
());
}
}
catch
(
Exception
e
)
{
logger
.
info
(
"发送短信失败"
,
e
);
}
}
}
gic-platform-enterprise-service/src/main/resources/dubbo-gic-platform-enterprise-service.xml
View file @
201c4e3a
...
...
@@ -136,4 +136,5 @@
<dubbo:reference
interface=
"com.gic.member.api.service.MemberUserApiService"
id=
"memberUserApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.store.service.StoreApiService"
id=
"storeApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.member.api.service.UserOwnerApiService"
id=
"userOwnerApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.marketing.process.api.service.sms.SmsSendApiService"
id=
"smsSendApiService"
timeout=
"60000"
/>
</beans>
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/BillingRecordController.java
View file @
201c4e3a
...
...
@@ -62,7 +62,7 @@ public class BillingRecordController {
if
(
applicationDTO
!=
null
)
{
return
applicationDTO
.
getApplicationId
();
}
else
{
return
null
;
return
0L
;
}
}
});
...
...
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