商品金额判断

This commit is contained in:
liupopo
2024-01-09 18:40:40 +08:00
parent 698e6b4708
commit 984ebd301a

View File

@@ -1,6 +1,7 @@
package com.yxt.yyth.api.appletgiftbag; package com.yxt.yyth.api.appletgiftbag;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.yxt.common.base.utils.StringUtils; import com.yxt.common.base.utils.StringUtils;
import lombok.Data; import lombok.Data;
@@ -38,40 +39,50 @@ public class GiftBagGoods {
public String getMefenPrice() { public String getMefenPrice() {
double dj = 0.0; double dj = 0.0;
if (StrUtil.isNotBlank(price)) {
try { try {
dj = Double.parseDouble(price); dj = Double.parseDouble(price);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
int js = 1; int js = 1;
if (StrUtil.isNotBlank(weight)) {
try { try {
js = Integer.parseInt(weight); js = Integer.parseInt(weight);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
double mfjg = dj * js; double mfjg = dj * js;
return NumberUtil.decimalFormatMoney(mfjg); return NumberUtil.decimalFormatMoney(mfjg);
} }
public String getSubtotal() { public String getSubtotal() {
double dj = 0.0; double dj = 0.0;
if (StrUtil.isNotBlank(price)) {
try { try {
dj = Double.parseDouble(price); dj = Double.parseDouble(price);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
int js = 1; int js = 1;
if (StrUtil.isNotBlank(weight)) {
try { try {
js = Integer.parseInt(weight); js = Integer.parseInt(weight);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
int fs = 1; int fs = 1;
if (StrUtil.isNotBlank(goodsNumber)) {
try { try {
fs = Integer.parseInt(goodsNumber); fs = Integer.parseInt(goodsNumber);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
double mfjg = dj * js * fs; double mfjg = dj * js * fs;
return NumberUtil.decimalFormatMoney(mfjg); return NumberUtil.decimalFormatMoney(mfjg);
} }