提交 02b9ad5a authored 作者: 梁业锦's avatar 梁业锦 💬

- 商品导入相关逻辑

上级 b535bbfe
......@@ -25,6 +25,9 @@ public class TbProductMissEntity implements Serializable {
* 失败类型【1:已存在】【2:出现了异常】
*/
private Integer missType;
private String missReason;
/**
* 页数(每250个)
*/
......@@ -99,4 +102,12 @@ public class TbProductMissEntity implements Serializable {
public Date getCreateTime() {
return createTime;
}
public String getMissReason() {
return missReason;
}
public void setMissReason(String missReason) {
this.missReason = missReason;
}
}
......@@ -60,12 +60,14 @@
`id`,
`product_id`,
`miss_type`,
`miss_reason`,
`page_size`,
`create_time`)
values(
#{id},
#{productId},
#{missType},
#{missReason},
#{pageSize},
#{createTime})
</insert>
......@@ -92,4 +94,4 @@
</foreach>
</delete>
</mapper>
\ No newline at end of file
</mapper>
package test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.concurrent.*;
/**
* 并发测试
*
* @author 爱酱油不爱醋
* @version 1.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:/applicationContext-test.xml"})
public class ConcurrencyApi {
private final int corePoolSize = 15;
private final int maximumPoolSize = 35;
@Test
public void test() {
ExecutorService executor = Executors.newCachedThreadPool();
int i = 0;
while (true) {
RunningTest test = new RunningTest(i);
executor.submit(test);
System.out.println("正在执行的线程编号:" + i);
i++;
}
}
}
package test;
/**
* @author 爱酱油不爱醋
* @version 1.0
*/
public class RunningTest implements Runnable {
private int taskNum;
public RunningTest(int num) {
this.taskNum = num;
}
@Override
public void run() {
System.out.println("正在执行任务:" + taskNum);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("执行完毕:" + taskNum);
}
}
......@@ -67,7 +67,6 @@ public class TestApi {
*/
private final String API_URL = "https://mollykitty.myshopify.com/admin/api/" + VERSION + "/products.json";
@Test
public void host() {
String link = API_URL + "?limit=250&page_info=eyJwcm9kdWN0X3R5cGUiOiJXb21lbiIsImxhc3RfaWQiOjQ0OTc2Nzg5NTg2ODksImxhc3RfdmFsdWUiOiJDYXN1YWwgU2xpbSBTd2VhdGVycyIsImRpcmVjdGlvbiI6Im5leHQifQ";
......@@ -720,12 +719,6 @@ public class TestApi {
return output.toByteArray();
}
public static void main(String[] args) throws Exception {
String link = "https://cdn.shopify.com/s/files/1/0079/8330/0705/products/0_-9_aee971dc-5661-46bb-9d7e-11f0a3ee5b35.jpg?v=1580133539";
InputStream inputStream = getImageStream(link);
byte[] bytes = toByteArray(inputStream);
String url = OssUtil.upload(bytes, IdUtil.simpleUUID() + ".jpg", "zion");
System.out.println(url);
}
}
truncate from tb_category_template;
DELETE from tb_cf_category;
DELETE from tb_cf_goodstwotype;
DELETE from tb_cf_goodstype;
DELETE from tb_cf_item_desc;
DELETE from tb_cf_item_skus;
DELETE from tb_cf_option;
DELETE from tb_cf_station_item;
\ No newline at end of file
SELECT count(*) FROM tb_cf_station_item WHERE item_category = '2fe6be991b4941608c7ebcea7091288f';
SELECT count(*) FROM tb_cf_station_item WHERE item_category = '7c0d04650ad649fd9bf6b9476947c118';
SELECT count(*) FROM tb_cf_station_item WHERE item_category = '03f2d9ab2ea44893a27d54c280233c9f';
SELECT count(*) FROM tb_cf_station_item WHERE item_category = '59a9e2c64d2a4a1696a06045f39c0166';
SELECT count(*) FROM tb_cf_station_item WHERE item_category = 'f0100ca392074027bb99da3a93625d63';
SELECT count(*) FROM tb_cf_station_item WHERE item_category = 'a777a18b4fc4423082fa843231cfc7bc';
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论