|
@@ -47,7 +47,7 @@ public class AppPageReportController {
|
|
|
map.put("取水量", supplyWaterList);
|
|
|
map.put("制水量", makingWaterList);
|
|
|
map.put("售水量", sellerWaterList);
|
|
|
- CalculationWaterData(supplyWaterList,makingWaterList,sellerWaterList,map);
|
|
|
+ CalculationNrw(supplyWaterList,makingWaterList,sellerWaterList,map);
|
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
}
|
|
|
|
|
@@ -69,7 +69,7 @@ public class AppPageReportController {
|
|
|
map.put("取水量", supplyWaterList);
|
|
|
map.put("制水量", makingWaterList);
|
|
|
map.put("售水量", sellerWaterList);
|
|
|
- CalculationWaterData(supplyWaterList,makingWaterList,sellerWaterList,map);
|
|
|
+ CalculationNrw(supplyWaterList,makingWaterList,sellerWaterList,map);
|
|
|
|
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
}
|
|
@@ -91,17 +91,15 @@ public class AppPageReportController {
|
|
|
map.put("取水量", supplyWaterList);
|
|
|
map.put("制水量", makingWaterList);
|
|
|
map.put("售水量", sellerWaterList);
|
|
|
- CalculationWaterData(supplyWaterList,makingWaterList,sellerWaterList,map);
|
|
|
+ CalculationNrw(supplyWaterList,makingWaterList,sellerWaterList,map);
|
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "getWaterIntakeComparison",method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "App总览——生产数据-取水环比(本月)")
|
|
|
public AjaxMessage<Object> getWaterIntakeComparison(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
-
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
LocalDate lastlocalDate = LocalDate.now();
|
|
|
-
|
|
|
List<DeviceWaterSupply> supplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4,
|
|
|
localDate.getYear(),localDate.getMonthValue(),1,
|
|
|
localDate.getYear(),localDate.getMonthValue(),localDate.getDayOfMonth() );
|
|
@@ -121,7 +119,7 @@ public class AppPageReportController {
|
|
|
* @param map
|
|
|
* @return
|
|
|
*/
|
|
|
- private void CalculationWaterData(List<DeviceWaterSupply> supplyWaterList, List<DeviceWaterSupply> makingWaterList,List<DeviceWaterSupply> sellerWaterList,Map<String,Object> map){
|
|
|
+ private void CalculationNrw(List<DeviceWaterSupply> supplyWaterList, List<DeviceWaterSupply> makingWaterList,List<DeviceWaterSupply> sellerWaterList,Map<String,Object> map){
|
|
|
BigDecimal supplyWaterAmount = new BigDecimal(0);
|
|
|
BigDecimal makingWaterAmount = new BigDecimal(0);
|
|
|
BigDecimal sellerWaterAmount = new BigDecimal(0);
|
|
@@ -141,7 +139,25 @@ public class AppPageReportController {
|
|
|
map.put("售水总量",sellerWaterAmount);
|
|
|
map.put("产销差",nrw);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * @Author wangbo
|
|
|
+ * @Description 计算环比
|
|
|
+ * @param sameWaterList 本月数据
|
|
|
+ * @param lastWaterList 上月数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private BigDecimal CalculationComparison(List<DeviceWaterSupply> sameWaterList, List<DeviceWaterSupply> lastWaterList){
|
|
|
+ BigDecimal sameWaterAmount = new BigDecimal(0);
|
|
|
+ BigDecimal lastWaterAmount = new BigDecimal(0);
|
|
|
+ for(DeviceWaterSupply water : sameWaterList){
|
|
|
+ sameWaterAmount = sameWaterAmount.add(water.getAmount());
|
|
|
+ }
|
|
|
+ for(DeviceWaterSupply water : lastWaterList){
|
|
|
+ lastWaterAmount = lastWaterAmount.add(water.getAmount());
|
|
|
+ }
|
|
|
+ BigDecimal comparison = lastWaterAmount ==BigDecimal.ZERO ? BigDecimal.ZERO : sameWaterAmount.multiply(new BigDecimal(100)).divide(lastWaterAmount,2);
|
|
|
+ return comparison;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|