Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
fangxinjiang
yifu-mvp
Commits
e71b5dd4
Commit
e71b5dd4
authored
Jun 20, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手机号码校验
parent
8ac021ed
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
591 additions
and
3 deletions
+591
-3
TEmpFamilyController.java
...lus/v1/yifu/archives/controller/TEmpFamilyController.java
+1
-0
TCheckMobile.java
...ava/com/yifu/cloud/plus/v1/check/entity/TCheckMobile.java
+90
-0
ChecksUtil.java
...n/java/com/yifu/cloud/plus/v1/check/utils/ChecksUtil.java
+149
-0
spring.factories.txt
...heck-api/src/main/resources/META-INF/spring.factories.txt
+2
-0
TCheckMobileController.java
...loud/plus/v1/check/controller/TCheckMobileController.java
+129
-0
TCheckMobileMapper.java
...m/yifu/cloud/plus/v1/check/mapper/TCheckMobileMapper.java
+33
-0
TCheckMobileService.java
...yifu/cloud/plus/v1/check/service/TCheckMobileService.java
+35
-0
TCheckIdCardServiceImpl.java
...d/plus/v1/check/service/impl/TCheckIdCardServiceImpl.java
+2
-2
TCheckMobileServiceImpl.java
...d/plus/v1/check/service/impl/TCheckMobileServiceImpl.java
+88
-0
TCheckMobileMapper.xml
...heck-biz/src/main/resources/mapper/TCheckMobileMapper.xml
+41
-0
CommonConstants.java
...ud.plus.v1/yifu/common/core/constant/CommonConstants.java
+1
-0
ErrorCodes.java
....cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
+12
-0
YifuUser.java
.../com/yifu/cloud/plus/v1/yifu/common/core/vo/YifuUser.java
+1
-1
messages_zh_CN.properties
...on-core/src/main/resources/i18n/messages_zh_CN.properties
+7
-0
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmpFamilyController.java
View file @
e71b5dd4
...
@@ -93,6 +93,7 @@ public class TEmpFamilyController {
...
@@ -93,6 +93,7 @@ public class TEmpFamilyController {
if
(
Common
.
isNotNull
(
checkRes
)){
if
(
Common
.
isNotNull
(
checkRes
)){
return
R
.
failed
(
checkRes
);
return
R
.
failed
(
checkRes
);
}
}
tEmpFamily
.
setDeleteFlag
(
CommonConstants
.
ZERO_STRING
);
return
R
.
ok
(
tEmpFamilyService
.
save
(
tEmpFamily
));
return
R
.
ok
(
tEmpFamilyService
.
save
(
tEmpFamily
));
}
}
...
...
yifu-check/yifu-check-api/src/main/java/com/yifu/cloud/plus/v1/check/entity/TCheckMobile.java
0 → 100644
View file @
e71b5dd4
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* 手机号码校验
*
* @author fxj
* @date 2022-06-20 17:29:03
*/
@Data
@TableName
(
"t_check_mobile"
)
@EqualsAndHashCode
(
callSuper
=
true
)
@Schema
(
description
=
"手机号码校验"
)
public
class
TCheckMobile
extends
BaseEntity
{
/**
* id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"id"
)
private
String
id
;
/**
* 0:初始数据 1:API验证结果
*/
@Schema
(
description
=
"0:初始数据 1:API验证结果"
)
private
String
type
;
/**
* 手机号码
*/
@Schema
(
description
=
"手机号码"
)
private
String
mobile
;
/**
* 手机号所属区域。样例:省-市
*/
@Schema
(
description
=
"手机号所属区域。样例:省-市"
)
private
String
area
;
/**
* 手机号运营商类型。样例:中国移动 GSM
*/
@Schema
(
description
=
"手机号运营商类型。样例:中国移动 GSM"
)
private
String
numbertype
;
/**
* 是否收费,枚举值:1 :收费 0:不收费
*/
@Schema
(
description
=
"是否收费,枚举值:1 :收费 0:不收费"
)
private
String
chargesstatus
;
/**
* 检测结果,枚举值:0:空号 1:实号 2:停机 3:库无 4:沉默号 5:风险号 10:配置异常
*/
@Schema
(
description
=
"检测结果,枚举值:0:空号 1:实号 2:停机 3:库无 4:沉默号 5:风险号 10:配置或接口异常"
)
private
String
status
;
/**
* 响应code码解释
*/
@Schema
(
description
=
"响应code码解释"
)
private
String
message
;
}
yifu-check/yifu-check-api/src/main/java/com/yifu/cloud/plus/v1/check/utils/Check
IdCard
.java
→
yifu-check/yifu-check-api/src/main/java/com/yifu/cloud/plus/v1/check/utils/Check
sUtil
.java
View file @
e71b5dd4
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
utils
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
utils
;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
import
com.google.gson.JsonObject
;
import
com.google.gson.JsonParser
;
import
com.google.gson.JsonParser
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckIdCard
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckIdCard
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckMobile
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -13,7 +18,7 @@ import java.util.Map;
...
@@ -13,7 +18,7 @@ import java.util.Map;
* @description 测试身份证
* @description 测试身份证
* @date 2022/5/7
* @date 2022/5/7
*/
*/
public
class
Check
IdCard
{
public
class
Check
sUtil
{
@Value
(
"${canCheck}"
)
@Value
(
"${canCheck}"
)
private
static
boolean
canCheck
;
private
static
boolean
canCheck
;
...
@@ -30,16 +35,63 @@ public class CheckIdCard {
...
@@ -30,16 +35,63 @@ public class CheckIdCard {
if
(
canCheck
)
{
if
(
canCheck
)
{
// 1.调用身份信息校验api
// 1.调用身份信息校验api
extracte
d
(
checkIdCard
);
checkIdCardMetho
d
(
checkIdCard
);
}
else
{
}
else
{
checkIdCard
.
setIsTrue
(
0
);
checkIdCard
.
setIsTrue
(
0
);
checkIdCard
.
setReason
(
"nacos中checks.yaml的配置canCheck未开启!"
);
checkIdCard
.
setReason
(
"nacos中checks.yaml的配置canCheck未开启!"
);
}
}
}
}
// 核心调用
public
static
R
<
Map
<
String
,
TCheckMobile
>>
checkMobile
(
String
mobiles
)
{
private
static
void
extracted
(
TCheckIdCard
checkIdCard
)
{
Map
<
String
,
TCheckMobile
>
checkMobiles
=
new
HashMap
<>();
final
JsonObject
jsonObject
=
CheckIdCard
.
invokeIdCard
(
checkIdCard
.
getName
(),
checkIdCard
.
getIdCard
());
if
(
canCheck
)
{
// 1.调用身份信息校验api
return
checkMobileMethod
(
mobiles
,
checkMobiles
);
}
else
{
return
R
.
failed
(
"nacos中checks.yaml的配置canCheck未开启!"
);
}
}
private
static
R
<
Map
<
String
,
TCheckMobile
>>
checkMobileMethod
(
String
mobiles
,
Map
<
String
,
TCheckMobile
>
checkMobileMap
)
{
final
JsonObject
jsonObject
=
ChecksUtil
.
invokeMobile
(
mobiles
);
// 2.处理返回结果
if
(
jsonObject
!=
null
)
{
//响应code码。200000:成功,其他失败
String
code
=
jsonObject
.
get
(
"code"
).
getAsString
();
if
(
"200000"
.
equals
(
code
)
&&
jsonObject
.
get
(
"data"
)
!=
null
)
{
// 调用身份信息校验成功
// 解析结果数据,进行业务处理
// 校验状态码 200000:成功,其他失败
JsonObject
resJson
=
jsonObject
.
get
(
"data"
).
getAsJsonObject
();
String
message
=
jsonObject
.
get
(
"message"
).
getAsString
();
JsonArray
mobileArray
=
resJson
.
getAsJsonArray
();
if
(
Common
.
isNotNull
(
mobileArray
)
&&
mobileArray
.
size
()
>
CommonConstants
.
ZERO_INT
){
TCheckMobile
mobile
=
null
;
for
(
int
i
=
0
;
i
<
mobileArray
.
size
();
i
++){
mobile
=
new
TCheckMobile
();
mobile
.
setMobile
(
mobileArray
.
get
(
i
).
getAsJsonObject
().
get
(
"mobile"
).
getAsString
());
mobile
.
setArea
(
mobileArray
.
get
(
i
).
getAsJsonObject
().
get
(
"area"
).
getAsString
());
mobile
.
setNumbertype
(
mobileArray
.
get
(
i
).
getAsJsonObject
().
get
(
"numberType"
).
getAsString
());
mobile
.
setChargesstatus
(
mobileArray
.
get
(
i
).
getAsJsonObject
().
get
(
"chargesStatus"
).
getAsString
());
mobile
.
setStatus
(
mobileArray
.
get
(
i
).
getAsJsonObject
().
get
(
"status"
).
getAsString
());
mobile
.
setMessage
(
message
);
mobile
.
setType
(
CommonConstants
.
ONE_STRING
);
checkMobileMap
.
put
(
mobile
.
getMobile
(),
mobile
);
}
}
}
else
{
// 记录错误日志,正式项目中请换成log打印
return
R
.
failed
(
"手机号校验失败,code:"
+
code
+
",msg:"
+
jsonObject
.
get
(
"message"
).
getAsString
());
}
}
else
{
return
R
.
failed
(
"接口无返回数据"
);
}
return
R
.
ok
(
checkMobileMap
);
}
// 核心调用
private
static
void
checkIdCardMethod
(
TCheckIdCard
checkIdCard
)
{
final
JsonObject
jsonObject
=
ChecksUtil
.
invokeIdCard
(
checkIdCard
.
getName
(),
checkIdCard
.
getIdCard
());
// 2.处理返回结果
// 2.处理返回结果
if
(
jsonObject
!=
null
)
{
if
(
jsonObject
!=
null
)
{
//响应code码。200000:成功,其他失败
//响应code码。200000:成功,其他失败
...
@@ -78,4 +130,20 @@ public class CheckIdCard {
...
@@ -78,4 +130,20 @@ public class CheckIdCard {
// 解析json,并返回结果
// 解析json,并返回结果
return
jsonParser
.
parse
(
result
).
getAsJsonObject
();
return
jsonParser
.
parse
(
result
).
getAsJsonObject
();
}
}
/**
* @Author fxj
* @Description 手机号码状态检测
* @Date 17:50 2022/6/20
* @param mobiles 检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码
**/
private
static
JsonObject
invokeMobile
(
String
mobiles
)
{
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"appId"
,
APP_ID_ID_CARD
);
params
.
put
(
"appKey"
,
APP_KEY_ID_CARD
);
params
.
put
(
"mobiles"
,
mobiles
);
String
result
=
HttpUtils
.
post
(
API_URL_ID_CARD
,
params
);
// 解析json,并返回结果
return
jsonParser
.
parse
(
result
).
getAsJsonObject
();
}
}
}
yifu-check/yifu-check-api/src/main/resources/META-INF/spring.factories.txt
0 → 100644
View file @
e71b5dd4
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.job.config.SchedulerBeanFactoryConfig
\ No newline at end of file
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/controller/TCheckMobileController.java
0 → 100644
View file @
e71b5dd4
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
controller
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckMobile
;
import
com.yifu.cloud.plus.v1.check.service.TCheckMobileService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 手机号码校验
*
* @author fxj
* @date 2022-06-20 17:29:03
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/tcheckmobile"
)
@Tag
(
name
=
"手机号码校验管理"
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
public
class
TCheckMobileController
{
private
final
TCheckMobileService
tCheckMobileService
;
/**
* 分页查询
* @param page 分页对象
* @param tCheckMobile 手机号码校验
* @return
*/
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@pms.hasPermission('demo_tcheckmobile_get')"
)
public
R
getTCheckMobilePage
(
Page
page
,
TCheckMobile
tCheckMobile
)
{
return
R
.
ok
(
tCheckMobileService
.
page
(
page
,
Wrappers
.
query
(
tCheckMobile
)));
}
/**
* 通过id查询手机号码校验
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('demo_tcheckmobile_get')"
)
public
R
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
tCheckMobileService
.
getById
(
id
));
}
/**
* 新增手机号码校验
* @param tCheckMobile 手机号码校验
* @return R
*/
@Operation
(
summary
=
"新增手机号码校验"
,
description
=
"新增手机号码校验"
)
@SysLog
(
"新增手机号码校验"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('demo_tcheckmobile_add')"
)
public
R
save
(
@RequestBody
TCheckMobile
tCheckMobile
)
{
return
R
.
ok
(
tCheckMobileService
.
save
(
tCheckMobile
));
}
/**
* 修改手机号码校验
* @param tCheckMobile 手机号码校验
* @return R
*/
@Operation
(
summary
=
"修改手机号码校验"
,
description
=
"修改手机号码校验"
)
@SysLog
(
"修改手机号码校验"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('demo_tcheckmobile_edit')"
)
public
R
updateById
(
@RequestBody
TCheckMobile
tCheckMobile
)
{
return
R
.
ok
(
tCheckMobileService
.
updateById
(
tCheckMobile
));
}
/**
* 通过id删除手机号码校验
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id删除手机号码校验"
,
description
=
"通过id删除手机号码校验"
)
@SysLog
(
"通过id删除手机号码校验"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('demo_tcheckmobile_del')"
)
public
R
removeById
(
@PathVariable
String
id
)
{
return
R
.
ok
(
tCheckMobileService
.
removeById
(
id
));
}
/**
* 手机号码状态校验
* @param mobiles 检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码
* @return R
*/
@Operation
(
description
=
"检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码"
)
@SysLog
(
"检测手机号状态"
)
@Inner
@GetMapping
(
"/checkMobiles"
)
public
R
checkMobiles
(
String
mobiles
)
{
return
R
.
ok
(
tCheckMobileService
.
checkMobiles
(
mobiles
));
}
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/mapper/TCheckMobileMapper.java
0 → 100644
View file @
e71b5dd4
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckMobile
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 手机号码校验
*
* @author fxj
* @date 2022-06-20 17:29:03
*/
@Mapper
public
interface
TCheckMobileMapper
extends
BaseMapper
<
TCheckMobile
>
{
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/TCheckMobileService.java
0 → 100644
View file @
e71b5dd4
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckMobile
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.util.Map
;
/**
* 手机号码校验
*
* @author fxj
* @date 2022-06-20 17:29:03
*/
public
interface
TCheckMobileService
extends
IService
<
TCheckMobile
>
{
R
<
Map
<
String
,
TCheckMobile
>>
checkMobiles
(
String
mobiles
);
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckIdCardServiceImpl.java
View file @
e71b5dd4
...
@@ -10,7 +10,7 @@ import com.yifu.cloud.plus.v1.check.mapper.TCheckIdCardMapper;
...
@@ -10,7 +10,7 @@ import com.yifu.cloud.plus.v1.check.mapper.TCheckIdCardMapper;
import
com.yifu.cloud.plus.v1.check.service.TCheckApiNumService
;
import
com.yifu.cloud.plus.v1.check.service.TCheckApiNumService
;
import
com.yifu.cloud.plus.v1.check.service.TCheckIdCardService
;
import
com.yifu.cloud.plus.v1.check.service.TCheckIdCardService
;
import
com.yifu.cloud.plus.v1.check.service.TCheckLockService
;
import
com.yifu.cloud.plus.v1.check.service.TCheckLockService
;
import
com.yifu.cloud.plus.v1.check.utils.Check
IdCard
;
import
com.yifu.cloud.plus.v1.check.utils.Check
sUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
...
@@ -144,7 +144,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
...
@@ -144,7 +144,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
// 调用API校验
// 调用API校验
if
(
nowApiNum
<
canApiNum
)
{
if
(
nowApiNum
<
canApiNum
)
{
nowApiNum
++;
nowApiNum
++;
Check
IdCard
.
checkIdCard
(
c
);
Check
sUtil
.
checkIdCard
(
c
);
c
.
setCreateUser
(
userId
);
c
.
setCreateUser
(
userId
);
c
.
setCreateTime
(
LocalDateTime
.
now
());
c
.
setCreateTime
(
LocalDateTime
.
now
());
c
.
setType
(
CommonConstants
.
ONE_INT
);
c
.
setType
(
CommonConstants
.
ONE_INT
);
...
...
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckMobileServiceImpl.java
0 → 100644
View file @
e71b5dd4
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckMobile
;
import
com.yifu.cloud.plus.v1.check.mapper.TCheckMobileMapper
;
import
com.yifu.cloud.plus.v1.check.service.TCheckMobileService
;
import
com.yifu.cloud.plus.v1.check.utils.ChecksUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
/**
* 手机号码校验
*
* @author fxj
* @date 2022-06-20 17:29:03
*/
@Service
public
class
TCheckMobileServiceImpl
extends
ServiceImpl
<
TCheckMobileMapper
,
TCheckMobile
>
implements
TCheckMobileService
{
/**
* @Author fxj
* @Description 号码状态校验,单次请求上限100 多一个号码请以逗号分割
* @Date 19:18 2022/6/20
**/
@Override
public
R
<
Map
<
String
,
TCheckMobile
>>
checkMobiles
(
String
mobiles
){
R
<
Map
<
String
,
TCheckMobile
>>
mobileMapR
;
Map
<
String
,
TCheckMobile
>
checkMobileMap
;
if
(
Common
.
isNotNull
(
mobiles
)){
List
<
String
>
mobileList
=
Common
.
initStrToList
(
mobiles
,
CommonConstants
.
COMMA_STRING
);
if
(
Common
.
isNotEmpty
(
mobileList
)
&&
mobileList
.
size
()
>
CommonConstants
.
INTEGER_HUNDRED
){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_MOBILE_REQUEST_LIMIT_HUNDRED
));
}
mobileMapR
=
ChecksUtil
.
checkMobile
(
mobiles
);
if
(
Common
.
isEmpty
(
mobileMapR
)
&&
Common
.
isEmpty
(
mobileMapR
.
getData
())){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_MOBILE_REQUEST_ERROR
));
}
checkMobileMap
=
mobileMapR
.
getData
();
if
(
Common
.
isNotNull
(
mobileList
)
&&
Common
.
isNotNull
(
checkMobileMap
)){
TCheckMobile
checkMobile
=
null
;
for
(
String
mobile:
mobileList
){
if
(
Common
.
isEmpty
(
checkMobileMap
.
get
(
mobile
))){
checkMobile
=
new
TCheckMobile
();
checkMobile
.
setType
(
CommonConstants
.
ONE_STRING
);
checkMobile
.
setMobile
(
mobile
);
checkMobile
.
setStatus
(
CommonConstants
.
TEN_STRING
);
checkMobile
.
setMessage
(
Common
.
isEmpty
(
mobileMapR
)?
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_MOBILE_REQUEST_ERROR
):
mobileMapR
.
getMsg
());
checkMobile
.
setChargesstatus
(
CommonConstants
.
ZERO_STRING
);
checkMobile
.
setNumbertype
(
CommonConstants
.
EMPTY_STRING
);
checkMobile
.
setArea
(
CommonConstants
.
EMPTY_STRING
);
checkMobileMap
.
put
(
mobile
,
checkMobile
);
}
}
mobileMapR
.
setData
(
checkMobileMap
);
}
}
else
{
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
PARAM_NOT_EMPTY
));
}
if
(
Common
.
isNotNull
(
checkMobileMap
)){
this
.
saveBatch
(
checkMobileMap
.
values
());
}
return
mobileMapR
;
}
}
yifu-check/yifu-check-biz/src/main/resources/mapper/TCheckMobileMapper.xml
0 → 100644
View file @
e71b5dd4
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yifu.cloud.plus.v1.check.mapper.TCheckMobileMapper"
>
<resultMap
id=
"tCheckMobileMap"
type=
"com.yifu.cloud.plus.v1.check.entity.TCheckMobile"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"createName"
column=
"create_name"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"mobile"
column=
"mobile"
/>
<result
property=
"area"
column=
"area"
/>
<result
property=
"numbertype"
column=
"numberType"
/>
<result
property=
"chargesstatus"
column=
"chargesStatus"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"message"
column=
"message"
/>
</resultMap>
</mapper>
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
View file @
e71b5dd4
...
@@ -197,4 +197,5 @@ public interface CommonConstants {
...
@@ -197,4 +197,5 @@ public interface CommonConstants {
char
ADD_CHAR
=
'+'
;
char
ADD_CHAR
=
'+'
;
//int 4
//int 4
int
FOUR_INT
=
4
;
int
FOUR_INT
=
4
;
String
TEN_STRING
=
"10"
;
}
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
View file @
e71b5dd4
...
@@ -189,4 +189,16 @@ public interface ErrorCodes {
...
@@ -189,4 +189,16 @@ public interface ErrorCodes {
* 已存在该员工对应学历名称的学历信息
* 已存在该员工对应学历名称的学历信息
*/
*/
String
ARCHIVES_EMP_EDUCATION_EXISTING
=
"archives.emp.education.existing"
;
String
ARCHIVES_EMP_EDUCATION_EXISTING
=
"archives.emp.education.existing"
;
/**
* 参数不可为空
*/
String
PARAM_NOT_EMPTY
=
"param.not.empty"
;
/**
* 校验请求异常
*/
String
CHECKS_MOBILE_REQUEST_ERROR
=
"checks.mobile.request.error"
;
/**
* 单次号码状态校验请求上限100
*/
String
CHECKS_MOBILE_REQUEST_LIMIT_HUNDRED
=
"checks.mobile.request.limit.hundred"
;
}
}
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/vo/YifuUser.java
View file @
e71b5dd4
...
@@ -53,7 +53,7 @@ public class YifuUser extends User {
...
@@ -53,7 +53,7 @@ public class YifuUser extends User {
private
final
String
phone
;
private
final
String
phone
;
/**
/**
*
系统内置标识 0 是 1 否
*
是否是系统内置(0是,1否)
*/
*/
@Getter
@Getter
private
String
systemFlag
;
private
String
systemFlag
;
...
...
yifu-common/yifu-common-core/src/main/resources/i18n/messages_zh_CN.properties
View file @
e71b5dd4
...
@@ -48,6 +48,13 @@ archives.emp.reduced=\u5458\u5DE5\u5DF2\u51CF\u6863
...
@@ -48,6 +48,13 @@ archives.emp.reduced=\u5458\u5DE5\u5DF2\u51CF\u6863
archives.emp.work.record.existing
=
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u
5DE5
\u
4F5C
\u
8BB0
\u
5F55
\u
4FE1
\u
606F
archives.emp.work.record.existing
=
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
8EAB
\u
4EFD
\u
8BC1
\u7684\u
5DE5
\u
4F5C
\u
8BB0
\u
5F55
\u
4FE1
\u
606F
archives.emp.education.existing
=
\u
5DF2
\u
5B58
\u5728\u
8BE5
\u5458\u
5DE5
\u
5BF9
\u
5E94
\u
5B66
\u5386\u
540D
\u
79F0
\u7684\u
5B66
\u5386\u
4FE1
\u
606F
archives.emp.education.existing
=
\u
5DF2
\u
5B58
\u5728\u
8BE5
\u5458\u
5DE5
\u
5BF9
\u
5E94
\u
5B66
\u5386\u
540D
\u
79F0
\u7684\u
5B66
\u5386\u
4FE1
\u
606F
param.not.empty
=
\u
53C2
\u6570\u
4E0D
\u
53EF
\u
4E3A
\u
7A7A
checks.mobile.request.error
=
\u6821\u
9A8C
\u
8BF7
\u
6C42
\u
5F02
\u
5E38
checks.mobile.request.limit.hundred
=
\u5355\u
6B21
\u
53F7
\u7801\u
72B6
\u6001\u6821\u
9A8C
\u
8BF7
\u
6C42
\u
4E0A
\u9650
100
...
...
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