|
@@ -29,12 +29,10 @@ import java.util.Map;
|
|
@RequestMapping("/appPageReport")
|
|
@RequestMapping("/appPageReport")
|
|
@Api(tags = "App总览报表")
|
|
@Api(tags = "App总览报表")
|
|
public class AppPageReportController {
|
|
public class AppPageReportController {
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private AppPageReportService appPageReportService;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private RevenueService revenueService;
|
|
private RevenueService revenueService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private AppPageReportService appPageReportService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Author wangbo
|
|
* @Author wangbo
|
|
@@ -107,22 +105,14 @@ public class AppPageReportController {
|
|
LocalDate now = LocalDate.now();
|
|
LocalDate now = LocalDate.now();
|
|
LocalDate last = now.minusMonths(1);
|
|
LocalDate last = now.minusMonths(1);
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
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());
|
|
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> 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> 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());
|
|
List<DeviceWaterSupply> lastSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, last.getYear(),last.getMonthValue(),1, last.getYear(),last.getMonthValue(),last.getDayOfMonth());
|
|
-
|
|
|
|
map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
-
|
|
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
-
|
|
|
|
List<DeviceWaterSupply> sameSellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,2);
|
|
List<DeviceWaterSupply> sameSellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,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);
|
|
|
|
|
|
+ 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(),2));
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -137,10 +127,8 @@ public class AppPageReportController {
|
|
List<DeviceWaterSupply> sameSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, now.getYear(),1,1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
|
|
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> lastSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, last.getYear(),1,1, last.getYear(),12,31);
|
|
List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,now.getMonthValue()+12);
|
|
List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,now.getMonthValue()+12);
|
|
-
|
|
|
|
BigDecimal sameSellerAmount = new BigDecimal(0);
|
|
BigDecimal sameSellerAmount = new BigDecimal(0);
|
|
BigDecimal lastSellerAmount = new BigDecimal(0);
|
|
BigDecimal lastSellerAmount = new BigDecimal(0);
|
|
-
|
|
|
|
for( int i =0 ;i<sellerWaterList.size(); i++){
|
|
for( int i =0 ;i<sellerWaterList.size(); i++){
|
|
if(i>=12){
|
|
if(i>=12){
|
|
sameSellerAmount = sameSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
sameSellerAmount = sameSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
@@ -149,10 +137,9 @@ public class AppPageReportController {
|
|
lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- 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("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
- map.put("sellerComparison",comparison);
|
|
|
|
|
|
+ map.put("sellerComparison", lastSellerAmount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,2));
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -182,13 +169,56 @@ public class AppPageReportController {
|
|
lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- 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("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
map.put("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
|
|
- map.put("sellerComparison",comparison);
|
|
|
|
|
|
+ map.put("sellerComparison",lastSellerAmount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,2));
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
return new AjaxMessage<>(ResultStatus.OK,map);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @Author wangbo
|
|
|
|
+ * @Description App 营业总览数据-本月应收实收回收率数据
|
|
|
|
+ * @param companyOrgId 公司ID
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "getBusinessDataForSameMonth",method = RequestMethod.GET)
|
|
|
|
+ @ApiOperation(value = "App总览——生产数据(本月)")
|
|
|
|
+ public AjaxMessage<Map<String,Object>> getSameMonthBusinessData(
|
|
|
|
+ @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
|
+ Map<String,Object> map = new HashMap<String,Object>();
|
|
|
|
+ List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerAmountReportForMonth(companyOrgId,1);
|
|
|
|
+ map.put("totalReceivable", sellerWaterList.get(0).getAmount());
|
|
|
|
+ map.put("totalReceived", sellerWaterList.get(0).getAmount2());
|
|
|
|
+ map.put("amount",sellerWaterList);
|
|
|
|
+ map.put("rate", sellerWaterList.get(0).getAmount().compareTo(BigDecimal.ZERO)==0? 0 : sellerWaterList.get(0).getAmount2().multiply(new BigDecimal(100)).divide(sellerWaterList.get(0).getAmount(),2));
|
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @Author wangbo
|
|
|
|
+ * @Description App 营业总览数据-本月应收实收回收率数据
|
|
|
|
+ * @param companyOrgId 公司ID
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "getBusinessDataForSameYear",method = RequestMethod.GET)
|
|
|
|
+ @ApiOperation(value = "App总览——生产数据(本年)")
|
|
|
|
+ public AjaxMessage<Map<String,Object>> getBusinessDataForSameYear(
|
|
|
|
+ @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
|
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
|
+ Map<String,Object> map = new HashMap<String,Object>();
|
|
|
|
+ List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerAmountReportForMonth(companyOrgId,now.getMonthValue());
|
|
|
|
+ BigDecimal totalReceivableAmount = new BigDecimal(0);
|
|
|
|
+ BigDecimal totalReceivedAmount = new BigDecimal(0);
|
|
|
|
+ for(DeviceWaterSupply amount: sellerWaterList){
|
|
|
|
+ totalReceivableAmount.add(amount.getAmount());
|
|
|
|
+ totalReceivedAmount.add(amount.getAmount2());
|
|
|
|
+ }
|
|
|
|
+ map.put("totalReceivable", totalReceivableAmount);
|
|
|
|
+ map.put("totalReceived",totalReceivedAmount);
|
|
|
|
+ map.put("amountDetails",sellerWaterList);
|
|
|
|
+ map.put("rate", sellerWaterList.get(0).getAmount().compareTo(BigDecimal.ZERO)==0? 0 : sellerWaterList.get(0).getAmount2().multiply(new BigDecimal(100)).divide(sellerWaterList.get(0).getAmount(),2));
|
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK,map);
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|