|
|
@@ -2,10 +2,8 @@ package com.uas.platform.b2c.trade.seek.service.impl;
|
|
|
|
|
|
import com.uas.platform.b2c.common.account.model.User;
|
|
|
import com.uas.platform.b2c.core.utils.StringUtilB2C;
|
|
|
-import com.uas.platform.b2c.prod.commodity.constant.UploadConstant;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
|
|
|
import com.uas.platform.b2c.prod.commodity.model.Goods;
|
|
|
-import com.uas.platform.b2c.prod.commodity.model.ReleaseProductByBatch;
|
|
|
import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
|
|
|
import com.uas.platform.b2c.prod.product.brand.modal.Brand;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
|
|
|
@@ -30,6 +28,7 @@ import com.uas.platform.core.persistence.criteria.CriterionExpression.Operator;
|
|
|
import com.uas.platform.core.persistence.criteria.LogicalExpression;
|
|
|
import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
|
import com.uas.platform.core.persistence.criteria.SimpleExpression;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@@ -305,6 +304,8 @@ public class SeekPurchaseServiceImpl implements SeekPurchaseService {
|
|
|
SeekPurchaseByBatch seekPurchaseByBatch = new SeekPurchaseByBatch();
|
|
|
blankNum = convertValueToSeekPurchase(row, seekPurchaseByBatch, r);
|
|
|
seekPurchaseByBatch.setBomId(seekPurchaseBom.getId());
|
|
|
+ seekPurchaseByBatch.setReleaseDate(new Date(System.currentTimeMillis()));
|
|
|
+
|
|
|
seekPurchaseByBatchList.add(seekPurchaseByBatch);
|
|
|
}
|
|
|
}
|
|
|
@@ -321,30 +322,39 @@ public class SeekPurchaseServiceImpl implements SeekPurchaseService {
|
|
|
rowNum, 0);
|
|
|
if (StringUtils.isEmpty(codeValue)) {
|
|
|
result += 1;
|
|
|
+ } else {
|
|
|
+ seekPurchaseByBatch.setCode(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(codeValue)));
|
|
|
}
|
|
|
- seekPurchaseByBatch.setCode(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(codeValue)));
|
|
|
|
|
|
// 品牌
|
|
|
Object brandValue = readWorkBookCell(row.getCell(1), Cell.CELL_TYPE_STRING,
|
|
|
rowNum, 1);
|
|
|
if (StringUtils.isEmpty(brandValue)) {
|
|
|
result += 1;
|
|
|
+ } else {
|
|
|
+ seekPurchaseByBatch.setBrand(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(brandValue)));
|
|
|
}
|
|
|
- seekPurchaseByBatch.setBrand(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(brandValue)));
|
|
|
|
|
|
// 截止日期
|
|
|
Object deadlineValue = readWorkBookCell(row.getCell(2), Cell.CELL_TYPE_STRING,
|
|
|
rowNum, 2);
|
|
|
if (StringUtils.isEmpty(deadlineValue)) {
|
|
|
result += 1;
|
|
|
+ } else {
|
|
|
+ String deadline = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(deadlineValue));
|
|
|
+ try {
|
|
|
+ deadline = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(deadline, 12);
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ seekPurchaseByBatch.setDeadline(deadline);
|
|
|
}
|
|
|
- seekPurchaseByBatch.setDeadline(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(deadlineValue)));
|
|
|
|
|
|
// 求购数量
|
|
|
Object amountValue = readWorkBookCell(row.getCell(3), Cell.CELL_TYPE_STRING,
|
|
|
rowNum, 3);
|
|
|
if (!StringUtils.isEmpty(amountValue)) {
|
|
|
- Integer amount = Integer.valueOf(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(deadlineValue)));
|
|
|
+ Integer amount = Integer.valueOf(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(amountValue)));
|
|
|
seekPurchaseByBatch.setAmount(amount);
|
|
|
}
|
|
|
|
|
|
@@ -363,18 +373,18 @@ public class SeekPurchaseServiceImpl implements SeekPurchaseService {
|
|
|
Double unitPrice = Double.valueOf(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(unitPriceValue)));
|
|
|
seekPurchaseByBatch.setUnitPrice(unitPrice);
|
|
|
}
|
|
|
-
|
|
|
// 封装
|
|
|
- Object encapsulationValue = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING,
|
|
|
- rowNum, 7);
|
|
|
+ Object encapsulationValue = readWorkBookCell(row.getCell(6), Cell.CELL_TYPE_STRING,
|
|
|
+ rowNum, 6);
|
|
|
if (!StringUtils.isEmpty(encapsulationValue)) {
|
|
|
String encapsulation = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(encapsulationValue));
|
|
|
seekPurchaseByBatch.setEncapsulation(encapsulation);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 生产日期
|
|
|
- Object produceDateValue = readWorkBookCell(row.getCell(8), Cell.CELL_TYPE_STRING,
|
|
|
- rowNum, 8);
|
|
|
+ Object produceDateValue = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING,
|
|
|
+ rowNum, 7);
|
|
|
if (!StringUtils.isEmpty(produceDateValue)) {
|
|
|
String produceDate = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(produceDateValue));
|
|
|
seekPurchaseByBatch.setProduceDate(produceDate);
|
|
|
@@ -430,7 +440,31 @@ public class SeekPurchaseServiceImpl implements SeekPurchaseService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultMap confirmBom(Long bomId, User user) {
|
|
|
+ public Page<SeekPurchaseByBatch> getSeekPurchaseByBatchPageInfo(final PageInfo pageInfo, Long bomId) {
|
|
|
+ if (bomId != null) {
|
|
|
+ pageInfo.filter("bomId", bomId);
|
|
|
+ }
|
|
|
+ Page<SeekPurchaseByBatch> pageSeeks = seekPurchaseByBatchDao.findAll(new Specification<SeekPurchaseByBatch>() {
|
|
|
+ public Predicate toPredicate(Root<SeekPurchaseByBatch> root, CriteriaQuery<?> query,
|
|
|
+ CriteriaBuilder builder) {
|
|
|
+ query.where(pageInfo.getPredicates(root, query, builder));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }, pageInfo);
|
|
|
+ return pageSeeks;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultMap confirmBom(Long bomId, String spIds) {
|
|
|
+ List<SeekPurchaseByBatch> seekPurchaseByBatchList = seekPurchaseByBatchDao.findByBomId(bomId);
|
|
|
+ if (!StringUtils.isEmpty(spIds)) {
|
|
|
+ // 保存选中
|
|
|
+ } else {
|
|
|
+ // 保存所有
|
|
|
+ }
|
|
|
+
|
|
|
+ SeekPurchaseBom seekPurchaseBom = seekPurchaseBomDao.findOne(bomId);
|
|
|
+ seekPurchaseBom.setAmount(seekPurchaseByBatchList.size());
|
|
|
return null;
|
|
|
}
|
|
|
}
|