|
@@ -72,23 +72,6 @@ public class TMonthlyQualityReportS0501Controller extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// do {
|
|
|
-// TMonthlyQualityReportS0501 reportS0501 = new TMonthlyQualityReportS0501();
|
|
|
-// reportS0501.setMonth(startMonth);
|
|
|
-// reportS0501.setYear(startYear);
|
|
|
-// TMonthlyQualityReportS0501 reportS05011 = tMonthlyQualityReportS0501Service.selectTMonthlyQualityReportS0501ListMonth(reportS0501);
|
|
|
-// if (reportS05011 != null) {
|
|
|
-// dataMap.put(startYear + "-" + startMonth, reportS05011);
|
|
|
-// }
|
|
|
-// if (startMonth == 12) {
|
|
|
-// startMonth = 1;
|
|
|
-// startYear++;
|
|
|
-// } else {
|
|
|
-// startMonth++;
|
|
|
-// }
|
|
|
-// } while (startYear != endYear || startMonth != endMonth + 1);
|
|
|
-
|
|
|
-
|
|
|
if (dataMap.size() == 0) {
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
@@ -97,17 +80,17 @@ public class TMonthlyQualityReportS0501Controller extends BaseController
|
|
|
String firstKey = keys.get(0);
|
|
|
TMonthlyQualityReportS0501 firstValue = dataMap.get(firstKey);
|
|
|
// 最大值
|
|
|
- BigDecimal pMax = new BigDecimal(firstValue.getP());
|
|
|
- BigDecimal iMax = new BigDecimal(firstValue.getI());
|
|
|
- BigDecimal oMax = new BigDecimal(firstValue.getO());
|
|
|
- BigDecimal nMax = new BigDecimal(firstValue.getN());
|
|
|
- BigDecimal fiftyMax = new BigDecimal(firstValue.getFifty());
|
|
|
+ BigDecimal pMax = new BigDecimal(firstValue.getP() == null ? "0" : firstValue.getP());
|
|
|
+ BigDecimal iMax = new BigDecimal(firstValue.getI() == null ? "0" : firstValue.getI());
|
|
|
+ BigDecimal oMax = new BigDecimal(firstValue.getO() == null ? "0" : firstValue.getO());
|
|
|
+ BigDecimal nMax = new BigDecimal(firstValue.getN() == null ? "0" : firstValue.getN());
|
|
|
+ BigDecimal fiftyMax = new BigDecimal(firstValue.getFifty() == null ? "0" : firstValue.getFifty());
|
|
|
// 最小值
|
|
|
- BigDecimal pMin = new BigDecimal(firstValue.getP());
|
|
|
- BigDecimal iMin = new BigDecimal(firstValue.getI());
|
|
|
- BigDecimal oMin = new BigDecimal(firstValue.getO());
|
|
|
- BigDecimal nMin = new BigDecimal(firstValue.getN());
|
|
|
- BigDecimal fiftyMin = new BigDecimal(firstValue.getFifty());
|
|
|
+ BigDecimal pMin = new BigDecimal(firstValue.getP() == null ? "0" : firstValue.getP());
|
|
|
+ BigDecimal iMin = new BigDecimal(firstValue.getI() == null ? "0" : firstValue.getI());
|
|
|
+ BigDecimal oMin = new BigDecimal(firstValue.getO() == null ? "0" : firstValue.getO());
|
|
|
+ BigDecimal nMin = new BigDecimal(firstValue.getN() == null ? "0" : firstValue.getN());
|
|
|
+ BigDecimal fiftyMin = new BigDecimal(firstValue.getFifty() == null ? "0" : firstValue.getFifty());
|
|
|
// 平均值
|
|
|
BigDecimal pAvg = new BigDecimal(BigInteger.ZERO);
|
|
|
BigDecimal iAvg = new BigDecimal(BigInteger.ZERO);
|
|
@@ -120,35 +103,65 @@ public class TMonthlyQualityReportS0501Controller extends BaseController
|
|
|
BigDecimal oSum = new BigDecimal(BigInteger.ZERO);
|
|
|
BigDecimal nSum = new BigDecimal(BigInteger.ZERO);
|
|
|
BigDecimal fiftySum = new BigDecimal(BigInteger.ZERO);
|
|
|
+ // 计数
|
|
|
+ int pCount = 0;
|
|
|
+ int iCount = 0;
|
|
|
+ int oCount = 0;
|
|
|
+ int nCount = 0;
|
|
|
+ int fiftyCount = 0;
|
|
|
for(Map.Entry entry : dataMap.entrySet()) {
|
|
|
TMonthlyQualityReportS0501 mapValue = (TMonthlyQualityReportS0501) entry.getValue();
|
|
|
- BigDecimal p = new BigDecimal(mapValue.getP());
|
|
|
- BigDecimal i = new BigDecimal(mapValue.getI());
|
|
|
- BigDecimal o = new BigDecimal(mapValue.getO());
|
|
|
- BigDecimal n = new BigDecimal(mapValue.getN());
|
|
|
- BigDecimal fifty = new BigDecimal(mapValue.getFifty());
|
|
|
- if (p.compareTo(pMax) > 0) { pMax = p; }
|
|
|
- if (i.compareTo(iMax) > 0) { iMax = i; }
|
|
|
- if (o.compareTo(oMax) > 0) { oMax = o; }
|
|
|
- if (n.compareTo(nMax) > 0) { nMax = n; }
|
|
|
- if (fifty.compareTo(fiftyMax) > 0) { fiftyMax = fifty; }
|
|
|
- if (p.compareTo(pMin) < 0) { pMin = p; }
|
|
|
- if (i.compareTo(iMin) < 0) { iMin = i; }
|
|
|
- if (o.compareTo(oMin) < 0) { oMin = o; }
|
|
|
- if (n.compareTo(nMin) < 0) { nMin = n; }
|
|
|
- if (fifty.compareTo(fiftyMin) < 0) { fiftyMin = fifty; }
|
|
|
- pSum = pSum.add(p);
|
|
|
- iSum = iSum.add(i);
|
|
|
- oSum = oSum.add(o);
|
|
|
- nSum = nSum.add(n);
|
|
|
- fiftySum = fiftySum.add(fifty);
|
|
|
+ String p1 = mapValue.getP();
|
|
|
+ if (p1 != null) {
|
|
|
+ BigDecimal p = new BigDecimal(p1);
|
|
|
+ if (p.compareTo(pMax) > 0) { pMax = p; }
|
|
|
+ if (p.compareTo(pMin) < 0) { pMin = p; }
|
|
|
+ pSum = pSum.add(p);
|
|
|
+ }
|
|
|
+ String i1 = mapValue.getI();
|
|
|
+ if (i1 != null) {
|
|
|
+ BigDecimal i = new BigDecimal(i1);
|
|
|
+ if (i.compareTo(iMax) > 0) { iMax = i; }
|
|
|
+ if (i.compareTo(iMin) < 0) { iMin = i; }
|
|
|
+ iSum = iSum.add(i);
|
|
|
+ }
|
|
|
+ String o1 = mapValue.getO();
|
|
|
+ if (o1 != null) {
|
|
|
+ BigDecimal o = new BigDecimal(o1);
|
|
|
+ if (o.compareTo(oMax) > 0) { oMax = o; }
|
|
|
+ if (o.compareTo(oMin) < 0) { oMin = o; }
|
|
|
+ oSum = oSum.add(o);
|
|
|
+ }
|
|
|
+ String n1 = mapValue.getN();
|
|
|
+ if (n1 != null) {
|
|
|
+ BigDecimal n = new BigDecimal(n1);
|
|
|
+ if (n.compareTo(nMax) > 0) { nMax = n; }
|
|
|
+ if (n.compareTo(nMin) < 0) { nMin = n; }
|
|
|
+ nSum = nSum.add(n);
|
|
|
+ }
|
|
|
+ String fifty1 = mapValue.getFifty();
|
|
|
+ if (fifty1 != null) {
|
|
|
+ BigDecimal fifty = new BigDecimal(fifty1);
|
|
|
+ if (fifty.compareTo(fiftyMax) > 0) { fiftyMax = fifty; }
|
|
|
+ if (fifty.compareTo(fiftyMin) < 0) { fiftyMin = fifty; }
|
|
|
+ fiftySum = fiftySum.add(fifty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (pCount != 0) {
|
|
|
+ pAvg = pSum.divide(new BigDecimal(pCount), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ if (iCount != 0) {
|
|
|
+ iAvg = iSum.divide(new BigDecimal(iCount), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ if (oCount != 0) {
|
|
|
+ oAvg = oSum.divide(new BigDecimal(oCount), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ if (nCount != 0) {
|
|
|
+ nAvg = nSum.divide(new BigDecimal(nCount), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ if (fiftyCount != 0) {
|
|
|
+ fiftyAvg = fiftySum.divide(new BigDecimal(fiftyCount), 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
- BigDecimal count = new BigDecimal(dataMap.size());
|
|
|
- pAvg = pSum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
- iAvg = iSum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
- oAvg = oSum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
- nAvg = nSum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
- fiftyAvg = fiftySum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
StringBuffer description = new StringBuffer();
|
|
|
description.append("正构烷烃(max)="+ pMax.toString() + "\t");
|
|
|
description.append("异构烷烃(max)="+ iMax.toString() + "\t");
|
|
@@ -185,17 +198,17 @@ public class TMonthlyQualityReportS0501Controller extends BaseController
|
|
|
// 获取list第一个元素
|
|
|
TMonthlyQualityReportS0501 firstValue = tMonthlyQualityReportS0501s.get(0);
|
|
|
// 最大值
|
|
|
- BigDecimal pMax = new BigDecimal(firstValue.getP());
|
|
|
- BigDecimal iMax = new BigDecimal(firstValue.getI());
|
|
|
- BigDecimal oMax = new BigDecimal(firstValue.getO());
|
|
|
- BigDecimal nMax = new BigDecimal(firstValue.getN());
|
|
|
- BigDecimal fiftyMax = new BigDecimal(firstValue.getFifty());
|
|
|
+ BigDecimal pMax = new BigDecimal(firstValue.getP() == null ? "0" : firstValue.getP());
|
|
|
+ BigDecimal iMax = new BigDecimal(firstValue.getI() == null ? "0" : firstValue.getI());
|
|
|
+ BigDecimal oMax = new BigDecimal(firstValue.getO() == null ? "0" : firstValue.getO());
|
|
|
+ BigDecimal nMax = new BigDecimal(firstValue.getN() == null ? "0" : firstValue.getN());
|
|
|
+ BigDecimal fiftyMax = new BigDecimal(firstValue.getFifty() == null ? "0" : firstValue.getFifty());
|
|
|
// 最小值
|
|
|
- BigDecimal pMin = new BigDecimal(firstValue.getP());
|
|
|
- BigDecimal iMin = new BigDecimal(firstValue.getI());
|
|
|
- BigDecimal oMin = new BigDecimal(firstValue.getO());
|
|
|
- BigDecimal nMin = new BigDecimal(firstValue.getN());
|
|
|
- BigDecimal fiftyMin = new BigDecimal(firstValue.getFifty());
|
|
|
+ BigDecimal pMin = new BigDecimal(firstValue.getP() == null ? "0" : firstValue.getP());
|
|
|
+ BigDecimal iMin = new BigDecimal(firstValue.getI() == null ? "0" : firstValue.getI());
|
|
|
+ BigDecimal oMin = new BigDecimal(firstValue.getO() == null ? "0" : firstValue.getO());
|
|
|
+ BigDecimal nMin = new BigDecimal(firstValue.getN() == null ? "0" : firstValue.getN());
|
|
|
+ BigDecimal fiftyMin = new BigDecimal(firstValue.getFifty() == null ? "0" : firstValue.getFifty());
|
|
|
// 平均值
|
|
|
BigDecimal pAvg = new BigDecimal(BigInteger.ZERO);
|
|
|
BigDecimal iAvg = new BigDecimal(BigInteger.ZERO);
|
|
@@ -208,34 +221,64 @@ public class TMonthlyQualityReportS0501Controller extends BaseController
|
|
|
BigDecimal oSum = new BigDecimal(BigInteger.ZERO);
|
|
|
BigDecimal nSum = new BigDecimal(BigInteger.ZERO);
|
|
|
BigDecimal fiftySum = new BigDecimal(BigInteger.ZERO);
|
|
|
+ // 计数
|
|
|
+ int pCount = 0;
|
|
|
+ int iCount = 0;
|
|
|
+ int oCount = 0;
|
|
|
+ int nCount = 0;
|
|
|
+ int fiftyCount = 0;
|
|
|
for (TMonthlyQualityReportS0501 monthlyQualityReportS0501 : tMonthlyQualityReportS0501s) {
|
|
|
- BigDecimal p = new BigDecimal(monthlyQualityReportS0501.getP());
|
|
|
- BigDecimal i = new BigDecimal(monthlyQualityReportS0501.getI());
|
|
|
- BigDecimal o = new BigDecimal(monthlyQualityReportS0501.getO());
|
|
|
- BigDecimal n = new BigDecimal(monthlyQualityReportS0501.getN());
|
|
|
- BigDecimal fifty = new BigDecimal(monthlyQualityReportS0501.getFifty());
|
|
|
- if (p.compareTo(pMax) > 0) { pMax = p; }
|
|
|
- if (i.compareTo(iMax) > 0) { iMax = i; }
|
|
|
- if (o.compareTo(oMax) > 0) { oMax = o; }
|
|
|
- if (n.compareTo(nMax) > 0) { nMax = n; }
|
|
|
- if (fifty.compareTo(fiftyMax) > 0) { fiftyMax = fifty; }
|
|
|
- if (p.compareTo(pMin) < 0) { pMin = p; }
|
|
|
- if (i.compareTo(iMin) < 0) { iMin = i; }
|
|
|
- if (o.compareTo(oMin) < 0) { oMin = o; }
|
|
|
- if (n.compareTo(nMin) < 0) { nMin = n; }
|
|
|
- if (fifty.compareTo(fiftyMin) < 0) { fiftyMin = fifty; }
|
|
|
- pSum = pSum.add(p);
|
|
|
- iSum = iSum.add(i);
|
|
|
- oSum = oSum.add(o);
|
|
|
- nSum = nSum.add(n);
|
|
|
- fiftySum = fiftySum.add(fifty);
|
|
|
+ String p1 = monthlyQualityReportS0501.getP();
|
|
|
+ if (p1 != null) {
|
|
|
+ BigDecimal p = new BigDecimal(p1);
|
|
|
+ if (p.compareTo(pMax) > 0) { pMax = p; }
|
|
|
+ if (p.compareTo(pMin) < 0) { pMin = p; }
|
|
|
+ pSum = pSum.add(p);
|
|
|
+ }
|
|
|
+ String i1 = monthlyQualityReportS0501.getI();
|
|
|
+ if (i1 != null) {
|
|
|
+ BigDecimal i = new BigDecimal(i1);
|
|
|
+ if (i.compareTo(iMax) > 0) { iMax = i; }
|
|
|
+ if (i.compareTo(iMin) < 0) { iMin = i; }
|
|
|
+ iSum = iSum.add(i);
|
|
|
+ }
|
|
|
+ String o1 = monthlyQualityReportS0501.getO();
|
|
|
+ if (o1 != null) {
|
|
|
+ BigDecimal o = new BigDecimal(o1);
|
|
|
+ if (o.compareTo(oMax) > 0) { oMax = o; }
|
|
|
+ if (o.compareTo(oMin) < 0) { oMin = o; }
|
|
|
+ oSum = oSum.add(o);
|
|
|
+ }
|
|
|
+ String n1 = monthlyQualityReportS0501.getN();
|
|
|
+ if (n1 != null) {
|
|
|
+ BigDecimal n = new BigDecimal(n1);
|
|
|
+ if (n.compareTo(nMax) > 0) { nMax = n; }
|
|
|
+ if (n.compareTo(nMin) < 0) { nMin = n; }
|
|
|
+ nSum = nSum.add(n);
|
|
|
+ }
|
|
|
+ String fifty1 = monthlyQualityReportS0501.getFifty();
|
|
|
+ if (fifty1 != null) {
|
|
|
+ BigDecimal fifty = new BigDecimal(fifty1);
|
|
|
+ if (fifty.compareTo(fiftyMax) > 0) { fiftyMax = fifty; }
|
|
|
+ if (fifty.compareTo(fiftyMin) < 0) { fiftyMin = fifty; }
|
|
|
+ fiftySum = fiftySum.add(fifty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (pCount != 0) {
|
|
|
+ pAvg = pSum.divide(new BigDecimal(pCount), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ if (iCount != 0) {
|
|
|
+ iAvg = iSum.divide(new BigDecimal(iCount), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ if (oCount != 0) {
|
|
|
+ oAvg = oSum.divide(new BigDecimal(oCount), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ if (nCount != 0) {
|
|
|
+ nAvg = nSum.divide(new BigDecimal(nCount), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ if (fiftyCount != 0) {
|
|
|
+ fiftyAvg = fiftySum.divide(new BigDecimal(fiftyCount), 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
- BigDecimal count = new BigDecimal(tMonthlyQualityReportS0501s.size());
|
|
|
- pAvg = pSum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
- iAvg = iSum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
- oAvg = oSum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
- nAvg = nSum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
- fiftyAvg = fiftySum.divide(count, 2, RoundingMode.HALF_UP);
|
|
|
StringBuffer description = new StringBuffer();
|
|
|
description.append("正构烷烃(max)="+ pMax.toString() + "\t");
|
|
|
description.append("异构烷烃(max)="+ iMax.toString() + "\t");
|