Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qg-bl-service
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
qg-bl-service
Commits
1e4bf001
Commit
1e4bf001
authored
Apr 15, 2020
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
黑灰名单结果表、明细表增加数据源
parent
27a13e8f
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1057 additions
and
88 deletions
+1057
-88
BlackGreyListDetails.java
...sitory/mybatis/entity/blacklist/BlackGreyListDetails.java
+43
-0
BlackGreyListQueryVo.java
...sitory/mybatis/entity/blacklist/BlackGreyListQueryVo.java
+32
-0
BlackGreyListResult.java
...ository/mybatis/entity/blacklist/BlackGreyListResult.java
+104
-0
Reasons.java
...lservice/repository/mybatis/entity/blacklist/Reasons.java
+26
-0
BlackGreyListMapper.java
...ository/mybatis/mapper/blacklist/BlackGreyListMapper.java
+33
-0
BlackGreyListMapper.xml
.../repository/mybatis/xml/blacklist/BlackGreyListMapper.xml
+125
-0
BlackListQueryMapper.xml
...repository/mybatis/xml/blacklist/BlackListQueryMapper.xml
+1
-1
IBlackGreyListService.java
...quantgroup/qgblservice/service/IBlackGreyListService.java
+34
-0
BlackGreyListServiceImpl.java
...up/qgblservice/service/impl/BlackGreyListServiceImpl.java
+503
-0
BlackListManagerServiceImpl.java
...qgblservice/service/impl/BlackListManagerServiceImpl.java
+1
-5
BlackListToolsManagerServiceImpl.java
...ervice/service/impl/BlackListToolsManagerServiceImpl.java
+84
-82
BlackListUtils.java
...uantgroup/qgblservice/utils/blacklist/BlackListUtils.java
+71
-0
No files found.
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/entity/blacklist/BlackGreyListDetails.java
0 → 100644
View file @
1e4bf001
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
blacklist
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: black_grey_list_details表实体 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:43 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
public
class
BlackGreyListDetails
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3504867579864272343L
;
private
Long
id
;
private
String
rId
;
private
String
name
;
private
String
phoneNo
;
private
String
idNo
;
private
String
type
;
//原始黑名单来源。1~99:QG黑名单(1:现金贷,2:白条,3:去哪儿,4:法院黑名单,5:线下黑名单,6新氧黑名单,8手机套现黑名单,9.环球黑卡套现,10.vcc逾期黑名单,11恶意投诉客户);101~199:P2P黑名单(101:p2p黑名单,102:weshare黑名单,103:芝麻行业关注名单,104:其他小贷黑名单,105-企美提供黑名单,106-拿下分期黑名单);201~299:机构黑名单(201-black_bank,202-black_kaola,203-black_car,204-前海黑名单,205-华融黑名单,206-人人信黑名单,207-同盾黑名单,208-大锤黑名单,209-国美黑名单,210-美借,211-快金,212-米么,213-手机贷,214-拍拍贷,215-掌众(闪电借款),216-向前贷(明特量化),217-齐立欣提供小贷渠道1,218-致诚阿福黑名单,219-算话黑名单);301~399:其他黑名单(301:black_dispute);401~499:白条黑名单(401:白条套现);501-马上闹事群众
private
String
reasonCode
;
//加入黑名单原因。1现金分期逾期大于15天,且仍然在逾;2.vcc逾期大于15天,且仍然在逾。;3.白条在逾;4.恶意投诉客户;
private
String
maxOverdueDays
;
private
String
totalOverdueDays
;
private
int
status
;
//状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的); 10:当前在黑名单,并且该条数据逾期已还清的
private
String
remark
;
@JsonIgnore
private
Timestamp
createdAt
;
@JsonIgnore
private
Timestamp
updatedAt
;
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/entity/blacklist/BlackGreyListQueryVo.java
0 → 100644
View file @
1e4bf001
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
blacklist
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: 黑灰名单查询参数类 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:43 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
@Builder
public
class
BlackGreyListQueryVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3504867579864272343L
;
private
String
rId
;
private
String
uuid
;
private
String
name
;
private
String
phoneNo
;
private
String
idNo
;
private
String
blackType
;
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/entity/blacklist/BlackGreyListResult.java
0 → 100644
View file @
1e4bf001
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
blacklist
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.*
;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: black_grey_list_result表实体 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:43 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
public
class
BlackGreyListResult
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3504867579864272343L
;
private
String
rId
;
private
String
uuid
;
private
String
name
;
private
String
phoneNo
;
private
String
idNo
;
/**phoneNo md5加密*/
private
String
phoneNoMd5
;
/**idNo md5加密*/
private
String
idNoMd5
;
private
String
blackType
;
private
String
types
;
private
String
reasons
;
@JsonIgnore
private
Timestamp
createdAt
;
@JsonIgnore
private
Timestamp
updatedAt
;
public
static
Set
<
String
>
typesToSet
(
String
oldTypesStr
,
String
newType
){
Set
<
String
>
typesSet
=
null
;
try
{
if
(
StringUtils
.
isEmpty
(
oldTypesStr
))
{
typesSet
=
new
HashSet
<>();
}
else
{
String
[]
array
=
oldTypesStr
.
trim
().
split
(
"[,]"
);
typesSet
=
new
HashSet
<>(
Arrays
.
asList
(
array
));
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
if
(
typesSet
==
null
){
typesSet
=
new
HashSet
<>();
}
typesSet
.
add
(
newType
);
return
typesSet
;
}
public
static
List
<
Reasons
>
reasonsToList
(
String
oldJsonStr
,
String
newReason
,
String
newType
){
List
<
Reasons
>
reasonList
=
null
;
try
{
if
(
StringUtils
.
isNotEmpty
(
oldJsonStr
))
{
reasonList
=
JSONArray
.
parseArray
(
oldJsonStr
,
Reasons
.
class
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
if
(
reasonList
==
null
){
reasonList
=
new
ArrayList
<
Reasons
>();
}
int
size
=
reasonList
.
size
();
if
(
size
>=
2
){
Reasons
back1
=
reasonList
.
get
(
0
);
for
(
int
i
=
1
;
i
<
size
;
i
++){
Reasons
tmp2
=
reasonList
.
get
(
i
);
if
(
back1
.
getUtcTime
()
<=
tmp2
.
getUtcTime
()){
back1
=
tmp2
;
}
}
reasonList
=
new
ArrayList
<
Reasons
>();
reasonList
.
add
(
back1
);
}
Reasons
newObj
=
new
Reasons
();
newObj
.
setReason
(
newReason
);
newObj
.
setType
(
newType
);
newObj
.
setUtcTime
(
System
.
currentTimeMillis
());
reasonList
.
add
(
newObj
);
return
reasonList
;
}
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/entity/blacklist/Reasons.java
0 → 100644
View file @
1e4bf001
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
entity
.
blacklist
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: black_grey_list_result表的reasons <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:57 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Data
public
class
Reasons
implements
Serializable
{
private
String
type
;
private
String
reason
;
private
long
utcTime
;
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/mapper/blacklist/BlackGreyListMapper.java
0 → 100644
View file @
1e4bf001
package
cn
.
quantgroup
.
qgblservice
.
repository
.
mybatis
.
mapper
.
blacklist
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: 黑灰名单 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 21:41 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
@Repository
public
interface
BlackGreyListMapper
{
BlackGreyListResult
findBGLResultByRid
(
String
rId
);
List
<
BlackGreyListResult
>
findBlackGreyListResult
(
BlackGreyListQueryVo
queryParams
);
int
insertBlackGreyListResult
(
BlackGreyListResult
result
);
int
insertBlackGreyListDetails
(
BlackGreyListDetails
details
);
int
updateBlackGreyListResult
(
BlackGreyListResult
params
);
int
updateDetailsStatus
(
BlackGreyListDetails
params
);
}
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/xml/blacklist/BlackGreyListMapper.xml
0 → 100644
View file @
1e4bf001
<?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.qgblservice.repository.mybatis.mapper.blacklist.BlackGreyListMapper"
>
<resultMap
id=
"BlackGreyListResultMap"
type=
"cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult"
>
<id
column=
"rId"
jdbcType=
"VARCHAR"
property=
"r_id"
/>
<result
column=
"uuid"
jdbcType=
"VARCHAR"
property=
"uuid"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"phoneNo"
jdbcType=
"VARCHAR"
property=
"phone_no"
/>
<result
column=
"idNo"
jdbcType=
"VARCHAR"
property=
"id_no"
/>
<result
column=
"phoneNoMd5"
jdbcType=
"VARCHAR"
property=
"phone_no_md5"
/>
<result
column=
"idNoMd5"
jdbcType=
"VARCHAR"
property=
"id_no_md5"
/>
<result
column=
"blackType"
jdbcType=
"VARCHAR"
property=
"black_type"
/>
<result
column=
"types"
jdbcType=
"VARCHAR"
property=
"types"
/>
<result
column=
"reasons"
jdbcType=
"VARCHAR"
property=
"reasons"
/>
<result
column=
"createdAt"
jdbcType=
"TIMESTAMP"
property=
"created_at"
/>
<result
column=
"updatedAt"
jdbcType=
"TIMESTAMP"
property=
"updated_at"
/>
</resultMap>
<resultMap
id=
"BlackGreyListDetailsMap"
type=
"cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"rId"
jdbcType=
"VARCHAR"
property=
"r_id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"phoneNo"
jdbcType=
"VARCHAR"
property=
"phone_no"
/>
<result
column=
"idNo"
jdbcType=
"VARCHAR"
property=
"id_no"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"reasonCode"
jdbcType=
"VARCHAR"
property=
"reason_code"
/>
<result
column=
"totalOverdueDays"
jdbcType=
"VARCHAR"
property=
"total_overdue_days"
/>
<result
column=
"maxOverdueDays"
jdbcType=
"VARCHAR"
property=
"max_overdue_days"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"createdAt"
jdbcType=
"TIMESTAMP"
property=
"created_at"
/>
<result
column=
"updatedAt"
jdbcType=
"TIMESTAMP"
property=
"updated_at"
/>
</resultMap>
<select
id=
"findBGLResultByRid"
parameterType=
"java.lang.String"
resultMap=
"BlackGreyListResultMap"
>
select * from black_grey_list_result where r_id = #{rId, jdbcType=VARCHAR} ;
</select>
<select
id=
"findBlackGreyListResult"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo"
resultMap=
"BlackGreyListResultMap"
>
select * from black_grey_list_result
<trim
prefix=
"where"
prefixOverrides=
"and"
>
<if
test=
"rId != null"
>
and r_id = #{rId,jdbcType=VARCHAR}
</if>
<if
test=
"phoneNo != null"
>
and phone_no = #{phoneNo,jdbcType=VARCHAR}
</if>
<if
test=
"name != null"
>
and name = #{name,jdbcType=VARCHAR}
</if>
<if
test=
"idNo != null"
>
and id_no = #{idNo,jdbcType=VARCHAR}
</if>
<if
test=
"blackType != null"
>
and black_type = #{blackType,jdbcType=VARCHAR}
</if>
</trim>
</select>
<insert
id=
"insertBlackGreyListResult"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult"
>
insert ignore into black_grey_list_result (`r_id`, `uuid`, `name`, `phone_no`, `id_no`, `phone_no_md5`, `id_no_md5`, `black_type`, `types`, `reasons`, `created_at`, `updated_at`)
values
(#{rId, jdbcType=VARCHAR}, #{uuid, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{phoneNo, jdbcType=VARCHAR}, #{idNo, jdbcType=VARCHAR}, #{phoneNoMd5, jdbcType=VARCHAR}, #{idNoMd5, jdbcType=VARCHAR},
#{blackType, jdbcType=VARCHAR}, #{types, jdbcType=VARCHAR}, #{reasons, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR})
</insert>
<insert
id=
"insertBlackGreyListDetails"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails"
>
insert ignore into black_grey_list_details (`r_id`, `name`, `phone_no`, `id_no`, `type`, `reason_code`,
`max_overdue_days`, `total_overdue_days`, `status`, `remark`, `created_at`, `updated_at`)
values
(#{rId, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{phoneNo, jdbcType=VARCHAR}, #{idNo, jdbcType=VARCHAR}, #{type, jdbcType=VARCHAR}, #{reasonCode, jdbcType=VARCHAR},
#{maxOverdueDays, jdbcType=VARCHAR}, #{totalOverdueDays, jdbcType=VARCHAR}, #{status, jdbcType=INTEGER}, #{remark, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR})
</insert>
<!--<insert id="insertBatch"
parameterType="cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0">
insert into black_list_new (`uuid`, `name`, `phone_no`, `id_no`, `major_type`, `type`, `total_overdue_days`,
`max_overdue_days`, `black_level`)
values
<foreach collection="list" item="item" separator=",">
(#{uuid, jdbcType=VARCHAR},
#{name, jdbcType=VARCHAR},
#{phone_no, jdbcType=VARCHAR},
#{id_no, jdbcType=VARCHAR},
#{major_type, jdbcType=VARCHAR},
#{type, jdbcType=VARCHAR},
#{total_overdue_days, jdbcType=VARCHAR},
#{max_overdue_days, jdbcType=VARCHAR},
#{black_level, jdbcType=VARCHAR})
</foreach>
</insert>-->
<update
id=
"updateBlackGreyListResult"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult"
>
update black_grey_list_result
<set>
<if
test=
"blackType!=null"
>
black_type = #{blackType,jdbcType=VARCHAR},
</if>
<if
test=
"types!=null"
>
types = #{types,jdbcType=VARCHAR},
</if>
<if
test=
"reasons!=null"
>
reasons = #{reasons,jdbcType=VARCHAR},
</if>
<if
test=
"updatedAt!=null"
>
updated_at = #{updatedAt,jdbcType=VARCHAR}
</if>
where
r_id = #{rId,jdbcType=VARCHAR};
</set>
</update>
<update
id=
"updateDetailsStatus"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails"
>
update black_grey_list_details
set status = #{status,jdbcType=INTEGER}, updated_at = #{updatedAt,jdbcType=VARCHAR}
where
r_id = #{rId,jdbcType=VARCHAR} AND status=0 ;
</update>
</mapper>
\ No newline at end of file
src/main/java/cn/quantgroup/qgblservice/repository/mybatis/xml/blacklist/BlackListQueryMapper.xml
View file @
1e4bf001
...
...
@@ -67,7 +67,7 @@
<update
id=
"updateThreeElementsById"
parameterType=
"cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0"
>
update black_list_new
<set>
<if
test=
"uuid!=null"
>
uuid = #{uuid,jdbcType=VARCHAR},
</if>
<if
test=
"uuid!=null"
>
uuid = #{uuid,jdbcType=VARCHAR},
</if>
<if
test=
"name!=null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"phoneNo!=null"
>
phone_no = #{phoneNo,jdbcType=VARCHAR},
</if>
<if
test=
"idNo!=null"
>
id_no = #{idNo,jdbcType=VARCHAR}
</if>
...
...
src/main/java/cn/quantgroup/qgblservice/service/IBlackGreyListService.java
0 → 100644
View file @
1e4bf001
package
cn
.
quantgroup
.
qgblservice
.
service
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.util.List
;
/**
* -----------------------------------------------------------------------------<br>
* 类描述: 黑灰名单表 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.14 20:34 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
public
interface
IBlackGreyListService
{
/**
* -----------------------------------------------------------------------------<br>
* 描述: 往black_grey_list_result表及black_grey_list_details表插入<br>
* 作者:yanhui.Hao <br>
* 时间:2020.04.02 <br>
* 授权: (C) Copyright (c) 2017 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*/
int
saveBlackRreyList
(
TmpBlackGreyList
blackGreyObj
);
int
saveBlackRreyListByJdbc
(
List
<
TmpBlackGreyList
>
tmpQueryList
)
throws
SQLException
;
}
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackGreyListServiceImpl.java
0 → 100644
View file @
1e4bf001
package
cn
.
quantgroup
.
qgblservice
.
service
.
impl
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListQueryVo
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.Reasons
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList
;
import
cn.quantgroup.qgblservice.repository.mybatis.mapper.blacklist.BlackGreyListMapper
;
import
cn.quantgroup.qgblservice.service.IBlackGreyListService
;
import
cn.quantgroup.qgblservice.utils.MD5Util
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.concurrent.atomic.AtomicInteger
;
@Slf4j
@Service
public
class
BlackGreyListServiceImpl
implements
IBlackGreyListService
{
//@Autowired
//private JdbcTemplate xyqbUserJdbcTemplate;
// @Autowired
//private JdbcTemplate xyqbJdbcTemplate;
@Autowired
private
JdbcTemplate
blackListJdbcTemplate
;
//@Autowired
//private JdbcTemplate acsdbJdbcTemplate;
@Autowired
private
BlackGreyListMapper
blackGreyListMapper
;
//private static Map<String, Integer> channelBlackListExpireConfigMap = new ConcurrentHashMap<>();
/*@PostConstruct
public void initChannelBlackListExpireConfig() {
List<BlackListChannelExpireConfigVo0> queryBlackListChannelExpireConfigVo0List = blackListJdbcTemplate.query(Constant.SQL.BLACK_LIST_NEW_QUERY_CHANNEL_BLACK_LIST_EXPIRE_CONFIG_SQL, new BeanPropertyRowMapper<>(BlackListChannelExpireConfigVo0.class));
channelBlackListExpireConfigMap = queryBlackListChannelExpireConfigVo0List.stream().collect(Collectors.toMap(BlackListChannelExpireConfigVo0::getType, BlackListChannelExpireConfigVo0::getExpireTime));
log.info("加载渠道黑名单有效期配置完成, result: {} ", JSON.toJSONString(channelBlackListExpireConfigMap));
}*/
/**
* -----------------------------------------------------------------------------<br>
* 描述: 往black_grey_list_result表及black_grey_list_details表插入<br>
* 作者:yanhui.Hao <br>
* 时间:2020.04.02 <br>
* 授权: (C) Copyright (c) 2017 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
*
* @param blackGreyObj
*/
@Override
public
int
saveBlackRreyList
(
TmpBlackGreyList
blackGreyObj
)
{
try
{
BlackGreyListQueryVo
queryResultParam
=
BlackGreyListQueryVo
.
builder
().
name
(
blackGreyObj
.
getName
()).
idNo
(
blackGreyObj
.
getIdNo
()).
phoneNo
(
blackGreyObj
.
getPhoneNo
()).
build
();
List
<
BlackGreyListResult
>
blackGreyResultList
=
blackGreyListMapper
.
findBlackGreyListResult
(
queryResultParam
);
BlackGreyListResult
oldResult
=
null
;
BlackGreyListDetails
details
=
new
BlackGreyListDetails
();
//结果中没有,新增
if
(
blackGreyResultList
==
null
||
blackGreyResultList
.
size
()==
0
){
String
rId
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
oldResult
=
new
BlackGreyListResult
();
oldResult
.
setRId
(
rId
);
oldResult
.
setUuid
(
blackGreyObj
.
getUuid
()!=
null
?
blackGreyObj
.
getUuid
().
trim
()
:
null
);
oldResult
.
setName
(
blackGreyObj
.
getName
()!=
null
?
blackGreyObj
.
getName
().
trim
()
:
null
);
oldResult
.
setPhoneNo
(
blackGreyObj
.
getPhoneNo
()!=
null
?
blackGreyObj
.
getPhoneNo
().
trim
()
:
null
);
oldResult
.
setIdNo
(
blackGreyObj
.
getIdNo
()!=
null
?
blackGreyObj
.
getIdNo
().
trim
().
toUpperCase
()
:
null
);
if
(
StringUtils
.
isNotEmpty
(
oldResult
.
getPhoneNo
())){
oldResult
.
setPhoneNoMd5
(
MD5Util
.
getMD5Digest
(
oldResult
.
getPhoneNo
()));
}
if
(
StringUtils
.
isNotEmpty
(
oldResult
.
getIdNo
())){
oldResult
.
setIdNoMd5
(
MD5Util
.
getMD5Digest
(
oldResult
.
getIdNo
()));
}
oldResult
.
setBlackType
(
blackGreyObj
.
getBlackType
());
oldResult
.
setTypes
(
blackGreyObj
.
getType
());
List
<
Reasons
>
reasonsList
=
BlackGreyListResult
.
reasonsToList
(
null
,
blackGreyObj
.
getJoinBlackReason
(),
blackGreyObj
.
getType
());
oldResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
oldResult
.
setCreatedAt
(
blackGreyObj
.
getCreatedAt
());
oldResult
.
setUpdatedAt
(
blackGreyObj
.
getUpdatedAt
());
details
.
setRId
(
rId
);
details
.
setName
(
oldResult
.
getName
());
details
.
setPhoneNo
(
oldResult
.
getPhoneNo
());
details
.
setIdNo
(
oldResult
.
getIdNo
());
details
.
setType
(
blackGreyObj
.
getType
());
details
.
setReasonCode
(
blackGreyObj
.
getJoinBlackReason
());
details
.
setMaxOverdueDays
(
blackGreyObj
.
getMaxOverdueDays
());
details
.
setTotalOverdueDays
(
blackGreyObj
.
getTotalOverdueDays
());
details
.
setStatus
(
0
);
//状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的);-3:在插入灰名单时,已经是黑名单 10:当前在黑名单,并且该条数据逾期已还清的
details
.
setRemark
(
blackGreyObj
.
getRemark
());
details
.
setCreatedAt
(
blackGreyObj
.
getCreatedAt
());
details
.
setUpdatedAt
(
blackGreyObj
.
getUpdatedAt
());
int
insert_result
=
blackGreyListMapper
.
insertBlackGreyListResult
(
oldResult
);
int
insert_details
=
blackGreyListMapper
.
insertBlackGreyListDetails
(
details
);
log
.
info
(
"黑灰名单增加结束-结果表插入: {} , 明细表插入: {} , blackGreyObj : {} "
,
insert_result
,
insert_details
,
blackGreyObj
.
toString
());
return
1
;
}
else
{
if
(
blackGreyResultList
.
size
()!=
1
){
log
.
error
(
"通过三要素正常查询结果表只有一条数据, 此时存在 "
+
blackGreyResultList
.
size
()+
" 条, blackGreyObj: {} "
,
blackGreyObj
.
toString
());
throw
new
SQLException
(
"通过三要素正常查询结果表只有一条数据, 此时存在 "
+
blackGreyResultList
.
size
()+
" 条, id="
+
blackGreyObj
.
getId
());
}
oldResult
=
blackGreyResultList
.
get
(
0
);
BlackGreyListResult
updateResult
=
new
BlackGreyListResult
();
BlackGreyListDetails
updateDetailsParam
=
null
;
//updateParams.setUpdatedAt("")
//updateParams.setBlackType("");
//updateParams.setTypes("");
//updateParams.setReasons("");
updateResult
.
setRId
(
oldResult
.
getRId
());
if
(
oldResult
.
getUpdatedAt
().
getTime
()
>=
blackGreyObj
.
getUpdatedAt
().
getTime
()){
updateResult
.
setUpdatedAt
(
oldResult
.
getUpdatedAt
());
}
else
{
updateResult
.
setUpdatedAt
(
blackGreyObj
.
getUpdatedAt
());
}
Set
<
String
>
typeSet
=
BlackGreyListResult
.
typesToSet
(
oldResult
.
getTypes
(),
blackGreyObj
.
getType
());
List
<
Reasons
>
reasonsList
=
BlackGreyListResult
.
reasonsToList
(
oldResult
.
getReasons
(),
blackGreyObj
.
getJoinBlackReason
(),
blackGreyObj
.
getType
());
/* 状态 status
0:正常有效的;
-1:由灰名单进入黑名单(无效,逻辑删除的);
-2:由黑名单进入灰名单(无效,逻辑删除的);
-3:在插入灰名单时,已经是黑名单
10:当前在黑名单,并且该条数据逾期已还清的
*/
int
details_status
=
0
;
if
(
"1"
.
equals
(
oldResult
.
getBlackType
())
&&
"1"
.
equals
(
blackGreyObj
.
getBlackType
())){
updateResult
.
setBlackType
(
"1"
);
updateResult
.
setTypes
(
String
.
join
(
","
,
typeSet
));
updateResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
}
else
if
(
"2"
.
equals
(
oldResult
.
getBlackType
())
&&
"2"
.
equals
(
blackGreyObj
.
getBlackType
())){
updateResult
.
setBlackType
(
"2"
);
updateResult
.
setTypes
(
String
.
join
(
","
,
typeSet
));
updateResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
}
//黑名单,不能转灰
else
if
(
"1"
.
equals
(
oldResult
.
getBlackType
())
&&
"2"
.
equals
(
blackGreyObj
.
getBlackType
())){
updateResult
.
setBlackType
(
"1"
);
updateResult
.
setTypes
(
String
.
join
(
","
,
typeSet
));
updateResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
details_status
=
-
3
;
// -3:在插入灰名单时,已经是黑名单
}
//由灰名单 转 黑名单
else
if
(
"2"
.
equals
(
oldResult
.
getBlackType
())
&&
"1"
.
equals
(
blackGreyObj
.
getBlackType
())){
updateResult
.
setBlackType
(
"1"
);
updateResult
.
setTypes
(
String
.
join
(
","
,
typeSet
));
updateResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
updateDetailsParam
=
new
BlackGreyListDetails
();
updateDetailsParam
.
setRId
(
oldResult
.
getRId
());
updateDetailsParam
.
setStatus
(-
1
);
//-1:由灰名单进入黑名单(无效,逻辑删除的)
Timestamp
newTime
=
new
Timestamp
(
System
.
currentTimeMillis
());
updateDetailsParam
.
setUpdatedAt
(
newTime
);
}
else
{
log
.
error
(
"黑灰名单新增发现其他类别BlackType, oldResult : {} , blackGrey : {} "
,
oldResult
.
toString
(),
blackGreyObj
.
toString
());
throw
new
SQLException
(
"黑灰名单新增发现其他类别BlackType, oldResult:"
+
oldResult
.
getBlackType
()+
", blackGrey:"
+
blackGreyObj
.
getBlackType
());
}
details
.
setRId
(
oldResult
.
getRId
());
details
.
setName
(
oldResult
.
getName
());
details
.
setPhoneNo
(
oldResult
.
getPhoneNo
());
details
.
setIdNo
(
oldResult
.
getIdNo
());
details
.
setType
(
blackGreyObj
.
getType
());
details
.
setReasonCode
(
blackGreyObj
.
getJoinBlackReason
());
details
.
setMaxOverdueDays
(
blackGreyObj
.
getMaxOverdueDays
());
details
.
setTotalOverdueDays
(
blackGreyObj
.
getTotalOverdueDays
());
details
.
setStatus
(
details_status
);
details
.
setRemark
(
blackGreyObj
.
getRemark
());
details
.
setCreatedAt
(
blackGreyObj
.
getCreatedAt
());
details
.
setUpdatedAt
(
blackGreyObj
.
getUpdatedAt
());
int
delete_details
=
0
;
if
(
updateDetailsParam
!=
null
){
delete_details
=
blackGreyListMapper
.
updateDetailsStatus
(
updateDetailsParam
);
}
int
insert_details
=
blackGreyListMapper
.
insertBlackGreyListDetails
(
details
);
int
update_result
=
blackGreyListMapper
.
updateBlackGreyListResult
(
updateResult
);
log
.
info
(
"黑灰名单增加结束-结果表修改: {} , 明细表插入: {} , 明细表修改: {} , blackGreyObj : {} "
,
update_result
,
insert_details
,
delete_details
,
blackGreyObj
.
toString
());
return
1
;
}
}
catch
(
Exception
e
){
log
.
error
(
"黑灰名单增加数据异常, bean: {} "
,
blackGreyObj
.
toString
(),
e
);
}
return
0
;
}
@Override
public
int
saveBlackRreyListByJdbc
(
List
<
TmpBlackGreyList
>
tmpQueryList
)
throws
SQLException
{
/*String sql_insert_result = " insert ignore into black_grey_list_result (`r_id`, `uuid`, `name`, `phone_no`, `id_no`, `phone_no_md5`, `id_no_md5`, `black_type`, `types`, `reasons`, `created_at`, `updated_at`) " +
" values (?,?,?,?,?,?,?,?,?,?,?,?) ;";
String sql_insert_details = " insert ignore into black_grey_list_details (`r_id`, `name`, `phone_no`, `id_no`, `type`, `reason_code`, `max_overdue_days`, `total_overdue_days`, `status`, `remark`, `created_at`, `updated_at`) " +
" values (?,?,?,?,?,?,?,?,?,?,?,?) ;";
String sql_update_result = "UPDATE black_grey_list_result set black_type=?, types=?, reasons=?, updated_at=? WHERE r_id=? ;";
String sql_update_details = "UPDATE black_grey_list_details set status=?, updated_at=? WHERE r_id=? AND status=0;";*/
AtomicInteger
atomicInteger
=
new
AtomicInteger
();
Connection
conn
=
null
;
Statement
statement
=
null
;
Boolean
ac
=
null
;
try
{
conn
=
blackListJdbcTemplate
.
getDataSource
().
getConnection
();
statement
=
conn
.
createStatement
();
// 获取到原本的自动提交状态
ac
=
conn
.
getAutoCommit
();
for
(
TmpBlackGreyList
blackGreyObj
:
tmpQueryList
){
BlackGreyListResult
insertResult
=
null
;
BlackGreyListResult
updateResult
=
null
;
BlackGreyListDetails
insertdetails
=
null
;
BlackGreyListDetails
deleteDetails
=
null
;
try
{
BlackGreyListQueryVo
queryResultParam
=
BlackGreyListQueryVo
.
builder
().
name
(
blackGreyObj
.
getName
()).
idNo
(
blackGreyObj
.
getIdNo
()).
phoneNo
(
blackGreyObj
.
getPhoneNo
()).
build
();
List
<
BlackGreyListResult
>
blackGreyResultList
=
blackGreyListMapper
.
findBlackGreyListResult
(
queryResultParam
);
//结果中没有,新增
if
(
blackGreyResultList
==
null
||
blackGreyResultList
.
size
()==
0
){
String
rId
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
insertResult
=
new
BlackGreyListResult
();
insertResult
.
setRId
(
rId
);
insertResult
.
setUuid
(
blackGreyObj
.
getUuid
()!=
null
?
blackGreyObj
.
getUuid
().
trim
()
:
null
);
insertResult
.
setName
(
blackGreyObj
.
getName
()!=
null
?
blackGreyObj
.
getName
().
trim
()
:
null
);
insertResult
.
setPhoneNo
(
blackGreyObj
.
getPhoneNo
()!=
null
?
blackGreyObj
.
getPhoneNo
().
trim
()
:
null
);
insertResult
.
setIdNo
(
blackGreyObj
.
getIdNo
()!=
null
?
blackGreyObj
.
getIdNo
().
trim
().
toUpperCase
()
:
null
);
if
(
StringUtils
.
isNotEmpty
(
insertResult
.
getPhoneNo
())){
insertResult
.
setPhoneNoMd5
(
MD5Util
.
getMD5Digest
(
insertResult
.
getPhoneNo
()));
}
if
(
StringUtils
.
isNotEmpty
(
insertResult
.
getIdNo
())){
insertResult
.
setIdNoMd5
(
MD5Util
.
getMD5Digest
(
insertResult
.
getIdNo
()));
}
insertResult
.
setBlackType
(
blackGreyObj
.
getBlackType
());
insertResult
.
setTypes
(
blackGreyObj
.
getType
());
List
<
Reasons
>
reasonsList
=
BlackGreyListResult
.
reasonsToList
(
null
,
blackGreyObj
.
getJoinBlackReason
(),
blackGreyObj
.
getType
());
insertResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
insertResult
.
setCreatedAt
(
blackGreyObj
.
getCreatedAt
());
insertResult
.
setUpdatedAt
(
blackGreyObj
.
getUpdatedAt
());
insertdetails
=
new
BlackGreyListDetails
();
insertdetails
.
setRId
(
rId
);
insertdetails
.
setName
(
insertResult
.
getName
());
insertdetails
.
setPhoneNo
(
insertResult
.
getPhoneNo
());
insertdetails
.
setIdNo
(
insertResult
.
getIdNo
());
insertdetails
.
setType
(
blackGreyObj
.
getType
());
insertdetails
.
setReasonCode
(
blackGreyObj
.
getJoinBlackReason
());
insertdetails
.
setMaxOverdueDays
(
blackGreyObj
.
getMaxOverdueDays
());
insertdetails
.
setTotalOverdueDays
(
blackGreyObj
.
getTotalOverdueDays
());
insertdetails
.
setStatus
(
0
);
//状态 0:正常有效的; -1:由灰名单进入黑名单(无效,逻辑删除的); -2:由黑名单进入灰名单(无效,逻辑删除的);-3:在插入灰名单时,已经是黑名单 10:当前在黑名单,并且该条数据逾期已还清的
insertdetails
.
setRemark
(
blackGreyObj
.
getRemark
());
insertdetails
.
setCreatedAt
(
blackGreyObj
.
getCreatedAt
());
insertdetails
.
setUpdatedAt
(
blackGreyObj
.
getUpdatedAt
());
/* int insert_result = blackGreyListMapper.insertBlackGreyListResult(insertResult);
int insert_details =blackGreyListMapper.insertBlackGreyListDetails(insertdetails);*/
log
.
info
(
"黑灰名单增加结束-结果表插入: {} , 明细表插入: {} "
,
insertResult
.
toString
(),
insertdetails
.
toString
());
}
else
{
if
(
blackGreyResultList
.
size
()!=
1
){
log
.
error
(
"通过三要素正常查询结果表只有一条数据, 此时存在 "
+
blackGreyResultList
.
size
()+
" 条, blackGreyObj: {} "
,
blackGreyObj
.
toString
());
throw
new
SQLException
(
"通过三要素正常查询结果表只有一条数据, 此时存在 "
+
blackGreyResultList
.
size
()+
" 条, id="
+
blackGreyObj
.
getId
());
}
BlackGreyListResult
oldResult
=
blackGreyResultList
.
get
(
0
);
updateResult
=
new
BlackGreyListResult
();
//updateParams.setUpdatedAt("")
//updateParams.setBlackType("");
//updateParams.setTypes("");
//updateParams.setReasons("");
updateResult
.
setRId
(
oldResult
.
getRId
());
if
(
oldResult
.
getUpdatedAt
().
getTime
()
>=
blackGreyObj
.
getUpdatedAt
().
getTime
()){
updateResult
.
setUpdatedAt
(
oldResult
.
getUpdatedAt
());
}
else
{
updateResult
.
setUpdatedAt
(
blackGreyObj
.
getUpdatedAt
());
}
Set
<
String
>
typeSet
=
BlackGreyListResult
.
typesToSet
(
oldResult
.
getTypes
(),
blackGreyObj
.
getType
());
List
<
Reasons
>
reasonsList
=
BlackGreyListResult
.
reasonsToList
(
oldResult
.
getReasons
(),
blackGreyObj
.
getJoinBlackReason
(),
blackGreyObj
.
getType
());
/* 状态 status
0:正常有效的;
-1:由灰名单进入黑名单(无效,逻辑删除的);
-2:由黑名单进入灰名单(无效,逻辑删除的);
-3:在插入灰名单时,已经是黑名单
10:当前在黑名单,并且该条数据逾期已还清的
*/
int
details_status
=
0
;
if
(
"1"
.
equals
(
oldResult
.
getBlackType
())
&&
"1"
.
equals
(
blackGreyObj
.
getBlackType
())){
updateResult
.
setBlackType
(
"1"
);
updateResult
.
setTypes
(
String
.
join
(
","
,
typeSet
));
updateResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
}
else
if
(
"2"
.
equals
(
oldResult
.
getBlackType
())
&&
"2"
.
equals
(
blackGreyObj
.
getBlackType
())){
updateResult
.
setBlackType
(
"2"
);
updateResult
.
setTypes
(
String
.
join
(
","
,
typeSet
));
updateResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
}
//黑名单,不能转灰
else
if
(
"1"
.
equals
(
oldResult
.
getBlackType
())
&&
"2"
.
equals
(
blackGreyObj
.
getBlackType
())){
updateResult
.
setBlackType
(
"1"
);
updateResult
.
setTypes
(
String
.
join
(
","
,
typeSet
));
updateResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
details_status
=
-
3
;
// -3:在插入灰名单时,已经是黑名单
}
//由灰名单 转 黑名单 >> 需要将明细表里之前的灰名单明细逻辑删除
else
if
(
"2"
.
equals
(
oldResult
.
getBlackType
())
&&
"1"
.
equals
(
blackGreyObj
.
getBlackType
())){
updateResult
.
setBlackType
(
"1"
);
updateResult
.
setTypes
(
String
.
join
(
","
,
typeSet
));
updateResult
.
setReasons
(
JSON
.
toJSONString
(
reasonsList
));
deleteDetails
=
new
BlackGreyListDetails
();
deleteDetails
.
setRId
(
oldResult
.
getRId
());
deleteDetails
.
setStatus
(-
1
);
//-1:由灰名单进入黑名单(无效,逻辑删除的)
Timestamp
newTime
=
new
Timestamp
(
System
.
currentTimeMillis
());
deleteDetails
.
setUpdatedAt
(
newTime
);
}
else
{
log
.
error
(
"黑灰名单新增发现其他类别BlackType, oldResult : {} , blackGrey : {} "
,
oldResult
.
toString
(),
blackGreyObj
.
toString
());
throw
new
SQLException
(
"黑灰名单新增发现其他类别BlackType, oldResult:"
+
oldResult
.
getBlackType
()+
", blackGrey:"
+
blackGreyObj
.
getBlackType
());
}
insertdetails
=
new
BlackGreyListDetails
();
insertdetails
.
setRId
(
oldResult
.
getRId
());
insertdetails
.
setName
(
oldResult
.
getName
());
insertdetails
.
setPhoneNo
(
oldResult
.
getPhoneNo
());
insertdetails
.
setIdNo
(
oldResult
.
getIdNo
());
insertdetails
.
setType
(
blackGreyObj
.
getType
());
insertdetails
.
setReasonCode
(
blackGreyObj
.
getJoinBlackReason
());
insertdetails
.
setMaxOverdueDays
(
blackGreyObj
.
getMaxOverdueDays
());
insertdetails
.
setTotalOverdueDays
(
blackGreyObj
.
getTotalOverdueDays
());
insertdetails
.
setStatus
(
details_status
);
insertdetails
.
setRemark
(
blackGreyObj
.
getRemark
());
insertdetails
.
setCreatedAt
(
blackGreyObj
.
getCreatedAt
());
insertdetails
.
setUpdatedAt
(
blackGreyObj
.
getUpdatedAt
());
/* int delete_details = 0;
if(iupdatedetails!=null){
delete_details = blackGreyListMapper.updateDetailsStatus(iupdatedetails);
}
int insert_details = blackGreyListMapper.insertBlackGreyListDetails(insertdetails);
int update_result = blackGreyListMapper.updateBlackGreyListResult(updateResult);*/
log
.
info
(
"黑灰名单增加结束-结果表修改: {} , 明细表插入: {} , 明细表修改: {} , blackGreyObj : {} "
,
updateResult
.
toString
(),
insertdetails
.
toString
(),
deleteDetails
,
blackGreyObj
.
toString
());
}
}
catch
(
Exception
e
){
log
.
error
(
"黑灰名单增加筛选结果异常, blackGreyObj : {}"
,
blackGreyObj
.
toString
(),
e
);
}
if
(
deleteDetails
!=
null
){
StringBuffer
sql_buff
=
new
StringBuffer
(
"UPDATE black_grey_list_details set "
);
sql_buff
.
append
(
" status="
).
append
(
deleteDetails
.
getStatus
()).
append
(
", "
);
sql_buff
.
append
(
" updated_at="
).
append
(
getValue
(
deleteDetails
.
getUpdatedAt
().
toString
()));
sql_buff
.
append
(
" where "
);
sql_buff
.
append
(
" r_id="
).
append
(
getValue
(
deleteDetails
.
getRId
()));
sql_buff
.
append
(
"AND status=0 "
);
// 防止把当前insert的这一条status也修改了
if
(
insertdetails
!=
null
){
sql_buff
.
append
(
" AND type!="
).
append
(
getValue
(
insertdetails
.
getType
()));
}
sql_buff
.
append
(
";"
);
// 批处理多条sql操作
statement
.
addBatch
(
sql_buff
.
toString
());
}
if
(
updateResult
!=
null
){
StringBuffer
sql_buff
=
new
StringBuffer
(
"UPDATE black_grey_list_result set "
);
sql_buff
.
append
(
" black_type="
).
append
(
getValue
(
updateResult
.
getBlackType
())).
append
(
", "
);
sql_buff
.
append
(
" types="
).
append
(
getValue
(
updateResult
.
getTypes
())).
append
(
", "
);
sql_buff
.
append
(
" reasons="
).
append
(
getValue
(
updateResult
.
getReasons
())).
append
(
", "
);
sql_buff
.
append
(
" updated_at="
).
append
(
getValue
(
updateResult
.
getUpdatedAt
().
toString
()));
sql_buff
.
append
(
" where "
);
sql_buff
.
append
(
" r_id="
).
append
(
getValue
(
updateResult
.
getRId
()));
sql_buff
.
append
(
";"
);
// 批处理多条sql操作
statement
.
addBatch
(
sql_buff
.
toString
());
}
if
(
insertResult
!=
null
){
StringBuffer
sql_buff
=
new
StringBuffer
(
"insert ignore into black_grey_list_result (`r_id`, `uuid`, `name`, `phone_no`, `id_no`, `phone_no_md5`, `id_no_md5`, `black_type`, `types`, `reasons`, `created_at`, `updated_at`) "
);
sql_buff
.
append
(
" values ("
);
sql_buff
.
append
(
getValue
(
insertResult
.
getRId
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getUuid
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getName
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getPhoneNo
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getIdNo
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getPhoneNoMd5
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getIdNoMd5
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getBlackType
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getTypes
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getReasons
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getCreatedAt
().
toString
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertResult
.
getUpdatedAt
().
toString
()));
sql_buff
.
append
(
") ;"
);
statement
.
addBatch
(
sql_buff
.
toString
());
}
if
(
insertdetails
!=
null
){
StringBuffer
sql_buff
=
new
StringBuffer
(
"insert ignore into black_grey_list_details (`r_id`, `name`, `phone_no`, `id_no`, `type`, `reason_code`, `max_overdue_days`, `total_overdue_days`, `status`, `remark`, `created_at`, `updated_at`) "
);
sql_buff
.
append
(
" values ("
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getRId
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getName
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getPhoneNo
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getIdNo
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getType
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getReasonCode
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getMaxOverdueDays
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getTotalOverdueDays
())).
append
(
", "
);
sql_buff
.
append
(
insertdetails
.
getStatus
()).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getRemark
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getCreatedAt
().
toString
())).
append
(
", "
);
sql_buff
.
append
(
getValue
(
insertdetails
.
getUpdatedAt
().
toString
()));
sql_buff
.
append
(
") ;"
);
// 批处理多条sql操作
statement
.
addBatch
(
sql_buff
.
toString
());
}
// 关闭自动提交
conn
.
setAutoCommit
(
false
);
try
{
// 提交批处理
statement
.
executeBatch
();
// 若批处理无异常,则准备手动commit
conn
.
commit
();
atomicInteger
.
getAndIncrement
();
statement
.
clearBatch
();
}
catch
(
Exception
e
)
{
log
.
error
(
"黑灰名单增加数据提交异常, blackGreyObj: {} , insertResult: {} , insertdetails: {} , updateResult: {} , updatedetails: {} "
,
blackGreyObj
.
toString
(),
insertResult
!=
null
?
insertResult
.
toString
():
null
,
insertdetails
!=
null
?
insertdetails
.
toString
():
null
,
updateResult
!=
null
?
updateResult
.
toString
():
null
,
deleteDetails
!=
null
?
deleteDetails
.
toString
():
null
,
e
);
// 批处理抛异常,则rollback
try
{
conn
.
rollback
();
}
catch
(
SQLException
ex
)
{
ex
.
printStackTrace
();
log
.
error
(
"黑灰名单增加数据回滚异常, blackGreyObj: {} "
,
blackGreyObj
.
toString
(),
e
);
}
}
}
}
catch
(
Exception
e
){
log
.
error
(
"黑灰名单增加数据异常"
,
e
);
}
finally
{
// 恢复到原本的自动提交状态
if
(
ac
!=
null
){
conn
.
setAutoCommit
(
ac
);
}
if
(
statement
!=
null
)
{
try
{
statement
.
close
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
if
(
conn
!=
null
)
{
try
{
conn
.
close
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
return
atomicInteger
.
get
();
}
private
String
getValue
(
String
value
){
if
(
value
==
null
){
return
null
;
}
else
{
return
"'"
+
value
+
"'"
;
}
}
}
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListManagerServiceImpl.java
View file @
1e4bf001
...
...
@@ -8,8 +8,8 @@ import cn.quantgroup.qgblservice.repository.mybatis.mapper.tidb.BlackListQueryTi
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.service.IBlackListManagerService
;
import
cn.quantgroup.qgblservice.service.IBlackListUpdateThreeEleService
;
import
cn.quantgroup.qgblservice.utils.MD5Util
;
import
cn.quantgroup.qgblservice.utils.ExcelUtil
;
import
cn.quantgroup.qgblservice.utils.MD5Util
;
import
cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters
;
import
com.google.common.base.Stopwatch
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -21,14 +21,10 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
...
...
src/main/java/cn/quantgroup/qgblservice/service/impl/BlackListToolsManagerServiceImpl.java
View file @
1e4bf001
...
...
@@ -7,10 +7,12 @@ import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList
import
cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyListRowMapper
;
import
cn.quantgroup.qgblservice.repository.mybatis.entity.xyqbuser.XyqbUser
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.service.IBlackGreyListService
;
import
cn.quantgroup.qgblservice.service.IBlackListToolsManagerService
;
import
cn.quantgroup.qgblservice.utils.MD5Util
;
import
cn.quantgroup.qgblservice.utils.ReadExcelUtils
;
import
cn.quantgroup.qgblservice.utils.ReadOrWriteTxt
;
import
cn.quantgroup.qgblservice.utils.blacklist.BlackListUtils
;
import
cn.quantgroup.qgblservice.utils.jdbc.JdbcExecuters
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Stopwatch
;
...
...
@@ -40,8 +42,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.TimeUnit
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
...
...
@@ -69,8 +69,9 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
private
final
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
private
final
int
LIMIT_1000
=
1000
;
private
static
Pattern
p_chinese
=
Pattern
.
compile
(
"[\u4e00-\u9fa5]"
);
//中文
private
static
Pattern
p_phone
=
Pattern
.
compile
(
"^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$"
);
@Autowired
private
IBlackGreyListService
blackGreyListService
;
@PostConstruct
public
void
initChannelBlackListExpireConfig
()
{
...
...
@@ -491,10 +492,11 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
// update_huiTohei_type2();
}
else
if
(
"update_huiTohei_type10"
.
equals
(
operatType
)){
update_huiTohei_type10
();
//update_huiTohei_type10();
}
else
if
(
"tmpBlackGreyToProduct"
.
equals
(
operatType
)){
tmpBlackGreyToProduct
();
}
else
{
log
.
error
(
"cleanTableData未知的操作类型!"
);
...
...
@@ -502,77 +504,6 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
}
}
private
static
boolean
isContainChinese
(
String
str
)
{
Matcher
m
=
p_chinese
.
matcher
(
str
);
if
(
m
.
find
())
{
return
true
;
}
return
false
;
}
private
static
boolean
isIDNumber
(
String
IDNumber
)
{
if
(
IDNumber
==
null
||
""
.
equals
(
IDNumber
))
{
return
false
;
}
/* String s = "61011319780908211x";
String regex = "\\d{15}|\\d{17}[\\dxX]";
if(s.matches(regex)) {
System.out.println("格式正确");
}else {
System.out.println("格式错误");
}*/
// 定义判别用户身份证号的正则表达式(15位或者18位,最后一位可以为字母)
String
regularExpression
=
"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|"
+
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)"
;
boolean
matches
=
IDNumber
.
matches
(
regularExpression
);
//判断第18位校验值
if
(
matches
)
{
if
(
IDNumber
.
length
()
==
18
)
{
try
{
char
[]
charArray
=
IDNumber
.
toCharArray
();
//前十七位加权因子
int
[]
idCardWi
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
//这是除以11后,可能产生的11位余数对应的验证码
String
[]
idCardY
=
{
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
"4"
,
"3"
,
"2"
};
int
sum
=
0
;
for
(
int
i
=
0
;
i
<
idCardWi
.
length
;
i
++)
{
int
current
=
Integer
.
parseInt
(
String
.
valueOf
(
charArray
[
i
]));
int
count
=
current
*
idCardWi
[
i
];
sum
+=
count
;
}
char
idCardLast
=
charArray
[
17
];
int
idCardMod
=
sum
%
11
;
if
(
idCardY
[
idCardMod
].
toUpperCase
().
equals
(
String
.
valueOf
(
idCardLast
).
toUpperCase
()))
{
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
}
}
}
return
matches
;
}
/**
* 大陆手机号码11位数,匹配格式:前三位固定格式+后8位任意数
* 此方法中前三位格式有:
* 13+任意数
* 15+除4的任意数
* 18+除1和4的任意数
* 17+除9的任意数
* 147
*/
private
static
boolean
isChinaPhone
(
String
str
)
{
Matcher
m
=
p_phone
.
matcher
(
str
);
return
m
.
matches
();
}
private
void
copyBlackListNew
(){
long
star
=
System
.
currentTimeMillis
();
...
...
@@ -631,7 +562,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
queryBean
.
setPhoneNo
(
null
);
}
//手机号等于姓名的
else
if
(
queryBean
.
getName
()!=
null
&&
queryBean
.
getPhoneNo
().
equals
(
queryBean
.
getName
())
&&
isContainChinese
(
queryBean
.
getPhoneNo
())){
else
if
(
queryBean
.
getName
()!=
null
&&
queryBean
.
getPhoneNo
().
equals
(
queryBean
.
getName
())
&&
BlackListUtils
.
isContainChinese
(
queryBean
.
getPhoneNo
())){
queryBean
.
setPhoneNo
(
null
);
}
}
...
...
@@ -654,7 +585,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
if
(
queryBean
.
getName
()!=
null
&&
queryBean
.
getIdNo
()!=
null
&&
(
queryBean
.
getName
().
length
()==
15
||
queryBean
.
getName
().
length
()==
18
)){
String
idNo
=
queryBean
.
getIdNo
();
String
name
=
queryBean
.
getName
();
if
(
isContainChinese
(
idNo
)
&&
isIDNumber
(
name
)){
if
(
BlackListUtils
.
isContainChinese
(
idNo
)
&&
BlackListUtils
.
isIDNumber
(
name
)){
queryBean
.
setName
(
idNo
);
queryBean
.
setIdNo
(
name
);
}
...
...
@@ -718,7 +649,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
if
(
queryBean
.
getPhoneNo
()
!=
null
&&
queryBean
.
getPhoneNo
().
length
()
!=
11
)
{
//手机和姓名颠倒的
if
(
queryBean
.
getName
()!=
null
&&
queryBean
.
getPhoneNo
()!=
null
&&
isChinaPhone
(
queryBean
.
getName
())
&&
isContainChinese
(
queryBean
.
getPhoneNo
()))
{
if
(
queryBean
.
getName
()!=
null
&&
queryBean
.
getPhoneNo
()!=
null
&&
BlackListUtils
.
isChinaPhone
(
queryBean
.
getName
())
&&
BlackListUtils
.
isContainChinese
(
queryBean
.
getPhoneNo
()))
{
String
name
=
queryBean
.
getName
();
String
phone
=
queryBean
.
getPhoneNo
();
queryBean
.
setPhoneNo
(
name
);
...
...
@@ -734,7 +665,7 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
updateBeanList
.
add
(
queryBean
);
}
//手机号是姓名的
else
if
(
isContainChinese
(
queryBean
.
getPhoneNo
()))
{
else
if
(
BlackListUtils
.
isContainChinese
(
queryBean
.
getPhoneNo
()))
{
if
(
queryBean
.
getName
()==
null
){
queryBean
.
setName
(
queryBean
.
getPhoneNo
());
}
...
...
@@ -1296,5 +1227,76 @@ public class BlackListToolsManagerServiceImpl implements IBlackListToolsManagerS
log
.
info
(
"\n>>>>>>方法update_huiTohei_type10()处理 Method End, totalQueryCount: {} , totalUpdateCount: {} , totalOkCount: {} , total cost: {} <<<<<<"
,
totalQueryCount
,
totalUpdateCount
,
totalOkCount
,
(
System
.
currentTimeMillis
()
-
totalStar
)
+
".ms"
);
}
/**
* -----------------------------------------------------------------------------<br>
* 描 述: 将tmp_black_grey_list临时表数据,copy到black_grey_list_result、black_grey_list_details <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.15 11:29 <br>
* 最后修改人: <br>
* 最后修改时间: 2020.04.15 11:29 <br>
* 入参说明: <br>
* 出参说明: <br>
* -----------------------------------------------------------------------------
*/
private
void
tmpBlackGreyToProduct
(){
long
totalStar
=
System
.
currentTimeMillis
();
//blackListJdbcTemplate
String
sql_blacklist3_query
=
"SELECT t.id, t.uuid, t.`name`, t.phone_no, t.id_no, t.black_type, t.type, t.join_black_reason, t.max_overdue_days, t.total_overdue_days, t.created_at, t.updated_at "
+
" from tmp_black_grey_list t "
+
" WHERE id > ? AND id<=?;"
;
int
maxId
=
0
;
try
{
String
value
=
stringRedisTemplate
.
opsForValue
().
get
(
"UPDATE_HUITOHEI_MAXID_TYPE1"
);
if
(
StringUtils
.
isNotEmpty
(
value
)){
maxId
=
Integer
.
parseInt
(
value
);
}
}
catch
(
Exception
e
){
log
.
error
(
"获取redis里值异常, key: {} "
,
"UPDATE_HUITOHEI_MAXID_TYPE1"
,
e
);
}
log
.
info
(
"方法tmpBlackGreyToProduct()查询缓存, maxId : {} "
,
maxId
);
if
(
maxId
<=
0
){
return
;
}
int
totalOkCount
=
0
;
int
totalPage
=
maxId
/
LIMIT_1000
;
if
((
maxId
%
LIMIT_1000
)!=
0
){
totalPage
+=
1
;
}
int
startId
=
0
,
endId
=
0
;
for
(
int
page
=
1
;
page
<=
totalPage
;
page
++)
{
startId
=
(
page
-
1
)
*
LIMIT_1000
;
endId
=
page
*
LIMIT_1000
;
long
thisPageStart
=
System
.
currentTimeMillis
();
List
<
TmpBlackGreyList
>
tmpQueryList
=
null
;
int
thisPageOk
=
0
;
try
{
log
.
info
(
"方法tmpBlackGreyToProduct()处理开始 page: {} , startId: {} , endId: {} , totalPage: {} ------>>>>>>"
,
page
,
startId
,
endId
,
totalPage
);
tmpQueryList
=
blackListJdbcTemplate
.
query
(
sql_blacklist3_query
,
new
Object
[]{
startId
,
endId
},
new
TmpBlackGreyListRowMapper
());
if
(
tmpQueryList
!=
null
&&
tmpQueryList
.
size
()>
0
){
/* for (TmpBlackGreyList blackGreyObj : tmpQueryList) {
blackGreyListService.saveBlackRreyList(blackGreyObj);
thisPageOk++;
totalOkCount++;
}*/
int
count
=
blackGreyListService
.
saveBlackRreyListByJdbc
(
tmpQueryList
);
thisPageOk
+=
count
;
totalOkCount
+=
count
;
}
}
catch
(
Exception
e
){
log
.
error
(
"方法tmpBlackGreyToProduct()处理异常, page: {} , startId: {} , endId: {} "
,
page
,
startId
,
endId
,
e
);
}
finally
{
log
.
info
(
"方法tmpBlackGreyToProduct()处理结束 page: {} , startId: {} , endId: {} , tmpQueryList: {} , thisPageOk: {} , 耗时: {} <<<<<<------\n"
,
page
,
startId
,
endId
,
(
tmpQueryList
!=
null
?
tmpQueryList
.
size
():
0
),
thisPageOk
,
((
System
.
currentTimeMillis
()-
thisPageStart
)+
".ms"
));
}
}
log
.
info
(
"\n>>>>>>方法tmpBlackGreyToProduct()处理 Method End, totalOkCount: {} , total cost: {} <<<<<<"
,
totalOkCount
,
(
System
.
currentTimeMillis
()-
totalStar
)+
".ms"
);
}
}
src/main/java/cn/quantgroup/qgblservice/utils/blacklist/BlackListUtils.java
View file @
1e4bf001
...
...
@@ -5,6 +5,8 @@ import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTi
import
java.sql.Timestamp
;
import
java.time.LocalDateTime
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* @Author fengjunkai
...
...
@@ -12,6 +14,11 @@ import java.time.LocalDateTime;
*/
public
class
BlackListUtils
{
private
static
Pattern
p_chinese
=
Pattern
.
compile
(
"[\u4e00-\u9fa5]"
);
//中文
private
static
Pattern
p_phone
=
Pattern
.
compile
(
"^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$"
);
public
static
void
getOrUpdateBlackListLevel
(
BlackListQueryTidbVo0
blackListQueryTidbVo0
,
String
type
)
{
LocalDateTime
localDateTimeCreatedAt
=
blackListQueryTidbVo0
.
getCreatedAt
().
toLocalDateTime
();
LocalDateTime
localDateTimeNow
=
LocalDateTime
.
now
();
...
...
@@ -28,4 +35,68 @@ public class BlackListUtils {
}
public
static
boolean
isContainChinese
(
String
str
)
{
Matcher
m
=
p_chinese
.
matcher
(
str
);
if
(
m
.
find
())
{
return
true
;
}
return
false
;
}
public
static
boolean
isIDNumber
(
String
IDNumber
)
{
if
(
IDNumber
==
null
||
""
.
equals
(
IDNumber
))
{
return
false
;
}
// 定义判别用户身份证号的正则表达式(15位或者18位,最后一位可以为字母)
String
regularExpression
=
"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|"
+
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)"
;
boolean
matches
=
IDNumber
.
matches
(
regularExpression
);
//判断第18位校验值
if
(
matches
)
{
if
(
IDNumber
.
length
()
==
18
)
{
try
{
char
[]
charArray
=
IDNumber
.
toCharArray
();
//前十七位加权因子
int
[]
idCardWi
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
//这是除以11后,可能产生的11位余数对应的验证码
String
[]
idCardY
=
{
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
"4"
,
"3"
,
"2"
};
int
sum
=
0
;
for
(
int
i
=
0
;
i
<
idCardWi
.
length
;
i
++)
{
int
current
=
Integer
.
parseInt
(
String
.
valueOf
(
charArray
[
i
]));
int
count
=
current
*
idCardWi
[
i
];
sum
+=
count
;
}
char
idCardLast
=
charArray
[
17
];
int
idCardMod
=
sum
%
11
;
if
(
idCardY
[
idCardMod
].
toUpperCase
().
equals
(
String
.
valueOf
(
idCardLast
).
toUpperCase
()))
{
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
}
}
}
return
matches
;
}
/**
* 大陆手机号码11位数,匹配格式:前三位固定格式+后8位任意数
* 此方法中前三位格式有:
* 13+任意数
* 15+除4的任意数
* 18+除1和4的任意数
* 17+除9的任意数
* 147
*/
public
static
boolean
isChinaPhone
(
String
str
)
{
Matcher
m
=
p_phone
.
matcher
(
str
);
return
m
.
matches
();
}
}
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