|
@@ -60,16 +60,15 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getPrintingCoreIndicators(IocParam iocParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
-
|
|
|
float compare = (float) Math.random();
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
Double avgCost = printMapper.getAvgCost(iocParam);
|
|
|
Double avgPaper = printMapper.getAvgPaper(iocParam);
|
|
|
Double avgCarbon = printMapper.getAvgCarbon(iocParam);
|
|
|
- avgCost = avgCost==null?0: Double.valueOf(decimalFormat.format(avgCost));
|
|
|
- avgPaper = avgPaper==null?0:Double.valueOf(decimalFormat.format(avgPaper));
|
|
|
- avgCarbon = avgCarbon==null?0:Double.valueOf(decimalFormat.format(avgCarbon));
|
|
|
+ avgCost = Double.valueOf(decimalFormat.format(avgCost));
|
|
|
+ avgPaper = Double.valueOf(decimalFormat.format(avgPaper));
|
|
|
+ avgCarbon = Double.valueOf(decimalFormat.format(avgCarbon));
|
|
|
Integer total = printMapper.getTotal(iocParam);
|
|
|
total= total==null?0:total;
|
|
|
|
|
@@ -92,8 +91,29 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
@Override
|
|
|
public ReturnMsg getPrintingCostTrend(IocParam iocParam) {
|
|
|
String[] param = {"cost"};
|
|
|
- String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
|
|
|
- List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
|
|
|
+ //String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
|
|
|
+ //List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
|
|
|
+ String startStr = iocParam.getTimeRange().getStartDate();
|
|
|
+ String endStr = iocParam.getTimeRange().getEndDate();
|
|
|
+ List<String> list = DateUtil.getBetweenDays(startStr, endStr);
|
|
|
+ String[] labKey = list.toArray(new String[0]);
|
|
|
+ List<Label> labels1 = new ArrayList<>();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ for (int i = 0; i < labKey.length; i++) {
|
|
|
+ Label label = new Label();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ IocParam iocParam1 = new IocParam();
|
|
|
+ IocTimeRange iocTimeRange = new IocTimeRange();
|
|
|
+ iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
|
|
|
+ iocTimeRange.setEndDate(labKey[i]+" 23:59:00");
|
|
|
+ iocParam1.setTimeRange(iocTimeRange);
|
|
|
+ Double avgCost = printMapper.getAvgCost(iocParam1);
|
|
|
+ avgCost =Double.valueOf(decimalFormat.format(avgCost));
|
|
|
+ jsonObject.put(param[0],avgCost);
|
|
|
+ label.setJsonObject(jsonObject);
|
|
|
+ label.setLabel(labKey[i]);
|
|
|
+ labels1.add(label);
|
|
|
+ }
|
|
|
return ReturnMsg.ok(labels1);
|
|
|
}
|
|
|
|
|
@@ -116,11 +136,9 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
iocParam1.setTimeRange(iocTimeRange);
|
|
|
Integer totalPaper = printMapper.getTotalPaper(iocParam1);
|
|
|
Double totalInkbox = printMapper.getTotalInkbox(iocParam1);
|
|
|
- totalInkbox= totalInkbox==null?0: Double.valueOf(decimalFormat.format(totalInkbox));
|
|
|
- totalPaper = totalPaper==null?0:totalPaper;
|
|
|
+ totalInkbox = Double.valueOf(decimalFormat.format(totalInkbox));
|
|
|
jsonObject.put(param[0],totalPaper);
|
|
|
jsonObject.put(param[1],totalInkbox);
|
|
|
-
|
|
|
label.setJsonObject(jsonObject);
|
|
|
label.setLabel(labKey[i]);
|
|
|
labels1.add(label);
|