Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
Z
zion
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
zion
Commits
caf410c6
提交
caf410c6
authored
1月 18, 2020
作者:
zgy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改购物车
上级
207c0bb1
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
87 行增加
和
9 行删除
+87
-9
TbCfStationItemDao.xml
src/main/resources/mapper/TbCfStationItemDao.xml
+3
-5
ZionApplicationTests.java
src/test/java/com/diaoyun/zion/ZionApplicationTests.java
+84
-4
没有找到文件。
src/main/resources/mapper/TbCfStationItemDao.xml
浏览文件 @
caf410c6
...
@@ -186,11 +186,9 @@
...
@@ -186,11 +186,9 @@
`item_descrition_id`
`item_descrition_id`
from tb_cf_station_item
from tb_cf_station_item
where enable_flag=1 and item_category = #{categoryId}
where enable_flag=1 and item_category = #{categoryId}
order by
<if
test=
"order != null "
>
<if
test=
"order != null"
>
discount_price ${order},
</if>
order by discount_price ${order}
item_num desc
</if>
</select>
</select>
<select
id=
"getGoodsTypeList"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity"
>
<select
id=
"getGoodsTypeList"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity"
>
select
select
...
...
src/test/java/com/diaoyun/zion/ZionApplicationTests.java
浏览文件 @
caf410c6
package
com
.
diaoyun
.
zion
;
package
com
.
diaoyun
.
zion
;
import
com.aliyun.oss.common.utils.HttpUtil
;
import
com.diaoyun.zion.chinafrica.constant.KeyConstant
;
import
com.diaoyun.zion.chinafrica.constant.KeyConstant
;
import
com.diaoyun.zion.chinafrica.dao.TbCfIssueCouponDao
;
import
com.diaoyun.zion.chinafrica.dao.TbCfIssueCouponDao
;
import
com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity
;
import
com.diaoyun.zion.chinafrica.entity.TbCfUserInfoEntity
;
import
com.diaoyun.zion.chinafrica.service.SpiderService
;
import
com.diaoyun.zion.chinafrica.service.SpiderService
;
import
com.diaoyun.zion.chinafrica.service.TbCfCouponService
;
import
com.diaoyun.zion.chinafrica.service.TbCfCouponService
;
import
com.diaoyun.zion.chinafrica.service.TbCfIssueCouponService
;
import
com.diaoyun.zion.chinafrica.service.TbCfIssueCouponService
;
import
com.diaoyun.zion.chinafrica.service.TbCfUserInfoService
;
import
com.diaoyun.zion.chinafrica.service.TbCfUserInfoService
;
import
com.diaoyun.zion.chinafrica.vo.ShopifyConstant
;
import
com.diaoyun.zion.chinafrica.vo.TbCfOrderVo
;
import
com.diaoyun.zion.chinafrica.vo.TbCfOrderVo
;
import
com.diaoyun.zion.master.common.RedisCache
;
import
com.diaoyun.zion.master.common.RedisCache
;
import
com.diaoyun.zion.master.thread.TaskLimitSemaphore
;
import
com.diaoyun.zion.master.thread.TaskLimitSemaphore
;
import
com.diaoyun.zion.master.util.AESUtils
;
import
com.diaoyun.zion.master.util.AESUtils
;
import
com.diaoyun.zion.master.util.HttpClientUtil
;
import
com.diaoyun.zion.master.util.IdUtil
;
import
com.diaoyun.zion.master.util.IdUtil
;
import
com.diaoyun.zion.master.util.SMSUtil
;
import
com.diaoyun.zion.master.util.SMSUtil
;
import
com.stripe.exception.StripeException
;
import
com.stripe.exception.StripeException
;
import
freemarker.template.Configuration
;
import
freemarker.template.Configuration
;
import
freemarker.template.TemplateException
;
import
freemarker.template.TemplateException
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.mail.EmailException
;
import
org.apache.commons.mail.EmailException
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.CookieStore
;
import
org.apache.http.client.CookieStore
;
...
@@ -570,8 +576,8 @@ public class ZionApplicationTests {
...
@@ -570,8 +576,8 @@ public class ZionApplicationTests {
}
}
public
String
getHour
(
String
time
)
{
public
String
getHour
(
String
time
)
{
if
(
Integer
.
parseInt
(
time
)<
0
)
{
if
(
Integer
.
parseInt
(
time
)
<
0
)
{
time
=
"0"
;
time
=
"0"
;
}
}
int
seconds
=
Integer
.
parseInt
(
time
);
int
seconds
=
Integer
.
parseInt
(
time
);
int
temp
=
0
;
int
temp
=
0
;
...
@@ -586,4 +592,78 @@ public class ZionApplicationTests {
...
@@ -586,4 +592,78 @@ public class ZionApplicationTests {
sb
.
append
((
temp
<
10
)
?
"0"
+
temp
:
""
+
temp
);
sb
.
append
((
temp
<
10
)
?
"0"
+
temp
:
""
+
temp
);
return
sb
.
toString
();
return
sb
.
toString
();
}
}
@Test
public
void
queryItemFromShopify
()
throws
IOException
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"product_type"
,
"Face"
);
params
.
put
(
"limit"
,
"2"
);
String
data
=
HttpClientUtil
.
createConnection
(
ShopifyConstant
.
productTypeUrl
(),
params
,
"UTF-8"
);
System
.
out
.
println
(
data
);
JSONObject
jsonObject
=
JSONObject
.
fromObject
(
data
);
JSONArray
products
=
jsonObject
.
getJSONArray
(
"products"
);
System
.
err
.
println
(
products
);
for
(
int
j
=
0
;
j
<
products
.
size
();
j
++)
{
JSONObject
object
=
products
.
getJSONObject
(
j
);
String
id
=
object
.
getString
(
"id"
);
String
title
=
object
.
getString
(
"title"
);
String
product_type
=
object
.
getString
(
"product_type"
);
JSONArray
variants
=
object
.
getJSONArray
(
"variants"
);
String
image
=
object
.
getJSONObject
(
"image"
).
getString
(
"src"
);
List
<
Double
>
priceList
=
new
ArrayList
<>();
for
(
int
m
=
0
;
m
<
variants
.
size
();
m
++)
{
JSONObject
obj
=
variants
.
getJSONObject
(
m
);
String
productPrice
=
obj
.
getString
(
"price"
);
priceList
.
add
(
Double
.
valueOf
(
productPrice
));
}
Collections
.
sort
(
priceList
);
System
.
out
.
println
(
id
);
System
.
out
.
println
(
title
);
System
.
out
.
println
(
product_type
);
System
.
out
.
println
(
image
);
System
.
out
.
println
(
priceList
);
System
.
out
.
println
(
"==================="
);
System
.
out
.
println
(
new
BigDecimal
(
priceList
.
get
(
0
)).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
));
TbCfStationItemEntity
product
=
new
TbCfStationItemEntity
();
product
.
setItemId
(
IdUtil
.
createIdbyUUID
());
product
.
setItemCode
(
id
);
product
.
setItemName
(
title
);
product
.
setItemBrief
(
title
);
product
.
setItemPrice
(
new
BigDecimal
(
priceList
.
get
(
0
)).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
));
product
.
setItemImg
(
image
);
product
.
setItemNum
(
0L
);
product
.
setPlatformCode
(
"afri-eshop"
);
product
.
setPlatformName
(
"afri-eshop"
);
product
.
setEnableFlag
(
3
);
product
.
setCreateTime
(
new
Date
());
// tbCfStationItemDao.save(product);
}
}
/**
* 查询所有商品分类
*
* @return
* @throws IOException
*/
public
List
getProductType
()
throws
IOException
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"fields"
,
"product_type"
);
String
connection
=
HttpClientUtil
.
createConnection
(
ShopifyConstant
.
productTypeUrl
(),
params
,
"UTF-8"
);
List
list
=
new
ArrayList
();
JSONArray
products
=
JSONObject
.
fromObject
(
connection
).
getJSONArray
(
"products"
);
for
(
int
i
=
0
;
i
<
products
.
size
();
i
++)
{
String
string
=
products
.
getString
(
i
);
JSONObject
jsonObject
=
JSONObject
.
fromObject
(
string
);
String
product_type
=
jsonObject
.
getString
(
"product_type"
);
if
(!
""
.
equals
(
product_type
)
&&
!
list
.
contains
(
product_type
))
{
list
.
add
(
product_type
);
}
}
System
.
out
.
println
(
list
);
return
list
;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论