Commit 6b8259f1 authored by renjie's avatar renjie

批量添加bug修改

parent 9aa6d352
......@@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
......@@ -134,6 +135,7 @@ public class ShopServiceImpl implements ShopService {
shopResultDto.setOwner(username);
Shop shop = new Shop();
shop.of(shopResultDto);
shop.setCreateTime(Instant.now().toEpochMilli());
id = shopRepository.save(shop).getShopId();
UserShop userShop = new UserShop();
userShop.setUsername(username);
......
......@@ -79,7 +79,8 @@ public class FileUtil {
Sheet sheet = workbook.getSheetAt(0);
//总行数
int rowLength = sheet.getLastRowNum() -1;
int rowLength = sheet.getPhysicalNumberOfRows();
log.error(rowLength + "");
//工作表的列
Row row = sheet.getRow(0);
......@@ -88,7 +89,8 @@ public class FileUtil {
//得到指定的单元格
Cell cell = row.getCell(0);;
int size = 1;
for (int i = 0; i < rowLength; i++) {
boolean first = false;
for (int i = 1; i < rowLength; i++) {
row = sheet.getRow(i);
List<Object> rowvalue = new ArrayList<>();
size = 0;
......@@ -97,13 +99,20 @@ public class FileUtil {
// System.out.println(cell);
if (cell!=null) {
Object cellValue = getCellFormatValue(cell);
if (cellValue.toString().contains(""))
if (cellValue.toString().contains("店铺名称")) {
first = true;
break;
}
rowvalue.add(cellValue);
if (StringUtils.isNotBlank(cellValue.toString())) {
size++;
}
}
}
if (first) {
first = false;
continue;
}
if (size == 0)
break;
if (StringUtils.isBlank(rowvalue.get(0).toString()) || StringUtils.isBlank(rowvalue.get(1).toString()))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment