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
1739b6ff
Commit
1739b6ff
authored
Aug 14, 2019
by
王俊权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关闭用户活跃订单
parent
c268bf75
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
204 additions
and
33 deletions
+204
-33
OrderController.java
...ashloanflowboss/api/order/controller/OrderController.java
+0
-4
Order.java
...n/quantgroup/cashloanflowboss/api/order/entity/Order.java
+6
-2
OrderService.java
...roup/cashloanflowboss/api/order/service/OrderService.java
+5
-27
UserController.java
.../cashloanflowboss/api/user/controller/UserController.java
+27
-0
XyqbUserDataSourceConfiguration.java
...e/configuration/data/XyqbUserDataSourceConfiguration.java
+72
-0
CLFCenter.java
...uantgroup/cashloanflowboss/spi/clf/service/CLFCenter.java
+23
-0
XyqbUserService.java
...up/cashloanflowboss/spi/user/service/XyqbUserService.java
+14
-0
XyqbUserServiceImpl.java
...ashloanflowboss/spi/user/service/XyqbUserServiceImpl.java
+57
-0
No files found.
src/main/java/cn/quantgroup/cashloanflowboss/api/order/controller/OrderController.java
View file @
1739b6ff
...
@@ -52,8 +52,4 @@ public class OrderController {
...
@@ -52,8 +52,4 @@ public class OrderController {
return
Result
.
buildSuccess
(
orderService
.
approveOpt
(
approveVo
));
return
Result
.
buildSuccess
(
orderService
.
approveOpt
(
approveVo
));
}
}
@PostMapping
(
value
=
"/cancel/loan"
,
consumes
=
"application/json"
)
public
Result
cancel
(
@RequestBody
@Valid
OrderVo
orderVo
)
{
return
Result
.
buildSuccess
(
orderService
.
cancel
(
orderVo
));
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/api/order/entity/Order.java
View file @
1739b6ff
package
cn
.
quantgroup
.
cashloanflowboss
.
api
.
order
.
entity
;
package
cn
.
quantgroup
.
cashloanflowboss
.
api
.
order
.
entity
;
import
cn.quantgroup.cashloanflowboss.core.persistence.Primary
;
import
cn.quantgroup.cashloanflowboss.core.persistence.Primary
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
...
@@ -13,6 +15,8 @@ import javax.persistence.Column;
...
@@ -13,6 +15,8 @@ import javax.persistence.Column;
*/
*/
@Data
@Data
@Entity
@Table
(
name
=
"order"
)
public
class
Order
extends
Primary
{
public
class
Order
extends
Primary
{
@Column
(
name
=
"channel_order_number"
)
@Column
(
name
=
"channel_order_number"
)
private
String
channelOrderNumber
;
private
String
channelOrderNumber
;
...
@@ -21,9 +25,9 @@ public class Order extends Primary {
...
@@ -21,9 +25,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
Integer
fundId
;
private
Long
fundId
;
@Column
(
name
=
"fund_type"
)
@Column
(
name
=
"fund_type"
)
private
Integer
fundType
;
private
Long
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 @
1739b6ff
package
cn
.
quantgroup
.
cashloanflowboss
.
api
.
order
.
service
;
package
cn
.
quantgroup
.
cashloanflowboss
.
api
.
order
.
service
;
import
cn.quantgroup.cashloanflowboss.spi.clf.service.CLFCenter
;
import
java.util.Date
;
import
java.util.Date
;
import
cn.quantgroup.cashloanflowboss.api.channel.entity.ChannelConf
;
import
cn.quantgroup.cashloanflowboss.api.channel.entity.ChannelConf
;
...
@@ -54,6 +55,8 @@ public class OrderService {
...
@@ -54,6 +55,8 @@ public class OrderService {
private
ClothoCenter
clothoCenter
;
private
ClothoCenter
clothoCenter
;
@Autowired
@Autowired
private
JolyneCenter
jolyneCenter
;
private
JolyneCenter
jolyneCenter
;
@Autowired
private
CLFCenter
clfCenter
;
...
@@ -141,8 +144,8 @@ public class OrderService {
...
@@ -141,8 +144,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
);
order
.
setFundId
(
fundId
.
longValue
()
);
order
.
setFundType
(
approveVo
.
getFundType
());
order
.
setFundType
(
approveVo
.
getFundType
()
.
longValue
()
);
order
.
setCreateTime
(
new
Date
());
order
.
setCreateTime
(
new
Date
());
order
.
setUpdateTime
(
new
Date
());
order
.
setUpdateTime
(
new
Date
());
orderRepository
.
save
(
order
);
orderRepository
.
save
(
order
);
...
@@ -172,29 +175,4 @@ public class OrderService {
...
@@ -172,29 +175,4 @@ public class OrderService {
}
}
}
}
public
boolean
cancel
(
OrderVo
orderVo
){
ClfOrderMapping
orderMapping
=
clfOrderMappingRepository
.
findByChannelOrderNoLastOne
(
orderVo
.
getChannelOrderNumber
());
if
(
orderMapping
==
null
)
{
log
.
info
(
"cancel,关单失败,无订单 channelOrderNumber={}"
,
orderVo
.
getChannelOrderNumber
());
return
false
;
}
XUser
xUser
=
xyqbUserService
.
findXUserById
(
orderMapping
.
getQgUserId
());
if
(
xUser
==
null
)
{
log
.
info
(
"cancel,关单失败,未找到用户 channelOrderNumber={}"
,
orderVo
.
getChannelOrderNumber
());
return
false
;
}
Long
userId
=
xUser
.
getId
();
ConcurrentMap
<
Object
,
Object
>
data
=
Maps
.
newConcurrentMap
();
ArrayList
<
Object
>
cancel_list
=
Lists
.
newArrayList
();
cancel_list
.
add
(
"update xyqb.quota_credit set is_active=0 where user_id="
+
userId
);
cancel_list
.
add
(
"update xyqb.quota_account set is_active=0 where user_id="
+
userId
);
cancel_list
.
add
(
"update xyqb.loan_application_history set progress=16 where user_id="
+
userId
);
cancel_list
.
add
(
"update xyqb.loan_application_history set is_active=0 where user_id="
+
userId
);
cancel_list
.
add
(
"delete from apply_quota_record where user_id="
+
userId
);
cancel_list
.
add
(
"delete from user_operation_history where user_id="
+
userId
);
data
.
put
(
"sql"
,
cancel_list
);
String
cancel_result
=
jolyneCenter
.
cancel
(
JSONTools
.
serialize
(
data
));
return
"success"
.
equals
(
cancel_result
);
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/api/user/controller/UserController.java
View file @
1739b6ff
...
@@ -5,6 +5,9 @@ import cn.quantgroup.cashloanflowboss.api.user.model.Pagination;
...
@@ -5,6 +5,9 @@ import cn.quantgroup.cashloanflowboss.api.user.model.Pagination;
import
cn.quantgroup.cashloanflowboss.api.user.model.RegisterUserFormModel
;
import
cn.quantgroup.cashloanflowboss.api.user.model.RegisterUserFormModel
;
import
cn.quantgroup.cashloanflowboss.api.user.service.UserService
;
import
cn.quantgroup.cashloanflowboss.api.user.service.UserService
;
import
cn.quantgroup.cashloanflowboss.component.validator.constraints.NotEmpty
;
import
cn.quantgroup.cashloanflowboss.component.validator.constraints.NotEmpty
;
import
cn.quantgroup.cashloanflowboss.spi.user.service.UserSysService
;
import
cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService
;
import
cn.quantgroup.user.IUserSdkService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -20,6 +23,8 @@ public class UserController {
...
@@ -20,6 +23,8 @@ public class UserController {
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@Autowired
private
XyqbUserService
xyqbUserService
;
/**
/**
* 注册用户
* 注册用户
...
@@ -75,4 +80,26 @@ public class UserController {
...
@@ -75,4 +80,26 @@ public class UserController {
return
this
.
userService
.
removeUser
(
id
);
return
this
.
userService
.
removeUser
(
id
);
}
}
/**
* 清除用户信息
*
* @param id 用户ID
* @return
*/
@PutMapping
(
"/clean"
)
public
Boolean
cleanUser
(
@RequestParam
@Valid
@NotEmpty
(
message
=
"无效的用户ID"
)
String
phoneNo
)
{
return
this
.
xyqbUserService
.
cleanUserExtInfo
(
phoneNo
);
}
/**
* 清除用户活跃订单
*
* @param phoneNo 用户ID
* @return
*/
@PutMapping
(
"/order/clean"
)
public
Boolean
cleanUserOrder
(
@RequestParam
@Valid
@NotEmpty
(
message
=
"无效的用户手机号"
)
String
phoneNo
)
{
return
this
.
xyqbUserService
.
cleanUserOrder
(
phoneNo
);
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/core/configuration/data/XyqbUserDataSourceConfiguration.java
0 → 100644
View file @
1739b6ff
package
cn
.
quantgroup
.
cashloanflowboss
.
core
.
configuration
.
data
;
import
cn.quantgroup.cashloanflowboss.core.persistence.CashLoanFlowDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder
;
import
javax.persistence.EntityManagerFactory
;
import
javax.sql.DataSource
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.orm.jpa.JpaTransactionManager
;
import
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
;
import
org.springframework.transaction.PlatformTransactionManager
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories
(
basePackages
=
{
"cn.quantgroup"
},
entityManagerFactoryRef
=
"xyqbUserEntityManager"
,
transactionManagerRef
=
"xyqbUserTransactionManager"
,
includeFilters
=
@ComponentScan
.
Filter
(
CashLoanFlowDataSource
.
class
))
public
class
XyqbUserDataSourceConfiguration
{
@Value
(
"${data.xyqb.user.url}"
)
private
String
jdbcUrl
;
@Value
(
"${data.xyqb.user.password}"
)
private
String
password
;
@Value
(
"${data.xyqb.user.username}"
)
private
String
user
;
private
String
uniquename
=
"clfDS"
;
@Value
(
"${data.xyqb.user.pool-size}"
)
private
Integer
poolSize
;
@Bean
(
name
=
"clfDataSource"
)
@ConfigurationProperties
(
prefix
=
"data.clf"
)
public
DataSource
createDataSource
()
{
DruidDataSource
source
=
DruidDataSourceBuilder
.
create
().
build
();
source
.
setMaxActive
(
200
);
source
.
setInitialSize
(
10
);
source
.
setMinIdle
(
10
);
source
.
setMaxWait
(
500000
);
source
.
setTimeBetweenEvictionRunsMillis
(
60000
);
source
.
setMinEvictableIdleTimeMillis
(
300000
);
source
.
setValidationQuery
(
"SELECT 'x'"
);
source
.
setTestWhileIdle
(
true
);
source
.
setTestOnBorrow
(
false
);
source
.
setTestOnReturn
(
false
);
source
.
setPoolPreparedStatements
(
Boolean
.
FALSE
);
return
source
;
}
@Bean
(
name
=
"xyqbUserEntityManager"
)
public
LocalContainerEntityManagerFactoryBean
entityManager
(
EntityManagerFactoryBuilder
builder
)
{
return
builder
.
dataSource
(
createDataSource
())
.
packages
(
"cn.quantgroup.cashloanflowboss.spi.clf.entity"
)
.
persistenceUnit
(
uniquename
)
.
build
();
}
@Bean
(
name
=
"xyqbUserTransactionManager"
)
public
PlatformTransactionManager
transactionManager
(
@Qualifier
(
"xyqbUserEntityManager"
)
EntityManagerFactory
entityManagerFactory
)
{
return
new
JpaTransactionManager
(
entityManagerFactory
);
}
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/clf/service/CLFCenter.java
0 → 100644
View file @
1739b6ff
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
clf
.
service
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
@Component
@FeignClient
(
name
=
"CLFServiceCenter"
,
url
=
"${qapi.https}"
,
fallback
=
CLFCenter
.
Fallback
.
class
)
public
interface
CLFCenter
{
@PostMapping
(
value
=
"/test//loanMq/batch"
,
consumes
=
"application/x-www-form-urlencoded"
)
public
void
loanMq
(
@RequestParam
(
"json"
)
String
loanMq
);
@Component
class
Fallback
implements
CLFCenter
{
@Override
public
void
loanMq
(
String
loanMq
)
{
return
;
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/service/XyqbUserService.java
View file @
1739b6ff
...
@@ -51,5 +51,19 @@ public interface XyqbUserService {
...
@@ -51,5 +51,19 @@ public interface XyqbUserService {
*/
*/
UserInfo
findUserByUuid
(
String
uuid
);
UserInfo
findUserByUuid
(
String
uuid
);
/**
* 清除用户信息
* @param phoneNo
* @return
*/
Boolean
cleanUserExtInfo
(
String
phoneNo
);
/**
* 清除用户活跃订单
* @param phoneNo
* @return
*/
Boolean
cleanUserOrder
(
String
phoneNo
);
}
}
src/main/java/cn/quantgroup/cashloanflowboss/spi/user/service/XyqbUserServiceImpl.java
View file @
1739b6ff
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
user
.
service
;
package
cn
.
quantgroup
.
cashloanflowboss
.
spi
.
user
.
service
;
import
cn.quantgroup.cashloanflowboss.api.order.model.OrderVo
;
import
cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping
;
import
cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneCenter
;
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
;
import
cn.quantgroup.user.bean.UserInfo
;
import
cn.quantgroup.user.bean.UserInfo
;
import
cn.quantgroup.user.enums.IncomeEnum
;
import
cn.quantgroup.user.enums.IncomeRangeEnum
;
import
cn.quantgroup.user.retbean.XUser
;
import
cn.quantgroup.user.retbean.XUser
;
import
cn.quantgroup.user.retbean.XUserDetail
;
import
cn.quantgroup.user.retbean.XUserDetail
;
import
cn.quantgroup.user.retbean.XUserExtInfo
;
import
cn.quantgroup.user.vo.UserSysResult
;
import
cn.quantgroup.user.vo.UserSysResult
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
java.util.concurrent.ConcurrentMap
;
import
lombok.extern.log4j.Log4j
;
import
org.apache.commons.lang3.StringUtils
;
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
;
...
@@ -28,11 +38,14 @@ public class XyqbUserServiceImpl implements XyqbUserService {
...
@@ -28,11 +38,14 @@ public class XyqbUserServiceImpl implements XyqbUserService {
private
UserSysService
userSysService
;
private
UserSysService
userSysService
;
@Autowired
@Autowired
private
HttpService
httpService
;
private
HttpService
httpService
;
@Autowired
private
JolyneCenter
jolyneCenter
;
@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
();
/**
/**
* 查询用户
* 查询用户
*
*
...
@@ -117,5 +130,49 @@ public class XyqbUserServiceImpl implements XyqbUserService {
...
@@ -117,5 +130,49 @@ public class XyqbUserServiceImpl implements XyqbUserService {
return
userInfo
.
getData
();
return
userInfo
.
getData
();
}
}
/**
* 清除用户信息
*/
@Override
public
Boolean
cleanUserExtInfo
(
String
phoneNo
)
{
if
(
StringUtils
.
isEmpty
(
phoneNo
))
{
return
false
;
}
UserSysResult
<
XUser
>
user
=
userSysService
.
getService
().
findUserByPhoneNo
(
phoneNo
);
if
(
Objects
.
isNull
(
user
)
||
Objects
.
isNull
(
user
.
getData
()))
{
return
false
;
}
Long
user_id
=
user
.
getData
().
getId
();
UserSysResult
<
Boolean
>
result
=
userSysService
.
getService
().
disableUser
(
user_id
);
UserSysResult
<
XUserExtInfo
>
userExtInfo
=
userSysService
.
getService
().
updateUserExtInfo
(
user_id
,
IncomeEnum
.
UNKNOWN
,
IncomeRangeEnum
.
UNKNOWN
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
if
(!
userExtInfo
.
isSuccess
()
||
userExtInfo
.
getData
()
==
null
)
{
return
false
;
}
return
true
;
}
/**
* 清除用户活跃订单
* @param phoneNo
* @return
*/
public
Boolean
cleanUserOrder
(
String
phoneNo
){
UserSysResult
<
XUser
>
xUser
=
userSysService
.
getService
().
findUserByPhoneNo
(
phoneNo
);
if
(
xUser
==
null
||
xUser
.
getData
()
==
null
)
{
LOGGER
.
info
(
"cleanUserOrder,清除用户活跃订单失败,未找到用户 phoneNo={}"
,
phoneNo
);
return
false
;
}
Long
userId
=
xUser
.
getData
().
getId
();
ConcurrentMap
<
Object
,
Object
>
data
=
Maps
.
newConcurrentMap
();
ArrayList
<
Object
>
cancel_list
=
Lists
.
newArrayList
();
cancel_list
.
add
(
"update xyqb.quota_credit set is_active=0 where user_id="
+
userId
);
cancel_list
.
add
(
"update xyqb.quota_account set is_active=0 where user_id="
+
userId
);
cancel_list
.
add
(
"update xyqb.loan_application_history set progress=16 where user_id="
+
userId
);
cancel_list
.
add
(
"update xyqb.loan_application_history set is_active=0 where user_id="
+
userId
);
cancel_list
.
add
(
"delete from apply_quota_record where user_id="
+
userId
);
cancel_list
.
add
(
"delete from user_operation_history where user_id="
+
userId
);
data
.
put
(
"sql"
,
cancel_list
);
String
cancel_result
=
jolyneCenter
.
cancel
(
JSONTools
.
serialize
(
data
));
return
"success"
.
equals
(
cancel_result
);
}
}
}
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