|
@@ -10,11 +10,15 @@ import com.hwrj.cloud.security.util.SpringUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import sun.plugin2.util.SystemUtil;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/*
|
|
|
* 监听器批处理数据
|
|
@@ -50,8 +54,6 @@ public class PmsProductExcelListener extends AnalysisEventListener<PmsProductExc
|
|
|
PmsProductParam pmsProductParam=new PmsProductParam();
|
|
|
BeanUtils.copyProperties(pmsProductExcel,pmsProductParam);
|
|
|
|
|
|
-
|
|
|
- pmsProductParam.setProductSn(pmsProductExcel.getProductStandardCode());
|
|
|
String name = pmsProductExcel.getName();
|
|
|
//标题
|
|
|
pmsProductParam.setDetailTitle(name);
|
|
@@ -60,14 +62,14 @@ public class PmsProductExcelListener extends AnalysisEventListener<PmsProductExc
|
|
|
//关键字
|
|
|
pmsProductParam.setKeywords(name);
|
|
|
|
|
|
- String description = pmsProductExcel.getDescription();
|
|
|
+ String description = replaceBlank(pmsProductExcel.getDescription());
|
|
|
|
|
|
//商品描述
|
|
|
pmsProductParam.setDescription(description);
|
|
|
//简述
|
|
|
pmsProductParam.setSubTitle(description);
|
|
|
//使用说明
|
|
|
- String instructions = pmsProductExcel.getInstructions();
|
|
|
+ String instructions = replaceBlank(pmsProductExcel.getInstructions());
|
|
|
//默认文本
|
|
|
pmsProductParam.setDetailDesc(instructions);
|
|
|
//web网页显示
|
|
@@ -77,6 +79,10 @@ public class PmsProductExcelListener extends AnalysisEventListener<PmsProductExc
|
|
|
BigDecimal price = pmsProductExcel.getPrice();
|
|
|
//市场价
|
|
|
pmsProductParam.setOriginalPrice(price);
|
|
|
+ //创建人 admin 1
|
|
|
+ pmsProductParam.setCreateUser((long) 1);
|
|
|
+ //创建时间
|
|
|
+ pmsProductParam.setCreateTime(new Date());
|
|
|
list.add(pmsProductParam);
|
|
|
if (list.size() >= BATCH_COUNT) {
|
|
|
saveData();
|
|
@@ -104,4 +110,14 @@ public class PmsProductExcelListener extends AnalysisEventListener<PmsProductExc
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ public static String replaceBlank(String str) {
|
|
|
+ String dest = "";
|
|
|
+ if (str!=null) {
|
|
|
+ Pattern p = Pattern.compile("\\s*|\t|\r|\n");
|
|
|
+ Matcher m = p.matcher(str);
|
|
|
+ dest = m.replaceAll("");
|
|
|
+ }
|
|
|
+ return dest;
|
|
|
+ }
|
|
|
}
|