|
@@ -9,6 +9,7 @@ import com.huaxu.model.AjaxMessage;
|
|
|
import com.huaxu.model.LoginUser;
|
|
|
import com.huaxu.model.ResultStatus;
|
|
|
import com.huaxu.service.AppPageReportService;
|
|
|
+import com.huaxu.service.HomePageReportService;
|
|
|
import com.huaxu.service.MonitorDataReportService;
|
|
|
import com.huaxu.service.RevenueService;
|
|
|
import com.huaxu.util.UserUtil;
|
|
@@ -31,60 +32,42 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class AppPageReportServiceImpl implements AppPageReportService {
|
|
|
|
|
|
- @Resource
|
|
|
- private HomePageReportMapper homePageReportMapper;
|
|
|
-
|
|
|
-
|
|
|
- @Resource
|
|
|
- private MonitorDataReportMapper monitorDataReportMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private UserCenterClient userCenterClient;
|
|
|
-
|
|
|
@Autowired
|
|
|
- private com.huaxu.service.MonitorDataReportService MonitorDataReportService;
|
|
|
-
|
|
|
+ private HomePageReportService homePageReportService;
|
|
|
|
|
|
@Autowired
|
|
|
private RevenueService revenueService;
|
|
|
|
|
|
/**
|
|
|
- * App 总览 本月制水量
|
|
|
- *
|
|
|
+ * App 总览 前N个月的取水量、制水量
|
|
|
* @param companyOrgId
|
|
|
* @param sceneType
|
|
|
* @param parmType
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<DeviceWaterSupply> deviceWaterReportForSameMonth(Integer companyOrgId, String sceneType, Integer parmType) {
|
|
|
- LocalDate localDate = LocalDate.now();
|
|
|
- List<DeviceWaterSupply> deviceWaterSupplies = new ArrayList<DeviceWaterSupply>();
|
|
|
- BigDecimal AmountCountMonth = MonitorDataReportService.getAmountCount(companyOrgId, null, sceneType, parmType, 2);
|
|
|
- DeviceWaterSupply deviceWaterSupplyMonth = new DeviceWaterSupply();
|
|
|
- deviceWaterSupplyMonth.setOrderNo(1);
|
|
|
- deviceWaterSupplyMonth.setAmount(AmountCountMonth != null ? AmountCountMonth.divide(new BigDecimal("10000")) : BigDecimal.ZERO);
|
|
|
- deviceWaterSupplyMonth.setYear(localDate.getYear());
|
|
|
- deviceWaterSupplyMonth.setMonth(localDate.getMonthValue());
|
|
|
- deviceWaterSupplyMonth.setDate(localDate);
|
|
|
- deviceWaterSupplyMonth.setDateLabel(localDate.getYear() + "-" + localDate.getMonthValue());
|
|
|
- deviceWaterSupplies.add(0, deviceWaterSupplyMonth);
|
|
|
- deviceWaterSupplies.sort(Comparator.comparing(DeviceWaterSupply::getOrderNo).reversed());
|
|
|
+ public List<DeviceWaterSupply> deviceWaterReportForMonth(Integer companyOrgId, String sceneType, Integer parmType, Integer month) {
|
|
|
+ List<DeviceWaterSupply> deviceWaterSupplies = homePageReportService.deviceWaterReportForMonth(companyOrgId,sceneType,parmType,month);
|
|
|
return deviceWaterSupplies;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * App 总览 前N个月的售水量
|
|
|
+ * @param companyOrgId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
- public List<DeviceWaterSupply> deviceSellerWaterReportForSameMonth(Integer companyOrgId) {
|
|
|
+ public List<DeviceWaterSupply> deviceSellerWaterReportForMonth(Integer companyOrgId,Integer month) {
|
|
|
BigDecimal AmountCountMonth = null;
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
List<DeviceWaterSupply> deviceWaterSupplies = new ArrayList<DeviceWaterSupply>();
|
|
|
- List<MonthRevenueDto> sellerWater = revenueService.selectOverviewRevenue(companyOrgId,1);
|
|
|
- if(sellerWater.size()>0){
|
|
|
+ List<MonthRevenueDto> sellerWater = revenueService.selectOverviewRevenue(companyOrgId,month);
|
|
|
+ if(sellerWater.size()>0 && sellerWater.get(0).getMeterReadingUsage() != null){
|
|
|
AmountCountMonth = new BigDecimal(sellerWater.get(0).getMeterReadingUsage());
|
|
|
}
|
|
|
DeviceWaterSupply deviceWaterSupplyMonth = new DeviceWaterSupply();
|
|
|
deviceWaterSupplyMonth.setOrderNo(1);
|
|
|
- deviceWaterSupplyMonth.setAmount(AmountCountMonth != null ? AmountCountMonth.divide(new BigDecimal("10000")) : BigDecimal.ZERO);
|
|
|
+ deviceWaterSupplyMonth.setAmount(AmountCountMonth != null ? AmountCountMonth : BigDecimal.ZERO);
|
|
|
deviceWaterSupplyMonth.setYear(localDate.getYear());
|
|
|
deviceWaterSupplyMonth.setMonth(localDate.getMonthValue());
|
|
|
deviceWaterSupplyMonth.setDate(localDate);
|