|
@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.text.NumberFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Calendar;
|
|
@@ -117,12 +118,11 @@ public class ProdSaleServiceImpl extends ServiceImpl<ProdSaleMapper, ProdSale> i
|
|
|
prodSaleVo.setQuantityCountLast(quantityCount1.toString());
|
|
|
prodSaleVo.setMoneyCount(moneyCount.toString());//本月销售数量
|
|
|
prodSaleVo.setQuantityCount(quantityCount.toString());//本月销售额
|
|
|
- double a = (moneyCount.doubleValue() - moneyCount1.doubleValue()) / moneyCount1.doubleValue();
|
|
|
- double b = (quantityCount.doubleValue() - quantityCount1.doubleValue())/ quantityCount1.doubleValue();
|
|
|
- NumberFormat nt = NumberFormat.getPercentInstance();
|
|
|
- nt.setMinimumFractionDigits(2);
|
|
|
- prodSaleVo.setMoneyRate(nt.format(a));
|
|
|
- prodSaleVo.setQuantityRate(nt.format(b));
|
|
|
+ double a = ((moneyCount.doubleValue() - moneyCount1.doubleValue()) / moneyCount1.doubleValue())*100;
|
|
|
+ double b = (quantityCount.doubleValue() - quantityCount1.doubleValue())/ quantityCount1.doubleValue()*100;
|
|
|
+ DecimalFormat df = new DecimalFormat("#.00");
|
|
|
+ prodSaleVo.setMoneyRate(df.format(a));
|
|
|
+ prodSaleVo.setQuantityRate(df.format(b));
|
|
|
return new Result(ResultCode.SUCCESS, prodSaleVo);
|
|
|
}
|
|
|
|