Browse Source

商品金额判断

master
liupopo 1 year ago
parent
commit
984ebd301a
  1. 11
      src/main/java/com/yxt/yyth/api/appletgiftbag/GiftBagGoods.java

11
src/main/java/com/yxt/yyth/api/appletgiftbag/GiftBagGoods.java

@ -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);
} }

Loading…
Cancel
Save