Browse Source

商品金额判断

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

51
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,16 +39,20 @@ public class GiftBagGoods {
public String getMefenPrice() { public String getMefenPrice() {
double dj = 0.0; double dj = 0.0;
try { if (StrUtil.isNotBlank(price)) {
dj = Double.parseDouble(price); try {
} catch (Exception e) { dj = Double.parseDouble(price);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
int js = 1; int js = 1;
try { if (StrUtil.isNotBlank(weight)) {
js = Integer.parseInt(weight); try {
} catch (Exception e) { js = Integer.parseInt(weight);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
double mfjg = dj * js; double mfjg = dj * js;
return NumberUtil.decimalFormatMoney(mfjg); return NumberUtil.decimalFormatMoney(mfjg);
@ -55,22 +60,28 @@ public class GiftBagGoods {
public String getSubtotal() { public String getSubtotal() {
double dj = 0.0; double dj = 0.0;
try { if (StrUtil.isNotBlank(price)) {
dj = Double.parseDouble(price); try {
} catch (Exception e) { dj = Double.parseDouble(price);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
int js = 1; int js = 1;
try { if (StrUtil.isNotBlank(weight)) {
js = Integer.parseInt(weight); try {
} catch (Exception e) { js = Integer.parseInt(weight);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
int fs = 1; int fs = 1;
try { if (StrUtil.isNotBlank(goodsNumber)) {
fs = Integer.parseInt(goodsNumber); try {
} catch (Exception e) { fs = Integer.parseInt(goodsNumber);
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
}
} }
double mfjg = dj * js * fs; double mfjg = dj * js * fs;
return NumberUtil.decimalFormatMoney(mfjg); return NumberUtil.decimalFormatMoney(mfjg);

Loading…
Cancel
Save