Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-spark-tag-4.0
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
wangxiaokang
gic-spark-tag-4.0
Commits
91190f76
Commit
91190f76
authored
Aug 26, 2020
by
guos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员标签4.0
parent
9cba724f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
70 deletions
+4
-70
HttpClient.java
src/main/java/com/gic/spark/util/HttpClient.java
+4
-4
IndexRequestUtil.java
src/main/java/com/gic/spark/util/IndexRequestUtil.java
+0
-66
No files found.
src/main/java/com/gic/spark/util/HttpClient.java
View file @
91190f76
...
@@ -468,11 +468,11 @@ public class HttpClient {
...
@@ -468,11 +468,11 @@ public class HttpClient {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
finally
{
logger
.
info
(
"result:"
+
result
);
//
logger.info("result:" + result);
logger
.
info
(
"responseStr:"
+
responseStr
);
//
logger.info("responseStr:" + responseStr);
logger
.
info
(
"responseCode:"
+
responseCode
);
logger
.
info
(
"responseCode:"
+
responseCode
);
System
.
out
.
println
(
"result:"
+
result
);
//
System.out.println("result:" + result);
System
.
out
.
println
(
"responseStr:"
+
responseStr
);
//
System.out.println("responseStr:" + responseStr);
System
.
out
.
println
(
"responseCode:"
+
responseCode
);
System
.
out
.
println
(
"responseCode:"
+
responseCode
);
}
}
...
...
src/main/java/com/gic/spark/util/IndexRequestUtil.java
View file @
91190f76
...
@@ -55,70 +55,4 @@ public class IndexRequestUtil {
...
@@ -55,70 +55,4 @@ public class IndexRequestUtil {
return
result
;
return
result
;
}
}
public
static
List
<
String
>
getGoodsInfoById
(
String
enterpriseId
,
String
selectorId
,
boolean
isProd
)
{
String
url
=
"http://gicdev.demogic.com/api-plug/get-store-goods-sku-filter?enterpriseId="
+
enterpriseId
+
"&id="
+
selectorId
;
if
(
isProd
)
{
url
=
"http://demogic.com/api-plug/get-store-goods-sku-filter?requestProject=goods&enterpriseId="
+
enterpriseId
+
"&id="
+
selectorId
;
}
try
{
HttpResponse
response
=
HttpClient
.
getHttpResponseByGet
(
url
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
HttpClient
.
getResponseString
(
response
));
JSONArray
filterConditions
=
jsonObject
.
getJSONObject
(
"result"
).
getJSONArray
(
"filterCondition"
);
System
.
out
.
println
(
"filterConditions==>"
+
filterConditions
.
toJSONString
());
JSONObject
resultSku
=
getSkuCode
(
enterpriseId
,
filterConditions
,
isProd
,
1
);
int
total
=
resultSku
.
getJSONObject
(
"result"
).
getIntValue
(
"total"
);
JSONArray
resultArray
=
resultSku
.
getJSONObject
(
"result"
).
getJSONArray
(
"result"
);
List
<
String
>
skuList
=
new
ArrayList
(
total
);
for
(
Object
object
:
resultArray
)
{
JSONObject
goodsInfo
=
(
JSONObject
)
object
;
skuList
.
add
(
goodsInfo
.
getString
(
"skuCode"
));
}
int
totalPages
=
(
total
-
1
)/
1000
+
1
;
if
(
totalPages
>
1
){
for
(
int
i
=
2
;
i
<=
totalPages
;
i
++){
JSONObject
rlt
=
getSkuCode
(
enterpriseId
,
filterConditions
,
isProd
,
i
);
if
(
null
!=
rlt
){
JSONObject
rltJSONO
=
rlt
.
getJSONObject
(
"result"
);
if
(
null
!=
rltJSONO
){
JSONArray
rltArray
=
rltJSONO
.
getJSONArray
(
"result"
);
for
(
Object
object
:
rltArray
)
{
JSONObject
goodsInfo
=
(
JSONObject
)
object
;
skuList
.
add
(
goodsInfo
.
getString
(
"skuCode"
));
}
}
}
}
}
return
skuList
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
DingtalkMessageUtil
.
sendAlertMessage
(
"selectorId: "
+
selectorId
+
" parsing result error "
);
}
return
null
;
}
private
static
JSONObject
getSkuCode
(
String
enterpriseId
,
JSONArray
filterConditions
,
boolean
isProd
,
int
currentPage
)
throws
IOException
{
String
skuUrl
=
"http://gicdev.demogic.com/api-plug/store-goods-sku-filter?enterpriseId="
+
enterpriseId
;
if
(
isProd
)
{
skuUrl
=
"http://demogic.com/api-plug/store-goods-sku-filter?enterpriseId="
+
enterpriseId
;
}
HttpPost
httpPost
=
new
HttpPost
(
skuUrl
);
httpPost
.
addHeader
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
JSONObject
requestObject
=
new
JSONObject
();
requestObject
.
put
(
"currentPage"
,
currentPage
);
requestObject
.
put
(
"pageSize"
,
Integer
.
MAX_VALUE
);
requestObject
.
put
(
"queryList"
,
filterConditions
);
requestObject
.
put
(
"source"
,
1
);
StringEntity
stringEntity
=
new
StringEntity
(
requestObject
.
toString
(),
"UTF-8"
);
stringEntity
.
setContentEncoding
(
"UTF-8"
);
httpPost
.
setEntity
(
stringEntity
);
HttpResponse
response
=
HttpClient
.
getHttpClient
().
execute
(
httpPost
);
JSONObject
result
=
JSONObject
.
parseObject
(
HttpClient
.
getResponseString
(
response
));
return
result
;
}
}
}
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