mirror of https://github.com/jeecgboot/jeecg-boot
Merge pull request #171 from LQYBill/feat/Reconstruct_Sku_price
feat: Reconstruct_Sku_price update new add and importpull/8523/head
commit
b59d206d08
|
@ -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;
|
||||||
|
|
|
@ -136,8 +136,7 @@
|
||||||
<result property="threshold" column="threshold"/>
|
<result property="threshold" column="threshold"/>
|
||||||
<result property="discountedPrice" column="discounted_price"/>
|
<result property="discountedPrice" column="discounted_price"/>
|
||||||
<result property="date" column="price_date"/>
|
<result property="date" column="price_date"/>
|
||||||
<result property="priceRmb" column="price_rmb"/>
|
<result property="currencyId" column="currency_id"/>
|
||||||
<result property="discountedPriceRmb" column="discounted_price_rmb"/>
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="promotionResultMap" type="org.jeecg.modules.business.entity.Promotion">
|
<resultMap id="promotionResultMap" type="org.jeecg.modules.business.entity.Promotion">
|
||||||
|
|
Loading…
Reference in New Issue