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
b32f4d5a
Commit
b32f4d5a
authored
Aug 16, 2019
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调用微信接口
parent
1faac854
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
746 additions
and
11 deletions
+746
-11
BillingAuditStatusEnum.java
...a/com/gic/enterprise/constant/BillingAuditStatusEnum.java
+1
-1
BillingRechargeDTO.java
.../main/java/com/gic/enterprise/dto/BillingRechargeDTO.java
+140
-0
BillingRechargeRecordDTO.java
...java/com/gic/enterprise/dto/BillingRechargeRecordDTO.java
+14
-0
RechargeRecordQO.java
...src/main/java/com/gic/enterprise/qo/RechargeRecordQO.java
+55
-0
BillingPayInfoApiService.java
.../com/gic/enterprise/service/BillingPayInfoApiService.java
+28
-0
BillingRechargeApiService.java
...com/gic/enterprise/service/BillingRechargeApiService.java
+38
-0
BillingRechargeRecordApiService.java
...c/enterprise/service/BillingRechargeRecordApiService.java
+36
-0
pom.xml
gic-platform-enterprise-service/pom.xml
+5
-0
TabBillingPayInfoMapper.java
...om/gic/enterprise/dao/mapper/TabBillingPayInfoMapper.java
+3
-0
BillingPayInfoService.java
...ava/com/gic/enterprise/service/BillingPayInfoService.java
+6
-0
BillingRechargeRecordService.java
.../gic/enterprise/service/BillingRechargeRecordService.java
+18
-0
BillingPayInfoServiceImpl.java
...ic/enterprise/service/impl/BillingPayInfoServiceImpl.java
+24
-0
BillingRechargeRecordServiceImpl.java
...rprise/service/impl/BillingRechargeRecordServiceImpl.java
+68
-0
BillingPayInfoApiServiceImpl.java
...nterprise/service/outer/BillingPayInfoApiServiceImpl.java
+115
-8
BillingRechargeApiServiceImpl.java
...terprise/service/outer/BillingRechargeApiServiceImpl.java
+83
-0
BillingRechargeRecordApiServiceImpl.java
...se/service/outer/BillingRechargeRecordApiServiceImpl.java
+28
-0
dubbo-gic-platform-enterprise-service.xml
.../main/resources/dubbo-gic-platform-enterprise-service.xml
+7
-0
TabBillingPayInfoMapper.xml
...ice/src/main/resources/mapper/TabBillingPayInfoMapper.xml
+53
-0
TabBillingRechargeRecordMapper.xml
.../main/resources/mapper/TabBillingRechargeRecordMapper.xml
+3
-0
EnterpriseApiServiceImplTest.java
...nterprise/service/outer/EnterpriseApiServiceImplTest.java
+0
-2
BillingRechargeController.java
.../enterprise/web/controller/BillingRechargeController.java
+21
-0
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/constant/BillingAuditStatusEnum.java
View file @
b32f4d5a
...
...
@@ -8,7 +8,7 @@ package com.gic.enterprise.constant;
* @date 2019/8/15 9:19
*/
public
enum
BillingAuditStatusEnum
{
WAIT_PAY
(
0
,
"待支付"
),
AUDITING
(
1
,
"审核中"
),
PASS
(
2
,
"已完成"
),
FAIL
(
3
,
"审核失败"
),
...
...
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/dto/BillingRechargeDTO.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
dto
;
import
java.io.Serializable
;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/15 16:58
*/
public
class
BillingRechargeDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4945894281594015128L
;
private
Integer
payType
;
private
Integer
enterpriseId
;
private
String
serialNumber
;
private
Double
totalFee
;
private
Double
totalFeePaid
;
private
Integer
initiator
;
private
Integer
initiatorUser
;
private
Integer
operator
;
private
String
verificationCode
;
private
Integer
payInfoId
;
private
String
codeUrl
;
private
Integer
resultCode
;
private
String
errCode
;
private
String
errorCodeDes
;
public
Integer
getPayType
()
{
return
payType
;
}
public
void
setPayType
(
Integer
payType
)
{
this
.
payType
=
payType
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getSerialNumber
()
{
return
serialNumber
;
}
public
void
setSerialNumber
(
String
serialNumber
)
{
this
.
serialNumber
=
serialNumber
;
}
public
Double
getTotalFee
()
{
return
totalFee
;
}
public
void
setTotalFee
(
Double
totalFee
)
{
this
.
totalFee
=
totalFee
;
}
public
Integer
getInitiator
()
{
return
initiator
;
}
public
void
setInitiator
(
Integer
initiator
)
{
this
.
initiator
=
initiator
;
}
public
Integer
getInitiatorUser
()
{
return
initiatorUser
;
}
public
void
setInitiatorUser
(
Integer
initiatorUser
)
{
this
.
initiatorUser
=
initiatorUser
;
}
public
Integer
getOperator
()
{
return
operator
;
}
public
void
setOperator
(
Integer
operator
)
{
this
.
operator
=
operator
;
}
public
String
getVerificationCode
()
{
return
verificationCode
;
}
public
void
setVerificationCode
(
String
verificationCode
)
{
this
.
verificationCode
=
verificationCode
;
}
public
void
setPayInfoId
(
Integer
payInfoId
)
{
this
.
payInfoId
=
payInfoId
;
}
public
Integer
getPayInfoId
()
{
return
payInfoId
;
}
public
Double
getTotalFeePaid
()
{
return
totalFeePaid
;
}
public
void
setTotalFeePaid
(
Double
totalFeePaid
)
{
this
.
totalFeePaid
=
totalFeePaid
;
}
public
String
getCodeUrl
()
{
return
codeUrl
;
}
public
void
setCodeUrl
(
String
codeUrl
)
{
this
.
codeUrl
=
codeUrl
;
}
public
Integer
getResultCode
()
{
return
resultCode
;
}
public
void
setResultCode
(
Integer
resultCode
)
{
this
.
resultCode
=
resultCode
;
}
public
String
getErrCode
()
{
return
errCode
;
}
public
void
setErrCode
(
String
errCode
)
{
this
.
errCode
=
errCode
;
}
public
String
getErrorCodeDes
()
{
return
errorCodeDes
;
}
public
void
setErrorCodeDes
(
String
errorCodeDes
)
{
this
.
errorCodeDes
=
errorCodeDes
;
}
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/dto/BillingRechargeRecordDTO.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
dto
;
import
java.io.Serializable
;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/15 17:22
*/
public
class
BillingRechargeRecordDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
80974612400162958L
;
}
\ No newline at end of file
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/qo/RechargeRecordQO.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
qo
;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/15 17:34
*/
public
class
RechargeRecordQO
extends
PageQO
{
private
static
final
long
serialVersionUID
=
-
215907058195851650L
;
private
String
startTime
;
private
String
endTime
;
/**
* 支付方式
*/
private
Integer
payType
;
private
Integer
auditStatus
;
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Integer
getPayType
()
{
return
payType
;
}
public
void
setPayType
(
Integer
payType
)
{
this
.
payType
=
payType
;
}
public
Integer
getAuditStatus
()
{
return
auditStatus
;
}
public
void
setAuditStatus
(
Integer
auditStatus
)
{
this
.
auditStatus
=
auditStatus
;
}
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/BillingPayInfoApiService.java
View file @
b32f4d5a
...
...
@@ -33,4 +33,32 @@ public interface BillingPayInfoApiService {
* @return com.gic.api.base.commons.ServiceResponse<com.gic.enterprise.dto.InvoiceDTO>
*/
ServiceResponse
<
InvoiceDTO
>
getInvoiceInfoFromRedis
(
Integer
enterpriseId
);
/**
* 预支付,生成二维码, 保存支付信息
* @Title: savePrePayInfo
* @Description:
* @author zhiwj
* @param enterpriseId 企业id
* @param serialNumber 唯一流水号
* @param totalFee 充值金额
* @param payType 支付方式
* @param buyType 2:短信套餐包购买 1:商户余额充值
* @return com.gic.enterprise.dto.BillingPayInfoDTO codeUrl:二维码url
* @throws
*/
ServiceResponse
<
BillingPayInfoDTO
>
savePrePayInfo
(
Integer
enterpriseId
,
String
serialNumber
,
Double
totalFee
,
Integer
payType
,
Integer
buyType
);
/**
* 查询支付状态
* @Title: queryPayStatus
* @Description:
* @author zhiwj
* @param enterpriseId
* @param serialNumber
* @param payType
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse
<
Integer
>
queryPayStatus
(
Integer
enterpriseId
,
String
serialNumber
,
Integer
payType
);
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/BillingRechargeApiService.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.dto.BillingRechargeDTO
;
/**
* 充值
* @ClassName: BillingRechargeApiService
* @Description:
* @author zhiwj
* @date 2019/8/15 16:25
*/
public
interface
BillingRechargeApiService
{
/**
* 选择支付方式,生成一个订单,如果是线上支付,会返回待扫描的二维码
* @Title: genRechargeUrl
* @Description:
* @author zhiwj
* @param billingRechargeDTO
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse
<
JSONObject
>
selectPaymentMethod
(
BillingRechargeDTO
billingRechargeDTO
);
ServiceResponse
<
Integer
>
afterPay
(
BillingRechargeDTO
billingRechargeDTO
);
/**
* @Title: updateRecharge
* @Description:
* @author zhiwj
* @param billingRechargeDTO
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse
<
Integer
>
updateRecharge
(
BillingRechargeDTO
billingRechargeDTO
);
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/BillingRechargeRecordApiService.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.dto.BillingRechargeRecordDTO
;
import
com.gic.enterprise.qo.RechargeRecordQO
;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/15 17:11
*/
public
interface
BillingRechargeRecordApiService
{
/**
* @Title: listRechargeRecord
* @Description:
* @author zhiwj
* @param rechargeRecordQO
* @return com.gic.api.base.commons.ServiceResponse<com.gic.enterprise.dto.BillingRechargeRecordDTO>
* @throws
*/
ServiceResponse
<
Page
<
BillingRechargeRecordDTO
>>
listRechargeRecord
(
RechargeRecordQO
rechargeRecordQO
);
/**
* @Title: getRechargeRecord
* @Description:
* @author zhiwj
* @param rechargeRecordId
* @return com.gic.api.base.commons.ServiceResponse<com.gic.enterprise.dto.BillingRechargeRecordDTO>
* @throws
*/
ServiceResponse
<
BillingRechargeRecordDTO
>
getRechargeRecord
(
Integer
rechargeRecordId
);
}
gic-platform-enterprise-service/pom.xml
View file @
b32f4d5a
...
...
@@ -124,6 +124,11 @@
<artifactId>
gic-job-sdk
</artifactId>
<version>
${gic-job-sdk}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-thirdparty-api
</artifactId>
<version>
${gic-thirdparty-api}
</version>
</dependency>
</dependencies>
<build>
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/dao/mapper/TabBillingPayInfoMapper.java
View file @
b32f4d5a
...
...
@@ -63,4 +63,6 @@ public interface TabBillingPayInfoMapper {
* @return java.util.List<com.gic.enterprise.entity.TabBillingPayInfo>
*/
List
<
TabBillingPayInfo
>
listBill
(
BillListQueryQO
params
);
void
updateBySerialNumber
(
TabBillingPayInfo
tabBillingPayInfo
);
}
\ No newline at end of file
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/BillingPayInfoService.java
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
;
import
com.gic.enterprise.dto.BillingPayInfoDTO
;
import
com.gic.enterprise.entity.TabBillingPayInfo
;
import
com.gic.enterprise.qo.BillListQueryQO
;
import
com.github.pagehelper.Page
;
...
...
@@ -32,4 +33,9 @@ public interface BillingPayInfoService {
* @return com.github.pagehelper.Page<com.gic.enterprise.entity.TabBillingPayInfo>
*/
Page
<
TabBillingPayInfo
>
listBilling
(
BillListQueryQO
params
);
Integer
savePayInfo
(
BillingPayInfoDTO
billingPayInfoDTO
);
Integer
updatePayInfoBySerialNumber
(
Integer
enterpriseId
,
String
serialNumber
,
Integer
resultCode
,
String
errCode
,
String
errCodeDes
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/BillingRechargeRecordService.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
;
import
com.gic.enterprise.dto.BillingRechargeDTO
;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/15 17:05
*/
public
interface
BillingRechargeRecordService
{
Integer
saveOffLinePay
(
BillingRechargeDTO
billingRechargeDTO
);
Integer
saveWxPay
(
BillingRechargeDTO
billingRechargeDTO
);
void
updateRechargeRecordBySerialNumber
(
BillingRechargeDTO
billingRechargeDTO
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/BillingPayInfoServiceImpl.java
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
.
impl
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.dao.mapper.TabBillingPayInfoMapper
;
import
com.gic.enterprise.dto.BillingPayInfoDTO
;
import
com.gic.enterprise.entity.TabBillingPayInfo
;
import
com.gic.enterprise.qo.BillListQueryQO
;
import
com.gic.enterprise.service.BillingPayInfoService
;
...
...
@@ -9,6 +12,7 @@ import com.github.pagehelper.PageHelper;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
(
"billingPayInfoService"
)
...
...
@@ -26,4 +30,24 @@ public class BillingPayInfoServiceImpl implements BillingPayInfoService{
List
<
TabBillingPayInfo
>
list
=
tabBillingPayInfoMapper
.
listBill
(
params
);
return
(
Page
<
TabBillingPayInfo
>)
list
;
}
@Override
public
Integer
savePayInfo
(
BillingPayInfoDTO
billingPayInfoDTO
)
{
TabBillingPayInfo
tabBillingPayInfo
=
EntityUtil
.
changeEntityByOrika
(
TabBillingPayInfo
.
class
,
billingPayInfoDTO
);
return
tabBillingPayInfoMapper
.
insertSelective
(
tabBillingPayInfo
);
}
@Override
public
Integer
updatePayInfoBySerialNumber
(
Integer
enterpriseId
,
String
serialNumber
,
Integer
resultCode
,
String
errCode
,
String
errCodeDes
)
{
TabBillingPayInfo
tabBillingPayInfo
=
new
TabBillingPayInfo
();
tabBillingPayInfo
.
setEnterpriseId
(
enterpriseId
);
tabBillingPayInfo
.
setTimeEnd
(
DateUtil
.
formatString
(
new
Date
(),
DateUtil
.
FORMAT_DATETIME_14
));
tabBillingPayInfo
.
setSerialNumber
(
serialNumber
);
tabBillingPayInfo
.
setResultCode
(
resultCode
);
tabBillingPayInfo
.
setErrCode
(
errCode
);
tabBillingPayInfo
.
setErrCodeDes
(
errCodeDes
);
tabBillingPayInfoMapper
.
updateBySerialNumber
(
tabBillingPayInfo
);
return
tabBillingPayInfo
.
getPayInfoId
();
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/BillingRechargeRecordServiceImpl.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
.
impl
;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.enterprise.constant.BillingAuditStatusEnum
;
import
com.gic.enterprise.constant.PayTypeEnum
;
import
com.gic.enterprise.dao.mapper.TabBillingRechargeRecordMapper
;
import
com.gic.enterprise.dto.BillingRechargeDTO
;
import
com.gic.enterprise.entity.TabBillingRechargeRecord
;
import
com.gic.enterprise.service.BillingRechargeRecordService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/15 17:05
*/
@Service
public
class
BillingRechargeRecordServiceImpl
implements
BillingRechargeRecordService
{
@Autowired
private
TabBillingRechargeRecordMapper
tabBillingRechargeRecordMapper
;
@Override
public
Integer
saveOffLinePay
(
BillingRechargeDTO
billingRechargeDTO
)
{
TabBillingRechargeRecord
rechargeRecord
=
new
TabBillingRechargeRecord
();
rechargeRecord
.
setEnterpriseId
(
billingRechargeDTO
.
getEnterpriseId
());
rechargeRecord
.
setSerialNumber
(
billingRechargeDTO
.
getSerialNumber
());
rechargeRecord
.
setTotalFee
(
billingRechargeDTO
.
getTotalFee
());
rechargeRecord
.
setPayType
(
PayTypeEnum
.
OFFLINE_PAY
.
getCode
());
rechargeRecord
.
setStatus
(
GlobalInfo
.
DATA_STATUS_NORMAL
);
rechargeRecord
.
setInitiator
(
billingRechargeDTO
.
getInitiator
());
rechargeRecord
.
setInitiatorUser
(
billingRechargeDTO
.
getInitiatorUser
());
rechargeRecord
.
setAuditStatus
(
BillingAuditStatusEnum
.
AUDITING
.
getCode
());
rechargeRecord
.
setOperator
(
billingRechargeDTO
.
getOperator
());
rechargeRecord
.
setVerificationCode
(
billingRechargeDTO
.
getVerificationCode
());
rechargeRecord
.
setCreateTime
(
new
Date
());
tabBillingRechargeRecordMapper
.
insertSelective
(
rechargeRecord
);
return
rechargeRecord
.
getRechargeRecordId
();
}
@Override
public
Integer
saveWxPay
(
BillingRechargeDTO
billingRechargeDTO
)
{
TabBillingRechargeRecord
rechargeRecord
=
new
TabBillingRechargeRecord
();
rechargeRecord
.
setEnterpriseId
(
billingRechargeDTO
.
getEnterpriseId
());
rechargeRecord
.
setSerialNumber
(
billingRechargeDTO
.
getSerialNumber
());
rechargeRecord
.
setTotalFee
(
billingRechargeDTO
.
getTotalFee
());
rechargeRecord
.
setTotalFeePaid
(
billingRechargeDTO
.
getTotalFeePaid
());
rechargeRecord
.
setPayType
(
PayTypeEnum
.
WE_CHAT_PAY
.
getCode
());
rechargeRecord
.
setStatus
(
GlobalInfo
.
DATA_STATUS_NORMAL
);
rechargeRecord
.
setInitiator
(
billingRechargeDTO
.
getInitiator
());
rechargeRecord
.
setInitiatorUser
(
billingRechargeDTO
.
getInitiatorUser
());
rechargeRecord
.
setAuditStatus
(
BillingAuditStatusEnum
.
WAIT_PAY
.
getCode
());
rechargeRecord
.
setOperator
(
billingRechargeDTO
.
getOperator
());
rechargeRecord
.
setVerificationCode
(
billingRechargeDTO
.
getVerificationCode
());
rechargeRecord
.
setCreateTime
(
new
Date
());
tabBillingRechargeRecordMapper
.
insertSelective
(
rechargeRecord
);
return
rechargeRecord
.
getRechargeRecordId
();
}
@Override
public
void
updateRechargeRecordBySerialNumber
(
BillingRechargeDTO
billingRechargeDTO
)
{
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/BillingPayInfoApiServiceImpl.java
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
.
outer
;
import
com.gic.enterprise.entity.TabEnterprise
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.service.EnterpriseService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.constant.PayTypeEnum
;
import
com.gic.enterprise.dto.BillingPayInfoDTO
;
import
com.gic.enterprise.dto.InvoiceDTO
;
import
com.gic.enterprise.entity.TabEnterprise
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.qo.BillListQueryQO
;
import
com.gic.enterprise.service.BillingPayInfoApiService
;
import
com.gic.enterprise.service.BillingPayInfoService
;
import
com.gic.enterprise.service.EnterpriseService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.thirdparty.api.dto.ScanPayQueryResData
;
import
com.gic.thirdparty.api.dto.ScanPayReqDataDTO
;
import
com.gic.thirdparty.api.service.Pay4WXService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Service
(
"billingPayInfoApiService"
)
public
class
BillingPayInfoApiServiceImpl
implements
BillingPayInfoApiService
{
public
class
BillingPayInfoApiServiceImpl
implements
BillingPayInfoApiService
{
@Autowired
private
BillingPayInfoService
billingPayInfoService
;
@Autowired
private
EnterpriseService
enterpriseService
;
@Autowired
private
Pay4WXService
pay4WXService
;
@Override
public
ServiceResponse
<
Page
<
BillingPayInfoDTO
>>
listBill
(
BillListQueryQO
params
)
{
com
.
github
.
pagehelper
.
Page
page
=
billingPayInfoService
.
listBilling
(
params
);
...
...
@@ -36,9 +48,104 @@ public class BillingPayInfoApiServiceImpl implements BillingPayInfoApiService{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户ID有误"
);
}
InvoiceDTO
value
=
(
InvoiceDTO
)
RedisUtil
.
getCache
(
"enterprise:billing:invoice:"
+
enterpriseId
);
if
(
value
==
null
)
{
if
(
value
==
null
)
{
return
ServiceResponse
.
success
(
new
InvoiceDTO
());
}
return
ServiceResponse
.
success
(
value
);
}
@Override
public
ServiceResponse
<
BillingPayInfoDTO
>
savePrePayInfo
(
Integer
enterpriseId
,
String
serialNumber
,
Double
totalFee
,
Integer
payType
,
Integer
buyType
)
{
if
(
PayTypeEnum
.
WE_CHAT_PAY
.
getCode
()
==
payType
)
{
// 微信支付
BillingPayInfoDTO
billingPayInfoDTO
=
saveWxPrePay
(
enterpriseId
,
serialNumber
,
totalFee
,
buyType
);
if
(
billingPayInfoDTO
!=
null
)
{
return
ServiceResponse
.
success
(
billingPayInfoDTO
);
}
else
{
return
ServiceResponse
.
failure
(
ErrorCode
.
SYSTEM_ERROR
.
getCode
(),
"调用微信支付失败"
);
}
}
else
if
(
PayTypeEnum
.
ALI_PAY
.
getCode
()
==
payType
)
{
// 支付宝
}
else
if
(
PayTypeEnum
.
OFFLINE_PAY
.
getCode
()
==
payType
)
{
return
ServiceResponse
.
success
(
saveOfflinePay
(
enterpriseId
,
serialNumber
,
totalFee
,
buyType
));
}
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
ErrorCode
.
PARAMETER_ERROR
.
getMsg
());
}
@Override
public
ServiceResponse
<
Integer
>
queryPayStatus
(
Integer
enterpriseId
,
String
serialNumber
,
Integer
payType
)
{
if
(
PayTypeEnum
.
WE_CHAT_PAY
.
getCode
()
==
payType
)
{
// 微信支付
ServiceResponse
<
ScanPayQueryResData
>
serviceResponse
=
pay4WXService
.
scanPayOrderQuery
(
serialNumber
);
if
(
serviceResponse
.
isSuccess
())
{
ScanPayQueryResData
resData
=
serviceResponse
.
getResult
();
if
(
StringUtils
.
equalsIgnoreCase
(
resData
.
getReturn_code
(),
"SUCCESS"
))
{
Integer
i
=
billingPayInfoService
.
updatePayInfoBySerialNumber
(
enterpriseId
,
serialNumber
,
StringUtils
.
equalsIgnoreCase
(
resData
.
getResult_code
(),
"SUCCESS"
)
?
1
:
0
,
resData
.
getErr_code
(),
resData
.
getErr_code_des
());
}
return
ServiceResponse
.
success
();
}
else
{
return
ServiceResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
}
else
if
(
PayTypeEnum
.
ALI_PAY
.
getCode
()
==
payType
)
{
// 支付宝
}
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
ErrorCode
.
PARAMETER_ERROR
.
getMsg
());
}
private
BillingPayInfoDTO
saveWxPrePay
(
Integer
enterpriseId
,
String
serialNumber
,
Double
totalFee
,
Integer
buyType
)
{
Date
startDate
=
new
Date
();
String
startDateFormat
=
DateUtil
.
formatString
(
startDate
,
DateUtil
.
FORMAT_DATETIME_14
);
// 生成付款码
ScanPayReqDataDTO
scanPayReqDataDTO
=
new
ScanPayReqDataDTO
(
"充值"
,
enterpriseId
.
toString
(),
serialNumber
,
new
BigDecimal
(
totalFee
).
add
(
new
BigDecimal
(
100
)).
intValue
(),
startDateFormat
,
""
,
"NATIVE"
);
ServiceResponse
<
String
>
serviceResponse
=
pay4WXService
.
createPrePaymentOrderForWX
(
scanPayReqDataDTO
);
if
(
"SUCCESS"
.
equals
(
serviceResponse
.
getCode
()))
{
// 生成支付记录
BillingPayInfoDTO
billingPayInfoDTO
=
new
BillingPayInfoDTO
();
billingPayInfoDTO
.
setEnterpriseId
(
enterpriseId
);
billingPayInfoDTO
.
setSerialNumber
(
serialNumber
);
billingPayInfoDTO
.
setPayType
(
PayTypeEnum
.
WE_CHAT_PAY
.
getCode
());
billingPayInfoDTO
.
setTimeStart
(
startDateFormat
);
billingPayInfoDTO
.
setCodeUrl
(
serviceResponse
.
getResult
());
billingPayInfoDTO
.
setTotalFeePaid
(
totalFee
);
billingPayInfoDTO
.
setStatus
(
GlobalInfo
.
DATA_STATUS_NORMAL
);
billingPayInfoDTO
.
setCreateTime
(
new
Date
());
billingPayInfoDTO
.
setBuyType
(
buyType
);
Integer
payInfoId
=
billingPayInfoService
.
savePayInfo
(
billingPayInfoDTO
);
billingPayInfoDTO
.
setPayInfoId
(
payInfoId
);
return
billingPayInfoDTO
;
}
else
{
return
null
;
}
}
private
BillingPayInfoDTO
saveOfflinePay
(
Integer
enterpriseId
,
String
serialNumber
,
Double
totalFee
,
Integer
buyType
)
{
// 生成支付记录
BillingPayInfoDTO
billingPayInfoDTO
=
new
BillingPayInfoDTO
();
billingPayInfoDTO
.
setEnterpriseId
(
enterpriseId
);
billingPayInfoDTO
.
setSerialNumber
(
serialNumber
);
billingPayInfoDTO
.
setPayType
(
PayTypeEnum
.
WE_CHAT_PAY
.
getCode
());
billingPayInfoDTO
.
setTimeStart
(
DateUtil
.
formatString
(
new
Date
(),
DateUtil
.
FORMAT_DATETIME_14
));
billingPayInfoDTO
.
setStatus
(
GlobalInfo
.
DATA_STATUS_NORMAL
);
billingPayInfoDTO
.
setCreateTime
(
new
Date
());
billingPayInfoDTO
.
setBuyType
(
buyType
);
Integer
payInfoId
=
billingPayInfoService
.
savePayInfo
(
billingPayInfoDTO
);
billingPayInfoDTO
.
setPayInfoId
(
payInfoId
);
return
billingPayInfoDTO
;
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/BillingRechargeApiServiceImpl.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
.
outer
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.constant.PayTypeEnum
;
import
com.gic.enterprise.dto.BillingRechargeDTO
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.service.BillingPayInfoApiService
;
import
com.gic.enterprise.service.BillingPayInfoService
;
import
com.gic.enterprise.service.BillingRechargeApiService
;
import
com.gic.enterprise.service.BillingRechargeRecordService
;
import
com.gic.thirdparty.api.service.Pay4WXService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
*
* @ClassName: BillingRechargeApiServiceImpl
* @Description:
* @author zhiwj
* @date 2019/8/15 17:05
*/
@Service
(
"billingRechargeApiService"
)
public
class
BillingRechargeApiServiceImpl
implements
BillingRechargeApiService
{
@Autowired
private
BillingRechargeRecordService
billingRechargeRecordService
;
@Autowired
private
Pay4WXService
pay4WXService
;
@Autowired
private
BillingPayInfoApiService
billingPayInfoApiService
;
@Autowired
private
BillingPayInfoService
billingPayInfoService
;
@Override
public
ServiceResponse
<
JSONObject
>
selectPaymentMethod
(
BillingRechargeDTO
billingRechargeDTO
)
{
// String serialNumber = CreateSerialNumberUtils.createSerialNumber();
// BillingPayInfoDTO billingPayInfoDTO = billingPayInfoApiService.savePrePayInfo(billingRechargeDTO.getEnterpriseId(), serialNumber, billingRechargeDTO.getTotalFee(), PayTypeEnum.WE_CHAT_PAY.getCode(), BuyTypeEnum.BALANCE_RECHARGE.getCode());
// if (PayTypeEnum.ALI_PAY.getCode() == billingRechargeDTO.getPayType()) {
// // 支付宝
// return ServiceResponse.success();
// } else if (PayTypeEnum.WE_CHAT_PAY.getCode() == billingRechargeDTO.getPayType()) {
// // 微信支付
// // 生成唯一流水号
// // 生成充值记录
// billingRechargeDTO.setPayInfoId(billingPayInfoDTO.getPayInfoId());
// billingRechargeDTO.setSerialNumber(serialNumber);
// billingRechargeRecordService.saveWxPay(billingRechargeDTO);
// return ServiceResponse.success();
// } else {
// return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "不存在该支付类型");
// }
return
null
;
}
@Override
public
ServiceResponse
<
Integer
>
afterPay
(
BillingRechargeDTO
billingRechargeDTO
)
{
if
(
PayTypeEnum
.
OFFLINE_PAY
.
getCode
()
==
billingRechargeDTO
.
getPayType
())
{
// 银行对公转账
billingRechargeRecordService
.
saveOffLinePay
(
billingRechargeDTO
);
// todo 发起审批
return
ServiceResponse
.
success
();
}
else
if
(
PayTypeEnum
.
ALI_PAY
.
getCode
()
==
billingRechargeDTO
.
getPayType
())
{
// 支付宝
return
ServiceResponse
.
success
();
}
else
if
(
PayTypeEnum
.
WE_CHAT_PAY
.
getCode
()
==
billingRechargeDTO
.
getPayType
())
{
// 微信支付
// billingRechargeRecordService
// 更新支付信息
// billingPayInfoService.updatePayInfoBySerialNumber(billingRechargeDTO);
// 更新充值记录
billingRechargeRecordService
.
updateRechargeRecordBySerialNumber
(
billingRechargeDTO
);
return
ServiceResponse
.
success
();
}
else
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"不存在该支付类型"
);
}
}
@Override
public
ServiceResponse
<
Integer
>
updateRecharge
(
BillingRechargeDTO
billingRechargeDTO
)
{
return
null
;
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/BillingRechargeRecordApiServiceImpl.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
.
outer
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.dto.BillingRechargeRecordDTO
;
import
com.gic.enterprise.qo.RechargeRecordQO
;
import
com.gic.enterprise.service.BillingRechargeRecordApiService
;
import
org.springframework.stereotype.Service
;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/15 17:47
*/
@Service
(
"billingRechargeRecordApiService"
)
public
class
BillingRechargeRecordApiServiceImpl
implements
BillingRechargeRecordApiService
{
@Override
public
ServiceResponse
<
Page
<
BillingRechargeRecordDTO
>>
listRechargeRecord
(
RechargeRecordQO
rechargeRecordQO
)
{
return
null
;
}
@Override
public
ServiceResponse
<
BillingRechargeRecordDTO
>
getRechargeRecord
(
Integer
rechargeRecordId
)
{
return
null
;
}
}
gic-platform-enterprise-service/src/main/resources/dubbo-gic-platform-enterprise-service.xml
View file @
b32f4d5a
...
...
@@ -33,4 +33,11 @@
<!--计费中心余额账户-->
<dubbo:service
interface=
"com.gic.enterprise.service.BillingAccountApiService"
ref=
"billingAccountApiService"
timeout=
"6000"
/>
<dubbo:service
interface=
"com.gic.enterprise.service.PackageApiService"
ref=
"packageApiService"
timeout=
"6000"
/>
<!-- 充值 -->
<dubbo:service
interface=
"com.gic.enterprise.service.BillingRechargeApiService"
ref=
"billingRechargeApiService"
timeout=
"60000"
/>
<dubbo:service
interface=
"com.gic.enterprise.service.BillingRechargeRecordApiService"
ref=
"billingRechargeRecordApiService"
timeout=
"60000"
/>
<!--微信支付-->
<dubbo:reference
interface=
"com.gic.thirdparty.api.service.Pay4WXService"
id=
"pay4WXService"
timeout=
"60000"
/>
</beans>
gic-platform-enterprise-service/src/main/resources/mapper/TabBillingPayInfoMapper.xml
View file @
b32f4d5a
...
...
@@ -50,6 +50,9 @@
#{updateTime,jdbcType=TIMESTAMP}, #{buyType,jdbcType=INTEGER})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.enterprise.entity.TabBillingPayInfo"
>
<selectKey
keyProperty=
"payInfoId"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
SELECT LAST_INSERT_ID()
</selectKey>
insert into tab_billing_pay_info
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"payInfoId != null"
>
...
...
@@ -254,4 +257,53 @@
and DATE_FORMAT(time_end,'%Y-%m-%d')
<
= #{endTime}
</if>
</select>
<update
id=
"updateBySerialNumber"
parameterType=
"com.gic.enterprise.entity.TabBillingPayInfo"
>
update tab_billing_pay_info
<set>
<if
test=
"payType != null"
>
pay_type = #{payType,jdbcType=INTEGER},
</if>
<if
test=
"totalFeePaid != null"
>
total_fee_paid = #{totalFeePaid,jdbcType=DOUBLE},
</if>
<if
test=
"timeStart != null"
>
time_start = #{timeStart,jdbcType=VARCHAR},
</if>
<if
test=
"timeEnd != null"
>
time_end = #{timeEnd,jdbcType=VARCHAR},
</if>
<if
test=
"resultCode != null"
>
result_code = #{resultCode,jdbcType=INTEGER},
</if>
<if
test=
"errCode != null"
>
err_code = #{errCode,jdbcType=VARCHAR},
</if>
<if
test=
"errCodeDes != null"
>
err_code_des = #{errCodeDes,jdbcType=VARCHAR},
</if>
<if
test=
"codeUrl != null"
>
code_url = #{codeUrl,jdbcType=VARCHAR},
</if>
<if
test=
"prepayId != null"
>
prepay_id = #{prepayId,jdbcType=VARCHAR},
</if>
<if
test=
"invoiceStatus != null"
>
invoice_status = #{invoiceStatus,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
status = #{status,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"buyType != null"
>
buy_type = #{buyType,jdbcType=INTEGER},
</if>
</set>
where enterprise_id = #{enterpriseId,jdbcType=INTEGER}
and serial_number = #{serialNumber,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
gic-platform-enterprise-service/src/main/resources/mapper/TabBillingRechargeRecordMapper.xml
View file @
b32f4d5a
...
...
@@ -49,6 +49,9 @@
#{deductionTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.enterprise.entity.TabBillingRechargeRecord"
>
<selectKey
keyProperty=
"rechargeRecordId"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
SELECT LAST_INSERT_ID()
</selectKey>
insert into tab_billing_recharge_record
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"rechargeRecordId != null"
>
...
...
gic-platform-enterprise-service/src/test/com/gic/enterprise/service/outer/EnterpriseApiServiceImplTest.java
→
gic-platform-enterprise-service/src/test/
java/
com/gic/enterprise/service/outer/EnterpriseApiServiceImplTest.java
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
service
.
outer
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.enterprise.service.EnterpriseInitService
;
import
org.junit.Test
;
...
...
gic-platform-enterprise-web/src/main/java/com/gic/enterprise/web/controller/BillingRechargeController.java
0 → 100644
View file @
b32f4d5a
package
com
.
gic
.
enterprise
.
web
.
controller
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.web.bind.annotation.RestController
;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/16 10:52
*/
@RestController
public
class
BillingRechargeController
{
private
Logger
logger
=
LogManager
.
getLogger
(
BillingRechargeController
.
class
);
}
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