Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
gs1-office-web-sit
Commits
da037ca7
Commit
da037ca7
authored
Dec 14, 2023
by
suxiaochun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
境外码 增加目标市场
parent
45e3bca3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
10 deletions
+71
-10
GLNOutController.java
...io/office/modules/manage/controller/GLNOutController.java
+55
-10
NationalDictionaryRe.java
...fice/modules/manage/vo/response/NationalDictionaryRe.java
+16
-0
No files found.
src/main/java/io/office/modules/manage/controller/GLNOutController.java
View file @
da037ca7
...
@@ -15,8 +15,10 @@ import io.office.modules.manage.vo.request.VbgOutFirmSearchVo;
...
@@ -15,8 +15,10 @@ import io.office.modules.manage.vo.request.VbgOutFirmSearchVo;
import
io.office.modules.manage.vo.request.VbgOutOtherKeyVo
;
import
io.office.modules.manage.vo.request.VbgOutOtherKeyVo
;
import
io.office.modules.manage.vo.request.VbgOutSearchGLNVo
;
import
io.office.modules.manage.vo.request.VbgOutSearchGLNVo
;
import
io.office.modules.manage.vo.request.VbgOutVerifiedVo
;
import
io.office.modules.manage.vo.request.VbgOutVerifiedVo
;
import
io.office.modules.manage.vo.response.NationalDictionaryRe
;
import
io.office.modules.sys.service.SysCaptchaService
;
import
io.office.modules.sys.service.SysCaptchaService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -28,10 +30,7 @@ import javax.crypto.SecretKey;
...
@@ -28,10 +30,7 @@ import javax.crypto.SecretKey;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.xml.bind.DatatypeConverter
;
import
javax.xml.bind.DatatypeConverter
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
@RestController
@RestController
@RequestMapping
(
value
=
"/vbgOutSearch"
)
@RequestMapping
(
value
=
"/vbgOutSearch"
)
...
@@ -42,7 +41,8 @@ public class GLNOutController {
...
@@ -42,7 +41,8 @@ public class GLNOutController {
private
static
String
KEY
=
"2mI+lM0U5AmGOr6dWDR735hcS4qLah7NoFI3LYnYtoo="
;
private
static
String
KEY
=
"2mI+lM0U5AmGOr6dWDR735hcS4qLah7NoFI3LYnYtoo="
;
private
static
String
HOST
=
"http://192.168.100.163:8088"
;
private
static
String
HOST
=
"http://192.168.100.163:8088"
;
private
static
JSONArray
COUNTRYS
;
private
static
List
<
NationalDictionaryRe
>
COUNTRYS
=
new
ArrayList
<>();
private
static
Map
<
String
,
NationalDictionaryRe
>
NUMBERCODEMAP
=
new
HashMap
<>();
@Autowired
@Autowired
private
SysCaptchaService
sysCaptchaService
;
private
SysCaptchaService
sysCaptchaService
;
...
@@ -97,9 +97,41 @@ public class GLNOutController {
...
@@ -97,9 +97,41 @@ public class GLNOutController {
String
result
=
HttpUtil
.
get
(
url
,
paramMap
);
String
result
=
HttpUtil
.
get
(
url
,
paramMap
);
log
.
info
(
"/verified==>{}==>{}"
,
paramMap
,
result
);
log
.
info
(
"/verified==>{}==>{}"
,
paramMap
,
result
);
JSONArray
objects
=
JSONArray
.
parseArray
(
result
);
JSONArray
objects
=
JSONArray
.
parseArray
(
result
);
return
R
.
ok
().
put
(
"data"
,
objects
);
//
if
(
CollectionUtils
.
isNotEmpty
(
objects
))
{
JSONObject
jsonObject
=
objects
.
getJSONObject
(
0
);
//人为增加英文产品类别
String
gpcCategoryCode
=
jsonObject
.
getString
(
"gpcCategoryCode"
);
if
(
StringUtils
.
isNotBlank
(
gpcCategoryCode
))
{
String
s
=
HttpUtil
.
get
(
HOST
+
"/api/ProductManager/GetSuccessGpc?code="
+
gpcCategoryCode
);
if
(
StringUtils
.
isNotBlank
(
s
))
{
String
gpcEnName
=
JSONObject
.
parseObject
(
s
).
getString
(
"GPCEnName"
);
jsonObject
.
put
(
"gpcCategoryCodeEnName"
,
gpcEnName
);
}
}
//人为赋值目标市场
List
<
JSONObject
>
countryOfSaleCodes
=
JSONArray
.
parseArray
(
jsonObject
.
getString
(
"countryOfSaleCode"
),
JSONObject
.
class
);
if
(
countryOfSaleCodes
!=
null
)
{
for
(
JSONObject
countryOfSaleCode
:
countryOfSaleCodes
)
{
String
numeric
=
countryOfSaleCode
.
getString
(
"numeric"
);
if
(
"001"
.
equals
(
numeric
))
{
countryOfSaleCode
.
put
(
"countrySale"
,
"全球"
);
}
else
{
if
(
NUMBERCODEMAP
.
size
()
<
1
)
{
getCountry
();
}
NationalDictionaryRe
re
=
NUMBERCODEMAP
.
get
(
numeric
);
if
(
re
!=
null
)
{
countryOfSaleCode
.
put
(
"countrySale"
,
re
.
getCountrytitle
());
}
}
}
jsonObject
.
put
(
"countryOfSaleCode"
,
countryOfSaleCodes
);
}
}
}
return
R
.
ok
().
put
(
"data"
,
objects
);
}
/**
/**
* 境外条码查询--验证其他GS1标识
* 境外条码查询--验证其他GS1标识
...
@@ -287,13 +319,26 @@ public class GLNOutController {
...
@@ -287,13 +319,26 @@ public class GLNOutController {
@Login
@Login
@RequestMapping
(
"/api/searchCountry"
)
@RequestMapping
(
"/api/searchCountry"
)
public
R
searchCountry
()
{
public
R
searchCountry
()
{
if
(
COUNTRYS
==
null
)
{
if
(
CollectionUtils
.
isEmpty
(
COUNTRYS
))
{
getCountry
();
}
return
R
.
ok
().
put
(
"data"
,
COUNTRYS
);
}
/**
* 初始化国家字典
*/
private
static
void
getCountry
()
{
log
.
info
(
"初始化国家字典"
);
String
url
=
"http://219.232.114.68:8088/api/importer/v1/CodeApi?name=ISO3166Code"
;
String
url
=
"http://219.232.114.68:8088/api/importer/v1/CodeApi?name=ISO3166Code"
;
String
result
=
HttpUtil
.
get
(
url
);
String
result
=
HttpUtil
.
get
(
url
);
log
.
info
(
"/searchCountry==>{}"
,
result
);
COUNTRYS
=
JSONArray
.
parseArray
(
result
,
NationalDictionaryRe
.
class
);
COUNTRYS
=
JSONArray
.
parseArray
(
result
);
log
.
info
(
"COUNTRYS==>{}"
,
COUNTRYS
.
size
());
//初始化
for
(
NationalDictionaryRe
country
:
COUNTRYS
)
{
NUMBERCODEMAP
.
put
(
country
.
getNumbercode
(),
country
);
}
}
return
R
.
ok
().
put
(
"data"
,
COUNTRYS
);
}
}
...
...
src/main/java/io/office/modules/manage/vo/response/NationalDictionaryRe.java
0 → 100644
View file @
da037ca7
package
io
.
office
.
modules
.
manage
.
vo
.
response
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
NationalDictionaryRe
implements
Serializable
{
private
String
twocode
;
private
String
threecode
;
private
String
numbercode
;
private
String
ISOcode
;
private
String
countrytitle
;
}
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