Pārlūkot izejas kodu

App总览-生产数据-本月

wangbo 4 gadi atpakaļ
vecāks
revīzija
245be95ab4

+ 18 - 13
sms_water/src/main/java/com/huaxu/controller/AppPageReportController.java

@@ -1,11 +1,13 @@
 package com.huaxu.controller;
 
 
+import com.huaxu.dto.MonthRevenueDto;
 import com.huaxu.dto.generalView.DeviceWaterSupply;
 import com.huaxu.model.AjaxMessage;
 import com.huaxu.model.ResultStatus;
 import com.huaxu.service.AppPageReportService;
 import com.huaxu.service.HomePageReportService;
+import com.huaxu.service.RevenueService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -30,20 +33,22 @@ public class AppPageReportController {
     @Autowired
     private AppPageReportService appPageReportService;
 
-    @RequestMapping(value = "getDeviceWaterIntake",method = RequestMethod.GET)
-    @ApiOperation(value = "App总览——取水图表(本月)")
-    public AjaxMessage<List<DeviceWaterSupply>> getDeviceWaterIntake(
+    @Autowired
+    private RevenueService revenueService;
+
+    /**
+     * 生产总览数据
+     * @param companyOrgId
+     * @return
+     */
+    @RequestMapping(value = "getProductionDataForSameMonth",method = RequestMethod.GET)
+    @ApiOperation(value = "App总览——生产数据(本月)")
+    public AjaxMessage<List<DeviceWaterSupply>> getProductionDataForSameMonth(
             @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
+        List<DeviceWaterSupply>  result = new ArrayList<DeviceWaterSupply>();
+        result.addAll(appPageReportService.deviceWaterReportForSameMonth(companyOrgId,"水源",4));
+        result.addAll(appPageReportService.deviceWaterReportForSameMonth(companyOrgId,"水厂",3));
+        result.addAll(appPageReportService.deviceSellerWaterReportForSameMonth(companyOrgId));
         return new AjaxMessage<>(ResultStatus.OK,appPageReportService.deviceWaterReportForSameMonth(companyOrgId,"水源",4));
     }
-
-    @RequestMapping(value = "getDeviceWaterMaking",method = RequestMethod.GET)
-    @ApiOperation(value = "App总览——制水图表(本月)")
-    public AjaxMessage<List<DeviceWaterSupply>> getDeviceWaterMaking(
-            @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId
-    ){
-        return new AjaxMessage<>(ResultStatus.OK,appPageReportService.deviceWaterReportForSameMonth(companyOrgId,"水厂",3));
-    }
-
-
 }

+ 2 - 0
sms_water/src/main/java/com/huaxu/service/AppPageReportService.java

@@ -7,4 +7,6 @@ import java.util.List;
 public interface AppPageReportService {
 
     List<DeviceWaterSupply> deviceWaterReportForSameMonth(Integer companyOrgId, String sceneType, Integer parmType);
+
+    List<DeviceWaterSupply> deviceSellerWaterReportForSameMonth(Integer companyOrgId);
 }

+ 33 - 9
sms_water/src/main/java/com/huaxu/service/impl/AppPageReportServiceImpl.java

@@ -3,10 +3,14 @@ package com.huaxu.service.impl;
 import com.huaxu.client.UserCenterClient;
 import com.huaxu.dao.HomePageReportMapper;
 import com.huaxu.dao.MonitorDataReportMapper;
+import com.huaxu.dto.MonthRevenueDto;
 import com.huaxu.dto.generalView.DeviceWaterSupply;
+import com.huaxu.model.AjaxMessage;
 import com.huaxu.model.LoginUser;
+import com.huaxu.model.ResultStatus;
 import com.huaxu.service.AppPageReportService;
 import com.huaxu.service.MonitorDataReportService;
+import com.huaxu.service.RevenueService;
 import com.huaxu.util.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -30,17 +34,23 @@ public class AppPageReportServiceImpl implements AppPageReportService {
     @Resource
     private HomePageReportMapper homePageReportMapper;
 
-    @Autowired
-    private UserCenterClient userCenterClient;
 
     @Resource
     private MonitorDataReportMapper monitorDataReportMapper;
 
+    @Autowired
+    private UserCenterClient userCenterClient;
+
     @Autowired
     private com.huaxu.service.MonitorDataReportService MonitorDataReportService;
 
+
+    @Autowired
+    private RevenueService revenueService;
+
     /**
      * App 总览 本月制水量
+     *
      * @param companyOrgId
      * @param sceneType
      * @param parmType
@@ -50,20 +60,34 @@ public class AppPageReportServiceImpl implements AppPageReportService {
     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 );
+        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.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());
+        deviceWaterSupplyMonth.setDateLabel(localDate.getYear() + "-" + localDate.getMonthValue());
         deviceWaterSupplies.add(0, deviceWaterSupplyMonth);
         deviceWaterSupplies.sort(Comparator.comparing(DeviceWaterSupply::getOrderNo).reversed());
         return deviceWaterSupplies;
     }
 
-
-
-
-}
+    @Override
+    public List<DeviceWaterSupply> deviceSellerWaterReportForSameMonth(Integer companyOrgId) {
+        LocalDate localDate = LocalDate.now();
+        List<DeviceWaterSupply> deviceWaterSupplies = new ArrayList<DeviceWaterSupply>();
+        List<MonthRevenueDto> result = revenueService.selectMonthRevenue(companyOrgId, localDate.getMonthValue());
+        BigDecimal AmountCountMonth = new BigDecimal(result.get(0).getMeterReadingUsage());
+        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());
+        return deviceWaterSupplies;
+    }
+}