Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
custom-server
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhonghong
custom-server
Commits
da5a00ac
Commit
da5a00ac
authored
Jul 16, 2026
by
Lizh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
与原接口对齐返回结构
parent
bae1ccc6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
14 deletions
+76
-14
custom-server-app/src/main/java/com/jomalls/custom/app/enums/ContinentEnum.java
+56
-0
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/CountryCodeService.java
+2
-1
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/impl/CountryCodeServiceImpl.java
+18
-13
No files found.
custom-server-app/src/main/java/com/jomalls/custom/app/enums/ContinentEnum.java
0 → 100644
View file @
da5a00ac
package
com
.
jomalls
.
custom
.
app
.
enums
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* 州
* AF Africa 非洲
* AS Asia 亚洲
* EU Europe 欧洲
* NA North America 北美洲
* OC Oceania 大洋洲
* SA South America 南美洲
* AN Antarctica 南极洲
*/
@Getter
public
enum
ContinentEnum
{
NA
(
"NA"
,
"North America"
,
"北美洲"
),
AS
(
"AS"
,
"Asia"
,
"亚洲"
),
EU
(
"EU"
,
"Europe"
,
"欧洲"
),
SA
(
"SA"
,
"South America"
,
"南美洲"
),
AF
(
"AF"
,
"Africa"
,
"非洲"
),
OC
(
"OC"
,
"Oceania"
,
"大洋洲"
),
AN
(
"AN"
,
"Antarctica"
,
"南极洲"
);
private
final
String
code
;
private
final
String
eName
;
private
final
String
cName
;
ContinentEnum
(
String
code
,
String
eName
,
String
cName
)
{
this
.
code
=
code
;
this
.
eName
=
eName
;
this
.
cName
=
cName
;
}
public
static
ContinentEnum
getStatusByCode
(
String
code
)
{
for
(
ContinentEnum
value
:
ContinentEnum
.
values
())
{
if
(
value
.
getCode
().
equals
(
code
))
{
return
value
;
}
}
throw
new
ServiceException
(
"the code "
+
code
+
" not be supported by ContinentEnum"
);
}
public
static
List
<
ContinentEnum
>
getAllList
()
{
return
Arrays
.
asList
(
ContinentEnum
.
values
());
}
}
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/CountryCodeService.java
View file @
da5a00ac
package
com
.
jomalls
.
custom
.
app
.
service
.
system
;
import
com.jomalls.custom.app.vo.system.CountryCodeVO
;
import
com.jomalls.custom.integrate.model.CountryCodeModel
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -17,7 +18,7 @@ public interface CountryCodeService {
*
* @return 国家代码映射
*/
Map
<
String
,
String
>
getMap
();
Map
<
String
,
List
<
CountryCodeModel
>
>
getMap
();
/**
* 获取全部国家代码列表
...
...
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/impl/CountryCodeServiceImpl.java
View file @
da5a00ac
package
com
.
jomalls
.
custom
.
app
.
service
.
system
.
impl
;
import
com.jomalls.custom.app.enums.ContinentEnum
;
import
com.jomalls.custom.app.service.system.CountryCodeService
;
import
com.jomalls.custom.app.vo.system.CountryCodeVO
;
import
com.jomalls.custom.integrate.model.CountryCodeModel
;
import
com.jomalls.custom.integrate.service.SaasAdminService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -27,19 +27,24 @@ public class CountryCodeServiceImpl implements CountryCodeService {
private
final
SaasAdminService
saasAdminService
;
@Override
public
Map
<
String
,
String
>
getMap
()
{
public
Map
<
String
,
List
<
CountryCodeModel
>
>
getMap
()
{
List
<
CountryCodeModel
>
list
=
saasAdminService
.
getAllCountryCode
();
if
(
list
==
null
||
list
.
isEmpty
(
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
Collections
.
emptyMap
();
}
Map
<
String
,
String
>
result
=
new
LinkedHashMap
<>();
for
(
CountryCodeModel
model
:
list
)
{
if
(
model
.
getCountryCode
()
!=
null
)
{
result
.
put
(
String
.
valueOf
(
model
.
getCountryCode
()),
model
.
getNameCn
()
!=
null
?
model
.
getNameCn
()
:
""
);
}
Map
<
String
,
List
<
CountryCodeModel
>>
map
=
new
HashMap
<>();
for
(
CountryCodeModel
countryCode
:
list
)
{
String
key
=
String
.
format
(
"%s(%s)"
,
countryCode
.
getContinentCode
(),
getContinentCName
(
countryCode
));
map
.
computeIfAbsent
(
key
,
k
->
new
ArrayList
<>()).
add
(
countryCode
);
}
return
map
;
}
private
String
getContinentCName
(
CountryCodeModel
countryCodeModel
)
{
if
(
StringUtils
.
isNotEmpty
(
countryCodeModel
.
getContinentCode
()))
{
return
ContinentEnum
.
getStatusByCode
(
countryCodeModel
.
getContinentCode
()).
getCName
();
}
return
result
;
return
""
;
}
@Override
...
...
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