Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
renhang-report
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
renhang-report
Commits
17897011
Commit
17897011
authored
Jun 11, 2020
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交2020.06.11
parent
4de7b501
Changes
18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
195 additions
and
1403 deletions
+195
-1403
RenHangDatasourceProperties.java
...onfig/datasource/renhang/RenHangDatasourceProperties.java
+4
-4
XyqbUserDataSourceConfig.java
.../config/datasource/xyqbuser/XyqbUserDataSourceConfig.java
+0
-78
XyqbUserDatasourceProperties.java
...fig/datasource/xyqbuser/XyqbUserDatasourceProperties.java
+0
-31
ManualToolController.java
...cn/quantgroup/report/controller/ManualToolController.java
+31
-0
User.java
src/main/java/cn/quantgroup/report/domain/renhang/User.java
+6
-2
User.java
src/main/java/cn/quantgroup/report/domain/xyqbuser/User.java
+0
-15
UserDetail.java
...java/cn/quantgroup/report/domain/xyqbuser/UserDetail.java
+0
-32
UserMapper.java
.../java/cn/quantgroup/report/mapper/renhang/UserMapper.java
+1
-0
UserDetailMapper.java
...n/quantgroup/report/mapper/xyqbuser/UserDetailMapper.java
+0
-13
UserMapper.java
...java/cn/quantgroup/report/mapper/xyqbuser/UserMapper.java
+0
-9
RenHangBatchExecuteJdbc.java
...group/report/service/renhang/RenHangBatchExecuteJdbc.java
+56
-34
UserOcrService.java
.../cn/quantgroup/report/service/renhang/UserOcrService.java
+62
-980
IUserCenterService.java
...quantgroup/report/service/usersdk/IUserCenterService.java
+0
-9
UserCenterServiceImpl.java
...up/report/service/usersdk/impl/UserCenterServiceImpl.java
+1
-118
RenHangHikDataSource.java
...java/cn/quantgroup/report/utils/RenHangHikDataSource.java
+17
-12
UserMapper.xml
...ources/cn/quantgroup/report/mapper/renhang/UserMapper.xml
+17
-1
UserDetailMapper.xml
...cn/quantgroup/report/mapper/xyqbuser/UserDetailMapper.xml
+0
-40
UserMapper.xml
...urces/cn/quantgroup/report/mapper/xyqbuser/UserMapper.xml
+0
-25
No files found.
src/main/java/cn/quantgroup/report/config/datasource/renhang/RenHangDatasourceProperties.java
View file @
17897011
...
@@ -23,10 +23,10 @@ public class RenHangDatasourceProperties {
...
@@ -23,10 +23,10 @@ public class RenHangDatasourceProperties {
@Value
(
"${db.driver}"
)
@Value
(
"${db.driver}"
)
private
String
driverClass
;
private
String
driverClass
;
@Value
(
"${db.minPoolSize}"
)
//
@Value("${db.minPoolSize}")
private
int
minPoolSize
;
private
int
minPoolSize
=
10
;
@Value
(
"${db.maxPoolSize}"
)
//
@Value("${db.maxPoolSize}")
private
int
maxPoolSize
;
private
int
maxPoolSize
=
20
;
...
...
src/main/java/cn/quantgroup/report/config/datasource/xyqbuser/XyqbUserDataSourceConfig.java
deleted
100644 → 0
View file @
4de7b501
package
cn
.
quantgroup
.
report
.
config
.
datasource
.
xyqbuser
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariDataSource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.SqlSessionTemplate
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
javax.sql.DataSource
;
/**
* Desc:
* User: HaiNan.Wang
* Date: 2017/5/2
*/
@Import
(
XyqbUserDatasourceProperties
.
class
)
@Configuration
@Slf4j
@MapperScan
(
basePackages
=
XyqbUserDataSourceConfig
.
PACKAGE
,
sqlSessionFactoryRef
=
"xyqbUserSqlSessionFactory"
)
public
class
XyqbUserDataSourceConfig
{
static
final
String
PACKAGE
=
"cn.quantgroup.report.mapper.xyqbuser"
;
@Value
(
"${xyqb_user.mapper-locations}"
)
private
String
mapperLocations
;
@Value
(
"${xyqb_user.type-aliases-package}"
)
private
String
typeAliasesPackage
;
@Value
(
"${config-location}"
)
private
String
configLocation
;
@Autowired
private
XyqbUserDatasourceProperties
xyqbUserDatasourceProperties
;
@Bean
(
name
=
"xyqbUserDataSource"
)
public
DataSource
xyqbUserDataSource
()
{
HikariConfig
config
=
new
HikariConfig
();
config
.
setJdbcUrl
(
xyqbUserDatasourceProperties
.
getJdbcUrl
());
log
.
info
(
"数据库地址:{}"
,
xyqbUserDatasourceProperties
.
getJdbcUrl
());
config
.
setPassword
(
xyqbUserDatasourceProperties
.
getPassword
());
config
.
setUsername
(
xyqbUserDatasourceProperties
.
getUsername
());
config
.
setMaximumPoolSize
(
xyqbUserDatasourceProperties
.
getMaxPoolSize
());
config
.
setMinimumIdle
(
xyqbUserDatasourceProperties
.
getMinPoolSize
());
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
return
new
HikariDataSource
(
config
);
}
@Bean
(
name
=
"xyqbUserTransactionManager"
)
public
DataSourceTransactionManager
xyqbUserTransactionManager
(
@Qualifier
(
"xyqbUserDataSource"
)
DataSource
xyqbUserDataSource
)
{
return
new
DataSourceTransactionManager
(
xyqbUserDataSource
);
}
@Bean
(
name
=
"xyqbUserSqlSessionFactory"
)
public
SqlSessionFactory
xyqbUserSqlSessionFactory
(
@Qualifier
(
"xyqbUserDataSource"
)
DataSource
xyqbUserDataSource
)
throws
Exception
{
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
xyqbUserDataSource
);
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
()
.
getResources
(
mapperLocations
));
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
sessionFactory
.
setConfigLocation
(
new
PathMatchingResourcePatternResolver
()
.
getResource
(
configLocation
));
return
sessionFactory
.
getObject
();
}
@Bean
(
name
=
"xyqbUserSqlSessionTemplate"
)
public
SqlSessionTemplate
xyqbUserSqlSessionTemplate
(
@Qualifier
(
"xyqbUserSqlSessionFactory"
)
SqlSessionFactory
xyqbUserSqlSessionFactory
)
throws
Exception
{
return
new
SqlSessionTemplate
(
xyqbUserSqlSessionFactory
);
}
}
src/main/java/cn/quantgroup/report/config/datasource/xyqbuser/XyqbUserDatasourceProperties.java
deleted
100644 → 0
View file @
4de7b501
package
cn
.
quantgroup
.
report
.
config
.
datasource
.
xyqbuser
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
/**
* Desc:
* User: HaiNan.Wang
* Date: 2017/5/2
*/
@Getter
@Setter
@Configuration
public
class
XyqbUserDatasourceProperties
{
@Value
(
"${db.driver}"
)
private
String
driverClass
;
@Value
(
"${db.minPoolSize}"
)
private
int
minPoolSize
;
@Value
(
"${db.maxPoolSize}"
)
private
int
maxPoolSize
;
@Value
(
"${db.xyqb_user.url}"
)
private
String
jdbcUrl
;
@Value
(
"${db.xyqb_user.username}"
)
private
String
username
;
@Value
(
"${db.xyqb_user.password}"
)
private
String
password
;
}
src/main/java/cn/quantgroup/report/controller/ManualToolController.java
View file @
17897011
...
@@ -2,8 +2,10 @@ package cn.quantgroup.report.controller;
...
@@ -2,8 +2,10 @@ package cn.quantgroup.report.controller;
import
cn.quantgroup.report.response.GlobalResponse
;
import
cn.quantgroup.report.response.GlobalResponse
;
import
cn.quantgroup.report.service.manualTool.ManualToolService
;
import
cn.quantgroup.report.service.manualTool.ManualToolService
;
import
cn.quantgroup.report.service.renhang.UserOcrService
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableMap
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -18,6 +20,9 @@ public class ManualToolController {
...
@@ -18,6 +20,9 @@ public class ManualToolController {
@Autowired
@Autowired
private
ManualToolService
manualToolService
;
private
ManualToolService
manualToolService
;
@Autowired
private
UserOcrService
userOcrService
;
...
@@ -68,4 +73,30 @@ public class ManualToolController {
...
@@ -68,4 +73,30 @@ public class ManualToolController {
}
}
@RequestMapping
(
"/synGrowingUser"
)
public
String
synGrowingUser
(
String
startnyr
,
String
endnyr
)
{
userOcrService
.
synGrowingUserOcr
(
startnyr
,
endnyr
);
return
"synGrowingUser方法调度成功"
;
}
@RequestMapping
(
"/synUserOcrByUuids"
)
public
String
synUserOcrByUuids
(
String
uuids
)
{
if
(
StringUtils
.
isEmpty
(
uuids
))
{
return
"参数为空"
;
}
userOcrService
.
synUserOcrByUuids
(
uuids
);
return
"synUserOcrByUuids方法调度成功"
;
}
@RequestMapping
(
"/synValidDateEndUserOcr"
)
public
String
synValidDateEndUserOcr
()
{
userOcrService
.
synValidDateEndUserOcr
();
return
"synValidDateEndUserOcr方法调度成功"
;
}
}
}
src/main/java/cn/quantgroup/report/domain/renhang/User.java
View file @
17897011
package
cn
.
quantgroup
.
report
.
domain
.
renhang
;
package
cn
.
quantgroup
.
report
.
domain
.
renhang
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor;
...
@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor;
import
org.apache.commons.net.ntp.TimeStamp
;
import
org.apache.commons.net.ntp.TimeStamp
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
@Builder
@Builder
@Data
@Data
...
@@ -27,8 +29,10 @@ public class User implements Serializable{
...
@@ -27,8 +29,10 @@ public class User implements Serializable{
private
Integer
enable
;
//'是否可用'
private
Integer
enable
;
//'是否可用'
private
TimeStamp
createdAt
;
//@JsonIgnore
private
Date
createdAt
;
private
TimeStamp
updatedAt
;
//@JsonIgnore
private
Date
updatedAt
;
}
}
src/main/java/cn/quantgroup/report/domain/xyqbuser/User.java
deleted
100644 → 0
View file @
4de7b501
package
cn
.
quantgroup
.
report
.
domain
.
xyqbuser
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
User
{
private
Long
id
;
private
String
phoneNo
;
private
String
uuid
;
private
Date
createdAt
;
}
\ No newline at end of file
src/main/java/cn/quantgroup/report/domain/xyqbuser/UserDetail.java
deleted
100644 → 0
View file @
4de7b501
package
cn
.
quantgroup
.
report
.
domain
.
xyqbuser
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
UserDetail
{
private
Long
id
;
private
Long
userId
;
private
String
phoneNo
;
private
String
name
;
private
String
idNo
;
private
Integer
idType
;
private
Boolean
isAuthenticated
;
private
Integer
gender
;
private
String
email
;
private
String
qq
;
private
Date
createdAt
;
private
Date
updatedAt
;
}
\ No newline at end of file
src/main/java/cn/quantgroup/report/mapper/renhang/UserMapper.java
View file @
17897011
...
@@ -13,4 +13,5 @@ public interface UserMapper {
...
@@ -13,4 +13,5 @@ public interface UserMapper {
//查询日增用户,之前没有的
//查询日增用户,之前没有的
List
<
User
>
queryGrowingUser
();
List
<
User
>
queryGrowingUser
();
List
<
User
>
queryValidDateEndUserOcr
(
String
todayNyr
);
}
}
\ No newline at end of file
src/main/java/cn/quantgroup/report/mapper/xyqbuser/UserDetailMapper.java
deleted
100644 → 0
View file @
4de7b501
package
cn
.
quantgroup
.
report
.
mapper
.
xyqbuser
;
import
cn.quantgroup.report.domain.xyqbuser.UserDetail
;
import
java.util.List
;
public
interface
UserDetailMapper
{
UserDetail
selectByPrimaryKey
(
Long
id
);
UserDetail
selectByUserId
(
Long
userId
);
List
<
UserDetail
>
selectByIdentityNumber
(
String
identityNumber
);
}
\ No newline at end of file
src/main/java/cn/quantgroup/report/mapper/xyqbuser/UserMapper.java
deleted
100644 → 0
View file @
4de7b501
package
cn
.
quantgroup
.
report
.
mapper
.
xyqbuser
;
import
cn.quantgroup.report.domain.xyqbuser.User
;
public
interface
UserMapper
{
User
selectByPrimaryKey
(
Long
id
);
User
selectByUuid
(
String
uuid
);
}
\ No newline at end of file
src/main/java/cn/quantgroup/report/service/renhang/RenHangBatchExecuteJdbc.java
View file @
17897011
package
cn
.
quantgroup
.
report
.
service
.
renhang
;
package
cn
.
quantgroup
.
report
.
service
.
renhang
;
import
cn.quantgroup.report.domain.renhang.UserOcrVo
;
import
cn.quantgroup.report.domain.renhang.UserOcrVo
;
import
com.alibaba.fastjson.JSON
;
import
cn.quantgroup.report.utils.RenHangHikDataSource
;
import
com.mysql.jdbc.PreparedStatement
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.sql.*
;
import
java.sql.*
;
import
java.util.List
;
import
java.util.List
;
import
static
cn
.
quantgroup
.
report
.
utils
.
RenHangHikDataSource
.
HIK_DATA_SOURCE_RENHANG
;
@Slf4j
@Slf4j
public
class
RenHangBatchExecuteJdbc
{
public
class
RenHangBatchExecuteJdbc
{
...
@@ -31,14 +28,16 @@ public class RenHangBatchExecuteJdbc {
...
@@ -31,14 +28,16 @@ public class RenHangBatchExecuteJdbc {
public
static
void
batchInsertExecute
(
List
<
UserOcrVo
>
ocrInfoList
){
public
static
void
batchInsertExecute
(
List
<
UserOcrVo
>
ocrInfoList
){
String
insert_sql
=
"INSERT INTO `user_ocr` (`uuid`, `address`, `birthday`, `citizen_id`, `gender`, `name`, `nation`, `agency`, `valid_date_begin`, `valid_date_end`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
;
int
commit_count
=
1000
;
String
insert_sql
=
"INSERT INTO `user_ocr` (`uuid`, `address`, `birthday`, `citizen_id`, `gender`, `name`, `nation`, `agency`, `valid_date_begin`, `valid_date_end`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "
;
Connection
conn
=
null
;
Connection
conn
=
null
;
java
.
sql
.
PreparedStatement
ps
=
null
;
java
.
sql
.
PreparedStatement
ps
=
null
;
try
{
try
{
conn
=
HIK_DATA_SOURCE_RENHANG
.
d
ataSourceJdbc
.
getConnection
();
conn
=
RenHangHikDataSource
.
INSTANCE
.
batchD
ataSourceJdbc
.
getConnection
();
ps
=
conn
.
prepareStatement
(
insert_sql
);
ps
=
conn
.
prepareStatement
(
insert_sql
);
conn
.
setAutoCommit
(
false
);
conn
.
setAutoCommit
(
false
);
for
(
int
i
=
0
;
i
<
ocrInfoList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
ocrInfoList
.
size
();
i
++)
{
try
{
UserOcrVo
bean
=
ocrInfoList
.
get
(
i
);
UserOcrVo
bean
=
ocrInfoList
.
get
(
i
);
ps
.
setString
(
1
,
bean
.
getUuid
());
ps
.
setString
(
1
,
bean
.
getUuid
());
ps
.
setString
(
2
,
bean
.
getAddress
());
ps
.
setString
(
2
,
bean
.
getAddress
());
...
@@ -54,26 +53,40 @@ public class RenHangBatchExecuteJdbc {
...
@@ -54,26 +53,40 @@ public class RenHangBatchExecuteJdbc {
ps
.
setTimestamp
(
11
,
timestamp
);
ps
.
setTimestamp
(
11
,
timestamp
);
ps
.
setTimestamp
(
12
,
timestamp
);
ps
.
setTimestamp
(
12
,
timestamp
);
ps
.
addBatch
();
ps
.
addBatch
();
if
(
i
>
0
&&
i
%
commit_count
==
0
){
ps
.
executeBatch
();
conn
.
commit
();
//ps.clearBatch();
log
.
info
(
"提交结束:"
+
(
i
/
commit_count
+
1
));
}
}
catch
(
Exception
e
){
log
.
error
(
"执行batchInsertExecute异常, SQL:{} , count: {} "
,
insert_sql
,
e
);
}
}
}
ps
.
executeBatch
();
ps
.
executeBatch
();
conn
.
commit
();
conn
.
commit
();
log
.
info
(
"所有保存提交结束"
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
error
(
"======执行batchInsertExecute异常======"
+
insert_sql
+
"\r\n"
,
e
);
log
.
error
(
"执行batchInsertExecute异常, SQL:{} , count: last "
,
insert_sql
,
e
);
e
.
printStackTrace
();
}
finally
{
}
finally
{
close
(
conn
,
ps
,
null
);
close
(
conn
,
ps
,
null
);
}
}
}
}
public
static
void
batchUpdateExecute
(
List
<
UserOcrVo
>
ocrInfoList
){
public
static
void
batchUpdateExecute
(
List
<
UserOcrVo
>
ocrInfoList
){
String
update_sql
=
"update user_ocr set valid_date_begin=?, valid_date_end=?, updated_at=? where uuid=?"
;
int
commit_count
=
1000
;
String
update_sql
=
"update user_ocr set valid_date_begin=?, valid_date_end=?, updated_at=? where uuid=? "
;
Connection
conn
=
null
;
Connection
conn
=
null
;
java
.
sql
.
PreparedStatement
ps
=
null
;
java
.
sql
.
PreparedStatement
ps
=
null
;
try
{
try
{
conn
=
HIK_DATA_SOURCE_RENHANG
.
d
ataSourceJdbc
.
getConnection
();
conn
=
RenHangHikDataSource
.
INSTANCE
.
batchD
ataSourceJdbc
.
getConnection
();
ps
=
conn
.
prepareStatement
(
update_sql
);
ps
=
conn
.
prepareStatement
(
update_sql
);
conn
.
setAutoCommit
(
false
);
conn
.
setAutoCommit
(
false
);
for
(
int
i
=
0
;
i
<
ocrInfoList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
ocrInfoList
.
size
();
i
++)
{
try
{
UserOcrVo
bean
=
ocrInfoList
.
get
(
i
);
UserOcrVo
bean
=
ocrInfoList
.
get
(
i
);
ps
.
setString
(
1
,
bean
.
getValidDateBegin
());
ps
.
setString
(
1
,
bean
.
getValidDateBegin
());
ps
.
setString
(
2
,
bean
.
getValidDateEnd
());
ps
.
setString
(
2
,
bean
.
getValidDateEnd
());
...
@@ -81,12 +94,21 @@ public class RenHangBatchExecuteJdbc {
...
@@ -81,12 +94,21 @@ public class RenHangBatchExecuteJdbc {
ps
.
setTimestamp
(
3
,
timestamp
);
ps
.
setTimestamp
(
3
,
timestamp
);
ps
.
setString
(
4
,
bean
.
getUuid
());
ps
.
setString
(
4
,
bean
.
getUuid
());
ps
.
addBatch
();
ps
.
addBatch
();
if
(
i
>
0
&&
i
%
commit_count
==
0
){
ps
.
executeBatch
();
conn
.
commit
();
//ps.clearBatch();
log
.
info
(
"提交结束:"
+
(
i
/
commit_count
+
1
));
}
}
catch
(
Exception
e
){
log
.
error
(
"执行batchUpdateExecute异常, SQL:{} , count: {} "
,
update_sql
,
e
);
}
}
}
ps
.
executeBatch
();
ps
.
executeBatch
();
conn
.
commit
();
conn
.
commit
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
error
(
"======执行batchUpdateExecute异常======"
+
update_sql
+
"\r\n"
,
e
);
log
.
error
(
"执行batchUpdateExecute异常, SQL:{} , count: last "
,
update_sql
,
e
);
e
.
printStackTrace
();
}
finally
{
}
finally
{
close
(
conn
,
ps
,
null
);
close
(
conn
,
ps
,
null
);
}
}
...
...
src/main/java/cn/quantgroup/report/service/renhang/UserOcrService.java
View file @
17897011
This diff is collapsed.
Click to expand it.
src/main/java/cn/quantgroup/report/service/usersdk/IUserCenterService.java
View file @
17897011
package
cn
.
quantgroup
.
report
.
service
.
usersdk
;
package
cn
.
quantgroup
.
report
.
service
.
usersdk
;
import
cn.quantgroup.report.domain.sdk.SdkUser
;
import
cn.quantgroup.report.domain.sdk.SdkUser
;
import
cn.quantgroup.report.domain.xyqbuser.User
;
import
cn.quantgroup.report.domain.xyqbuser.UserDetail
;
public
interface
IUserCenterService
{
public
interface
IUserCenterService
{
...
@@ -19,14 +17,7 @@ public interface IUserCenterService {
...
@@ -19,14 +17,7 @@ public interface IUserCenterService {
*/
*/
public
SdkUser
getSdkUserByUuid
(
String
uuid
);
public
SdkUser
getSdkUserByUuid
(
String
uuid
);
public
User
getSdkUserByUserId
(
String
userId
);
public
UserDetail
getSdkUserDetailByUserId
(
Long
userId
);
public
Long
getUserIdByIdentityNumberAndName
(
String
identityNumber
,
String
name
);
public
Long
getUserIdByIdentityNumber
(
String
identityNumber
);
public
String
getUuidByIdentityNumber
(
String
identityNumber
);
public
String
getUuidByPhoneNumber
(
String
phoneNumber
);
public
String
getUuidByPhoneNumber
(
String
phoneNumber
);
public
SdkUser
getUserFullInfoByUuid
(
String
uuid
);
public
SdkUser
getUserFullInfoByUuid
(
String
uuid
);
...
...
src/main/java/cn/quantgroup/report/service/usersdk/impl/UserCenterServiceImpl.java
View file @
17897011
package
cn
.
quantgroup
.
report
.
service
.
usersdk
.
impl
;
package
cn
.
quantgroup
.
report
.
service
.
usersdk
.
impl
;
import
cn.quantgroup.motan.bean.UserInfo
;
import
cn.quantgroup.motan.bean.UserInfo
;
import
cn.quantgroup.motan.retbean.XUser
;
import
cn.quantgroup.motan.retbean.XUserDetail
;
import
cn.quantgroup.motan.retbean.XUserFullInfo
;
import
cn.quantgroup.motan.retbean.XUserFullInfo
;
import
cn.quantgroup.motan.vo.UserSysResult
;
import
cn.quantgroup.motan.vo.UserSysResult
;
import
cn.quantgroup.report.cmpt.CommonAlarmCmpt
;
import
cn.quantgroup.report.cmpt.CommonAlarmCmpt
;
import
cn.quantgroup.report.domain.sdk.SdkUser
;
import
cn.quantgroup.report.domain.sdk.SdkUser
;
import
cn.quantgroup.report.domain.xyqbuser.User
;
import
cn.quantgroup.report.error.QGExceptionType
;
import
cn.quantgroup.report.error.QGPreconditions
;
import
cn.quantgroup.report.service.usersdk.IUserCenterService
;
import
cn.quantgroup.report.domain.xyqbuser.UserDetail
;
import
cn.quantgroup.report.service.http.IHttpService
;
import
cn.quantgroup.report.service.http.IHttpService
;
import
cn.quantgroup.report.service.usersdk.IUserCenterService
;
import
cn.quantgroup.user.IUserSdkService
;
import
cn.quantgroup.user.IUserSdkService
;
import
cn.quantgroup.user.UserSdkServiceFactory
;
import
cn.quantgroup.user.UserSdkServiceFactory
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableMap
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -30,9 +23,6 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -30,9 +23,6 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
@Service
@Service
public
class
UserCenterServiceImpl
implements
IUserCenterService
{
public
class
UserCenterServiceImpl
implements
IUserCenterService
{
...
@@ -93,113 +83,6 @@ public class UserCenterServiceImpl implements IUserCenterService {
...
@@ -93,113 +83,6 @@ public class UserCenterServiceImpl implements IUserCenterService {
return
null
;
return
null
;
}
}
@Override
public
User
getSdkUserByUserId
(
String
userId
)
{
try
{
UserSysResult
<
XUser
>
userByUserId
=
userSdkService
.
findUserByUserId
(
Long
.
parseLong
(
userId
));
User
user
=
new
User
();
if
(
userByUserId
.
isSuccess
()&&
userByUserId
.
getData
()!=
null
){
XUser
data
=
userByUserId
.
getData
();
BeanUtils
.
copyProperties
(
data
,
user
);
return
user
;
}
}
catch
(
Exception
e
){
LOGGER
.
error
(
"查询用户用心异常,uuid: {} , {}"
,
userId
,
e
);
iMonitorAlarmService
.
alarm
(
"WARN"
,
"用户中心查询异常告警"
,
"接口 : findUserByUserId(userId) , 异常信息:"
+
e
.
getMessage
());
}
return
null
;
}
@Override
public
UserDetail
getSdkUserDetailByUserId
(
Long
userId
)
{
try
{
UserSysResult
<
XUserDetail
>
userDetailUserSysResult
=
userSdkService
.
findUserDetailByUserId
(
userId
);
UserDetail
userDetail
=
new
UserDetail
();
if
(
userDetailUserSysResult
.
isSuccess
()
&&
userDetailUserSysResult
.
getData
()!=
null
){
XUserDetail
xUserDetail
=
userDetailUserSysResult
.
getData
();
BeanUtils
.
copyProperties
(
xUserDetail
,
userDetail
);
return
userDetail
;
}
}
catch
(
Exception
e
){
LOGGER
.
error
(
"查询用户中心用户详情异常, userId: {} , {}"
,
userId
,
e
);
iMonitorAlarmService
.
alarm
(
"WARN"
,
"用户中心查询异常告警"
,
"接口 : getSdkUserDetailByUserId(userId) , 异常信息:"
+
e
.
getMessage
());
}
return
null
;
}
@Override
public
Long
getUserIdByIdentityNumberAndName
(
String
identityNumber
,
String
name
)
{
UserSysResult
<
List
<
XUserDetail
>>
userDetailBySpecification
=
userSdkService
.
queryUserDetailBySpecification
(
null
,
null
,
identityNumber
);
LOGGER
.
info
(
"getUserIdByIdentityNumberAndName, identityNumber: {} , name:{}, 结果:{}"
,
identityNumber
,
name
,
JSON
.
toJSONString
(
userDetailBySpecification
));
List
<
UserDetail
>
userDetails
=
new
ArrayList
<>();
if
(
userDetailBySpecification
.
isSuccess
()&&
userDetailBySpecification
.
getData
()!=
null
){
List
<
XUserDetail
>
xUserDetails
=
userDetailBySpecification
.
getData
();
xUserDetails
.
forEach
(
xUserDetail2
->
{
UserDetail
userDetail
=
new
UserDetail
();
BeanUtils
.
copyProperties
(
xUserDetail2
,
userDetail
);
userDetails
.
add
(
userDetail
);
});
QGPreconditions
.
checkArgument
(
CollectionUtils
.
isNotEmpty
(
userDetails
),
QGExceptionType
.
XYQB_USER_NOT_EXSIT
);
Optional
<
UserDetail
>
optional
=
userDetails
.
parallelStream
().
filter
(
detail
->
StringUtils
.
equals
(
detail
.
getName
(),
name
)).
findFirst
();
boolean
isPresent
=
optional
.
isPresent
();
QGPreconditions
.
checkArgument
(
isPresent
,
QGExceptionType
.
XYQB_USER_NOT_MATCH
);
long
userId
=
optional
.
get
().
getUserId
();
return
userId
;
}
return
null
;
}
public
Long
getUserIdByIdentityNumber
(
String
identityNumber
)
{
UserSysResult
<
List
<
XUserDetail
>>
userDetailBySpecification
=
userSdkService
.
queryUserDetailBySpecification
(
null
,
null
,
identityNumber
);
LOGGER
.
info
(
"getUserIdByIdentityNumber, identityNumber:{}, 结果:{}"
,
identityNumber
,
JSON
.
toJSONString
(
userDetailBySpecification
));
List
<
UserDetail
>
userDetails
=
new
ArrayList
<>();
if
(
userDetailBySpecification
.
isSuccess
()&&
userDetailBySpecification
.
getData
()!=
null
){
List
<
XUserDetail
>
xUserDetails
=
userDetailBySpecification
.
getData
();
xUserDetails
.
forEach
(
xUserDetail2
->
{
UserDetail
userDetail
=
new
UserDetail
();
BeanUtils
.
copyProperties
(
xUserDetail2
,
userDetail
);
userDetails
.
add
(
userDetail
);
});
QGPreconditions
.
checkArgument
(
CollectionUtils
.
isNotEmpty
(
userDetails
),
QGExceptionType
.
XYQB_USER_NOT_EXSIT
);
Optional
<
UserDetail
>
optional
=
userDetails
.
parallelStream
().
filter
(
detail
->
(
detail
.
getUserId
()
!=
null
)).
findFirst
();
boolean
isPresent
=
optional
.
isPresent
();
QGPreconditions
.
checkArgument
(
isPresent
,
QGExceptionType
.
XYQB_USER_NOT_MATCH
);
long
userId
=
optional
.
get
().
getUserId
();
return
userId
;
}
return
null
;
}
@Override
public
String
getUuidByIdentityNumber
(
String
identityNumber
)
{
try
{
UserSysResult
<
List
<
XUserDetail
>>
userDetailBySpecification
=
userSdkService
.
queryUserDetailBySpecification
(
null
,
null
,
identityNumber
);
LOGGER
.
info
(
"getUuidByIdentityNumber, identityNumber: {} , 结果:{}"
,
identityNumber
,
JSON
.
toJSONString
(
userDetailBySpecification
));
List
<
UserDetail
>
userDetails
=
new
ArrayList
<>();
if
(
userDetailBySpecification
.
isSuccess
()
&&
userDetailBySpecification
.
getData
()
!=
null
)
{
List
<
XUserDetail
>
xUserDetails
=
userDetailBySpecification
.
getData
();
xUserDetails
.
forEach
(
xUserDetail2
->
{
UserDetail
userDetail
=
new
UserDetail
();
BeanUtils
.
copyProperties
(
xUserDetail2
,
userDetail
);
userDetails
.
add
(
userDetail
);
});
QGPreconditions
.
checkArgument
(
CollectionUtils
.
isNotEmpty
(
userDetails
),
QGExceptionType
.
XYQB_USER_NOT_EXSIT
);
Optional
<
UserDetail
>
optional
=
userDetails
.
parallelStream
().
filter
(
detail
->
(
detail
.
getUserId
()
!=
null
)).
findFirst
();
boolean
isPresent
=
optional
.
isPresent
();
QGPreconditions
.
checkArgument
(
isPresent
,
QGExceptionType
.
XYQB_USER_NOT_MATCH
);
long
userId
=
optional
.
get
().
getUserId
();
User
user
=
getSdkUserByUserId
(
String
.
valueOf
(
userId
));
if
(
user
==
null
)
{
LOGGER
.
info
(
"查询用户用心,identityNumber: {} , user {}"
,
identityNumber
,
user
);
return
null
;
}
return
user
.
getUuid
();
}
}
catch
(
Exception
e
){
LOGGER
.
error
(
"查询用户用心异常,identityNumber: {} , {}"
,
identityNumber
,
e
);
}
return
null
;
}
@Override
@Override
public
String
getUuidByPhoneNumber
(
String
phoneNumber
)
{
public
String
getUuidByPhoneNumber
(
String
phoneNumber
)
{
...
...
src/main/java/cn/quantgroup/report/utils/RenHangHikDataSource.java
View file @
17897011
package
cn
.
quantgroup
.
report
.
utils
;
package
cn
.
quantgroup
.
report
.
utils
;
import
cn.quantgroup.report.service.renhang.UserOcrService
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariConfig
;
import
com.zaxxer.hikari.HikariDataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
@Slf4j
public
enum
RenHangHikDataSource
{
public
enum
RenHangHikDataSource
{
HIK_DATA_SOURCE_RENHANG
;
@Value
(
"${db.renhang.rc_sync_guangda.fullurl}"
)
INSTANCE
;
/* @Value("${db.renhang.rc_sync_guangda.fullurl}")
private String datasourceJdbcUrl;
private String datasourceJdbcUrl;
@Value("${db.renhang.rc_sync_guangda.username}")
@Value("${db.renhang.rc_sync_guangda.username}")
private String datasourceUsername;
private String datasourceUsername;
@Value("${db.renhang.rc_sync_guangda.password}")
@Value("${db.renhang.rc_sync_guangda.password}")
private
String
datasourcePassword
;
private String datasourcePassword;
*/
public
DataSource
d
ataSourceJdbc
;
public
DataSource
batchD
ataSourceJdbc
;
RenHangHikDataSource
(){
RenHangHikDataSource
(){
if
(
dataSourceJdbc
==
null
){
Logger
log
=
LoggerFactory
.
getLogger
(
RenHangHikDataSource
.
class
);
if
(
batchDataSourceJdbc
==
null
){
HikariConfig
config
=
new
HikariConfig
();
HikariConfig
config
=
new
HikariConfig
();
//"jdbc:mysql://fengkong-tidb.quantgroups.com:4010/risk_datasource?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true"
config
.
setJdbcUrl
(
"jdbc:mysql://172.30.220.4:3306/rc_sync_guangda?useUnicode=true&characterEncoding=UTF8&useSSL=false&rewriteBatchedStatements=true"
);
config
.
setJdbcUrl
(
datasourceJdbcUrl
.
substring
(
0
,
datasourceJdbcUrl
.
indexOf
(
"?"
))+
"?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true"
);
//
config.setJdbcUrl(datasourceJdbcUrl.substring(0, datasourceJdbcUrl.indexOf("?"))+"?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true");
config
.
setUsername
(
datasourceUsername
);
config
.
setUsername
(
"rc_sync_guangda_w"
);
config
.
setPassword
(
datasourcePassword
);
config
.
setPassword
(
"KETqFdAj6b4vHX4z"
);
config
.
setDriverClassName
(
"com.mysql.jdbc.Driver"
);
config
.
setDriverClassName
(
"com.mysql.jdbc.Driver"
);
config
.
setMaximumPoolSize
(
10
);
config
.
setMaximumPoolSize
(
10
);
config
.
setMinimumIdle
(
5
);
config
.
setMinimumIdle
(
5
);
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"cachePrepStmts"
,
"true"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSize"
,
"250"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
config
.
addDataSourceProperty
(
"prepStmtCacheSqlLimit"
,
"2048"
);
d
ataSourceJdbc
=
new
HikariDataSource
(
config
);
batchD
ataSourceJdbc
=
new
HikariDataSource
(
config
);
System
.
out
.
println
(
"rc_sync_guangda创建数据库连接完毕"
);
log
.
info
(
"rc_sync_guangda创建数据库连接完毕"
);
}
}
}
}
...
...
src/main/resources/cn/quantgroup/report/mapper/renhang/UserMapper.xml
View file @
17897011
...
@@ -17,4 +17,20 @@
...
@@ -17,4 +17,20 @@
where o.id is null;
where o.id is null;
</select>
</select>
<select
id=
"findTargetRepaymentDayList"
parameterType=
"java.lang.String"
resultType=
"java.lang.String"
>
select date(DATE_SUB(deadline,INTERVAL 1 second)) from xyqb_i_repayment_plan where loan_application_history_id=#{reqID}
</select>
<select
id=
"queryValidDateEndUserOcr"
parameterType=
"java.lang.String"
resultMap=
"growingUserMap"
>
select uo.uuid, '1' enable, uo.updated_at, uo.created_at from user_ocr uo
where LENGTH(uo.valid_date_end)=8
and DATE_FORMAT(uo.valid_date_end,'%Y%m%d')
<
DATE_FORMAT(#{todayNyr},'%Y-%m-%d')
UNION
select uo.uuid, '1' enable, uo.updated_at, uo.created_at from user_ocr uo
where LENGTH(uo.valid_date_end)!=8
and uo.valid_date_end!='长期'
and uo.valid_date_end!='长期有效'
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/cn/quantgroup/report/mapper/xyqbuser/UserDetailMapper.xml
deleted
100644 → 0
View file @
4de7b501
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.quantgroup.report.mapper.xyqbuser.UserDetailMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.quantgroup.report.domain.xyqbuser.UserDetail"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"user_id"
jdbcType=
"BIGINT"
property=
"userId"
/>
<result
column=
"phone_no"
jdbcType=
"VARCHAR"
property=
"phoneNo"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"id_no"
jdbcType=
"VARCHAR"
property=
"idNo"
/>
<result
column=
"id_type"
jdbcType=
"TINYINT"
property=
"idType"
/>
<result
column=
"is_authenticated"
jdbcType=
"BIT"
property=
"isAuthenticated"
/>
<result
column=
"gender"
jdbcType=
"TINYINT"
property=
"gender"
/>
<result
column=
"email"
jdbcType=
"VARCHAR"
property=
"email"
/>
<result
column=
"qq"
jdbcType=
"VARCHAR"
property=
"qq"
/>
<result
column=
"created_at"
jdbcType=
"TIMESTAMP"
property=
"createdAt"
/>
<result
column=
"updated_at"
jdbcType=
"TIMESTAMP"
property=
"updatedAt"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, user_id, phone_no, name, id_no, id_type, is_authenticated, gender, email, qq,
created_at, updated_at
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from user_detail
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"selectByUserId"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from user_detail
where user_id = #{userId,jdbcType=BIGINT}
</select>
<select
id=
"selectByIdentityNumber"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from user_detail
where id_no = #{identityNumber,jdbcType=VARCHAR}
</select>
</mapper>
\ No newline at end of file
src/main/resources/cn/quantgroup/report/mapper/xyqbuser/UserMapper.xml
deleted
100644 → 0
View file @
4de7b501
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.quantgroup.report.mapper.xyqbuser.UserMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.quantgroup.report.domain.xyqbuser.User"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"phone_no"
jdbcType=
"VARCHAR"
property=
"phoneNo"
/>
<result
column=
"uuid"
jdbcType=
"VARCHAR"
property=
"uuid"
/>
<result
column=
"created_at"
jdbcType=
"TIMESTAMP"
property=
"createdAt"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, phone_no, uuid,created_at
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from user
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"selectByUuid"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from user
where uuid = #{uuid,jdbcType=VARCHAR}
</select>
</mapper>
\ 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