|
@@ -607,54 +607,56 @@ public class ComponentSubmitServiceImpl implements ComponentSubmitService {
|
|
|
|
|
|
|
|
for (int i = 1; i < rows.size(); i++) {
|
|
for (int i = 1; i < rows.size(); i++) {
|
|
|
List<Object> row = rows.get(i);
|
|
List<Object> row = rows.get(i);
|
|
|
- ComponentCrawl component = new ComponentCrawl();
|
|
|
|
|
-
|
|
|
|
|
- // 型号
|
|
|
|
|
- Object code = row.get(0);
|
|
|
|
|
- if (code != null && StringUtils.hasText(code.toString())) {
|
|
|
|
|
- component.setCode(code.toString().trim());
|
|
|
|
|
- } else {
|
|
|
|
|
- throw new IllegalOperatorException(String.format("第%s行型号为空", (i + 1)));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 规格书
|
|
|
|
|
- Object attach = row.get(5);
|
|
|
|
|
- if (attach != null && StringUtils.hasText(attach.toString())) {
|
|
|
|
|
- component.setAttach(attach.toString().trim());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 图片
|
|
|
|
|
- Object img = row.get(6);
|
|
|
|
|
- if (img != null && StringUtils.hasText(img.toString())) {
|
|
|
|
|
- component.setImg(img.toString().trim());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 描述
|
|
|
|
|
- Object description = row.get(7);
|
|
|
|
|
- if (description != null && StringUtils.hasText(description.toString())) {
|
|
|
|
|
- component.setDescription(description.toString().trim());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 参数值
|
|
|
|
|
- Set<PropertyValueCrawl> propertyValues = new HashSet<PropertyValueCrawl>();
|
|
|
|
|
- for (int j = 8; j < maxSize && j < row.size(); j++) {
|
|
|
|
|
- Object property = row.get(j);
|
|
|
|
|
- if (property != null && StringUtils.hasText(property.toString())) {
|
|
|
|
|
- PropertyValueCrawl propertyValue = new PropertyValueCrawl();
|
|
|
|
|
- propertyValue.setValue(property.toString().trim());
|
|
|
|
|
- propertyValue.setPropertyName(propertyNames.get(j));
|
|
|
|
|
- propertyValues.add(propertyValue);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- component.setProperties(propertyValues);
|
|
|
|
|
- // 设置基本参数
|
|
|
|
|
- component.setB2cBrId(b2cBrand.getId());
|
|
|
|
|
- component.setB2cKiId(b2cKind.getId());
|
|
|
|
|
- component.setKindName(kindName);
|
|
|
|
|
- component.setTask(task.getId());
|
|
|
|
|
-
|
|
|
|
|
- components.add(component);
|
|
|
|
|
|
|
+ if (row != null && row.size() > 0) {
|
|
|
|
|
+ ComponentCrawl component = new ComponentCrawl();
|
|
|
|
|
+
|
|
|
|
|
+ // 型号
|
|
|
|
|
+ Object code = row.get(0);
|
|
|
|
|
+ if (code != null && StringUtils.hasText(code.toString())) {
|
|
|
|
|
+ component.setCode(code.toString().trim());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new IllegalOperatorException(String.format("第%s行型号为空", (i + 1)));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 规格书
|
|
|
|
|
+ Object attach = row.get(5);
|
|
|
|
|
+ if (attach != null && StringUtils.hasText(attach.toString())) {
|
|
|
|
|
+ component.setAttach(attach.toString().trim());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 图片
|
|
|
|
|
+ Object img = row.get(6);
|
|
|
|
|
+ if (img != null && StringUtils.hasText(img.toString())) {
|
|
|
|
|
+ component.setImg(img.toString().trim());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 描述
|
|
|
|
|
+ Object description = row.get(7);
|
|
|
|
|
+ if (description != null && StringUtils.hasText(description.toString())) {
|
|
|
|
|
+ component.setDescription(description.toString().trim());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 参数值
|
|
|
|
|
+ Set<PropertyValueCrawl> propertyValues = new HashSet<PropertyValueCrawl>();
|
|
|
|
|
+ for (int j = 8; j < maxSize && j < row.size(); j++) {
|
|
|
|
|
+ Object property = row.get(j);
|
|
|
|
|
+ if (property != null && StringUtils.hasText(property.toString())) {
|
|
|
|
|
+ PropertyValueCrawl propertyValue = new PropertyValueCrawl();
|
|
|
|
|
+ propertyValue.setValue(property.toString().trim());
|
|
|
|
|
+ propertyValue.setPropertyName(propertyNames.get(j));
|
|
|
|
|
+ propertyValues.add(propertyValue);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ component.setProperties(propertyValues);
|
|
|
|
|
+ // 设置基本参数
|
|
|
|
|
+ component.setB2cBrId(b2cBrand.getId());
|
|
|
|
|
+ component.setB2cKiId(b2cKind.getId());
|
|
|
|
|
+ component.setKindName(kindName);
|
|
|
|
|
+ component.setTask(task.getId());
|
|
|
|
|
+
|
|
|
|
|
+ components.add(component);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return components;
|
|
return components;
|
|
|
}
|
|
}
|