mirror of https://github.com/jeecgboot/jeecg-boot
feat: Reconstruct_Sku_price update new add and import
parent
5a6d7489b6
commit
c2b69c0e5b
|
@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -130,6 +131,12 @@ public class SkuPriceController extends JeecgController<SkuPrice, ISkuPriceServi
|
||||||
return Result.error("相同内容的售价记录已存在,仅日期不同,请勿重复添加。");
|
return Result.error("相同内容的售价记录已存在,仅日期不同,请勿重复添加。");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (skuPrice.getPrice() != null) {
|
||||||
|
skuPrice.setPrice(skuPrice.getPrice().setScale(2, RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
|
if (skuPrice.getDiscountedPrice() != null) {
|
||||||
|
skuPrice.setDiscountedPrice(skuPrice.getDiscountedPrice().setScale(2, RoundingMode.HALF_UP));
|
||||||
|
}
|
||||||
skuPrice.setCreateBy(sysUser.getUsername());
|
skuPrice.setCreateBy(sysUser.getUsername());
|
||||||
skuPrice.setCreateTime(new Date());
|
skuPrice.setCreateTime(new Date());
|
||||||
skuPriceService.save(skuPrice);
|
skuPriceService.save(skuPrice);
|
||||||
|
@ -281,16 +288,20 @@ public class SkuPriceController extends JeecgController<SkuPrice, ISkuPriceServi
|
||||||
break;
|
break;
|
||||||
case 1: // Price
|
case 1: // Price
|
||||||
BigDecimal price;
|
BigDecimal price;
|
||||||
if (cell.getCellType() == CellType.NUMERIC) {
|
if (cell.getCellType() == CellType.BLANK) {
|
||||||
price = BigDecimal.valueOf(cell.getNumericCellValue());
|
price = null;
|
||||||
|
} else if (cell.getCellType() == CellType.NUMERIC) {
|
||||||
|
price = BigDecimal.valueOf(cell.getNumericCellValue()).setScale(2, RoundingMode.UP);
|
||||||
} else {
|
} else {
|
||||||
price = new BigDecimal(cell.getStringCellValue().trim());
|
price = new BigDecimal(cell.getStringCellValue().trim()).setScale(2, RoundingMode.UP);
|
||||||
}
|
}
|
||||||
skuPrice.setPrice(price);
|
skuPrice.setPrice(price);
|
||||||
break;
|
break;
|
||||||
case 2: // Threshold
|
case 2: // Threshold
|
||||||
int threshold;
|
Integer threshold;
|
||||||
if (cell.getCellType() == CellType.NUMERIC) {
|
if (cell.getCellType() == CellType.BLANK) {
|
||||||
|
threshold = null;
|
||||||
|
} else if (cell.getCellType() == CellType.NUMERIC) {
|
||||||
threshold = (int) cell.getNumericCellValue();
|
threshold = (int) cell.getNumericCellValue();
|
||||||
} else {
|
} else {
|
||||||
threshold = Integer.parseInt(cell.getStringCellValue().trim());
|
threshold = Integer.parseInt(cell.getStringCellValue().trim());
|
||||||
|
@ -299,10 +310,12 @@ public class SkuPriceController extends JeecgController<SkuPrice, ISkuPriceServi
|
||||||
break;
|
break;
|
||||||
case 3: // Discounted Price
|
case 3: // Discounted Price
|
||||||
BigDecimal discountedPrice;
|
BigDecimal discountedPrice;
|
||||||
if (cell.getCellType() == CellType.NUMERIC) {
|
if (cell.getCellType() == CellType.BLANK) {
|
||||||
discountedPrice = BigDecimal.valueOf(cell.getNumericCellValue());
|
discountedPrice = null;
|
||||||
|
} else if (cell.getCellType() == CellType.NUMERIC) {
|
||||||
|
discountedPrice = BigDecimal.valueOf(cell.getNumericCellValue()).setScale(2, RoundingMode.UP);
|
||||||
} else {
|
} else {
|
||||||
discountedPrice = new BigDecimal(cell.getStringCellValue().trim());
|
discountedPrice = new BigDecimal(cell.getStringCellValue().trim()).setScale(2, RoundingMode.UP);
|
||||||
}
|
}
|
||||||
skuPrice.setDiscountedPrice(discountedPrice);
|
skuPrice.setDiscountedPrice(discountedPrice);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue