Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
financial-sdk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QG
financial-sdk
Commits
9afcab2a
Commit
9afcab2a
authored
Jul 26, 2016
by
Java-刘 彧阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资金方给财务同步消息的SDK
parent
5ce33830
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
391 additions
and
8 deletions
+391
-8
pom.xml
pom.xml
+1
-1
quantgroup-fs-sdk.iml
quantgroup-fs-sdk.iml
+17
-0
ChannelPoolFactory.java
src/main/java/cn/quantgroup/fs/ChannelPoolFactory.java
+0
-1
LoanInfo.java
src/main/java/cn/quantgroup/fs/LoanInfo.java
+173
-0
LoanInfoSender.java
src/main/java/cn/quantgroup/fs/LoanInfoSender.java
+88
-0
RepayPlan.java
src/main/java/cn/quantgroup/fs/RepayPlan.java
+89
-0
LoanStatus.java
src/main/java/cn/quantgroup/fs/enums/LoanStatus.java
+9
-0
MsgType.java
src/main/java/cn/quantgroup/fs/enums/MsgType.java
+8
-0
config.properties
src/main/resources/config/beta/config.properties
+2
-2
config.properties
src/main/resources/config/product/config.properties
+4
-4
No files found.
pom.xml
View file @
9afcab2a
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
sdk:fs
</name>
<name>
sdk:fs
</name>
<description>
信用钱包短信
SDK
</description>
<description>
财务同步数据用
SDK
</description>
<properties>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
...
...
quantgroup-fs-sdk.iml
0 → 100644
View file @
9afcab2a
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_8"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/resources"
type=
"java-resource"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
name=
"Maven: com.rabbitmq:amqp-client:3.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"PROVIDED"
name=
"Maven: org.apache.commons:commons-pool2:2.4.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"PROVIDED"
name=
"Maven: com.google.code.gson:gson:2.3.1"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
src/main/java/cn/quantgroup/fs/ChannelPoolFactory.java
View file @
9afcab2a
...
@@ -3,7 +3,6 @@ package cn.quantgroup.fs;
...
@@ -3,7 +3,6 @@ package cn.quantgroup.fs;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.ConfirmListener
;
import
com.rabbitmq.client.ConfirmListener
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.ConnectionFactory
;
import
org.apache.commons.pool2.BasePooledObjectFactory
;
import
org.apache.commons.pool2.BasePooledObjectFactory
;
import
org.apache.commons.pool2.PooledObject
;
import
org.apache.commons.pool2.PooledObject
;
import
org.apache.commons.pool2.impl.DefaultPooledObject
;
import
org.apache.commons.pool2.impl.DefaultPooledObject
;
...
...
src/main/java/cn/quantgroup/fs/LoanInfo.java
0 → 100644
View file @
9afcab2a
package
cn
.
quantgroup
.
fs
;
import
cn.quantgroup.fs.enums.LoanStatus
;
import
cn.quantgroup.fs.enums.MsgType
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* Created by ocean on 2016/7/25.
*/
public
class
LoanInfo
{
private
Long
loanId
;
//loan_application_history.id
private
Long
loanManifestId
;
//loan_application_manifest_history.id
private
Long
fundingCorpId
;
//资金方id
private
String
fundingCorpName
;
// 资金方名称
private
Long
pushLoanTime
;
//量化派推送给资金方的时间
private
Long
userId
;
//放款的客户的id
private
String
userName
;
//客户姓名
private
String
userIdNo
;
//用户身份证
private
String
userPhone
;
//用户手机号
private
String
userBankCardNo
;
//用户银行卡号
private
BigDecimal
loanAmount
;
//放款金额
private
LoanStatus
loanStatus
;
//放款状态
private
Integer
contractTerm
;
//还款分期总数(共多少期还款)
private
List
<
RepayPlan
>
repayPlans
;
//对应的还款计划
private
MsgType
msgType
;
//消息类型
private
String
source
;
public
Long
getLoanId
()
{
return
loanId
;
}
public
void
setLoanId
(
Long
loanId
)
{
this
.
loanId
=
loanId
;
}
public
Long
getLoanManifestId
()
{
return
loanManifestId
;
}
public
void
setLoanManifestId
(
Long
loanManifestId
)
{
this
.
loanManifestId
=
loanManifestId
;
}
public
Long
getFundingCorpId
()
{
return
fundingCorpId
;
}
public
void
setFundingCorpId
(
Long
fundingCorpId
)
{
this
.
fundingCorpId
=
fundingCorpId
;
}
public
String
getFundingCorpName
()
{
return
fundingCorpName
;
}
public
void
setFundingCorpName
(
String
fundingCorpName
)
{
this
.
fundingCorpName
=
fundingCorpName
;
}
public
Long
getPushLoanTime
()
{
return
pushLoanTime
;
}
public
void
setPushLoanTime
(
Long
pushLoanTime
)
{
this
.
pushLoanTime
=
pushLoanTime
;
}
public
Long
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getUserIdNo
()
{
return
userIdNo
;
}
public
void
setUserIdNo
(
String
userIdNo
)
{
this
.
userIdNo
=
userIdNo
;
}
public
String
getUserPhone
()
{
return
userPhone
;
}
public
void
setUserPhone
(
String
userPhone
)
{
this
.
userPhone
=
userPhone
;
}
public
String
getUserBankCardNo
()
{
return
userBankCardNo
;
}
public
void
setUserBankCardNo
(
String
userBankCardNo
)
{
this
.
userBankCardNo
=
userBankCardNo
;
}
public
BigDecimal
getLoanAmount
()
{
return
loanAmount
;
}
public
void
setLoanAmount
(
BigDecimal
loanAmount
)
{
this
.
loanAmount
=
loanAmount
;
}
public
LoanStatus
getLoanStatus
()
{
return
loanStatus
;
}
public
void
setLoanStatus
(
LoanStatus
loanStatus
)
{
this
.
loanStatus
=
loanStatus
;
}
public
Integer
getContractTerm
()
{
return
contractTerm
;
}
public
void
setContractTerm
(
Integer
contractTerm
)
{
this
.
contractTerm
=
contractTerm
;
}
public
List
<
RepayPlan
>
getRepayPlans
()
{
return
repayPlans
;
}
public
void
setRepayPlans
(
List
<
RepayPlan
>
repayPlans
)
{
this
.
repayPlans
=
repayPlans
;
}
public
MsgType
getMsgType
()
{
return
msgType
;
}
public
void
setMsgType
(
MsgType
msgType
)
{
this
.
msgType
=
msgType
;
}
public
String
getSource
()
{
return
source
;
}
public
void
setSource
(
String
source
)
{
this
.
source
=
source
;
}
}
src/main/java/cn/quantgroup/fs/LoanInfoSender.java
0 → 100644
View file @
9afcab2a
package
cn
.
quantgroup
.
fs
;
import
com.google.gson.Gson
;
import
com.rabbitmq.client.AMQP
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.ConfirmListener
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
import
java.net.SocketException
;
import
java.util.Collections
;
import
java.util.Enumeration
;
/**
* Created by ocean on 2016/7/25.
*/
public
class
LoanInfoSender
{
private
ChannelPool
channelPool
;
private
String
exchangeName
;
private
static
final
Gson
GSON
=
new
Gson
();
private
String
source
;
private
static
final
AMQP
.
BasicProperties
PROPERTIES
=
new
AMQP
.
BasicProperties
.
Builder
().
contentType
(
"text/plain"
).
contentEncoding
(
"utf8"
).
deliveryMode
(
1
).
expiration
(
"240000"
).
build
();
public
LoanInfoSender
()
{
this
(
null
);
}
public
LoanInfoSender
(
ConfirmListener
confirmListener
)
{
PropertyHolder
propertyHolder
=
new
PropertyHolder
();
exchangeName
=
propertyHolder
.
getProperty
(
"fs.rabbitmq.exchange-name"
);
channelPool
=
new
ChannelPool
(
confirmListener
);
boolean
needBreak
=
false
;
try
{
Enumeration
<
NetworkInterface
>
enumeration
=
NetworkInterface
.
getNetworkInterfaces
();
while
(
enumeration
.
hasMoreElements
())
{
NetworkInterface
networkInterface
=
enumeration
.
nextElement
();
Enumeration
<
InetAddress
>
inetAddresses
=
networkInterface
.
getInetAddresses
();
for
(
InetAddress
inetAddress
:
Collections
.
list
(
inetAddresses
))
{
if
(
inetAddress
.
isSiteLocalAddress
()
&&
inetAddress
.
getHostAddress
()
!=
null
&&
!
inetAddress
.
getHostAddress
().
startsWith
(
"127"
))
{
this
.
source
=
inetAddress
.
getHostAddress
();
needBreak
=
true
;
break
;
}
}
if
(
needBreak
)
{
break
;
}
}
}
catch
(
SocketException
e
)
{
this
.
source
=
"unknown source"
;
}
if
(
null
==
source
)
{
source
=
"unknown source"
;
}
}
/**
* �����ʽſ���Ϣ
* @param message
* @throws Exception
*/
public
void
sendLoanInfo
(
LoanInfo
message
)
throws
Exception
{
if
(
message
==
null
)
{
return
;
}
message
.
setSource
(
source
);
String
messageStr
=
GSON
.
toJson
(
message
);
Channel
channel
=
null
;
try
{
channel
=
channelPool
.
borrowObject
();
channel
.
basicPublish
(
exchangeName
,
"loan_info"
,
false
,
false
,
PROPERTIES
,
messageStr
.
getBytes
(
"utf8"
));
}
finally
{
if
(
channel
!=
null
)
{
channelPool
.
returnObject
(
channel
);
}
}
}
}
src/main/java/cn/quantgroup/fs/RepayPlan.java
0 → 100644
View file @
9afcab2a
package
cn
.
quantgroup
.
fs
;
import
java.math.BigDecimal
;
/**
* Created by ocean on 2016/7/26.
*/
public
class
RepayPlan
{
private
Long
repayMentPlanId
;
//对应还款计划id
private
Integer
termNo
;
//当前第几期数
private
Long
deadLine
;
//本期还款期限
private
BigDecimal
principal
;
//本期应还本金
private
BigDecimal
interest
;
//本期应还利息
private
BigDecimal
serviceFeePerTerm
;
//(量化派)服务费
private
BigDecimal
fundingCorpServiceFee
;
//(资金方)服务费
private
BigDecimal
requiredRepayment
;
//应还合计
public
Long
getRepayMentPlanId
()
{
return
repayMentPlanId
;
}
public
void
setRepayMentPlanId
(
Long
repayMentPlanId
)
{
this
.
repayMentPlanId
=
repayMentPlanId
;
}
public
Integer
getTermNo
()
{
return
termNo
;
}
public
void
setTermNo
(
Integer
termNo
)
{
this
.
termNo
=
termNo
;
}
public
Long
getDeadLine
()
{
return
deadLine
;
}
public
void
setDeadLine
(
Long
deadLine
)
{
this
.
deadLine
=
deadLine
;
}
public
BigDecimal
getPrincipal
()
{
return
principal
;
}
public
void
setPrincipal
(
BigDecimal
principal
)
{
this
.
principal
=
principal
;
}
public
BigDecimal
getInterest
()
{
return
interest
;
}
public
void
setInterest
(
BigDecimal
interest
)
{
this
.
interest
=
interest
;
}
public
BigDecimal
getServiceFeePerTerm
()
{
return
serviceFeePerTerm
;
}
public
void
setServiceFeePerTerm
(
BigDecimal
serviceFeePerTerm
)
{
this
.
serviceFeePerTerm
=
serviceFeePerTerm
;
}
public
BigDecimal
getFundingCorpServiceFee
()
{
return
fundingCorpServiceFee
;
}
public
void
setFundingCorpServiceFee
(
BigDecimal
fundingCorpServiceFee
)
{
this
.
fundingCorpServiceFee
=
fundingCorpServiceFee
;
}
public
BigDecimal
getRequiredRepayment
()
{
return
requiredRepayment
;
}
public
void
setRequiredRepayment
(
BigDecimal
requiredRepayment
)
{
this
.
requiredRepayment
=
requiredRepayment
;
}
}
src/main/java/cn/quantgroup/fs/enums/LoanStatus.java
0 → 100644
View file @
9afcab2a
package
cn
.
quantgroup
.
fs
.
enums
;
/**
* Created by ocean on 2016/7/25.
*/
public
enum
LoanStatus
{
WAITING
,
SUCCESS
,
FAIL
;
}
src/main/java/cn/quantgroup/fs/enums/MsgType.java
0 → 100644
View file @
9afcab2a
package
cn
.
quantgroup
.
fs
.
enums
;
/**
* Created by ocean on 2016/7/25.
*/
public
enum
MsgType
{
REQUEST_NOTIFY
,
CALLBACK_NOTIFY
;
}
src/main/resources/config/beta/config.properties
View file @
9afcab2a
...
@@ -2,5 +2,5 @@ fs.rabbitmq.host=192.168.192.243
...
@@ -2,5 +2,5 @@ fs.rabbitmq.host=192.168.192.243
fs.rabbitmq.port
=
5672
fs.rabbitmq.port
=
5672
fs.rabbitmq.user
=
rabbit_admin
fs.rabbitmq.user
=
rabbit_admin
fs.rabbitmq.password
=
abc1234
fs.rabbitmq.password
=
abc1234
fs.rabbitmq.exchange-name
=
fs-control
fs.rabbitmq.exchange-name
=
fs
fs.rabbitmq.vhost
=
fs
fs.rabbitmq.vhost
=
financial_system
\ No newline at end of file
\ No newline at end of file
src/main/resources/config/product/config.properties
View file @
9afcab2a
fs.rabbitmq.host
=
1
92.168.192.243
fs.rabbitmq.host
=
1
72.168.20.144
fs.rabbitmq.port
=
5672
fs.rabbitmq.port
=
5672
0
fs.rabbitmq.user
=
rabbit_admin
fs.rabbitmq.user
=
rabbit_admin
fs.rabbitmq.password
=
abc1234
fs.rabbitmq.password
=
abc1234
fs.rabbitmq.exchange-name
=
fs-control
fs.rabbitmq.exchange-name
=
fs
fs.rabbitmq.vhost
=
fs
fs.rabbitmq.vhost
=
financial_system
\ No newline at end of file
\ 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