Authored by wangnan

fix

... ... @@ -21,6 +21,7 @@ import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
... ... @@ -120,10 +121,10 @@ public class ProductMqListener extends AbstractMqListener implements ChannelAwar
int dateCount = DateUtil.getIntervalDays(now, shelve_time);
if (dateCount <= 7) {
//计算折扣
DecimalFormat df = new DecimalFormat("0.0");
String str = df.format(productPrice.getSalesPrice().divide(productPrice.getMarketPrice(), 1));
DecimalFormat df = new DecimalFormat("0.00");
String str = df.format(productPrice.getSalesPrice().divide(productPrice.getMarketPrice(), 2, RoundingMode.DOWN));
Double discount = Double.valueOf(str);
if(discount<0.88)
if(discount<=0.88)
productI.setIsnew("Y");
}
}
... ...
... ... @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
... ... @@ -172,10 +173,10 @@ public class ProductPriceMqListener extends AbstractMqListener implements Channe
int dateCount = DateUtil.getIntervalDays(now, shelve_time);
if (dateCount <= 7) {
//计算折扣
DecimalFormat df = new DecimalFormat("0.0");
String str = df.format(productPrice.getSalesPrice().divide(productPrice.getMarketPrice(), 1));
DecimalFormat df = new DecimalFormat("0.00");
String str = df.format(productPrice.getSalesPrice().divide(productPrice.getMarketPrice(), 2, RoundingMode.DOWN));
Double discount = Double.valueOf(str);
if(discount<0.88)
if(discount<=0.88)
indexData.put("isnew", "Y");
}
}
... ...