Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asset-distribution
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
data-spider
asset-distribution
Commits
e5131dee
Commit
e5131dee
authored
Mar 23, 2020
by
zhengjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
你我贷
parent
40b95c9f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
224 additions
and
2 deletions
+224
-2
pom.xml
pom.xml
+11
-2
INiwodaiAssetService.java
...et/distribution/service/niwodai/INiwodaiAssetService.java
+6
-0
NiwodaiAssetServiceImpl.java
...ibution/service/niwodai/impl/NiwodaiAssetServiceImpl.java
+103
-0
IdCardA.java
...tgroup/asset/distribution/service/niwodai/vo/IdCardA.java
+41
-0
IdCardB.java
...tgroup/asset/distribution/service/niwodai/vo/IdCardB.java
+31
-0
AddressResolutionUtil.java
...tgroup/asset/distribution/util/AddressResolutionUtil.java
+32
-0
No files found.
pom.xml
View file @
e5131dee
...
@@ -319,7 +319,16 @@
...
@@ -319,7 +319,16 @@
<artifactId>
druid
</artifactId>
<artifactId>
druid
</artifactId>
<version>
1.1.10
</version>
<version>
1.1.10
</version>
</dependency>
</dependency>
<!-- ocr hbase -->
<dependency>
<groupId>
com.lkb.data
</groupId>
<artifactId>
lkb-data-service
</artifactId>
<version>
1.7.8.4-3c-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.lkb.data
</groupId>
<artifactId>
lkb-core
</artifactId>
<version>
1.0.21
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
src/main/java/com/quantgroup/asset/distribution/service/niwodai/INiwodaiAssetService.java
0 → 100644
View file @
e5131dee
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
niwodai
;
public
interface
INiwodaiAssetService
{
}
src/main/java/com/quantgroup/asset/distribution/service/niwodai/impl/NiwodaiAssetServiceImpl.java
0 → 100644
View file @
e5131dee
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
niwodai
.
impl
;
import
cn.quantgroup.motan.bean.UserInfo
;
import
cn.quantgroup.motan.vo.UserSysResult
;
import
cn.quantgroup.user.IUserSdkService
;
import
cn.quantgroup.user.UserSdkServiceFactory
;
import
com.alibaba.fastjson.JSON
;
import
com.lkb.data.hbase.dataservice.verify.OCRIdCardDataService
;
import
com.lkb.data.hbase.row.verify.OCRIdCardRow
;
import
com.quantgroup.asset.distribution.exception.QGException
;
import
com.quantgroup.asset.distribution.exception.QGExceptionType
;
import
com.quantgroup.asset.distribution.service.niwodai.INiwodaiAssetService
;
import
com.quantgroup.asset.distribution.service.niwodai.INiwodaiService
;
import
com.quantgroup.asset.distribution.service.niwodai.vo.*
;
import
com.quantgroup.asset.distribution.util.AddressResolutionUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
NiwodaiAssetServiceImpl
implements
INiwodaiAssetService
{
@Autowired
@Qualifier
(
"httpClient"
)
private
CloseableHttpClient
httpClient
;
@Autowired
private
INiwodaiService
niwodaiService
;
@Value
(
"${user.sdk.url}"
)
private
String
userSysUrl
;
private
IUserSdkService
userSdkService
;
private
static
String
[]
companyNames
=
new
String
[]{
"1"
,
"2"
};
@PostConstruct
private
void
init
()
{
userSdkService
=
UserSdkServiceFactory
.
generateSDKService
(
userSysUrl
,
httpClient
);
}
public
NiwodaiIncomingResponseVO
incoming
(
String
uuid
,
String
orderId
,
String
amount
,
Integer
term
,
NiwodaiCostant
.
MnoData
mnoData
,
NiwodaiCostant
.
Contacts
contacts
)
{
List
<
OCRIdCardRow
>
list
=
OCRIdCardDataService
.
get
(
uuid
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
throw
new
QGException
(
"没有相关用户信息"
,
QGExceptionType
.
COMMON_ILLEGAL_PARAM
);
}
OCRIdCardRow
ocrIdCardRow
=
list
.
get
(
0
);
UserSysResult
<
UserInfo
>
userInfoByUuid
=
userSdkService
.
findUserInfoByUuid
(
uuid
);
IdCardA
idCardA
=
JSON
.
parseObject
(
ocrIdCardRow
.
getIdCardContentA
(),
IdCardA
.
class
);
IdCardB
idCardB
=
JSON
.
parseObject
(
ocrIdCardRow
.
getIdCardContentB
(),
IdCardB
.
class
);
NiwodaiIncomingRequestVO
vo
=
new
NiwodaiIncomingRequestVO
();
vo
.
setOrderId
(
orderId
);
NiwodaiCostant
.
UserInfo
userInfo
=
new
NiwodaiCostant
.
UserInfo
();
userInfo
.
setRealName
(
idCardA
.
getName
());
userInfo
.
setIdcardNumber
(
idCardA
.
getCitizen_id
());
userInfo
.
setPhone
(
userInfoByUuid
.
getData
().
getPhoneNo
());
userInfo
.
setMaritalStatus
(
NiwodaiCostant
.
MaritalStatus
.
UNMARRIED
.
name
());
userInfo
.
setGender
(
"男"
.
equals
(
idCardA
.
getGender
())
?
NiwodaiCostant
.
Gender
.
MALE
.
name
()
:
NiwodaiCostant
.
Gender
.
FEMALE
.
name
());
userInfo
.
setEducation
(
NiwodaiCostant
.
EducationalBackground
.
JUNIOR_SCHOOL_AND_BELOW
.
name
());
userInfo
.
setOccupation
(
NiwodaiCostant
.
Occupation
.
WORKER
.
name
());
userInfo
.
setIdcardValidity
(
idCardB
.
getValid_date_end
());
userInfo
.
setIdcardFront
(
ocrIdCardRow
.
getIdCardBaseContentA
());
userInfo
.
setIdcardBack
(
ocrIdCardRow
.
getIdCardBaseContentB
());
userInfo
.
setBioPhoto
(
ocrIdCardRow
.
getLivePhotoContent
());
userInfo
.
setImageType
(
"BASE64"
);
Map
<
String
,
String
>
addressMap
=
AddressResolutionUtil
.
addressResolution
(
userInfo
.
getAddress
());
userInfo
.
setProvince
(
addressMap
.
get
(
"province"
));
userInfo
.
setCity
(
addressMap
.
get
(
"city"
));
userInfo
.
setAddress
(
idCardA
.
getAddress
());
userInfo
.
setIndustry
(
NiwodaiCostant
.
Industry
.
ENTERTAINMENT
.
name
());
userInfo
.
setIncome
(
NiwodaiCostant
.
Income
.
FOUR
.
name
());
userInfo
.
setIncomeType
(
NiwodaiCostant
.
IncomeType
.
SALARY
.
name
());
userInfo
.
setDebt
(
NiwodaiCostant
.
Debt
.
ZERO
.
name
());
vo
.
setUserInfo
(
userInfo
);
NiwodaiCostant
.
LoanInfo
loanInfo
=
new
NiwodaiCostant
.
LoanInfo
();
loanInfo
.
setAmount
(
new
BigDecimal
(
amount
));
loanInfo
.
setTerm
(
term
);
loanInfo
.
setPurpose
(
NiwodaiCostant
.
Purpose
.
CONSUMPTION
.
name
());
vo
.
setLoanInfo
(
loanInfo
);
vo
.
setContacts
(
contacts
);
NiwodaiCostant
.
CompnayInfo
compnayInfo
=
new
NiwodaiCostant
.
CompnayInfo
();
compnayInfo
.
setName
(
randomCompanyName
());
compnayInfo
.
setAddress
(
userInfo
.
getProvince
()+
userInfo
.
getCity
()+
compnayInfo
.
getName
());
compnayInfo
.
setCity
(
userInfo
.
getCity
());
compnayInfo
.
setProvince
(
userInfo
.
getProvince
());
vo
.
setCompanyInfo
(
compnayInfo
);
vo
.
setMnoData
(
mnoData
);
return
niwodaiService
.
incoming
(
vo
);
}
private
static
String
randomCompanyName
(){
int
index
=
(
int
)
(
Math
.
random
()
*
companyNames
.
length
);
return
companyNames
[
index
];
}
}
src/main/java/com/quantgroup/asset/distribution/service/niwodai/vo/IdCardA.java
0 → 100644
View file @
e5131dee
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
niwodai
.
vo
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@Builder
public
class
IdCardA
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
private
String
name
;
private
String
gender
;
//性别 男/女
private
String
nation
;
//民族
private
String
birthday
;
//出生日期 格式 :1990.02.14
private
String
citizen_id
;
//身份证号
private
String
address
;
public
IdCardA
(
String
name
,
String
gender
,
String
nation
,
String
birthday
,
String
citizen_id
,
String
address
)
{
super
();
this
.
name
=
name
;
this
.
gender
=
gender
;
this
.
nation
=
nation
;
this
.
birthday
=
birthday
;
this
.
citizen_id
=
citizen_id
;
this
.
address
=
address
;
}
public
IdCardA
()
{
}
}
src/main/java/com/quantgroup/asset/distribution/service/niwodai/vo/IdCardB.java
0 → 100644
View file @
e5131dee
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
niwodai
.
vo
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@Builder
public
class
IdCardB
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
private
String
agency
;
//签发机关
private
String
valid_date_begin
;
//有效日期之起始日期 格式:20131022
private
String
valid_date_end
;
//有效日期之结束日期 格式:20231022
public
IdCardB
(
String
agency
,
String
valid_date_begin
,
String
valid_date_end
)
{
super
();
this
.
agency
=
agency
;
this
.
valid_date_begin
=
valid_date_begin
;
this
.
valid_date_end
=
valid_date_end
;
}
public
IdCardB
(){
}
}
src/main/java/com/quantgroup/asset/distribution/util/AddressResolutionUtil.java
0 → 100644
View file @
e5131dee
package
com
.
quantgroup
.
asset
.
distribution
.
util
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
AddressResolutionUtil
{
public
static
Map
<
String
,
String
>
addressResolution
(
String
address
)
{
String
regex
=
"(?<province>[^省]+自治区|.*?省|.*?行政区|.*?市)(?<city>[^市]+自治州|.*?地区|.*?行政单位|.+盟|市辖区|.*?市|.*?县)(?<county>[^县]+县|.+区|.+市|.+旗|.+海域|.+岛)?(?<town>[^区]+区|.+镇)?(?<village>.*)"
;
Matcher
m
=
Pattern
.
compile
(
regex
).
matcher
(
address
);
String
province
,
city
,
county
,
town
,
village
;
Map
<
String
,
String
>
row
=
null
;
while
(
m
.
find
())
{
row
=
new
LinkedHashMap
<
String
,
String
>();
province
=
m
.
group
(
"province"
);
row
.
put
(
"province"
,
province
==
null
?
""
:
province
.
trim
());
city
=
m
.
group
(
"city"
);
row
.
put
(
"city"
,
city
==
null
?
""
:
city
.
trim
());
county
=
m
.
group
(
"county"
);
row
.
put
(
"county"
,
county
==
null
?
""
:
county
.
trim
());
town
=
m
.
group
(
"town"
);
row
.
put
(
"town"
,
town
==
null
?
""
:
town
.
trim
());
village
=
m
.
group
(
"village"
);
row
.
put
(
"village"
,
village
==
null
?
""
:
village
.
trim
());
}
return
row
;
}
}
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