|
|
@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
@ -198,6 +199,7 @@ public class AppletGiftBagService extends MybatisBaseService<AppletGiftBagMapper |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
List<AppletGiftBagVo> list=baseMapper.giftBagList(); |
|
|
|
list.forEach(s->{ |
|
|
|
// s.setPrice(Double.valueOf(aa(s.getPrice())));
|
|
|
|
List<AppletGiftBagGoods> appletGiftBagGoods=appletGiftBagGoodsService.list(new QueryWrapper<AppletGiftBagGoods>().eq("giftbagSid",s.getSid())); |
|
|
|
s.setCount(appletGiftBagGoods.size()+"种蔬菜"); |
|
|
|
s.setIconUrl(fileUploadComponent.getUrlPrefix() +s.getIconUrl()); |
|
|
@ -215,14 +217,18 @@ public class AppletGiftBagService extends MybatisBaseService<AppletGiftBagMapper |
|
|
|
for(GiftBagGoods goods:goodsList){ |
|
|
|
i=i+Double.valueOf(goods.getPrice())*Double.valueOf(goods.getGoodsNumber()); |
|
|
|
goods.setIconUrl(fileUploadComponent.getUrlPrefix() +goods.getIconUrl()); |
|
|
|
goods.setTotalValue(String.valueOf(Double.valueOf(goods.getGoodsNumber())*Double.valueOf(goods.getPrice()))); |
|
|
|
goods.setTotalValue(String.valueOf(decimalFormat.format(Double.valueOf(goods.getGoodsNumber())*Double.valueOf(goods.getPrice())))); |
|
|
|
goods.setJPrice(String.valueOf(decimalFormat.format(Double.valueOf(goods.getPrice())/Double.valueOf(goods.getWeight())))); |
|
|
|
} |
|
|
|
appletGiftBagVo.setPrice(String.valueOf(i)); |
|
|
|
appletGiftBagVo.setPrice(decimalFormat.format(i)); |
|
|
|
appletGiftBagVo.setGoods(goodsList); |
|
|
|
appletGiftBagVo.setName(s.getName()); |
|
|
|
return rb.success().setData(appletGiftBagVo); |
|
|
|
} |
|
|
|
|
|
|
|
public String aa(double a){ |
|
|
|
BigDecimal d=new BigDecimal(a); |
|
|
|
double c= d.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
return String.valueOf(c); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|