Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cash-loan-flow-boss
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
cash-loan-flow-boss
Commits
2a775e59
Commit
2a775e59
authored
Aug 16, 2019
by
王俊权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
贷前关单、贷后关单、清除用户信息
parent
87693169
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
470 additions
and
19 deletions
+470
-19
OrderController.java
...ashloanflowboss/api/order/controller/OrderController.java
+18
-3
Order.java
...n/quantgroup/cashloanflowboss/api/order/entity/Order.java
+2
-2
OrderService.java
...roup/cashloanflowboss/api/order/service/OrderService.java
+63
-2
UserController.java
.../cashloanflowboss/api/user/controller/UserController.java
+11
-0
CashLoanFlowBossDataSourceConfiguration.java
...uration/data/CashLoanFlowBossDataSourceConfiguration.java
+1
-1
ClothoCenter.java
...roup/cashloanflowboss/spi/clotho/client/ClothoCenter.java
+25
-0
UserDetail.java
...antgroup/cashloanflowboss/spi/user/entity/UserDetail.java
+55
-0
UserExtInfo.java
...ntgroup/cashloanflowboss/spi/user/entity/UserExtInfo.java
+70
-0
UserDetailRepository.java
...oanflowboss/spi/user/repository/UserDetailRepository.java
+19
-0
UserExtInfoRepository.java
...anflowboss/spi/user/repository/UserExtInfoRepository.java
+19
-0
XyqbUserService.java
...up/cashloanflowboss/spi/user/service/XyqbUserService.java
+4
-1
XyqbUserServiceImpl.java
...ashloanflowboss/spi/user/service/XyqbUserServiceImpl.java
+40
-0
XyqbUserDataSource.java
.../cashloanflowboss/spi/user/source/XyqbUserDataSource.java
+11
-0
XyqbUserDataSourceConfiguration.java
...boss/spi/user/source/XyqbUserDataSourceConfiguration.java
+12
-10
AssignFundingRecord.java
...cashloanflowboss/spi/xyqb/entity/AssignFundingRecord.java
+87
-0
AssignStatusEnum.java
...oup/cashloanflowboss/spi/xyqb/model/AssignStatusEnum.java
+15
-0
CancelPreLoanRepository.java
...flowboss/spi/xyqb/repository/CancelPreLoanRepository.java
+16
-0
XYQBDataSourceConfiguration.java
...flowboss/spi/xyqb/source/XYQBDataSourceConfiguration.java
+2
-0
No files found.
src/main/java/cn/quantgroup/cashloanflowboss/api/order/controller/OrderController.java
View file @
2a775e59
...
@@ -66,8 +66,23 @@ public class OrderController {
...
@@ -66,8 +66,23 @@ public class OrderController {
return
Result
.
buildSuccess
(
this
.
orderService
.
lending
(
lendingFormModel
));
return
Result
.
buildSuccess
(
this
.
orderService
.
lending
(
lendingFormModel
));
}
}
@PostMapping
(
value
=
"/cancel/loan"
,
consumes
=
"application/json"
)
/**
public
Result
cancel
(
@RequestBody
@Valid
OrderVo
orderVo
)
{
* 贷前关单
return
Result
.
buildSuccess
(
orderService
.
cancel
(
orderVo
));
*
* @return
*/
@PostMapping
(
"/cancel/loan"
)
public
Result
<
Boolean
>
cancelPreLoan
(
@RequestBody
@Valid
String
channelOrderNumber
)
{
return
Result
.
buildSuccess
(
this
.
orderService
.
cancelPreLoan
(
channelOrderNumber
));
}
/**
* 贷后关单
*
* @return
*/
@PostMapping
(
"/cancel/after/loan"
)
public
Result
<
Boolean
>
cancelAfterLoan
(
@RequestParam
@Valid
String
channelOrderNumber
)
{
return
Result
.
buildSuccess
(
this
.
orderService
.
cancelAfterLoan
(
channelOrderNumber
));
}
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/api/order/entity/Order.java
View file @
2a775e59
...
@@ -27,9 +27,9 @@ public class Order extends Primary {
...
@@ -27,9 +27,9 @@ public class Order extends Primary {
@Column
(
name
=
"channel_id"
)
@Column
(
name
=
"channel_id"
)
private
Long
channelId
;
private
Long
channelId
;
@Column
(
name
=
"fund_id"
)
@Column
(
name
=
"fund_id"
)
private
Long
fundId
;
private
Integer
fundId
;
@Column
(
name
=
"fund_type"
)
@Column
(
name
=
"fund_type"
)
private
Long
fundType
;
private
Integer
fundType
;
@Column
(
name
=
"ext_data"
)
@Column
(
name
=
"ext_data"
)
private
String
extData
;
private
String
extData
;
}
}
src/main/java/cn/quantgroup/cashloanflowboss/api/order/service/OrderService.java
View file @
2a775e59
...
@@ -17,9 +17,11 @@ import cn.quantgroup.cashloanflowboss.spi.clotho.client.ClothoCenter;
...
@@ -17,9 +17,11 @@ import cn.quantgroup.cashloanflowboss.spi.clotho.client.ClothoCenter;
import
cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenterService
;
import
cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenterService
;
import
cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneCenter
;
import
cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneCenter
;
import
cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService
;
import
cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService
;
import
cn.quantgroup.cashloanflowboss.spi.xyqb.repository.CancelPreLoanRepository
;
import
cn.quantgroup.cashloanflowboss.spi.xyqb.service.XYQBCenterService
;
import
cn.quantgroup.cashloanflowboss.spi.xyqb.service.XYQBCenterService
;
import
cn.quantgroup.cashloanflowboss.utils.JSONTools
;
import
cn.quantgroup.cashloanflowboss.utils.JSONTools
;
import
cn.quantgroup.user.retbean.XUser
;
import
cn.quantgroup.user.retbean.XUser
;
import
com.google.common.collect.Maps
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
@@ -28,6 +30,8 @@ import java.util.HashMap;
...
@@ -28,6 +30,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.UUID
;
import
java.util.concurrent.ConcurrentMap
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Predicate
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -72,6 +76,9 @@ public class OrderService {
...
@@ -72,6 +76,9 @@ public class OrderService {
@Autowired
@Autowired
private
ClfOrderMappingRepository
clfOrderMappingRepository
;
private
ClfOrderMappingRepository
clfOrderMappingRepository
;
@Autowired
private
CancelPreLoanRepository
cancelPreLoanRepository
;
public
Page
<
OrderVo
>
getOrders
(
Long
channelId
,
String
channelOrderNo
,
Integer
pageNumber
,
Integer
pageSize
)
{
public
Page
<
OrderVo
>
getOrders
(
Long
channelId
,
String
channelOrderNo
,
Integer
pageNumber
,
Integer
pageSize
)
{
Page
<
ClfOrderMapping
>
page
=
this
.
clfOrderMappingRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
{
Page
<
ClfOrderMapping
>
page
=
this
.
clfOrderMappingRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
{
...
@@ -157,8 +164,8 @@ public class OrderService {
...
@@ -157,8 +164,8 @@ public class OrderService {
order
.
setChannelOrderNumber
(
approveVo
.
getChannelOrderNumber
());
order
.
setChannelOrderNumber
(
approveVo
.
getChannelOrderNumber
());
order
.
setCreditNumber
(
orderMapping
.
getApplyNo
());
order
.
setCreditNumber
(
orderMapping
.
getApplyNo
());
order
.
setChannelId
(
orderMapping
.
getRegisteredFrom
());
order
.
setChannelId
(
orderMapping
.
getRegisteredFrom
());
order
.
setFundId
(
fundId
.
longValue
()
);
order
.
setFundId
(
fundId
);
order
.
setFundType
(
approveVo
.
getFundType
()
.
longValue
()
);
order
.
setFundType
(
approveVo
.
getFundType
());
order
.
setCreateTime
(
new
Date
());
order
.
setCreateTime
(
new
Date
());
order
.
setUpdateTime
(
new
Date
());
order
.
setUpdateTime
(
new
Date
());
orderRepository
.
save
(
order
);
orderRepository
.
save
(
order
);
...
@@ -221,4 +228,58 @@ public class OrderService {
...
@@ -221,4 +228,58 @@ public class OrderService {
}
}
/**
* 贷前关单
*
* @param
* @return
*/
public
boolean
cancelPreLoan
(
String
channelOrderNumber
)
{
/*Order order = this.orderRepository.findOrderByChannelOrderNumber(channelOrderNumber);
ClfOrderMapping orderMapping = this.clfOrderMappingRepository.findByChannelOrderNoLastOne(channelOrderNumber);
if (orderMapping == null) {
log.info("cancelPreLoan,贷前关单失败,无订单 channelOrderNumber={}", channelOrderNumber);
return false;
}*/
Long
id
=
cancelPreLoanRepository
.
cancelPreLoan
(
"SP468047603002844481308092"
);
ConcurrentMap
<
Object
,
Object
>
data
=
Maps
.
newConcurrentMap
();
data
.
put
(
"data"
,
id
);
data
.
put
(
"remark"
,
"系统关单"
);
String
result
=
clothoCenter
.
cancelPreLoan
(
data
);
return
true
;
}
/**
* 贷后关单
*
* @param
* @return
*/
public
boolean
cancelAfterLoan
(
String
channelOrderNumber
)
{
ClfOrderMapping
orderMapping
=
this
.
clfOrderMappingRepository
.
findByChannelOrderNoLastOne
(
channelOrderNumber
);
if
(
orderMapping
==
null
)
{
log
.
info
(
"cancelAfterLoan,贷后关单失败,无订单 channelOrderNumber={}"
,
channelOrderNumber
);
return
false
;
}
if
(
orderMapping
.
getLoanId
()
==
null
)
{
log
.
info
(
"cancelAfterLoan,贷后关单失败,loanId为空,channelOrderNumber={}"
,
channelOrderNumber
);
return
false
;
}
ConcurrentMap
<
Object
,
Object
>
data
=
Maps
.
newConcurrentMap
();
data
.
put
(
"loanId"
,
orderMapping
.
getLoanId
());
data
.
put
(
"userId"
,
orderMapping
.
getQgUserId
());
data
.
put
(
"flowNo"
,
UUID
.
randomUUID
());
String
id
=
clothoCenter
.
cancelAfterLoan
(
data
);
return
true
;
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/api/user/controller/UserController.java
View file @
2a775e59
...
@@ -117,4 +117,15 @@ public class UserController {
...
@@ -117,4 +117,15 @@ public class UserController {
return
this
.
xyqbUserService
.
cleanUserOrder
(
phoneNo
);
return
this
.
xyqbUserService
.
cleanUserOrder
(
phoneNo
);
}
}
/**
* 删除订单
*
* @param phoneNo 用户ID
* @return
*/
@PutMapping
(
"/delete/userid"
)
public
Boolean
deleteByUserId
(
@RequestParam
@Valid
@NotEmpty
(
message
=
"无效的用户手机号"
)
String
phoneNo
)
{
return
this
.
xyqbUserService
.
deleteByUserId
(
phoneNo
);
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/core/configuration/data/CashLoanFlowBossDataSourceConfiguration.java
View file @
2a775e59
...
@@ -39,7 +39,7 @@ public class CashLoanFlowBossDataSourceConfiguration {
...
@@ -39,7 +39,7 @@ public class CashLoanFlowBossDataSourceConfiguration {
@Value
(
"${data.boss.pool-size}"
)
@Value
(
"${data.boss.pool-size}"
)
private
Integer
poolSize
;
private
Integer
poolSize
;
@Primary
//
@Primary
@Bean
(
name
=
"bossDataSource"
)
@Bean
(
name
=
"bossDataSource"
)
@ConfigurationProperties
(
prefix
=
"data.boss"
)
@ConfigurationProperties
(
prefix
=
"data.boss"
)
public
DataSource
createDataSource
()
{
public
DataSource
createDataSource
()
{
...
...
src/main/java/cn/quantgroup/cashloanflowboss/spi/clotho/client/ClothoCenter.java
View file @
2a775e59
...
@@ -40,6 +40,24 @@ public interface ClothoCenter {
...
@@ -40,6 +40,24 @@ public interface ClothoCenter {
@PostMapping
(
value
=
"clotho/funds/plan/loan/apply"
,
consumes
=
"application/x-www-form-urlencoded"
)
@PostMapping
(
value
=
"clotho/funds/plan/loan/apply"
,
consumes
=
"application/x-www-form-urlencoded"
)
String
lending
(
@RequestParam
Map
data
);
String
lending
(
@RequestParam
Map
data
);
/**
* 贷前关单
*
* @param data
* @return
*/
@PostMapping
(
value
=
"/loan/super/close/quota"
,
consumes
=
"application/x-www-form-urlencoded"
)
String
cancelPreLoan
(
@RequestParam
Map
data
);
/**
* 贷后关单
*
* @param data
* @return
*/
@PostMapping
(
value
=
"/external/huijinsuo/withdraw/test/72"
,
consumes
=
"application/x-www-form-urlencoded"
)
String
cancelAfterLoan
(
@RequestParam
Map
data
);
@Component
@Component
class
Fallback
implements
ClothoCenter
{
class
Fallback
implements
ClothoCenter
{
...
@@ -58,5 +76,12 @@ public interface ClothoCenter {
...
@@ -58,5 +76,12 @@ public interface ClothoCenter {
return
null
;
return
null
;
}
}
@Override
public
String
cancelPreLoan
(
Map
data
)
{
return
null
;
}
@Override
public
String
cancelAfterLoan
(
Map
data
)
{
return
null
;
}
}
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/entity/UserDetail.java
0 → 100644
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
user
.
entity
;
import
java.sql.Timestamp
;
import
java.util.Date
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.Data
;
@Data
@Entity
@Table
(
name
=
"user_detail"
)
public
class
UserDetail
{
@Id
@Column
(
name
=
"id"
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"user_id"
)
private
Long
userId
;
@Column
(
name
=
"phone_no"
)
private
String
phone_no
;
@Column
(
name
=
"name"
)
private
String
name
;
@Column
(
name
=
"id_no"
)
private
String
id_no
;
@Column
(
name
=
"id_type"
)
private
Integer
id_type
;
@Column
(
name
=
"is_authenticated"
)
private
Integer
is_authenticated
;
@Column
(
name
=
"gender"
)
private
Integer
gender
;
@Column
(
name
=
"email"
)
private
String
email
;
@Column
(
name
=
"qq"
)
private
String
qq
;
@Column
(
name
=
"created_at"
)
private
Timestamp
created_at
;
@Column
(
name
=
"updated_at"
)
private
Timestamp
updated_at
;
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/entity/UserExtInfo.java
0 → 100644
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
user
.
entity
;
import
cn.quantgroup.user.enums.EducationEnum
;
import
cn.quantgroup.user.enums.IncomeEnum
;
import
cn.quantgroup.user.enums.IncomeRangeEnum
;
import
cn.quantgroup.user.enums.MaritalStatus
;
import
cn.quantgroup.user.enums.OccupationEnum
;
import
cn.quantgroup.user.retbean.XUserExtInfo
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.Data
;
@Data
@Entity
@Table
(
name
=
"user_ext_info"
)
public
class
UserExtInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1L
;
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
private
Long
id
;
@Column
(
name
=
"user_id"
)
private
Long
userId
;
@Column
(
name
=
"means_of_income_payment"
)
private
IncomeEnum
incomeEnum
=
IncomeEnum
.
UNKNOWN
;
@Column
(
name
=
"monthly_income_range"
)
private
IncomeRangeEnum
incomeRangeEnum
=
IncomeRangeEnum
.
UNKNOWN
;
@Column
(
name
=
"occupation"
)
private
OccupationEnum
occupationEnum
=
OccupationEnum
.
UNKNOWN
;
@Column
(
name
=
"education"
)
private
EducationEnum
educationEnum
=
EducationEnum
.
UNKNOWN
;
@Column
(
name
=
"has_car"
)
private
Boolean
hasCar
=
false
;
@Column
(
name
=
"has_social_security"
)
private
Boolean
hasSocialSecurity
=
false
;
@Column
(
name
=
"has_house"
)
private
Boolean
hasHouse
=
false
;
@Column
(
name
=
"has_credit_card"
)
private
Boolean
hasCreditCard
=
false
;
@Column
(
name
=
"marry_status"
)
private
MaritalStatus
marryStatus
=
MaritalStatus
.
UNKNOWN
;
@Column
(
name
=
"created_at"
)
private
Timestamp
createdAt
;
@Column
(
name
=
"updated_at"
)
private
Timestamp
updateAt
;
/*public XUserExtInfo toXUserExtInfo() {
XUserExtInfo xUserExtInfo = new XUserExtInfo();
xUserExtInfo.setId(this.id);
xUserExtInfo.setUserId(this.userId);
xUserExtInfo.setEducationEnum(cn.quantgroup.motan.enums.EducationEnum.valueOf(this.educationEnum.name()));
xUserExtInfo.setIncomeEnum(cn.quantgroup.motan.enums.IncomeEnum.valueOf(this.incomeEnum.name()));
xUserExtInfo.setIncomeRangeEnum(cn.quantgroup.motan.enums.IncomeRangeEnum.valueOf(this.incomeRangeEnum.name()));
xUserExtInfo.setOccupationEnum(cn.quantgroup.motan.enums.OccupationEnum.valueOf(this.occupationEnum.name()));
xUserExtInfo.setHasCar(this.hasCar);
xUserExtInfo.setHasSocialSecurity(this.hasSocialSecurity);
xUserExtInfo.setHasCreditCard(this.hasCreditCard);
xUserExtInfo.setMarryStatus(cn.quantgroup.motan.enums.MaritalStatus.valueOf(this.marryStatus.name()));
xUserExtInfo.setCreatedAt(this.createdAt);
xUserExtInfo.setUpdateAt(this.updateAt);
return xUserExtInfo;
}*/
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/repository/UserDetailRepository.java
0 → 100644
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
user
.
repository
;
import
cn.quantgroup.cashloanflowboss.spi.user.entity.UserDetail
;
import
cn.quantgroup.cashloanflowboss.spi.user.source.XyqbUserDataSource
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
@XyqbUserDataSource
@Repository
public
interface
UserDetailRepository
extends
JpaRepository
<
UserDetail
,
Long
>{
@Transactional
@Modifying
@Query
(
value
=
"delete from user_detail where user_id = ?1"
,
nativeQuery
=
true
)
int
deleteByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/repository/UserExtInfoRepository.java
0 → 100644
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
user
.
repository
;
import
cn.quantgroup.cashloanflowboss.spi.user.entity.UserExtInfo
;
import
cn.quantgroup.cashloanflowboss.spi.user.source.XyqbUserDataSource
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
@XyqbUserDataSource
@Repository
public
interface
UserExtInfoRepository
extends
JpaRepository
<
UserExtInfo
,
Long
>{
@Transactional
@Modifying
@Query
(
value
=
"delete from user_ext_info where user_id = ?1"
,
nativeQuery
=
true
)
void
deleteByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/service/XyqbUserService.java
View file @
2a775e59
...
@@ -65,5 +65,8 @@ public interface XyqbUserService {
...
@@ -65,5 +65,8 @@ public interface XyqbUserService {
*/
*/
Boolean
cleanUserOrder
(
String
phoneNo
);
Boolean
cleanUserOrder
(
String
phoneNo
);
/**
* 删除记录
*/
Boolean
deleteByUserId
(
String
phoneNo
);
}
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/service/XyqbUserServiceImpl.java
View file @
2a775e59
...
@@ -3,6 +3,8 @@ package cn.quantgroup.cashloanflowboss.spi.user.service;
...
@@ -3,6 +3,8 @@ package cn.quantgroup.cashloanflowboss.spi.user.service;
import
cn.quantgroup.cashloanflowboss.api.order.model.OrderVo
;
import
cn.quantgroup.cashloanflowboss.api.order.model.OrderVo
;
import
cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping
;
import
cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping
;
import
cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneCenter
;
import
cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneCenter
;
import
cn.quantgroup.cashloanflowboss.spi.user.repository.UserDetailRepository
;
import
cn.quantgroup.cashloanflowboss.spi.user.repository.UserExtInfoRepository
;
import
cn.quantgroup.cashloanflowboss.spi.util.HttpService
;
import
cn.quantgroup.cashloanflowboss.spi.util.HttpService
;
import
cn.quantgroup.cashloanflowboss.utils.JSONTools
;
import
cn.quantgroup.cashloanflowboss.utils.JSONTools
;
import
cn.quantgroup.cashloanflowboss.utils.MD5Tools
;
import
cn.quantgroup.cashloanflowboss.utils.MD5Tools
;
...
@@ -22,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -22,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.*
;
...
@@ -40,6 +43,12 @@ public class XyqbUserServiceImpl implements XyqbUserService {
...
@@ -40,6 +43,12 @@ public class XyqbUserServiceImpl implements XyqbUserService {
private
HttpService
httpService
;
private
HttpService
httpService
;
@Autowired
@Autowired
private
JolyneCenter
jolyneCenter
;
private
JolyneCenter
jolyneCenter
;
@Autowired
private
UserDetailRepository
userDetailRepository
;
@Autowired
private
UserExtInfoRepository
userExtInfoRepository
;
@Autowired
private
StringRedisTemplate
redisTemplate
;
@Value
(
"${passportapi.http}"
)
@Value
(
"${passportapi.http}"
)
private
String
passportapiHttp
;
private
String
passportapiHttp
;
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
();
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
();
...
@@ -175,4 +184,35 @@ public class XyqbUserServiceImpl implements XyqbUserService {
...
@@ -175,4 +184,35 @@ public class XyqbUserServiceImpl implements XyqbUserService {
String
cancel_result
=
jolyneCenter
.
cancel
(
JSONTools
.
serialize
(
data
));
String
cancel_result
=
jolyneCenter
.
cancel
(
JSONTools
.
serialize
(
data
));
return
"success"
.
equals
(
cancel_result
);
return
"success"
.
equals
(
cancel_result
);
}
}
@Override
public
Boolean
deleteByUserId
(
String
phoneNo
)
{
try
{
UserSysResult
<
XUser
>
xUser
=
userSysService
.
getService
().
findUserByPhoneNo
(
phoneNo
);
if
(
xUser
==
null
||
xUser
.
getData
()
==
null
)
{
LOGGER
.
error
(
"cleanUserOrder,删除用户信息失败,未找到用户 phoneNo={}"
,
phoneNo
);
return
false
;
}
Long
userId
=
xUser
.
getData
().
getId
();
int
i
=
userDetailRepository
.
deleteByUserId
(
userId
);
userExtInfoRepository
.
deleteByUserId
(
userId
);
Set
<
String
>
phoneNoKeys
=
redisTemplate
.
keys
(
phoneNo
);
if
(
phoneNoKeys
!=
null
){
redisTemplate
.
delete
(
phoneNoKeys
);
}
Set
<
String
>
userKeys
=
redisTemplate
.
keys
(
String
.
valueOf
(
userId
));
if
(
userKeys
!=
null
){
redisTemplate
.
delete
(
userKeys
);
}
String
token_key
=
"userid-sessionvalue:cache::"
+
userId
+
":xyqb"
;
String
token
=
redisTemplate
.
opsForValue
().
get
(
token_key
);
if
(
token
!=
null
&&
redisTemplate
.
keys
(
token
)!=
null
){
Set
<
String
>
tokenKeys
=
redisTemplate
.
keys
(
token
);
redisTemplate
.
delete
(
tokenKeys
);
}
}
catch
(
Exception
e
){
LOGGER
.
error
(
"cleanUserOrder,删除用户信息失败,phoneNo={}"
,
phoneNo
);
return
false
;
}
return
true
;
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/source/XyqbUserDataSource.java
0 → 100644
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
user
.
source
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Target
({
ElementType
.
TYPE
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
XyqbUserDataSource
{
}
src/main/java/cn/quantgroup/cashloanflowboss/
core/configuration/data
/XyqbUserDataSourceConfiguration.java
→
src/main/java/cn/quantgroup/cashloanflowboss/
spi/user/source
/XyqbUserDataSourceConfiguration.java
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
core
.
configuration
.
data
;
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
user
.
source
;
import
cn.quantgroup.cashloanflowboss.core.persistence.CashLoanFlowDataSource
;
import
cn.quantgroup.cashloanflowboss.core.persistence.CashLoanFlowDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
...
@@ -12,6 +12,7 @@ import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
...
@@ -12,6 +12,7 @@ import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.orm.jpa.JpaTransactionManager
;
import
org.springframework.orm.jpa.JpaTransactionManager
;
import
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
;
import
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
;
...
@@ -20,25 +21,26 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
...
@@ -20,25 +21,26 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@Configuration
@EnableTransactionManagement
@EnableTransactionManagement
@EnableJpaRepositories
(
basePackages
=
{
"cn.quantgroup"
},
entityManagerFactoryRef
=
"xyqbUserEntityManager"
,
transactionManagerRef
=
"xyqbUserTransactionManager"
,
includeFilters
=
@ComponentScan
.
Filter
(
CashLoanFlow
DataSource
.
class
))
@EnableJpaRepositories
(
basePackages
=
{
"cn.quantgroup"
},
entityManagerFactoryRef
=
"xyqbUserEntityManager"
,
transactionManagerRef
=
"xyqbUserTransactionManager"
,
includeFilters
=
@ComponentScan
.
Filter
(
XyqbUser
DataSource
.
class
))
public
class
XyqbUserDataSourceConfiguration
{
public
class
XyqbUserDataSourceConfiguration
{
@Value
(
"${data.
xyqb.
user.url}"
)
@Value
(
"${data.user.url}"
)
private
String
jdbcUrl
;
private
String
jdbcUrl
;
@Value
(
"${data.
xyqb.
user.password}"
)
@Value
(
"${data.user.password}"
)
private
String
password
;
private
String
password
;
@Value
(
"${data.
xyqb.
user.username}"
)
@Value
(
"${data.user.username}"
)
private
String
user
;
private
String
user
;
private
String
uniquename
=
"
clf
DS"
;
private
String
uniquename
=
"
xyqbUser
DS"
;
@Value
(
"${data.
xyqb.
user.pool-size}"
)
@Value
(
"${data.user.pool-size}"
)
private
Integer
poolSize
;
private
Integer
poolSize
;
@Bean
(
name
=
"clfDataSource"
)
//@Primary
@ConfigurationProperties
(
prefix
=
"data.clf"
)
@Bean
(
name
=
"xyqbUserDataSource"
)
@ConfigurationProperties
(
prefix
=
"data.user"
)
public
DataSource
createDataSource
()
{
public
DataSource
createDataSource
()
{
DruidDataSource
source
=
DruidDataSourceBuilder
.
create
().
build
();
DruidDataSource
source
=
DruidDataSourceBuilder
.
create
().
build
();
source
.
setMaxActive
(
200
);
source
.
setMaxActive
(
200
);
...
@@ -59,7 +61,7 @@ public class XyqbUserDataSourceConfiguration {
...
@@ -59,7 +61,7 @@ public class XyqbUserDataSourceConfiguration {
public
LocalContainerEntityManagerFactoryBean
entityManager
(
EntityManagerFactoryBuilder
builder
)
{
public
LocalContainerEntityManagerFactoryBean
entityManager
(
EntityManagerFactoryBuilder
builder
)
{
return
builder
.
dataSource
(
createDataSource
())
return
builder
.
dataSource
(
createDataSource
())
.
packages
(
"cn.quantgroup.cashloanflowboss.spi.
clf
.entity"
)
.
packages
(
"cn.quantgroup.cashloanflowboss.spi.
user
.entity"
)
.
persistenceUnit
(
uniquename
)
.
persistenceUnit
(
uniquename
)
.
build
();
.
build
();
}
}
...
...
src/main/java/cn/quantgroup/cashloanflowboss/spi/xyqb/entity/AssignFundingRecord.java
0 → 100644
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
xyqb
.
entity
;
import
cn.quantgroup.cashloanflowboss.spi.xyqb.model.AssignStatusEnum
;
import
java.sql.Timestamp
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.Data
;
/**
* 资产分配记录表
*/
@Data
@Entity
@Table
(
name
=
"assign_funding_record"
)
public
class
AssignFundingRecord
{
@Id
@Column
(
name
=
"id"
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
/**
* 用户id
*/
@Column
(
name
=
"user_id"
)
private
Long
userId
;
/**
* 资产订单表ID
*/
@Column
(
name
=
"asset_order_id"
)
private
Long
assetOrderId
;
/**
* 分配状态
*/
@Column
(
name
=
"assign_status"
)
private
AssignStatusEnum
assignStatus
;
/**
* 业务类型
*/
@Column
(
name
=
"business_type"
)
private
Integer
businessType
;
/**
* 资金方id
*/
@Column
(
name
=
"funding_corp_id"
)
private
Long
fundingCorpId
;
/**
* 被拒绝的资金方列表,以","分隔
*/
@Column
(
name
=
"funding_block_list"
)
private
String
fundingBlockList
;
/**
* 备注
*/
@Column
(
name
=
"remark"
)
private
String
remark
;
/**
* 尝试分配的次数
*/
@Column
(
name
=
"try_assign_count"
)
private
Integer
tryAssignCount
;
/**
* 创建时间
*/
@Column
(
name
=
"created_at"
)
private
Timestamp
createdAt
;
/**
* 更新时间
*/
@Column
(
name
=
"updated_at"
)
private
Timestamp
updatedAt
;
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/xyqb/model/AssignStatusEnum.java
0 → 100644
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
xyqb
.
model
;
/**
* 预审选取资金方结果
* @author HAN CHENGLONG
* @create 2018-04-16 18:04
**/
public
enum
AssignStatusEnum
{
ASSIGN_INIT
(
"未分配"
),
ASSIGN_QUEUE
(
"分配队列中"
),
ON_ASSIGNING
(
"分配中"
),
ASSIGN_SUCC
(
"分配成功"
),
ASSIGN_FAIL
(
"分配失败"
),
USER_CANCEL
(
"取消借款"
),
ASSIGN_HANG
(
"分配挂起"
);
AssignStatusEnum
(
String
name
)
{
}
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/xyqb/repository/CancelPreLoanRepository.java
0 → 100644
View file @
2a775e59
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
xyqb
.
repository
;
import
cn.quantgroup.cashloanflowboss.spi.xyqb.entity.AssignFundingRecord
;
import
cn.quantgroup.cashloanflowboss.spi.xyqb.source.XYQBDataSource
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
@XYQBDataSource
@Repository
public
interface
CancelPreLoanRepository
extends
JpaRepository
<
AssignFundingRecord
,
Long
>{
@Query
(
value
=
"select f.id from apply_quota_record a JOIN assets_order o on o.out_trade_no = convert(a.id,char) JOIN assign_funding_record f on f.asset_order_id = o.id where a.order_no = ?1"
,
nativeQuery
=
true
)
Long
cancelPreLoan
(
String
applyNo
);
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/xyqb/source/XYQBDataSourceConfiguration.java
View file @
2a775e59
...
@@ -7,6 +7,7 @@ import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
...
@@ -7,6 +7,7 @@ import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.orm.jpa.JpaTransactionManager
;
import
org.springframework.orm.jpa.JpaTransactionManager
;
import
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
;
import
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
;
...
@@ -21,6 +22,7 @@ import javax.sql.DataSource;
...
@@ -21,6 +22,7 @@ import javax.sql.DataSource;
@EnableJpaRepositories
(
basePackages
=
{
"cn.quantgroup.cashloanflowboss.spi.xyqb"
},
entityManagerFactoryRef
=
"xyqbEntityManager"
,
transactionManagerRef
=
"xyqbTransactionManager"
,
includeFilters
=
@ComponentScan
.
Filter
(
XYQBDataSource
.
class
))
@EnableJpaRepositories
(
basePackages
=
{
"cn.quantgroup.cashloanflowboss.spi.xyqb"
},
entityManagerFactoryRef
=
"xyqbEntityManager"
,
transactionManagerRef
=
"xyqbTransactionManager"
,
includeFilters
=
@ComponentScan
.
Filter
(
XYQBDataSource
.
class
))
public
class
XYQBDataSourceConfiguration
{
public
class
XYQBDataSourceConfiguration
{
@Primary
@Bean
@Bean
@ConfigurationProperties
(
prefix
=
"data.xyqb"
)
@ConfigurationProperties
(
prefix
=
"data.xyqb"
)
public
DataSource
xyqbDataSource
()
{
public
DataSource
xyqbDataSource
()
{
...
...
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