|
@@ -41,14 +41,14 @@ public class AppPageReportController {
|
|
|
@ApiOperation(value = "App总览——生产数据(本月)")
|
|
|
public AjaxMessage<Map<String,Object>> getProductionDataForMonth(
|
|
|
@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
- List<DeviceWaterSupply> supplyWaterList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,1);
|
|
|
+ List<DeviceWaterSupply> intakeWaterList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,1);
|
|
|
List<DeviceWaterSupply> makingWaterList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水厂",3,1);
|
|
|
List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,1);
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
- map.put("intake", supplyWaterList);
|
|
|
+ map.put("intake", intakeWaterList);
|
|
|
map.put("making", makingWaterList);
|
|
|
map.put("seller", sellerWaterList);
|
|
|
- appPageReportService.CalculationNrw(supplyWaterList,makingWaterList,sellerWaterList,map);
|
|
|
+ appPageReportService.CalculationNrw(intakeWaterList,makingWaterList,sellerWaterList,map);
|
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
}
|
|
|
|
|
@@ -63,7 +63,6 @@ public class AppPageReportController {
|
|
|
public AjaxMessage<Map<String,Object>> getProductionDataForSameYear(
|
|
|
@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
-
|
|
|
List<DeviceWaterSupply> supplyWaterList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,localDate.getMonthValue());
|
|
|
List<DeviceWaterSupply> makingWaterList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水厂",3,localDate.getMonthValue());
|
|
|
List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,localDate.getMonthValue());
|
|
@@ -102,17 +101,14 @@ public class AppPageReportController {
|
|
|
@ApiOperation(value = "App总览——生产数据-取水环比(本月)")
|
|
|
public AjaxMessage<Object> getProductionComparisonForSameMonth(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
LocalDate now = LocalDate.now();
|
|
|
- LocalDate last = now.minusMonths(1);
|
|
|
+ List<DeviceWaterSupply> intakeComparisonList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,2);
|
|
|
+ List<DeviceWaterSupply> makingComparisonList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水厂",3,2);
|
|
|
+ List<DeviceWaterSupply> sellerComparisonList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,2);
|
|
|
|
|
|
- List<DeviceWaterSupply> sameMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, now.getYear(),now.getMonthValue(),1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
|
|
|
- List<DeviceWaterSupply> lastMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, last.getYear(),last.getMonthValue(),1, last.getYear(),last.getMonthValue(),last.getDayOfMonth());
|
|
|
- List<DeviceWaterSupply> sameSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, now.getYear(),now.getMonthValue(),1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
|
|
|
- List<DeviceWaterSupply> lastSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, last.getYear(),last.getMonthValue(),1, last.getYear(),last.getMonthValue(),last.getDayOfMonth());
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
- map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
|
- map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
|
- List<DeviceWaterSupply> sameSellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,2);
|
|
|
- map.put("sellerComparison", sameSellerWaterList.get(0).getAmount().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameSellerWaterList.get(0).getAmount().multiply(new BigDecimal(100)).divide(sameSellerWaterList.get(1).getAmount(),3));
|
|
|
+ map.put("intakeComparison",appPageReportService.CalculationComparison2(intakeComparisonList,1));
|
|
|
+ map.put("makingComparison",appPageReportService.CalculationComparison2(makingComparisonList,1));
|
|
|
+ map.put("sellerComparison", appPageReportService.CalculationComparison2(sellerComparisonList,1));
|
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
}
|
|
|
|
|
@@ -120,27 +116,14 @@ public class AppPageReportController {
|
|
|
@ApiOperation(value = "App总览——生产数据-取水环比、供水环比、售水环比(本年)")
|
|
|
public AjaxMessage<Object> getProductionComparisonForSameYear(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
LocalDate now = LocalDate.now();
|
|
|
- LocalDate last = now.minusYears(1);
|
|
|
-
|
|
|
- List<DeviceWaterSupply> sameMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, now.getYear(),1,1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
|
|
|
- List<DeviceWaterSupply> lastMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, last.getYear(),1,1, last.getYear(),12,31);
|
|
|
- List<DeviceWaterSupply> sameSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, now.getYear(),1,1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
|
|
|
- List<DeviceWaterSupply> lastSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, last.getYear(),1,1, last.getYear(),12,31);
|
|
|
- List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,now.getMonthValue()+12);
|
|
|
- BigDecimal sameSellerAmount = new BigDecimal(0);
|
|
|
- BigDecimal lastSellerAmount = new BigDecimal(0);
|
|
|
- for( int i =0 ;i<sellerWaterList.size(); i++){
|
|
|
- if(i>=12){
|
|
|
- sameSellerAmount = sameSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
|
- }
|
|
|
- else{
|
|
|
- lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
|
- }
|
|
|
- }
|
|
|
+ List<DeviceWaterSupply> intakeComparisonList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,now.getMonthValue()+12);
|
|
|
+ List<DeviceWaterSupply> makingComparisonList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水厂",3,now.getMonthValue()+12);
|
|
|
+ List<DeviceWaterSupply> sellerComparisonList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,now.getMonthValue()+12);
|
|
|
+
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
- map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
|
- map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
|
- map.put("sellerComparison", lastSellerAmount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,3));
|
|
|
+ map.put("intakeComparison",appPageReportService.CalculationComparison2(intakeComparisonList,2));
|
|
|
+ map.put("makingComparison",appPageReportService.CalculationComparison2(makingComparisonList,2));
|
|
|
+ map.put("sellerComparison", appPageReportService.CalculationComparison2(sellerComparisonList,2));
|
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
}
|
|
|
|
|
@@ -148,33 +131,16 @@ public class AppPageReportController {
|
|
|
@ApiOperation(value = "App总览——生产数据-取水环比、供水环比、售水环比(近一年)")
|
|
|
public AjaxMessage<Object> getProductionComparisonForLast12Month(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
LocalDate now = LocalDate.now();
|
|
|
- LocalDate last = now.minusMonths(11);
|
|
|
-
|
|
|
|
|
|
- List<DeviceWaterSupply> sameMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, last.getYear(),last.getMonthValue(),last.getDayOfMonth(), now.getYear(),now.getMonthValue(),now.getDayOfMonth());
|
|
|
- List<DeviceWaterSupply> sameSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, last.getYear(),last.getMonthValue(),last.getDayOfMonth(),now.getYear(),now.getMonthValue(),now.getDayOfMonth());
|
|
|
- LocalDate last2 = last.minusDays(1);
|
|
|
- LocalDate last3 = last2.minusMonths(11);
|
|
|
- List<DeviceWaterSupply> lastMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, last3.getYear(),last2.getMonthValue(),last2.getDayOfMonth(), last.getYear(),12,31);
|
|
|
- List<DeviceWaterSupply> lastSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, last.getYear(),1,1, last.getYear(),12,31);
|
|
|
|
|
|
- List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,24);
|
|
|
+ List<DeviceWaterSupply> intakeComparisonList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水源",4,24);
|
|
|
+ List<DeviceWaterSupply> makingComparisonList = appPageReportService.deviceWaterReportForMonth(companyOrgId,"水厂",3,24);
|
|
|
+ List<DeviceWaterSupply> sellerComparisonList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,24);
|
|
|
|
|
|
- BigDecimal sameSellerAmount = new BigDecimal(0);
|
|
|
- BigDecimal lastSellerAmount = new BigDecimal(0);
|
|
|
-
|
|
|
- for( int i =0 ;i<sellerWaterList.size(); i++){
|
|
|
- if(i>=12){
|
|
|
- sameSellerAmount = sameSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
|
- }
|
|
|
- else{
|
|
|
- lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
|
- }
|
|
|
- }
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
- map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
|
- map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
|
- map.put("sellerComparison",lastSellerAmount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,3));
|
|
|
+ map.put("intakeComparison",appPageReportService.CalculationComparison2(intakeComparisonList,3));
|
|
|
+ map.put("makingComparison",appPageReportService.CalculationComparison2(makingComparisonList,3));
|
|
|
+ map.put("sellerComparison", appPageReportService.CalculationComparison2(sellerComparisonList,3));
|
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
}
|
|
|
|
|
@@ -308,8 +274,8 @@ public class AppPageReportController {
|
|
|
public AjaxMessage<Object> getSellerComparisonForSameMonth(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
|
|
|
List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerAmountReportForMonth(companyOrgId,2);
|
|
|
- BigDecimal receivableComparison = sellerWaterList.get(1).getReceivableAmount().compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:sellerWaterList.get(0).getReceivableAmount().multiply(new BigDecimal(100)).divide(sellerWaterList.get(1).getReceivableAmount(),3);
|
|
|
- BigDecimal receivedComparison = sellerWaterList.get(1).getReceivedAmount().compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:sellerWaterList.get(0).getReceivedAmount().multiply(new BigDecimal(100)).divide(sellerWaterList.get(1).getReceivedAmount(),3);
|
|
|
+ BigDecimal receivableComparison = sellerWaterList.get(1).getReceivableAmount().compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:sellerWaterList.get(0).getReceivableAmount().subtract(sellerWaterList.get(1).getReceivableAmount()).multiply(new BigDecimal(100)).divide(sellerWaterList.get(1).getReceivableAmount(),3);
|
|
|
+ BigDecimal receivedComparison = sellerWaterList.get(1).getReceivedAmount().compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:sellerWaterList.get(0).getReceivedAmount().subtract(sellerWaterList.get(1).getReceivedAmount()).multiply(new BigDecimal(100)).divide(sellerWaterList.get(1).getReceivedAmount(),3);
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
map.put("receivableComparison",receivableComparison);
|
|
|
map.put("receivedComparison",receivedComparison);
|
|
@@ -337,8 +303,8 @@ public class AppPageReportController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- BigDecimal receivedComparison = receivedLastYearComparison.compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:receivedSameYearComparison.multiply(new BigDecimal(100)).divide(receivedLastYearComparison,3);
|
|
|
- BigDecimal receivableComparison = receivableLastYearComparison.compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:receivableSameYearComparison.multiply(new BigDecimal(100)).divide(receivableLastYearComparison,3);
|
|
|
+ BigDecimal receivedComparison = receivedLastYearComparison.compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:receivedSameYearComparison.subtract(receivedLastYearComparison).multiply(new BigDecimal(100)).divide(receivedLastYearComparison,3);
|
|
|
+ BigDecimal receivableComparison = receivableLastYearComparison.compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:receivableSameYearComparison.subtract(receivableLastYearComparison).multiply(new BigDecimal(100)).divide(receivableLastYearComparison,3);
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
map.put("receivableComparison",receivableComparison);
|
|
|
map.put("receivedComparison",receivedComparison);
|
|
@@ -365,8 +331,8 @@ public class AppPageReportController {
|
|
|
receivableLastYearComparison =receivableLastYearComparison.add(sellerWaterList.get(i).getReceivableAmount());
|
|
|
}
|
|
|
}
|
|
|
- BigDecimal receivedComparison = receivedLastYearComparison.compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:receivedSameYearComparison.multiply(new BigDecimal(100)).divide(receivedLastYearComparison,3);
|
|
|
- BigDecimal receivableComparison = receivableLastYearComparison.compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:receivableSameYearComparison.multiply(new BigDecimal(100)).divide(receivableLastYearComparison,3);
|
|
|
+ BigDecimal receivedComparison = receivedLastYearComparison.compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:receivedSameYearComparison.subtract(receivedLastYearComparison).multiply(new BigDecimal(100)).divide(receivedLastYearComparison,3);
|
|
|
+ BigDecimal receivableComparison = receivableLastYearComparison.compareTo(BigDecimal.ZERO)==0 ?BigDecimal.ZERO:receivableSameYearComparison.subtract(receivableLastYearComparison).multiply(new BigDecimal(100)).divide(receivableLastYearComparison,3);
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
map.put("receivableComparison",receivableComparison);
|
|
|
map.put("receivedComparison",receivedComparison);
|