|
@@ -200,6 +200,47 @@ public class TestController {
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/test/uploadExcelHK2")
|
|
|
+ public ResultData uploadExcelHK2(@RequestParam(required = false) MultipartFile file) throws IOException {
|
|
|
+
|
|
|
+ List<HashMap<Integer, String>> excelRowList = ExcelUtil.getExcelRowList(file);
|
|
|
+ for (HashMap<Integer, String> map : excelRowList) {
|
|
|
+ Integer productId = StringUtils.isNotBlank(map.get(0)) ? Double.valueOf(map.get(0)).intValue() : null;
|
|
|
+ String sku = map.get(1);
|
|
|
+ if(sku.equals("sku") || StringUtils.isBlank(sku) || productId != null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String eshop_en = map.get(2);
|
|
|
+ String eshop_zh = map.get(3);
|
|
|
+ String eshop_cn = map.get(4);
|
|
|
+ String attribute = map.get(5);
|
|
|
+ String categories = map.get(6);
|
|
|
+ String en_url = map.get(7);
|
|
|
+ String zh_url = map.get(8);
|
|
|
+ String cn_url = map.get(9);
|
|
|
+ String image_url = map.get(10);
|
|
|
+ Integer online = StringUtils.isNotBlank(map.get(11)) ? Double.valueOf(map.get(11)).intValue() : null;
|
|
|
+ String visibility = map.get(12);
|
|
|
+
|
|
|
+ ProductHk productHk = new ProductHk();
|
|
|
+ productHk.setSku(sku);
|
|
|
+ productHk.setEshopEn(eshop_en);
|
|
|
+ productHk.setEshopZh(eshop_zh);
|
|
|
+ productHk.setEshopCn(eshop_cn);
|
|
|
+ productHk.setAttribute(attribute);
|
|
|
+ productHk.setCategories(categories);
|
|
|
+ productHk.setEnUrl(en_url);
|
|
|
+ productHk.setZhUrl(zh_url);
|
|
|
+ productHk.setCnUrl(cn_url);
|
|
|
+ productHk.setImageUrl(image_url);
|
|
|
+ productHk.setOnline(online);
|
|
|
+ productHk.setVisibility(visibility);
|
|
|
+ productHkService.save(productHk);
|
|
|
+ }
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public void commonExport(HttpServletRequest request, HttpServletResponse response, String name, List<?> result, Class<?> clazz) throws Exception {
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
response.setCharacterEncoding("utf-8");
|