|
@@ -1,6 +1,11 @@
|
|
|
package com.uas.platform.b2c.prod.commodity.service.impl;
|
|
package com.uas.platform.b2c.prod.commodity.service.impl;
|
|
|
|
|
|
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
|
|
|
+import com.uas.platform.b2c.common.base.dao.CommonDao;
|
|
|
|
|
+import com.uas.platform.b2c.core.config.SysConf;
|
|
|
|
|
+import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
|
|
+import com.uas.platform.b2c.core.utils.NumberUtil;
|
|
|
|
|
+import com.uas.platform.b2c.core.utils.RegexConstant;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
|
|
import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.ReleaseProductByBatchDao;
|
|
import com.uas.platform.b2c.prod.commodity.dao.ReleaseProductByBatchDao;
|
|
|
import com.uas.platform.b2c.prod.commodity.model.Goods;
|
|
import com.uas.platform.b2c.prod.commodity.model.Goods;
|
|
@@ -8,17 +13,16 @@ import com.uas.platform.b2c.prod.commodity.model.GoodsQtyPrice;
|
|
|
import com.uas.platform.b2c.prod.commodity.model.ReleaseProductByBatch;
|
|
import com.uas.platform.b2c.prod.commodity.model.ReleaseProductByBatch;
|
|
|
import com.uas.platform.b2c.prod.commodity.service.GoodsService;
|
|
import com.uas.platform.b2c.prod.commodity.service.GoodsService;
|
|
|
import com.uas.platform.b2c.prod.commodity.service.ReleaseProductByBatchService;
|
|
import com.uas.platform.b2c.prod.commodity.service.ReleaseProductByBatchService;
|
|
|
-import com.uas.platform.b2c.common.base.dao.CommonDao;
|
|
|
|
|
-import com.uas.platform.b2c.core.config.SysConf;
|
|
|
|
|
import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
|
|
import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
|
|
|
-import com.uas.platform.b2c.prod.store.dao.StoreInDao;
|
|
|
|
|
import com.uas.platform.b2c.prod.store.model.StoreIn;
|
|
import com.uas.platform.b2c.prod.store.model.StoreIn;
|
|
|
-import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
|
|
|
|
+import com.uas.platform.b2c.prod.store.model.StoreStatus;
|
|
|
|
|
+import com.uas.platform.b2c.prod.store.service.StoreInService;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.ReleaseStatus;
|
|
import com.uas.platform.core.model.ReleaseStatus;
|
|
|
import com.uas.platform.core.model.Type;
|
|
import com.uas.platform.core.model.Type;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
+import org.apache.commons.lang.ArrayUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -60,7 +64,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
private CommonDao commonDao;
|
|
private CommonDao commonDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private StoreInDao storeInDao;
|
|
|
|
|
|
|
+ private StoreInService storeInService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SysConf SysConf;
|
|
private SysConf SysConf;
|
|
@@ -79,6 +83,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale) {
|
|
public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale) {
|
|
|
ModelMap modelMap = new ModelMap();
|
|
ModelMap modelMap = new ModelMap();
|
|
|
List<ReleaseProductByBatch> releaseProductByBatchs = new ArrayList<ReleaseProductByBatch>();
|
|
List<ReleaseProductByBatch> releaseProductByBatchs = new ArrayList<ReleaseProductByBatch>();
|
|
|
|
|
+ Pattern codePattern = Pattern.compile(RegexConstant.EnglishAnDigitAndSpecialCharacter);
|
|
|
|
|
+
|
|
|
|
|
+ Pattern chineseAndEnglishPattern = Pattern.compile(RegexConstant.chineseAndEnglish);
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
int colNum = sheet.getRow(0).getPhysicalNumberOfCells();
|
|
int colNum = sheet.getRow(0).getPhysicalNumberOfCells();
|
|
|
if(colNum != 25) {
|
|
if(colNum != 25) {
|
|
@@ -86,16 +93,18 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
}
|
|
|
int rowNum = sheet.getLastRowNum();
|
|
int rowNum = sheet.getLastRowNum();
|
|
|
String batch = createNumberService.getTimeNumber("product$goods", 8, rowNum);
|
|
String batch = createNumberService.getTimeNumber("product$goods", 8, rowNum);
|
|
|
- String storeid = null;
|
|
|
|
|
|
|
+ String storeid = null, storeName = null;
|
|
|
if(selfSale) {
|
|
if(selfSale) {
|
|
|
- List<StoreIn> storeIns = storeInDao.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
- if(CollectionUtils.isEmpty(storeIns)) {
|
|
|
|
|
|
|
+ StoreIn storeIn = storeInService.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
+ if(storeIn == null || storeIn.getStatus() != StoreStatus.OPENED) {
|
|
|
throw new IllegalOperatorException("您还没有开店铺,不能选择店铺自营。");
|
|
throw new IllegalOperatorException("您还没有开店铺,不能选择店铺自营。");
|
|
|
}else {
|
|
}else {
|
|
|
- storeid = storeIns.get(0).getUuid();
|
|
|
|
|
|
|
+ storeid = storeIn.getUuid();
|
|
|
|
|
+ storeName = storeIn.getStoreName();
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|
|
|
storeid = SysConf.getStoreid();
|
|
storeid = SysConf.getStoreid();
|
|
|
|
|
+ storeName = SysConf.getEnName();
|
|
|
}
|
|
}
|
|
|
Row headerRow = sheet.getRow(0);
|
|
Row headerRow = sheet.getRow(0);
|
|
|
int total = 0;
|
|
int total = 0;
|
|
@@ -111,8 +120,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
for (int r = 1; r <= rowNum; r++) {
|
|
for (int r = 1; r <= rowNum; r++) {
|
|
|
Row row = sheet.getRow(r);
|
|
Row row = sheet.getRow(r);
|
|
|
// 英文品牌名称
|
|
// 英文品牌名称
|
|
|
- total++;
|
|
|
|
|
if (row != null && row.getCell(1) != null && row.getCell(1).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
if (row != null && row.getCell(1) != null && row.getCell(1).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
|
|
+ total++;
|
|
|
ReleaseProductByBatch releaseProductByBatch = new ReleaseProductByBatch();
|
|
ReleaseProductByBatch releaseProductByBatch = new ReleaseProductByBatch();
|
|
|
releaseProductByBatch.setReleaseCode(ReleaseStatus.success.value());
|
|
releaseProductByBatch.setReleaseCode(ReleaseStatus.success.value());
|
|
|
releaseProductByBatch.setReleaseStatus(ReleaseStatus.success.getPhrase());
|
|
releaseProductByBatch.setReleaseStatus(ReleaseStatus.success.getPhrase());
|
|
@@ -138,7 +147,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if(StringUtils.isEmpty(codeCellValue) || "B2C1".equals(brandNameCnCellValue) || "B2C2".equals(brandNameCnCellValue)) {
|
|
if(StringUtils.isEmpty(codeCellValue) || "B2C1".equals(brandNameCnCellValue) || "B2C2".equals(brandNameCnCellValue)) {
|
|
|
continue;
|
|
continue;
|
|
|
}else {
|
|
}else {
|
|
|
- releaseProductByBatch.setCode(codeCellValue.toString());
|
|
|
|
|
|
|
+ String code = codeCellValue.toString();
|
|
|
|
|
+ releaseProductByBatch.setCode(code);
|
|
|
|
|
+ Matcher matcher = codePattern.matcher(code);
|
|
|
|
|
+ if(!matcher.find()) {
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("3:产品型号仅限英文、数字、特殊字符");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 库存类型
|
|
// 库存类型
|
|
@@ -156,14 +170,16 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
|
|
|
|
|
// 发布库存量
|
|
// 发布库存量
|
|
|
Double reserve = null;
|
|
Double reserve = null;
|
|
|
- Object reserveCellValue = readWorkBookCell(row.getCell(4), Cell.CELL_TYPE_NUMERIC, r, 4);
|
|
|
|
|
- if (reserveCellValue == null || Double.valueOf(reserveCellValue.toString()).doubleValue() <= 0) {
|
|
|
|
|
- releaseProductByBatch.addErrmsg("5:发布数量为空或者小于等于0");
|
|
|
|
|
|
|
+ Object reserveCellValue = readWorkBookCell(row.getCell(4), Cell.CELL_TYPE_STRING, r, 4);
|
|
|
|
|
+ if (reserveCellValue == null || !isNumber(reserveCellValue.toString())) {
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("5:发布数量为空或者不是数字");
|
|
|
} else {
|
|
} else {
|
|
|
reserve = Double.valueOf(reserveCellValue.toString());
|
|
reserve = Double.valueOf(reserveCellValue.toString());
|
|
|
int compareTo = reserve.compareTo(99999999d);
|
|
int compareTo = reserve.compareTo(99999999d);
|
|
|
if(compareTo > 0) {
|
|
if(compareTo > 0) {
|
|
|
releaseProductByBatch.addErrmsg("5:发布数量大于了我们设置的最大值99999999");
|
|
releaseProductByBatch.addErrmsg("5:发布数量大于了我们设置的最大值99999999");
|
|
|
|
|
+ }else if(NumberUtil.compare(reserve, 0.0) < 1) {
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("5:发布数量必须大于0");
|
|
|
}
|
|
}
|
|
|
releaseProductByBatch.setReserve(reserve);
|
|
releaseProductByBatch.setReserve(reserve);
|
|
|
}
|
|
}
|
|
@@ -174,7 +190,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if (packagingCellValue == null || StringUtils.isEmpty(packagingCellValue.toString())) {
|
|
if (packagingCellValue == null || StringUtils.isEmpty(packagingCellValue.toString())) {
|
|
|
releaseProductByBatch.addErrmsg("6:包装方式不能为空");
|
|
releaseProductByBatch.addErrmsg("6:包装方式不能为空");
|
|
|
} else {
|
|
} else {
|
|
|
- releaseProductByBatch.setPackaging(packagingCellValue.toString());
|
|
|
|
|
|
|
+ packaging = packagingCellValue.toString();
|
|
|
|
|
+ releaseProductByBatch.setPackaging(packaging);
|
|
|
|
|
+ Matcher matcher = chineseAndEnglishPattern.matcher(packaging);
|
|
|
|
|
+ if(!matcher.find()) {
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("6:包装方式仅限中文或英文");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//封装方式
|
|
//封装方式
|
|
@@ -182,8 +203,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
releaseProductByBatch.setEncapsulation(String.valueOf(encapsulationCellValue));
|
|
releaseProductByBatch.setEncapsulation(String.valueOf(encapsulationCellValue));
|
|
|
|
|
|
|
|
Double sample = null;
|
|
Double sample = null;
|
|
|
- Object sampleObj = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_NUMERIC, r, 7);
|
|
|
|
|
- if (sampleObj != null) {
|
|
|
|
|
|
|
+ Object sampleObj = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING, r, 7);
|
|
|
|
|
+ if ((sampleObj != null)&&(isNumber(sampleObj.toString()))) {
|
|
|
sample = Double.valueOf(sampleObj.toString());
|
|
sample = Double.valueOf(sampleObj.toString());
|
|
|
if (sample <= 0) {
|
|
if (sample <= 0) {
|
|
|
// 这个是存在输入数据后再删除就会默认成0
|
|
// 这个是存在输入数据后再删除就会默认成0
|
|
@@ -197,8 +218,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 最小起订量
|
|
// 最小起订量
|
|
|
- Object minBuyCellValue = readWorkBookCell(row.getCell(8), Cell.CELL_TYPE_NUMERIC, r, 8);
|
|
|
|
|
- if (minBuyCellValue != null) {
|
|
|
|
|
|
|
+ Object minBuyCellValue = readWorkBookCell(row.getCell(8), Cell.CELL_TYPE_STRING, r, 8);
|
|
|
|
|
+ if ((minBuyCellValue != null)&&(isNumber(minBuyCellValue.toString()))) {
|
|
|
Double minBuy = Double.valueOf(minBuyCellValue.toString());
|
|
Double minBuy = Double.valueOf(minBuyCellValue.toString());
|
|
|
if (minBuy <= 0) {
|
|
if (minBuy <= 0) {
|
|
|
// 输入负数
|
|
// 输入负数
|
|
@@ -212,12 +233,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
releaseProductByBatch.setMinBuyQty(minBuy);
|
|
releaseProductByBatch.setMinBuyQty(minBuy);
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|
|
|
- releaseProductByBatch.addErrmsg("9:最小起订量的数量不可以为空");
|
|
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("9:最小起订量的数量不可以为空且只能是数字");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 最小包装量
|
|
// 最小包装量
|
|
|
- Object minPackQtyCellValue = readWorkBookCell(row.getCell(9), Cell.CELL_TYPE_NUMERIC, r, 9);
|
|
|
|
|
- if (minPackQtyCellValue != null) {
|
|
|
|
|
|
|
+ Object minPackQtyCellValue = readWorkBookCell(row.getCell(9), Cell.CELL_TYPE_STRING, r, 9);
|
|
|
|
|
+ if ((minPackQtyCellValue != null)&&(isNumber(minPackQtyCellValue.toString()))) {
|
|
|
Double minPackQty = Double.valueOf(minPackQtyCellValue.toString());
|
|
Double minPackQty = Double.valueOf(minPackQtyCellValue.toString());
|
|
|
if (minPackQty <= 0) {
|
|
if (minPackQty <= 0) {
|
|
|
// 输入负数
|
|
// 输入负数
|
|
@@ -226,20 +247,20 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
releaseProductByBatch.setMinPackage(minPackQty);
|
|
releaseProductByBatch.setMinPackage(minPackQty);
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|
|
|
- releaseProductByBatch.addErrmsg("10:最小包装量不可以为空");
|
|
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("10:最小包装量不可以为空且只能是数字");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 最小包单价(人民币)
|
|
// 最小包单价(人民币)
|
|
|
- Object rmbPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(10), Cell.CELL_TYPE_NUMERIC, r, 10);
|
|
|
|
|
- if (rmbPriceMinPackQtyCellValue != null) {
|
|
|
|
|
|
|
+ Object rmbPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(10), Cell.CELL_TYPE_STRING, r, 10);
|
|
|
|
|
+ if ((rmbPriceMinPackQtyCellValue != null)&&(isNumber(rmbPriceMinPackQtyCellValue.toString()))) {
|
|
|
Double rmbPrice = Double.valueOf(rmbPriceMinPackQtyCellValue.toString());
|
|
Double rmbPrice = Double.valueOf(rmbPriceMinPackQtyCellValue.toString());
|
|
|
rmbPrice = fractionNumCeil(rmbPrice, 6);
|
|
rmbPrice = fractionNumCeil(rmbPrice, 6);
|
|
|
releaseProductByBatch.setRmbMinPackPrice(rmbPrice);
|
|
releaseProductByBatch.setRmbMinPackPrice(rmbPrice);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 最小包单价(美元)
|
|
// 最小包单价(美元)
|
|
|
- Object usdPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(11), Cell.CELL_TYPE_NUMERIC, r, 11);
|
|
|
|
|
- if (usdPriceMinPackQtyCellValue != null) {
|
|
|
|
|
|
|
+ Object usdPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(11), Cell.CELL_TYPE_STRING, r, 11);
|
|
|
|
|
+ if ((usdPriceMinPackQtyCellValue != null)&&(isNumber(usdPriceMinPackQtyCellValue.toString()))) {
|
|
|
Double usdPrice = Double.valueOf(usdPriceMinPackQtyCellValue.toString());
|
|
Double usdPrice = Double.valueOf(usdPriceMinPackQtyCellValue.toString());
|
|
|
usdPrice = fractionNumCeil(usdPrice, 6);
|
|
usdPrice = fractionNumCeil(usdPrice, 6);
|
|
|
releaseProductByBatch.setUsdMinPackPrice(usdPrice);
|
|
releaseProductByBatch.setUsdMinPackPrice(usdPrice);
|
|
@@ -296,10 +317,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
Object deliveryCellValue = readWorkBookCell(row.getCell(13), Cell.CELL_TYPE_STRING, r, 13);
|
|
Object deliveryCellValue = readWorkBookCell(row.getCell(13), Cell.CELL_TYPE_STRING, r, 13);
|
|
|
if (!StringUtils.isEmpty(deliveryCellValue)) {
|
|
if (!StringUtils.isEmpty(deliveryCellValue)) {
|
|
|
Short[] delivers = splitDeliveryString(deliveryCellValue.toString());
|
|
Short[] delivers = splitDeliveryString(deliveryCellValue.toString());
|
|
|
- if (delivers != null) {
|
|
|
|
|
|
|
+ if (!ArrayUtils.isEmpty(delivers)&&(delivers[0] !=null)&&(delivers[1] !=null)) {
|
|
|
releaseProductByBatch.setDeliveryDemMinTime(delivers[0]);
|
|
releaseProductByBatch.setDeliveryDemMinTime(delivers[0]);
|
|
|
releaseProductByBatch.setDeliveryDemMaxTime(delivers[1]);
|
|
releaseProductByBatch.setDeliveryDemMaxTime(delivers[1]);
|
|
|
-
|
|
|
|
|
Boolean aBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryDemMaxTime(), (short) 0, (short) 9);
|
|
Boolean aBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryDemMaxTime(), (short) 0, (short) 9);
|
|
|
if(!aBoolean) {
|
|
if(!aBoolean) {
|
|
|
releaseProductByBatch.addErrmsg("14:大陆交期的不在(0,9]天");
|
|
releaseProductByBatch.addErrmsg("14:大陆交期的不在(0,9]天");
|
|
@@ -317,7 +337,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
Object deliveryhkCellValue = readWorkBookCell(row.getCell(14), Cell.CELL_TYPE_STRING, r, 14);
|
|
Object deliveryhkCellValue = readWorkBookCell(row.getCell(14), Cell.CELL_TYPE_STRING, r, 14);
|
|
|
if (!StringUtils.isEmpty(deliveryhkCellValue)) {
|
|
if (!StringUtils.isEmpty(deliveryhkCellValue)) {
|
|
|
Short[] deliverys = splitDeliveryString(deliveryhkCellValue.toString());
|
|
Short[] deliverys = splitDeliveryString(deliveryhkCellValue.toString());
|
|
|
- if (deliverys != null) {
|
|
|
|
|
|
|
+ if (!ArrayUtils.isEmpty(deliverys)&&(deliverys[0] !=null)&&(deliverys[1] !=null)) {
|
|
|
releaseProductByBatch.setDeliveryHKMinTime(deliverys[0]);
|
|
releaseProductByBatch.setDeliveryHKMinTime(deliverys[0]);
|
|
|
releaseProductByBatch.setDeliveryHKMaxTime(deliverys[1]);
|
|
releaseProductByBatch.setDeliveryHKMaxTime(deliverys[1]);
|
|
|
|
|
|
|
@@ -335,19 +355,19 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
|
|
|
|
|
if("RMB-USD".equals(releaseProductByBatch.getCurrency())) {
|
|
if("RMB-USD".equals(releaseProductByBatch.getCurrency())) {
|
|
|
if(releaseProductByBatch.getDeliveryDemMaxTime() == null || releaseProductByBatch.getDeliveryHKMaxTime() == null) {
|
|
if(releaseProductByBatch.getDeliveryDemMaxTime() == null || releaseProductByBatch.getDeliveryHKMaxTime() == null) {
|
|
|
- releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币和美金,所以香港和大陆的交期都需要填写");
|
|
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币和美金,所以香港和大陆的交期都需要填写,且格式必须是5~5");
|
|
|
}
|
|
}
|
|
|
}else if("RMB".equals(releaseProductByBatch.getCurrency())) {
|
|
}else if("RMB".equals(releaseProductByBatch.getCurrency())) {
|
|
|
if(releaseProductByBatch.getDeliveryDemMaxTime() == null) {
|
|
if(releaseProductByBatch.getDeliveryDemMaxTime() == null) {
|
|
|
- releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币,所以大陆交期需要填写");
|
|
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币,所以大陆交期需要填写,且格式必须是5~5");
|
|
|
}
|
|
}
|
|
|
}else if("USD".equals(releaseProductByBatch.getCurrency())) {
|
|
}else if("USD".equals(releaseProductByBatch.getCurrency())) {
|
|
|
if(releaseProductByBatch.getDeliveryHKMaxTime() == null) {
|
|
if(releaseProductByBatch.getDeliveryHKMaxTime() == null) {
|
|
|
- releaseProductByBatch.addErrmsg("14-15:您上架的币别是美金,所以香港交期需要填写");
|
|
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("14-15:您上架的币别是美金,所以香港交期需要填写,且格式必须是5~5");
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|
|
|
if(releaseProductByBatch.getDeliveryDemMaxTime() == null && releaseProductByBatch.getDeliveryHKMaxTime() == null) {
|
|
if(releaseProductByBatch.getDeliveryDemMaxTime() == null && releaseProductByBatch.getDeliveryHKMaxTime() == null) {
|
|
|
- releaseProductByBatch.addErrmsg("14-15:您必须要填写一个类型的交期");
|
|
|
|
|
|
|
+ releaseProductByBatch.addErrmsg("14-15:您必须要填写一个类型的交期,且格式必须是5~5");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -431,13 +451,11 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
releaseProductByBatch.setPublisherTel(SystemSession.getUser().getUserTel());
|
|
releaseProductByBatch.setPublisherTel(SystemSession.getUser().getUserTel());
|
|
|
releaseProductByBatch.setPublisherUu(SystemSession.getUser().getUserUU());
|
|
releaseProductByBatch.setPublisherUu(SystemSession.getUser().getUserUU());
|
|
|
releaseProductByBatch.setStoreid(storeid);
|
|
releaseProductByBatch.setStoreid(storeid);
|
|
|
- StoreIn storeIn = storeInDao.findByUuid(storeid);
|
|
|
|
|
- if (storeIn == null) {
|
|
|
|
|
- throw new IllegalOperatorException("店铺不存在");
|
|
|
|
|
-
|
|
|
|
|
|
|
+ releaseProductByBatch.setStoreName(storeName);
|
|
|
|
|
+ if(!StringUtils.isEmpty(releaseProductByBatch.getErrmsg())) {
|
|
|
|
|
+ releaseProductByBatch.setReleaseCode(ReleaseStatus.failure.value());
|
|
|
|
|
+ releaseProductByBatch.setReleaseStatus(ReleaseStatus.failure.getPhrase());
|
|
|
}
|
|
}
|
|
|
- releaseProductByBatch.setStoreName(storeIn.getStoreName());
|
|
|
|
|
-
|
|
|
|
|
releaseProductByBatch.setUnit("PCS");
|
|
releaseProductByBatch.setUnit("PCS");
|
|
|
releaseProductByBatch.setCreateDate(new Date());
|
|
releaseProductByBatch.setCreateDate(new Date());
|
|
|
releaseProductByBatchs.add(releaseProductByBatch);
|
|
releaseProductByBatchs.add(releaseProductByBatch);
|
|
@@ -457,7 +475,17 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
return modelMap;
|
|
return modelMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
|
|
+ private Boolean isNumber(String str) {
|
|
|
|
|
+ Pattern numberPattern = Pattern.compile(RegexConstant.NumberData);
|
|
|
|
|
+ Matcher matcher = numberPattern.matcher(str);
|
|
|
|
|
+ if(matcher.find()) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }else {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 创建时间 :2016年12月11日 下午2:02:16
|
|
* 创建时间 :2016年12月11日 下午2:02:16
|
|
|
*
|
|
*
|
|
|
* @author yujia
|
|
* @author yujia
|
|
@@ -584,8 +612,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
private void readSectionPrice(Cell cellQty, Cell cellPriceRMB, Cell cellPriceUSD, List<GoodsQtyPrice> prices,
|
|
private void readSectionPrice(Cell cellQty, Cell cellPriceRMB, Cell cellPriceUSD, List<GoodsQtyPrice> prices,
|
|
|
ReleaseProductByBatch releaseProductByBatch, int r, int num, Double[] priceMaxMinPrice) {
|
|
ReleaseProductByBatch releaseProductByBatch, int r, int num, Double[] priceMaxMinPrice) {
|
|
|
// 先跟据币别判断对应的价格是否有空值
|
|
// 先跟据币别判断对应的价格是否有空值
|
|
|
- Object startQtyCellValue = readWorkBookCell(cellQty, Cell.CELL_TYPE_NUMERIC, r, num);
|
|
|
|
|
- if (startQtyCellValue != null) {
|
|
|
|
|
|
|
+ Object startQtyCellValue = readWorkBookCell(cellQty, Cell.CELL_TYPE_STRING, r, num);
|
|
|
|
|
+ if ((startQtyCellValue != null)&&(isNumber(startQtyCellValue.toString()))) {
|
|
|
Double start = Double.valueOf(startQtyCellValue.toString());
|
|
Double start = Double.valueOf(startQtyCellValue.toString());
|
|
|
GoodsQtyPrice qtyPrice = new GoodsQtyPrice();
|
|
GoodsQtyPrice qtyPrice = new GoodsQtyPrice();
|
|
|
// 分段数量start不得大于库存量
|
|
// 分段数量start不得大于库存量
|
|
@@ -599,8 +627,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
// 人民币价格
|
|
// 人民币价格
|
|
|
if(currency != null && currency.contains("RMB")) {
|
|
if(currency != null && currency.contains("RMB")) {
|
|
|
Double pricermb = null;
|
|
Double pricermb = null;
|
|
|
- Object pricermbReadWorkBookCellValue = readWorkBookCell(cellPriceRMB, Cell.CELL_TYPE_NUMERIC, r, num+1);
|
|
|
|
|
- if (pricermbReadWorkBookCellValue != null) {
|
|
|
|
|
|
|
+ Object pricermbReadWorkBookCellValue = readWorkBookCell(cellPriceRMB, Cell.CELL_TYPE_STRING, r, num+1);
|
|
|
|
|
+ if ((pricermbReadWorkBookCellValue != null)&&(isNumber(pricermbReadWorkBookCellValue.toString()))) {
|
|
|
pricermb = Double.valueOf(pricermbReadWorkBookCellValue.toString());
|
|
pricermb = Double.valueOf(pricermbReadWorkBookCellValue.toString());
|
|
|
}
|
|
}
|
|
|
if (pricermb != null && pricermb > 0.0) {
|
|
if (pricermb != null && pricermb > 0.0) {
|
|
@@ -620,8 +648,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
if(currency != null && currency.contains("USD")) {
|
|
if(currency != null && currency.contains("USD")) {
|
|
|
// 美金价格
|
|
// 美金价格
|
|
|
Double priceusd = null;
|
|
Double priceusd = null;
|
|
|
- Object priceusdReadWorkBookCellValue = readWorkBookCell(cellPriceUSD, Cell.CELL_TYPE_NUMERIC, r, num+2);
|
|
|
|
|
- if (priceusdReadWorkBookCellValue != null) {
|
|
|
|
|
|
|
+ Object priceusdReadWorkBookCellValue = readWorkBookCell(cellPriceUSD, Cell.CELL_TYPE_STRING, r, num+2);
|
|
|
|
|
+ if ((priceusdReadWorkBookCellValue != null)&&(isNumber(priceusdReadWorkBookCellValue.toString()))) {
|
|
|
priceusd = Double.valueOf(priceusdReadWorkBookCellValue.toString());
|
|
priceusd = Double.valueOf(priceusdReadWorkBookCellValue.toString());
|
|
|
}
|
|
}
|
|
|
if (priceusd != null && priceusd > 0) {
|
|
if (priceusd != null && priceusd > 0) {
|