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
ac5f58cd
Commit
ac5f58cd
authored
Jan 12, 2022
by
吴迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】修改代码
parent
b18c4f67
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
240 additions
and
73 deletions
+240
-73
GLNController.java
...va/io/office/modules/manage/controller/GLNController.java
+44
-36
TycpdmFirmServiceImpl.java
...ce/modules/manage/service/impl/TycpdmFirmServiceImpl.java
+7
-10
TransferController.java
...io/office/modules/manage/transfer/TransferController.java
+164
-0
DESUtils.java
src/main/java/io/office/modules/manage/utils/DESUtils.java
+10
-3
HttpUtlis.java
src/main/java/io/office/modules/manage/utils/HttpUtlis.java
+5
-0
Test.java
src/main/java/io/office/modules/manage/webservice/Test.java
+10
-24
No files found.
src/main/java/io/office/modules/manage/controller/GLNController.java
View file @
ac5f58cd
...
@@ -228,47 +228,55 @@ public class GLNController {
...
@@ -228,47 +228,55 @@ public class GLNController {
@RequestMapping
(
"/api/domesticCodeProductionNews"
)
@RequestMapping
(
"/api/domesticCodeProductionNews"
)
public
R
domesticCodeProductionNews
(
@RequestBody
DomesticCodeVo
domesticCodeVo
,
HttpServletRequest
request
)
{
public
R
domesticCodeProductionNews
(
@RequestBody
DomesticCodeVo
domesticCodeVo
,
HttpServletRequest
request
)
{
SearchgtinlogEntity
searchgtinlogEntity
=
new
SearchgtinlogEntity
();
if
(
StringUtils
.
isNotBlank
(
domesticCodeVo
.
getCode
()))
{
searchgtinlogEntity
.
setCreatedate
(
new
Date
());
if
(
domesticCodeVo
.
getCode
().
length
()<
13
)
{
searchgtinlogEntity
.
setIp
(
IPUtils
.
getIpAddr
(
request
));
return
R
.
error
(
"商品条码卡位数太少!请输入正确的13位或14位商品条码!"
);
searchgtinlogEntity
.
setClassStr
(
"境内商品条码信息查询"
);
searchgtinlogEntity
.
setKeyword
(
domesticCodeVo
.
getCode
());
searchgtinlogEntity
.
setSearchsource
(
0
);
//新增查询日志
searchgtinlogService
.
save
(
searchgtinlogEntity
);
String
urlMac
=
"/AAQI/v1/ProductData/gtin/${code}?targetMarket=156&dataVersion=1.1&clientGln=6901234503814"
;
String
macStr
=
MacUtils
.
getMac
(
urlMac
.
replaceAll
(
"\\$\\{code\\}"
,
domesticCodeVo
.
getCode
()));
String
url
=
"http://api.chinatrace.org/AAQI/v1/ProductData/gtin/${code}?targetMarket=156&dataVersion=1.1&clientGln=6901234503814&mac="
;
url
=
url
.
replaceAll
(
"\\$\\{code\\}"
,
domesticCodeVo
.
getCode
())+
macStr
;
System
.
out
.
println
(
url
);
RestTemplate
restTemplate
=
new
RestTemplate
();
//创建请求头
//创建请求头
ResponseEntity
<
String
>
responseEntity
=
null
;
try
{
responseEntity
=
restTemplate
.
getForEntity
(
url
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
e
.
printStackTrace
();
if
(
e
.
getLocalizedMessage
().
equals
(
"400 Bad Request"
))
{
return
R
.
error
(
"无效的境内商品条码!"
);
}
else
if
(
e
.
getLocalizedMessage
().
equals
(
"403 Bad Request"
))
{
return
R
.
error
(
"安全异常!"
);
}
}
}
SearchgtinlogEntity
searchgtinlogEntity
=
new
SearchgtinlogEntity
();
if
(
responseEntity
.
getStatusCode
().
value
()
==
200
)
{
searchgtinlogEntity
.
setCreatedate
(
new
Date
());
// 下面的是通过解析xml字符串的
searchgtinlogEntity
.
setIp
(
IPUtils
.
getIpAddr
(
request
));
String
returnObjs
=
responseEntity
.
getBody
().
substring
(
responseEntity
.
getBody
().
indexOf
(
"<productInformationLink>"
),
responseEntity
.
getBody
().
lastIndexOf
(
"</productInformationLink>"
)+
"</productInformationLink>"
.
length
());
//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点
searchgtinlogEntity
.
setClassStr
(
"境内商品条码信息查询"
);
ProductInformationLink
productInformationLink
=
JaxbUtil
.
converyToJavaBean
(
returnObjs
,
ProductInformationLink
.
class
);
searchgtinlogEntity
.
setKeyword
(
domesticCodeVo
.
getCode
());
if
(
productInformationLink
!=
null
)
searchgtinlogEntity
.
setSearchsource
(
0
);
{
//新增查询日志
if
(
StringUtils
.
isNotBlank
(
productInformationLink
.
getUrl
()))
{
searchgtinlogService
.
save
(
searchgtinlogEntity
);
return
R
.
ok
().
put
(
"data"
,
productInformationLink
.
getUrl
());
String
urlMac
=
"/AAQI/v1/ProductData/gtin/${code}?targetMarket=156&dataVersion=1.1&clientGln=6901234503814"
;
String
macStr
=
MacUtils
.
getMac
(
urlMac
.
replaceAll
(
"\\$\\{code\\}"
,
domesticCodeVo
.
getCode
()));
String
url
=
"http://api.chinatrace.org/AAQI/v1/ProductData/gtin/${code}?targetMarket=156&dataVersion=1.1&clientGln=6901234503814&mac="
;
url
=
url
.
replaceAll
(
"\\$\\{code\\}"
,
domesticCodeVo
.
getCode
())+
macStr
;
System
.
out
.
println
(
url
);
RestTemplate
restTemplate
=
new
RestTemplate
();
//创建请求头
//创建请求头
ResponseEntity
<
String
>
responseEntity
=
null
;
try
{
responseEntity
=
restTemplate
.
getForEntity
(
url
,
String
.
class
);
}
catch
(
RestClientException
e
)
{
e
.
printStackTrace
();
if
(
e
.
getLocalizedMessage
().
equals
(
"400 Bad Request"
))
{
return
R
.
error
(
"无效的境内商品条码!"
);
}
else
if
(
e
.
getLocalizedMessage
().
equals
(
"403 Bad Request"
))
{
return
R
.
error
(
"安全异常!"
);
}
}
if
(
responseEntity
.
getStatusCode
().
value
()
==
200
)
{
// 下面的是通过解析xml字符串的
String
returnObjs
=
responseEntity
.
getBody
().
substring
(
responseEntity
.
getBody
().
indexOf
(
"<productInformationLink>"
),
responseEntity
.
getBody
().
lastIndexOf
(
"</productInformationLink>"
)+
"</productInformationLink>"
.
length
());
//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点
ProductInformationLink
productInformationLink
=
JaxbUtil
.
converyToJavaBean
(
returnObjs
,
ProductInformationLink
.
class
);
if
(
productInformationLink
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
productInformationLink
.
getUrl
()))
{
return
R
.
ok
().
put
(
"data"
,
productInformationLink
.
getUrl
());
}
}
}
}
}
}
}
return
R
.
error
(
"查询失败!"
);
return
R
.
error
(
"查询失败!"
);
}
}
...
...
src/main/java/io/office/modules/manage/service/impl/TycpdmFirmServiceImpl.java
View file @
ac5f58cd
...
@@ -67,9 +67,6 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
...
@@ -67,9 +67,6 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Value
(
"${uploadFileQYOne}"
)
@Value
(
"${uploadFileQYOne}"
)
String
uploadFileQYOne
;
String
uploadFileQYOne
;
@Autowired
private
DomainListProperties
domainListProperties
;
@Override
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
TycpdmFirmEntity
>
page
=
this
.
page
(
IPage
<
TycpdmFirmEntity
>
page
=
this
.
page
(
...
@@ -129,7 +126,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
...
@@ -129,7 +126,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}
else
if
(
levels
==
1
){
}
else
if
(
levels
==
1
){
throw
new
RRException
(
"无权访问"
);
throw
new
RRException
(
"无权访问"
);
}
else
if
(
String
.
valueOf
(
levels
).
length
()==
4
){
}
else
if
(
String
.
valueOf
(
levels
).
length
()==
4
){
//levels=-99;
//levels=-99;
}
else
{
}
else
{
throw
new
RRException
(
"无权访问"
);
throw
new
RRException
(
"无权访问"
);
}
}
...
@@ -184,8 +181,8 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
...
@@ -184,8 +181,8 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
file
.
transferTo
(
dest
);
file
.
transferTo
(
dest
);
//保存路径 firm_archivesFile
//保存路径 firm_archivesFile
tycpdmFirmDao
.
updateByIdfirmArchivesFile
(
uploadFileQY
+
uuid
+
substring
,
id
,
0
,
DateUtils
.
getTime
());
tycpdmFirmDao
.
updateByIdfirmArchivesFile
(
uploadFileQY
+
uuid
+
substring
,
id
,
0
,
DateUtils
.
getTime
());
//tycpdm_vip_user表中新增数据
//tycpdm_vip_user表中新增数据
/*TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
/*TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser();
String baseUser = tycpdmFirmEntity.getBaseUser();
String firmname = tycpdmFirmEntity.getFirmname();
String firmname = tycpdmFirmEntity.getFirmname();
...
@@ -199,7 +196,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
...
@@ -199,7 +196,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}
}
}
}
return
;
return
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
dir
.
delete
();
dir
.
delete
();
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -532,7 +529,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
...
@@ -532,7 +529,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
File
file
=
new
File
(
filePath
);
File
file
=
new
File
(
filePath
);
if
(!
file
.
exists
()){
if
(!
file
.
exists
()){
return
"不存在"
;
return
"不存在"
;
}
}
return
"存在"
;
return
"存在"
;
}
}
...
@@ -632,7 +629,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
...
@@ -632,7 +629,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
String
phone_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
phone
.
getBytes
(),
"loginkey"
.
getBytes
()));
String
phone_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
phone
.
getBytes
(),
"loginkey"
.
getBytes
()));
String
password
=
memberUser
.
getPassword
();
//名文密码
String
password
=
memberUser
.
getPassword
();
//名文密码
String
password_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
password
.
getBytes
(),
"loginkey"
.
getBytes
()));
String
password_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
password
.
getBytes
(),
"loginkey"
.
getBytes
()));
String
url
=
domainListProperties
.
getDomain
()+
"redirectBusinessHall
/anccoh/login?method=gdsLoginSSO&gdsCode="
+
phone_M
+
"&password="
+
password_M
;
String
url
=
"http://wsdt.gs1cn.org
/anccoh/login?method=gdsLoginSSO&gdsCode="
+
phone_M
+
"&password="
+
password_M
;
return
url
;
return
url
;
}
else
if
(
userType
==
3
){
}
else
if
(
userType
==
3
){
phone
=
memberUser
.
getPhone
();
//手机号
phone
=
memberUser
.
getPhone
();
//手机号
...
@@ -641,7 +638,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
...
@@ -641,7 +638,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}
}
String
phone_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
phone
.
getBytes
(),
"loginkey"
.
getBytes
()));
String
phone_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
phone
.
getBytes
(),
"loginkey"
.
getBytes
()));
String
url
=
domainListProperties
.
getDomain
()+
"redirectBusinessHall
/anccoh/login?method=phoneSSO&phone="
+
phone_M
;
String
url
=
"http://wsdt.gs1cn.org
/anccoh/login?method=phoneSSO&phone="
+
phone_M
;
return
url
;
return
url
;
}
}
...
...
src/main/java/io/office/modules/manage/transfer/TransferController.java
View file @
ac5f58cd
...
@@ -59,6 +59,8 @@ public class TransferController {
...
@@ -59,6 +59,8 @@ public class TransferController {
@Autowired
@Autowired
private
PolicyService
policyService
;
private
PolicyService
policyService
;
@Autowired
private
KnowledgeinfoService
knowledgeinfoService
;
@RequestMapping
(
"/api/indexCarouselManage"
)
@RequestMapping
(
"/api/indexCarouselManage"
)
// @RequiresPermissions("generator:topicnews:list")
// @RequiresPermissions("generator:topicnews:list")
...
@@ -1245,6 +1247,168 @@ public class TransferController {
...
@@ -1245,6 +1247,168 @@ public class TransferController {
}
}
@RequestMapping
(
"/api/knowledgeInfo"
)
// @RequiresPermissions("generator:topicnews:list")
public
R
knowledgeInfo
()
{
QueryWrapper
<
KnowledgeinfoEntity
>
indexCarouselManageEntityQueryWrapper
=
new
QueryWrapper
<>();
int
count
=
knowledgeinfoService
.
count
(
indexCarouselManageEntityQueryWrapper
);
if
(
count
>
0
)
{
boolean
flag
=
true
;
int
n
=
1
;
while
(
flag
)
{
int
limit
=
10
;
int
pages
=
0
;
if
((
count
%
limit
)
==
0
)
{
pages
=
(
count
/
limit
);
}
else
{
pages
=
(
count
/
limit
)
+
1
;
}
if
(
n
<=
pages
)
{
IPage
<
KnowledgeinfoEntity
>
pageData
=
knowledgeinfoService
.
page
(
new
Page
(
n
,
limit
),
indexCarouselManageEntityQueryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
pageData
.
getRecords
()))
{
for
(
KnowledgeinfoEntity
knowledgeinfoEntity
:
pageData
.
getRecords
())
{
KnowledgeinfoEntity
knowledgeinfoEntityDB
=
new
KnowledgeinfoEntity
();
//如果不为空
if
(
StringUtils
.
isNotBlank
(
knowledgeinfoEntity
.
getDirectpath
()))
{
//先判断是否是官网的前缀
if
(
knowledgeinfoEntity
.
getDirectpath
().
startsWith
(
"http://www.gs1cn.org"
))
{
//官网的链接
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"http://www.gs1cn.org"
,
domainListProperties
.
getDomain
()));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
startsWith
(
"http://www.ancc.org.cn"
))
{
//官网的链接
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"http://www.ancc.org.cn"
,
domainListProperties
.
getDomain
()));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
startsWith
(
"http://81.68.189.225:8080"
))
{
//官网的链接
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"http://81.68.189.225:8080"
,
domainListProperties
.
getDomain
()));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"news/article.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"news/article.aspx"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"News/article.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"News/article.aspx"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"news/article_admin.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"news/article_admin.aspx"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"News/VideoDetails.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"News/VideoDetails.aspx"
,
"News/msgVideo"
));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"/Org/Intro.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"/Org/Intro.aspx"
,
domainListProperties
+
"/Org/Intro"
));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"News/PicNews.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"News/PicNews.aspx"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"news/newsone.asp"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"news/newsone.asp"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"Service/notice/article.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"Service/notice/article.aspx"
,
"News/NoticeArticle"
));
}
if
(
knowledgeinfoEntity
.
getDirectpath
().
indexOf
(
"News/VideoDetails.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setDirectpath
(
knowledgeinfoEntity
.
getDirectpath
().
replaceAll
(
"News/VideoDetails.aspx"
,
"News/msgVideo"
));
}
}
if
(
StringUtils
.
isNotBlank
(
knowledgeinfoEntity
.
getContent
()))
{
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"http://www.gs1cn.org"
)
>
-
1
&&
!(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"http://www.gs1cn.org/UserImages"
)
>
-
1
)
&&
!(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"http://www.ancc.org.cn/UserFiles"
)
>
-
1
))
{
//官网的链接
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"http://www.gs1cn.org"
,
domainListProperties
.
getDomain
()));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"http://www.ancc.org.cn"
)
>
-
1
&&
!(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"http://www.gs1cn.org/UserImages"
)
>
-
1
)
&&
!(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"http://www.ancc.org.cn/UserFiles"
)
>
-
1
))
{
//官网的链接
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"http://www.ancc.org.cn"
,
domainListProperties
.
getDomain
()));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"http://81.68.189.225:8080"
)
>
-
1
)
{
//官网的链接
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"http://81.68.189.225:8080"
,
domainListProperties
.
getDomain
()));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"news/article.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"news/article.aspx"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"News/article.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"News/article.aspx"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"news/article_admin.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"news/article_admin.aspx"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"News/VideoDetails.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"News/VideoDetails.aspx"
,
"News/msgVideo"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"/Org/Intro.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"/Org/Intro.aspx"
,
domainListProperties
+
"/Org/Intro"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"News/PicNews.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"News/PicNews.aspx"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"news/newsone.asp"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"news/newsone.asp"
,
"News/msg"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"Service/notice/article.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"Service/notice/article.aspx"
,
"News/NoticeArticle"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"News/VideoDetails.aspx"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"News/VideoDetails.aspx"
,
"News/msgVideo"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"/News/msg?Id"
)
>
-
1
)
{
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"/News/msg\\?Id"
,
"/News/msg?id"
));
}
}
if
(
StringUtils
.
isNotBlank
(
knowledgeinfoEntity
.
getContent
()))
{
// if (knowledgeinfoEntity.getContent().indexOf("<img src=\"/UserFiles/") > -1) {//官网的链接
// knowledgeinfoEntityDB.setContent(knowledgeinfoEntity.getContent().replaceAll("<img src=\"/UserFiles/", "<img src=\"" + fileRequestPrefix + "UserFiles/"));
// }
// if (knowledgeinfoEntity.getContent().indexOf("<img src=\"/UserImages") > -1) {//官网的链接
// knowledgeinfoEntityDB.setContent(knowledgeinfoEntity.getContent().replaceAll("<img src=\"UserImages", "<img src=\"" + fileRequestPrefix + "UserImages/"));
// }
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"src=\"/UserFiles"
)
>
-
1
)
{
//官网的链接
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"src=\"/UserFiles"
,
"src=\""
+
fileRequestPrefix
+
"UserFiles"
));
}
if
(
knowledgeinfoEntity
.
getContent
().
indexOf
(
"src=\"/UserImages"
)
>
-
1
)
{
//官网的链接
knowledgeinfoEntityDB
.
setContent
(
knowledgeinfoEntity
.
getContent
().
replaceAll
(
"src=\"/UserImages"
,
"src=\""
+
fileRequestPrefix
+
"UserImages"
));
}
}
//修改
if
(
StringUtils
.
isNotBlank
(
knowledgeinfoEntityDB
.
getContent
())
||
StringUtils
.
isNotBlank
(
knowledgeinfoEntityDB
.
getDirectpath
())
)
{
UpdateWrapper
<
KnowledgeinfoEntity
>
updateWrapper
=
new
UpdateWrapper
();
updateWrapper
.
eq
(
"knowledgeinfoid"
,
knowledgeinfoEntity
.
getKnowledgeinfoid
());
knowledgeinfoService
.
update
(
knowledgeinfoEntityDB
,
updateWrapper
);
}
}
n
=
n
+
1
;
}
}
else
{
flag
=
false
;
}
}
}
return
R
.
ok
().
put
(
"data"
,
null
);
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
str
=
"\n"
+
String
str
=
"\n"
+
"<STYLE type=text/css>\n"
+
"<STYLE type=text/css>\n"
+
...
...
src/main/java/io/office/modules/manage/utils/DESUtils.java
View file @
ac5f58cd
...
@@ -72,18 +72,25 @@ public class DESUtils {
...
@@ -72,18 +72,25 @@ public class DESUtils {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
userName
=
"test_tru"
;
//http://wsdt.ancc.org.cn/anccoh/loginOper.jsp?method=AppLogin&identity=AFE77D5AB4599C4E82D4ACAB169A4DB6&pwd=e10adc3949ba59abbe56e057f20f883e&code=
String
password
=
"123123"
;
String
userName
=
"18810209356"
;
String
password
=
"123qwe"
;
String
card
=
"1165004"
;
String
password_MD5
=
"4297f44b13955235245b2497399d7a93"
;
String
password_MD5
=
"4297f44b13955235245b2497399d7a93"
;
System
.
out
.
println
(
MD5Util
.
unicodeToString
(
"123qwe"
));;
String
userName_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
userName
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
userName_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
userName
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
password_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
password
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
password_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
password
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
password_M_MD5
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
password_MD5
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
password_M_MD5
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
password_MD5
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
card_M_MD5
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
card
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
System
.
out
.
println
(
userName_M
);
System
.
out
.
println
(
userName_M
);
System
.
out
.
println
(
password_M
);
System
.
out
.
println
(
password_M
);
System
.
out
.
println
(
password_M_MD5
);
System
.
out
.
println
(
password_M_MD5
);
System
.
out
.
println
(
card_M_MD5
);
String
aaa
=
"
88DA15B9F9F602F0D32D46808652B06DC6E939D1424CE39F69A2AC39743F7ED7591975685B543E1D
"
;
String
aaa
=
"
AFE77D5AB4599C4E82D4ACAB169A4DB6
"
;
//String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes()));
//String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes()));
String
s
=
new
String
(
DESUtils
.
DES_CBC_Decrypt
(
aaa
,
"appsGdsn"
.
getBytes
()));
String
s
=
new
String
(
DESUtils
.
DES_CBC_Decrypt
(
aaa
,
"appsGdsn"
.
getBytes
()));
...
...
src/main/java/io/office/modules/manage/utils/HttpUtlis.java
View file @
ac5f58cd
...
@@ -27,4 +27,9 @@ public class HttpUtlis {
...
@@ -27,4 +27,9 @@ public class HttpUtlis {
throw
new
RuntimeException
(
e
.
getMessage
());
throw
new
RuntimeException
(
e
.
getMessage
());
}
}
}
}
}
}
src/main/java/io/office/modules/manage/webservice/Test.java
View file @
ac5f58cd
package
io
.
office
.
modules
.
manage
.
webservice
;
package
io
.
office
.
modules
.
manage
.
webservice
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
io.office.modules.manage.webservice.newWebservice.JaxbUtil
;
import
io.office.modules.manage.webservice.newWebservice.ProductInformationLink
;
import
org.jdom.Document
;
import
org.jdom.Document
;
import
org.jdom.Element
;
import
org.jdom.Element
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpEntity
;
...
@@ -28,38 +30,22 @@ public class Test {
...
@@ -28,38 +30,22 @@ public class Test {
public
static
void
main
(
String
[]
args
)
throws
JAXBException
,
IOException
{
public
static
void
main
(
String
[]
args
)
throws
JAXBException
,
IOException
{
String
smsTemplateXml
=
WebServiceXmlTemplate
.
SEND_MESSAGE_TEMPLATE
.
replaceAll
(
"\\$\\{cascade\\}"
,
"9"
).
replaceAll
(
"\\$\\{requestedKeyCode\\}"
,
"GLN"
)
.
replaceAll
(
"\\$\\{requestedKeyValue\\}"
,
"6973947140013"
).
replaceAll
(
"\\$\\{requestedLanguage\\}"
,
"en"
);
String
url
=
"http://api.chinatrace.org/AAQI/v1/ProductData/gtin/6920582200169?targetMarket=156&dataVersion=1.1&clientGln=6901234503814&mac=F562D581607A5582187B4231B2CEFC7BB94EC11FF5F0D0082AD013F2254103E1"
;
String
url
=
"http://webservice.anccnet.com:8080/gepir4/gepirv4.asmx"
;
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
//创建请求头
//创建请求头
//创建请求头
//创建请求头
HttpHeaders
headers
=
new
HttpHeaders
();
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
url
,
String
.
class
);
headers
.
set
(
"Content-Type"
,
"text/xml; charset=utf-8"
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
smsTemplateXml
,
headers
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
url
,
entity
,
String
.
class
);
if
(
responseEntity
.
getStatusCode
().
value
()
==
200
)
{
if
(
responseEntity
.
getStatusCode
().
value
()
==
200
)
{
// 下面的是通过解析xml字符串的
// 下面的是通过解析xml字符串的
Document
doc
=
null
;
Document
doc
=
null
;
String
returnObjs
=
responseEntity
.
getBody
().
substring
(
responseEntity
.
getBody
().
indexOf
(
"<p
artyDataLine>"
),
responseEntity
.
getBody
().
indexOf
(
"</gepirParty>"
));
//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点
String
returnObjs
=
responseEntity
.
getBody
().
substring
(
responseEntity
.
getBody
().
indexOf
(
"<p
roductInformationLink>"
),
responseEntity
.
getBody
().
lastIndexOf
(
"</productInformationLink>"
)+
"</productInformationLink>"
.
length
(
));
//注意 获取根节点的时候要查看返回的xml参数的形式是否为一个根节点
System
.
out
.
println
(
returnObjs
);
System
.
out
.
println
(
returnObjs
);
Object
xmlObject
=
null
;
ProductInformationLink
book
=
JaxbUtil
.
converyToJavaBean
(
returnObjs
,
ProductInformationLink
.
class
);
Reader
reader
=
null
;
book
.
getUrl
();
//利用JAXBContext将类转为一个实例
System
.
out
.
println
(
JSONUtil
.
toJsonStr
(
book
));
JAXBContext
context
=
JAXBContext
.
newInstance
(
PartyDataLine
.
class
);
System
.
out
.
println
(
book
.
getUrl
());
//XMl 转为对象的接口
Unmarshaller
unmarshaller
=
context
.
createUnmarshaller
();
reader
=
new
StringReader
(
returnObjs
);
xmlObject
=
unmarshaller
.
unmarshal
(
reader
);
if
(
reader
!=
null
)
{
reader
.
close
();
}
System
.
out
.
println
(
JSONUtil
.
toJsonStr
(
xmlObject
));
/*Object xmlObject = null;
/*Object xmlObject = null;
Reader reader = null;
Reader reader = null;
...
...
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