Ver código fonte

App总览-生产数据-本月本年近一年

wangbo 4 anos atrás
pai
commit
1f08c9f6f8

+ 5 - 0
sms_water/src/main/java/com/huaxu/dao/RevenueMapper.java

@@ -41,4 +41,9 @@ public interface RevenueMapper {
      */
     List<MonthRevenueDto> selectCompanyRevenue(MonthRevenueDto monthRevenueDto);
 
+    /**
+     * 查询App总览售水数据
+     */
+    List<MonthRevenueDto> selectOverviewRevenue(MonthRevenueDto monthRevenueDto);
+
 }

+ 7 - 0
sms_water/src/main/java/com/huaxu/service/RevenueService.java

@@ -36,4 +36,11 @@ public interface RevenueService {
      * @return
      */
     List<MonthRevenueDto> selectCompanyRevenue();
+
+
+    /**
+     * 查询App总览售水数据
+     */
+    List<MonthRevenueDto> selectOverviewRevenue(Integer companyOrgId,Integer months);
+
 }

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

@@ -78,7 +78,7 @@ public class AppPageReportServiceImpl implements AppPageReportService {
         BigDecimal AmountCountMonth = null;
         LocalDate localDate = LocalDate.now();
         List<DeviceWaterSupply> deviceWaterSupplies = new ArrayList<DeviceWaterSupply>();
-        List<MonthRevenueDto> sellerWater = revenueService.selectMonthRevenue(companyOrgId,1);
+        List<MonthRevenueDto> sellerWater = revenueService.selectOverviewRevenue(companyOrgId,1);
         if(sellerWater.size()>0){
             AmountCountMonth = new BigDecimal(sellerWater.get(0).getMeterReadingUsage());
         }

+ 16 - 0
sms_water/src/main/java/com/huaxu/service/impl/RevenueServiceImpl.java

@@ -129,4 +129,20 @@ public class RevenueServiceImpl implements RevenueService {
         monthRevenueDto.setPermissonType(loginUser.getPermissonType());
         return revenueMapper.selectCompanyRevenue(monthRevenueDto);
     }
+
+    @Override
+    public List<MonthRevenueDto> selectOverviewRevenue(Integer companyOrgId,Integer months) {
+
+        MonthRevenueDto monthRevenueDto=new MonthRevenueDto();
+        monthRevenueDto.setCompanyOrgId(companyOrgId);
+        monthRevenueDto.setMonths(months);
+
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        monthRevenueDto.setTenantId(loginUser.getTenantId());
+        monthRevenueDto.setProgramItems(loginUser.getProgramItemList());
+        monthRevenueDto.setUserType(loginUser.getType());
+        //1是公司,2是公司及以下,3部门,4部门及以下,5自定义
+        monthRevenueDto.setPermissonType(loginUser.getPermissonType());
+        return revenueMapper.selectOverviewRevenue(monthRevenueDto);
+    }
 }

+ 23 - 0
sms_water/src/main/resources/mapper/RevenueMapper.xml

@@ -97,4 +97,27 @@
         order by company_org_id
     </select>
 
+    <!--App总览-生产-售水量(本月,本年)-->
+    <select id="selectOverviewRevenue" resultType="com.huaxu.dto.MonthRevenueDto">
+        select date_format(t1.collect_date, '%Y-%m' ) collect_date_string,sum(METER_READING_USAGE) meter_reading_usage
+        from sms_month_revenue t1
+        where t1.collect_date>=date_sub(date_format(curdate(), '%y-%m-1' ), interval #{months}-1 month)
+        <if test="tenantId != null and tenantId != ''">
+            and t1.tenant_id=#{tenantId}
+        </if>
+        <if test="companyOrgId != null and companyOrgId !=''">
+            and t1.company_org_id=#{companyOrgId}
+        </if>
+        <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
+            <if test="permissonType == 5 or permissonType == 2 or permissonType == 1">
+                and t1.company_org_id in
+                <foreach collection="programItems" item="item" open="(" close=")" separator=",">
+                    #{item.orgId}
+                </foreach>
+            </if>
+        </if>
+        group by collect_date_string
+        order by collect_date_string
+    </select>
+
 </mapper>