no message
parent
fa5ae61571
commit
fc6417acd2
|
|
@ -25,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -79,11 +81,15 @@ public class DashBoardController {
|
||||||
outObj.put("color", "orange");
|
outObj.put("color", "orange");
|
||||||
jsonArray.add(outObj);
|
jsonArray.add(outObj);
|
||||||
|
|
||||||
|
//turnoverTotal四舍五入,保留两位小数
|
||||||
double turnoverTotal = outTotal / (double) invTotal;
|
double turnoverTotal = outTotal / (double) invTotal;
|
||||||
|
BigDecimal bd = new BigDecimal(turnoverTotal);
|
||||||
|
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
||||||
|
double roundedValue = bd.doubleValue();
|
||||||
JSONObject turnoverObj = new JSONObject(true);
|
JSONObject turnoverObj = new JSONObject(true);
|
||||||
turnoverObj.put("title", "库存周转率(次/天)");
|
turnoverObj.put("title", "库存周转率(次/天)");
|
||||||
turnoverObj.put("icon", "transaction|svg");
|
turnoverObj.put("icon", "transaction|svg");
|
||||||
turnoverObj.put("total", turnoverTotal);
|
turnoverObj.put("total", roundedValue);
|
||||||
jsonArray.add(turnoverObj);
|
jsonArray.add(turnoverObj);
|
||||||
|
|
||||||
result.setResult(jsonArray);
|
result.setResult(jsonArray);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue