Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
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
lanbaoming
jiedao-api-boot-master
Commits
d7578025
Commit
d7578025
authored
Sep 18, 2024
by
zhengyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
检查国家区域是否与手机号国家区号一致
parent
147ed595
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
84 additions
and
9 deletions
+84
-9
ErrorCodeConstants.java
...cn/iocoder/yudao/module/ecw/enums/ErrorCodeConstants.java
+2
-0
RegionController.java
.../module/ecw/controller/admin/region/RegionController.java
+20
-0
AppRegionController.java
...module/ecw/controller/app/region/AppRegionController.java
+22
-0
RegionService.java
...ocoder/yudao/module/ecw/service/region/RegionService.java
+8
-0
RegionServiceImpl.java
...er/yudao/module/ecw/service/region/RegionServiceImpl.java
+17
-6
messages.properties
yudao-server/src/main/resources/i18n/messages.properties
+5
-1
messages_en.properties
yudao-server/src/main/resources/i18n/messages_en.properties
+5
-1
messages_zh.properties
yudao-server/src/main/resources/i18n/messages_zh.properties
+5
-1
No files found.
yudao-module-ecw/yudao-module-ecw-api/src/main/java/cn/iocoder/yudao/module/ecw/enums/ErrorCodeConstants.java
View file @
d7578025
...
...
@@ -188,6 +188,8 @@ public interface ErrorCodeConstants {
ErrorCode
CUSTOMER_APPROVAL_IN_PROCESSING
=
new
ErrorCode
(
1004006043
,
"customer.approval.in.processing"
);
ErrorCode
AREA_CODE_NOT_NULL
=
new
ErrorCode
(
1004006044
,
"area.code.not.null"
);
ErrorCode
CURRENCY_ID_NOT_NULL
=
new
ErrorCode
(
1004006045
,
"currency.id.not.null"
);
}
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/controller/admin/region/RegionController.java
View file @
d7578025
...
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ecw.controller.admin.region;
import
cn.iocoder.yudao.framework.apollo.core.event.ChannelDataEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -26,6 +27,7 @@ import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
operatelog
.
core
.
enums
.
OperateTypeEnum
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
ecw
.
enums
.
ErrorCodeConstants
.*;
import
cn.iocoder.yudao.module.ecw.controller.admin.region.vo.*
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO
;
...
...
@@ -217,4 +219,22 @@ public class RegionController {
List
<
RegionDO
>
cityList
=
regionService
.
getCityListByParentId
(
parentId
);
return
success
(
RegionConvert
.
INSTANCE
.
convertList
(
cityList
));
}
@GetMapping
(
"/check/dest-currency/area-code/"
)
@ApiOperation
(
"检查国家区域是否与手机号国家区号一致"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currencyId"
,
value
=
"国家ID"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
),
@ApiImplicitParam
(
name
=
"areaCode"
,
value
=
"手机国家区号"
,
required
=
true
,
example
=
"86"
,
dataTypeClass
=
String
.
class
)
})
public
CommonResult
<
Boolean
>
checkDestCurrencyAndAreaCode
(
@RequestParam
(
"currencyId"
)
Long
currencyId
,
@RequestParam
(
"areaCode"
)
String
areaCode
)
{
if
(
currencyId
==
null
)
{
return
CommonResult
.
error
(
CURRENCY_ID_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
areaCode
))
{
return
CommonResult
.
error
(
AREA_CODE_NOT_NULL
);
}
return
success
(
regionService
.
countByIdAndAreaCode
(
currencyId
,
areaCode
));
}
}
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/controller/app/region/AppRegionController.java
View file @
d7578025
...
...
@@ -10,7 +10,9 @@ import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import
cn.iocoder.yudao.module.ecw.service.region.RegionService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -25,6 +27,8 @@ import java.util.stream.Collectors;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
enums
.
GlobalErrorCodeConstants
.
INTERNAL_SERVER_ERROR
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
error
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
static
cn
.
iocoder
.
yudao
.
module
.
ecw
.
enums
.
ErrorCodeConstants
.
AREA_CODE_NOT_NULL
;
import
static
cn
.
iocoder
.
yudao
.
module
.
ecw
.
enums
.
ErrorCodeConstants
.
CURRENCY_ID_NOT_NULL
;
@Api
(
tags
=
"app-web - 国家城市管理"
)
@RestController
...
...
@@ -130,6 +134,24 @@ public class AppRegionController {
return
success
(
RegionConvert
.
INSTANCE
.
convertList
(
cityList
));
}
@GetMapping
(
"/check/dest-currency/area-code/"
)
@ApiOperation
(
"检查国家区域是否与手机号国家区号一致"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"currencyId"
,
value
=
"国家ID"
,
required
=
true
,
example
=
"1024"
,
dataTypeClass
=
Long
.
class
),
@ApiImplicitParam
(
name
=
"areaCode"
,
value
=
"手机国家区号"
,
required
=
true
,
example
=
"86"
,
dataTypeClass
=
String
.
class
)
})
public
CommonResult
<
Boolean
>
checkDestCurrencyAndAreaCode
(
@RequestParam
(
"currencyId"
)
Long
currencyId
,
@RequestParam
(
"areaCode"
)
String
areaCode
)
{
if
(
currencyId
==
null
)
{
return
CommonResult
.
error
(
CURRENCY_ID_NOT_NULL
);
}
if
(
StringUtils
.
isBlank
(
areaCode
))
{
return
CommonResult
.
error
(
AREA_CODE_NOT_NULL
);
}
return
success
(
regionService
.
countByIdAndAreaCode
(
currencyId
,
areaCode
));
}
private
RegionRespVO
buildChildTree
(
RegionRespVO
pNode
,
List
<
RegionRespVO
>
allDatas
){
List
<
RegionRespVO
>
childs
=
new
ArrayList
<>();
for
(
RegionRespVO
itemNode
:
allDatas
)
{
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/region/RegionService.java
View file @
d7578025
...
...
@@ -44,6 +44,14 @@ public interface RegionService {
*/
RegionDO
getRegion
(
Long
id
);
/**
* 根据国家id和手机国家区号统计数值,判断区号是否与国家一致
* @param id
* @param areaCode
* @return
*/
Boolean
countByIdAndAreaCode
(
Long
id
,
String
areaCode
);
/**
* 获得区域设置列表
*
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/region/RegionServiceImpl.java
View file @
d7578025
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
service
.
region
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.*
;
import
cn.iocoder.yudao.module.ecw.controller.admin.region.vo.*
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
...
...
@@ -31,12 +35,12 @@ public class RegionServiceImpl implements RegionService {
@Override
public
Long
createRegion
(
RegionCreateReqVO
createReqVO
)
{
if
(
Objects
.
equals
(
createReqVO
.
getType
(),
"1"
)
||
Objects
.
equals
(
createReqVO
.
getType
(),
"3"
)){
if
(
StringUtils
.
isBlank
(
createReqVO
.
getLabelCode
())){
if
(
Objects
.
equals
(
createReqVO
.
getType
(),
"1"
)
||
Objects
.
equals
(
createReqVO
.
getType
(),
"3"
))
{
if
(
StringUtils
.
isBlank
(
createReqVO
.
getLabelCode
()))
{
throw
exception
(
REGION_LABEL_CODE_NOT_NULL
);
}
String
[]
codes
=
createReqVO
.
getLabelCode
().
split
(
StrUtil
.
DASHED
);
if
(
codes
.
length
<
2
){
if
(
codes
.
length
<
2
)
{
throw
exception
(
REGION_LABEL_CODE_COUNTRY_AND_CITY_AND_AIR_COUNTRY
);
}
}
...
...
@@ -49,12 +53,12 @@ public class RegionServiceImpl implements RegionService {
@Override
public
void
updateRegion
(
RegionUpdateReqVO
updateReqVO
)
{
if
(
Objects
.
equals
(
updateReqVO
.
getType
(),
"1"
)
||
Objects
.
equals
(
updateReqVO
.
getType
(),
"3"
)){
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getLabelCode
())){
if
(
Objects
.
equals
(
updateReqVO
.
getType
(),
"1"
)
||
Objects
.
equals
(
updateReqVO
.
getType
(),
"3"
))
{
if
(
StringUtils
.
isBlank
(
updateReqVO
.
getLabelCode
()))
{
throw
exception
(
REGION_LABEL_CODE_NOT_NULL
);
}
String
[]
codes
=
updateReqVO
.
getLabelCode
().
split
(
StrUtil
.
DASHED
);
if
(
codes
.
length
<
2
){
if
(
codes
.
length
<
2
)
{
throw
exception
(
REGION_LABEL_CODE_COUNTRY_AND_CITY_AND_AIR_COUNTRY
);
}
}
...
...
@@ -94,6 +98,13 @@ public class RegionServiceImpl implements RegionService {
return
regionMapper
.
selectById
(
id
);
}
@Override
public
Boolean
countByIdAndAreaCode
(
Long
id
,
String
areaCode
)
{
Long
count
=
regionMapper
.
selectCount
(
new
LambdaQueryWrapper
<
RegionDO
>().
eq
(
RegionDO:
:
getId
,
id
).
eq
(
RegionDO:
:
getAreaCode
,
areaCode
));
return
Objects
.
nonNull
(
count
)
&&
count
>
0L
;
}
@Override
public
List
<
RegionDO
>
getRegionList
(
Collection
<
Long
>
ids
)
{
return
regionMapper
.
selectBatchIds
(
ids
);
...
...
yudao-server/src/main/resources/i18n/messages.properties
View file @
d7578025
...
...
@@ -300,4 +300,8 @@ customer.approval.in.processing=
order.overseas.warehouse.update.is.or.no
=
order.is.overseas.warehouse.order
=
order.not.is.overseas.warehouse.order
=
\ No newline at end of file
order.not.is.overseas.warehouse.order
=
area.code.not.null
=
currency.id.not.null
=
\ No newline at end of file
yudao-server/src/main/resources/i18n/messages_en.properties
View file @
d7578025
...
...
@@ -1107,4 +1107,8 @@ customer.approval.in.processing=Non-main customer approval is in progress and ca
order.overseas.warehouse.update.is.or.no
=
Please select order overseas warehouse modification Yes or No
order.is.overseas.warehouse.order
=
This order is already an overseas warehouse order
order.not.is.overseas.warehouse.order
=
This order is already a non overseas warehouse order
\ No newline at end of file
order.not.is.overseas.warehouse.order
=
This order is already a non overseas warehouse order
area.code.not.null
=
The national mobile phone area code cannot be empty
currency.id.not.null
=
The country ID cannot be empty
\ No newline at end of file
yudao-server/src/main/resources/i18n/messages_zh.properties
View file @
d7578025
...
...
@@ -1107,4 +1107,8 @@ customer.approval.in.processing=\u975E\u4E3B\u5BA2\u6237\u5BA1\u6279\u6B63\u5728
order.overseas.warehouse.update.is.or.no
=
\u
8bf7
\u9009\u
62e9
\u
8ba2
\u5355\u
6d77
\u5916\u
4ed3
\u
4fee
\u6539\u
662f
\u6216\u5426
order.is.overseas.warehouse.order
=
\u
8be5
\u
8ba2
\u5355\u
5df2
\u
7ecf
\u
662f
\u
6d77
\u5916\u
4ed3
\u
8ba2
\u5355
order.not.is.overseas.warehouse.order
=
\u
8be5
\u
8ba2
\u5355\u
5df2
\u
7ecf
\u
662f
\u
975e
\u
6d77
\u5916\u
4ed3
\u
8ba2
\u5355
\ No newline at end of file
order.not.is.overseas.warehouse.order
=
\u
8be5
\u
8ba2
\u5355\u
5df2
\u
7ecf
\u
662f
\u
975e
\u
6d77
\u5916\u
4ed3
\u
8ba2
\u5355
area.code.not.null
=
\u
56fd
\u
5bb6
\u
624b
\u
673a
\u
533a
\u
53f7
\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a
currency.id.not.null
=
\u
56fd
\u
5bb6id
\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a
\ 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