public String countFee(Order order){
double totalFee = 0;
ArrayList<DiscountInfo> discountInfos = order.getDiscountInfos();
ArrayList<Product>products = order.getProducts();
String coupon = order.getCouponInfo();
if(null!=discountInfos&&discountInfos.size()>0){
for(int i=0;i<discountInfos.size();i++){
for(int j=0;j<products.size();j++){
//此处做判断是为了防止结算日期和打折日期不一致,也就是该订单已经过了打折日期
if(discountInfos.get(i).getDate().trim().equals(order.getPayDate().trim())){
if(products.get(j).getType().trim().equals(discountInfos.get(i).getProType().trim())){
products.get(j).setFee(products.get(j).getUnitPrice()*products.get(j).getCount()*Double.valueOf(discountInfos.get(i).getDiscount()));
}else{
products.get(j).setFee(products.get(j).getUnitPrice()*products.get(j).getCount());
}
}else{
products.get(j).setFee(products.get(j).getUnitPrice()*products.get(j).getCount());
}
}
}
}else{
for(int j=0;j<products.size();j++){
products.get(j).setFee(products.get(j).getUnitPrice()*products.get(j).getCount());
}
}
for(int i=0;i<products.size();i++){
totalFee = totalFee+products.get(i).getFee();
}
if(null!=order.getCouponInfo()&&(order.getCouponInfo().length()>0)){
String[] coupons = order.getCouponInfo().split(" ");
if(coupons[0].trim().compareTo(order.getPayDate().trim())>0){
if(totalFee>Double.valueOf(coupons[1])){
totalFee = totalFee-Double.valueOf(coupons[2]);
}
}
}
double temp = (double)Math.round(totalFee*100)/100;
BigDecimal big = new BigDecimal(temp);
DecimalFormat df = new DecimalFormat("#.00");
return df.format(temp);
}