|
|
@@ -97,16 +97,7 @@ import java.sql.SQLException;
|
|
|
import java.sql.Statement;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.regex.Matcher;
|
|
|
@@ -461,6 +452,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
throw new IllegalOperatorException("您上传的信息超过2000条,请拆分成2000以再在上传");
|
|
|
}
|
|
|
List<ReleaseProductByBatch> batchList = new ArrayList<>(rowNum);
|
|
|
+ List<ReleaseProductByBatch> repeatBatchList = new ArrayList<>(rowNum);
|
|
|
String batch = createNumberService.getTimeNumber("product$goods", 8, rowNum);
|
|
|
Row headerRow = sheet.getRow(1);
|
|
|
validateModifyExcel(headerRow);
|
|
|
@@ -496,7 +488,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
aBatch.setReleaseCode(ReleaseStatus.lack_info.value());
|
|
|
aBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
|
|
|
} else {
|
|
|
- validateRepeatInExcel(batchList, aBatch, true);
|
|
|
+ validateRepeatInExcel(batchList, aBatch, true, repeatBatchList);
|
|
|
}
|
|
|
batchList.add(aBatch);
|
|
|
total++;
|
|
|
@@ -507,10 +499,11 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
// resetRepeatData(batchList, true, false);
|
|
|
// setDefaultTag(batchList);
|
|
|
commonDao.save(batchList, ReleaseProductByBatch.class);
|
|
|
+ commonDao.save(repeatBatchList, ReleaseProductByBatch.class);
|
|
|
Integer filter = releaseProductByBatchDao.getCountOfImportFail(userUU, batch, failCode);
|
|
|
modelMap.put("total", total);
|
|
|
modelMap.put("success", success);
|
|
|
- modelMap.put("fail", batchList.size() - success);
|
|
|
+ modelMap.put("fail", batchList.size() - success + repeatBatchList.size());
|
|
|
modelMap.put("filter", filter);
|
|
|
modelMap.put("batch", batch);
|
|
|
return modelMap;
|
|
|
@@ -528,11 +521,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
List<Long> productIds = new ArrayList<>(batchList.size());
|
|
|
List<String> batchCodes = new ArrayList<>();
|
|
|
for (ReleaseProductByBatch aBatch : batchList) {
|
|
|
- if (!StringUtilB2C.isEmpty(aBatch.getBatchCode()) && RegexConstant.isNumber(aBatch.getBatchCode())) {
|
|
|
+ if (!StringUtilB2C.isEmpty(aBatch.getBatchCode()) && RegexConstant.isNumber(aBatch.getBatchCode())
|
|
|
+ && StringUtilB2C.isEmpty(aBatch.getErrmsg())) {
|
|
|
productIds.add(Long.parseLong(aBatch.getBatchCode()));
|
|
|
continue;
|
|
|
}
|
|
|
- if (!StringUtilB2C.isEmpty(aBatch.getBatchCode())) {
|
|
|
+ if (!StringUtilB2C.isEmpty(aBatch.getBatchCode()) && StringUtilB2C.isEmpty(aBatch.getErrmsg())) {
|
|
|
batchCodes.add(aBatch.getBatchCode());
|
|
|
}
|
|
|
}
|
|
|
@@ -760,6 +754,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
} else {
|
|
|
goods.setSelfSale("1");
|
|
|
}
|
|
|
+ if (null != aBatch.getCostPrice()) {
|
|
|
+ goods.setCostPrice(aBatch.getCostPrice());
|
|
|
+ }
|
|
|
goods.setSpec(aBatch.getSpec());
|
|
|
goods.setStatus(aBatch.getStatus());
|
|
|
}
|
|
|
@@ -892,6 +889,18 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if (!StringUtils.isEmpty(statusValue)) {
|
|
|
aProduct.setCostPriceByExcel(statusValue);
|
|
|
}
|
|
|
+ Object status = readWorkBookCell(row.getCell(ModifyConstant.SALE_STATUS), Cell.CELL_TYPE_STRING,
|
|
|
+ rowNum, ModifyConstant.SALE_STATUS);
|
|
|
+ if (!StringUtils.isEmpty(status)) {
|
|
|
+ List<String> statuss = ReleaseProductByBatch.STATUS_LIST;
|
|
|
+ if (statuss.contains(status)) {
|
|
|
+ if (statuss.get(0).equals(status)) {
|
|
|
+ aProduct.setStatus(601);
|
|
|
+ } else {
|
|
|
+ aProduct.setStatus(612);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// Object tagValue = readWorkBookCell(row.getCell(ModifyConstant.CUSTOM_LABEL), Cell.CELL_TYPE_STRING,
|
|
|
// rowNum, ModifyConstant.CUSTOM_LABEL);
|
|
|
@@ -920,29 +929,28 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
* @param aBatch
|
|
|
* @param isImport
|
|
|
*/
|
|
|
- private void validateRepeatInExcel(List<ReleaseProductByBatch> batchList, ReleaseProductByBatch aBatch, Boolean isImport) {
|
|
|
+ private void validateRepeatInExcel(List<ReleaseProductByBatch> batchList, ReleaseProductByBatch aBatch, Boolean isImport,
|
|
|
+ List<ReleaseProductByBatch> repeatBatchList) {
|
|
|
if (CollectionUtils.isEmpty(batchList) || !StringUtils.isEmpty(aBatch.getErrmsg()))
|
|
|
- return ;
|
|
|
- for (ReleaseProductByBatch each : batchList) {
|
|
|
- if (StringUtils.isEmpty(each.getErrmsg()) && each.equals(aBatch)) {
|
|
|
- aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
- aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
- aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
-// if (!isImport) {
|
|
|
-// aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
-// aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
-// aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
-// break;
|
|
|
-// } else {
|
|
|
-// if (GoodsUtil.compareWithQtyPrice(each.getPrices(), aBatch.getPrices(), each.getCurrency())) {
|
|
|
-// aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
-// aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
-// aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
- }
|
|
|
- }
|
|
|
+ return;
|
|
|
+ Iterator<ReleaseProductByBatch> iterator = batchList.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ ReleaseProductByBatch byBatch = iterator.next();
|
|
|
+ if (StringUtils.isEmpty(byBatch.getErrmsg()) && byBatch.equals(aBatch)) {
|
|
|
+ byBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
+ byBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
+ byBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
+ repeatBatchList.add(byBatch);
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+// for (ReleaseProductByBatch each : batchList) {
|
|
|
+// if (StringUtils.isEmpty(each.getErrmsg()) && each.equals(aBatch)) {
|
|
|
+// aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
|
|
|
+// aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
|
|
|
+// aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
/**
|