|
@@ -105,7 +105,7 @@ public class AppPageReportController {
|
|
|
@ApiOperation(value = "App总览——生产数据-取水环比(本月)")
|
|
|
public AjaxMessage<Object> getSameMonthComparison(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
LocalDate now = LocalDate.now();
|
|
|
- LocalDate last = now.minusMonths(-1);
|
|
|
+ LocalDate last = now.minusMonths(1);
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
|
|
|
List<DeviceWaterSupply> sameMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, now.getYear(),now.getMonthValue(),1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
|
|
@@ -121,7 +121,7 @@ public class AppPageReportController {
|
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
|
|
|
|
List<DeviceWaterSupply> sameSellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,2);
|
|
|
- BigDecimal comparison = sameSellerWaterList.get(0).getAmount() ==BigDecimal.ZERO ? BigDecimal.ZERO : sameSellerWaterList.get(0).getAmount().multiply(new BigDecimal(100)).divide(sameSellerWaterList.get(1).getAmount(),2);
|
|
|
+ BigDecimal comparison = sameSellerWaterList.get(0).getAmount().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameSellerWaterList.get(0).getAmount().multiply(new BigDecimal(100)).divide(sameSellerWaterList.get(1).getAmount(),2);
|
|
|
map.put("sellerComparison",comparison);
|
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
}
|
|
@@ -130,7 +130,7 @@ public class AppPageReportController {
|
|
|
@ApiOperation(value = "App总览——生产数据-取水环比、供水环比、售水环比(本年)")
|
|
|
public AjaxMessage<Object> getWaterIntakeComparison(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
LocalDate now = LocalDate.now();
|
|
|
- LocalDate last = now.minusYears(-1);
|
|
|
+ LocalDate last = now.minusYears(1);
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
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);
|
|
@@ -142,14 +142,14 @@ public class AppPageReportController {
|
|
|
BigDecimal lastSellerAmount = new BigDecimal(0);
|
|
|
|
|
|
for( int i =0 ;i<sellerWaterList.size(); i++){
|
|
|
- if(i<now.getMonthValue()){
|
|
|
+ if(i>=12){
|
|
|
sameSellerAmount = sameSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
|
}
|
|
|
else{
|
|
|
lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
|
}
|
|
|
}
|
|
|
- BigDecimal comparison = lastSellerAmount ==BigDecimal.ZERO ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,2);
|
|
|
+ BigDecimal comparison = lastSellerAmount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,2);
|
|
|
map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
|
map.put("sellerComparison",comparison);
|
|
@@ -160,11 +160,14 @@ public class AppPageReportController {
|
|
|
@ApiOperation(value = "App总览——生产数据-取水环比、供水环比、售水环比(近一年)")
|
|
|
public AjaxMessage<Object> getLast12YearComparison(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
LocalDate now = LocalDate.now();
|
|
|
- LocalDate last = now.minusYears(-1);
|
|
|
+ LocalDate last = now.minusMonths(11);
|
|
|
+
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
- 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> 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,now.getMonthValue()+12);
|
|
|
|
|
@@ -179,7 +182,7 @@ public class AppPageReportController {
|
|
|
lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
|
}
|
|
|
}
|
|
|
- BigDecimal comparison = lastSellerAmount ==BigDecimal.ZERO ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,2);
|
|
|
+ BigDecimal comparison = lastSellerAmount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,2);
|
|
|
map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
|
map.put("sellerComparison",comparison);
|