|
@@ -1,8 +1,23 @@
|
|
|
package com.huaxu.service.impl;
|
|
|
|
|
|
+import com.huaxu.client.UserCenterClient;
|
|
|
+import com.huaxu.dao.HomePageReportMapper;
|
|
|
+import com.huaxu.dao.MonitorDataReportMapper;
|
|
|
+import com.huaxu.dto.generalView.DeviceWaterSupply;
|
|
|
+import com.huaxu.model.LoginUser;
|
|
|
import com.huaxu.service.AppPageReportService;
|
|
|
+import com.huaxu.service.MonitorDataReportService;
|
|
|
+import com.huaxu.util.UserUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @description
|
|
@@ -12,6 +27,48 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class AppPageReportServiceImpl implements AppPageReportService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private HomePageReportMapper homePageReportMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserCenterClient userCenterClient;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MonitorDataReportMapper monitorDataReportMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private com.huaxu.service.MonitorDataReportService MonitorDataReportService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * App 总览 本月制水量
|
|
|
+ * @param companyOrgId
|
|
|
+ * @param sceneType
|
|
|
+ * @param parmType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<DeviceWaterSupply> deviceWaterReportForSameMonth(Integer companyOrgId, String sceneType, Integer parmType) {
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ String tenantId = loginUser.getTenantId();
|
|
|
+ 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());
|
|
|
+ return deviceWaterSupplies;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|