Forráskód Böngészése

Merge remote-tracking branch 'origin/20210223' into 20210223

wangyangyang 4 éve
szülő
commit
096773a499
19 módosított fájl, 367 hozzáadás és 93 törlés
  1. 2 1
      sms_water/src/main/java/com/huaxu/client/UserCenterClient.java
  2. 29 0
      sms_water/src/main/java/com/huaxu/common/converter/Double2Serializer.java
  3. 85 28
      sms_water/src/main/java/com/huaxu/controller/AppPageReportController.java
  4. 37 13
      sms_water/src/main/java/com/huaxu/controller/AppReportMonitorController.java
  5. 15 0
      sms_water/src/main/java/com/huaxu/controller/OnlineMonitorController.java
  6. 1 1
      sms_water/src/main/java/com/huaxu/dao/HomePageReportMapper.java
  7. 8 0
      sms_water/src/main/java/com/huaxu/dto/DeviceCountStatsDto.java
  8. 3 0
      sms_water/src/main/java/com/huaxu/dto/generalView/DeviceWaterSupply.java
  9. 1 1
      sms_water/src/main/java/com/huaxu/dto/generalView/WaterSupplyChart.java
  10. 3 5
      sms_water/src/main/java/com/huaxu/service/AppPageReportService.java
  11. 4 0
      sms_water/src/main/java/com/huaxu/service/AppReportMonitorService.java
  12. 36 32
      sms_water/src/main/java/com/huaxu/service/impl/AppPageReportServiceImpl.java
  13. 125 2
      sms_water/src/main/java/com/huaxu/service/impl/AppReportMonitorServiceImpl.java
  14. 1 0
      sms_water/src/main/resources/mapper/AppReportMonitorMapper.xml
  15. 2 2
      sms_water/src/main/resources/mapper/HomePageReportMapper.xml
  16. 9 4
      sms_water/src/main/resources/mapper/RevenueMapper.xml
  17. 1 1
      user_center/src/main/java/com/huaxu/controller/OrgController.java
  18. 1 1
      user_center/src/main/resources/mapper/OrgMapper.xml
  19. 4 2
      user_center/src/main/resources/mapper/TenantMapper.xml

+ 2 - 1
sms_water/src/main/java/com/huaxu/client/UserCenterClient.java

@@ -7,6 +7,7 @@ import com.huaxu.entity.Org;
 import com.huaxu.model.AjaxMessage;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
@@ -36,5 +37,5 @@ public interface UserCenterClient {
     Integer countCompanyByUser();
 
     @PostMapping(value = "/org/getCompanyByUser")
-    List<OrgBaseTreeInfoDto> getCompanyByUser(@RequestParam("condition") String condition,@RequestParam("companyIds") List<Integer> companyIds);
+    List<OrgBaseTreeInfoDto> getCompanyByUser(@RequestParam(value = "condition" ,required =  false) String condition,@RequestBody List<Integer> companyIds);
 }

+ 29 - 0
sms_water/src/main/java/com/huaxu/common/converter/Double2Serializer.java

@@ -0,0 +1,29 @@
+package com.huaxu.common.converter;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+import java.io.IOException;
+import java.text.DecimalFormat;
+
+public class Double2Serializer extends JsonSerializer<Double> {
+
+    private DecimalFormat df = new DecimalFormat("0.##");
+
+    /**
+     * 小数保留3位返回给前端序列化器
+     * @param data
+     * @param jsonGenerator
+     * @param serializerProvider
+     * @throws IOException
+     */
+    @Override
+    public void serialize(Double data, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
+            throws IOException {
+        if (data != null) {
+            jsonGenerator.writeNumber(df.format(data));
+        }
+    }
+
+}

+ 85 - 28
sms_water/src/main/java/com/huaxu/controller/AppPageReportController.java

@@ -29,12 +29,10 @@ import java.util.Map;
 @RequestMapping("/appPageReport")
 @Api(tags = "App总览报表")
 public class AppPageReportController {
-
-    @Autowired
-    private AppPageReportService appPageReportService;
-
     @Autowired
     private RevenueService revenueService;
+    @Autowired
+    private AppPageReportService appPageReportService;
 
     /**
      * @Author wangbo
@@ -105,24 +103,16 @@ public class AppPageReportController {
     @ApiOperation(value = "App总览——生产数据-取水环比(本月)")
     public AjaxMessage<Object> getSameMonthComparison(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
         LocalDate now = LocalDate.now();
-        LocalDate last = now.minusMonths(-1);
+        LocalDate last = now.minusMonths(1);
         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> 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> 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("makingComparison",appPageReportService.CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
-
         List<DeviceWaterSupply> sameSellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,2);
-        BigDecimal comparison = sameSellerWaterList.get(0).getAmount() ==BigDecimal.ZERO ? 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);
     }
 
@@ -130,41 +120,41 @@ public class AppPageReportController {
     @ApiOperation(value = "App总览——生产数据-取水环比、供水环比、售水环比(本年)")
     public AjaxMessage<Object> getWaterIntakeComparison(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
         LocalDate now = LocalDate.now();
-        LocalDate last = now.minusYears(-1);
+        LocalDate last = now.minusYears(1);
         Map<String,Object> map = new HashMap<String,Object>();
         List<DeviceWaterSupply> sameMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, now.getYear(),1,1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
         List<DeviceWaterSupply> lastMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, last.getYear(),1,1, last.getYear(),12,31);
         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> sellerWaterList = appPageReportService.deviceSellerWaterReportForMonth(companyOrgId,now.getMonthValue()+12);
-
         BigDecimal sameSellerAmount = new BigDecimal(0);
         BigDecimal lastSellerAmount = new BigDecimal(0);
-
         for( int i =0 ;i<sellerWaterList.size(); i++){
-            if(i<now.getMonthValue()){
+            if(i>=12){
                 sameSellerAmount = sameSellerAmount.add(sellerWaterList.get(i).getAmount());
             }
             else{
                 lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
             }
         }
-        BigDecimal comparison = lastSellerAmount ==BigDecimal.ZERO ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,2);
         map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
         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);
     }
 
-    @RequestMapping(value = "getLast12YearComparison",method = RequestMethod.GET)
+    @RequestMapping(value = "getComparisonForLast12Month",method = RequestMethod.GET)
     @ApiOperation(value = "App总览——生产数据-取水环比、供水环比、售水环比(近一年)")
-    public AjaxMessage<Object> getLast12YearComparison(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
+    public AjaxMessage<Object> getComparisonForLast12Month(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
         LocalDate now = LocalDate.now();
-        LocalDate last = now.minusYears(-1);
+        LocalDate last = now.minusMonths(11);
+
         Map<String,Object> map = new HashMap<String,Object>();
-        List<DeviceWaterSupply> sameMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, now.getYear(),1,1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
-        List<DeviceWaterSupply> lastMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, last.getYear(),1,1, last.getYear(),12,31);
-        List<DeviceWaterSupply> sameSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, now.getYear(),1,1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
+        List<DeviceWaterSupply> sameMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, last.getYear(),last.getMonthValue(),last.getDayOfMonth(), now.getYear(),now.getMonthValue(),now.getDayOfMonth());
+        List<DeviceWaterSupply> sameSupplyWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水厂",3, last.getYear(),last.getMonthValue(),last.getDayOfMonth(),now.getYear(),now.getMonthValue(),now.getDayOfMonth());
+        LocalDate last2 = last.minusDays(1);
+        LocalDate last3 = last2.minusMonths(11);
+        List<DeviceWaterSupply> lastMakingWaterList = appPageReportService.deviceWaterReportForDay(companyOrgId,"水源",4, last3.getYear(),last2.getMonthValue(),last2.getDayOfMonth(), 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);
 
@@ -179,13 +169,80 @@ public class AppPageReportController {
                 lastSellerAmount = lastSellerAmount.add(sellerWaterList.get(i).getAmount());
             }
         }
-        BigDecimal comparison = lastSellerAmount ==BigDecimal.ZERO ? BigDecimal.ZERO : sameSellerAmount.multiply(new BigDecimal(100)).divide(lastSellerAmount,2);
         map.put("intakeComparison",appPageReportService.CalculationComparison(sameMakingWaterList,lastMakingWaterList));
         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);
     }
 
+    /**
+     * @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);
+    }
+
+    /**
+     * @Author wangbo
+     * @Description App 营业总览数据-近一年应收实收回收率数据
+     * @param companyOrgId 公司ID
+     * @return
+     */
+    @RequestMapping(value = "getBusinessDataForLast12Month",method = RequestMethod.GET)
+    @ApiOperation(value = "App总览——营业总览应收实收回收率数据(近一年)")
+    public AjaxMessage<Map<String,Object>> getBusinessDataForLast12Month(
+            @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
+        Map<String,Object> map = new HashMap<String,Object>();
+        List<DeviceWaterSupply> sellerWaterList = appPageReportService.deviceSellerAmountReportForMonth(companyOrgId,12);
+        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);
+    }
 
 }

+ 37 - 13
sms_water/src/main/java/com/huaxu/controller/AppReportMonitorController.java

@@ -3,7 +3,9 @@ package com.huaxu.controller;
 import com.huaxu.client.UserCenterClient;
 import com.huaxu.dto.CompanySceneInfoDto;
 import com.huaxu.dto.OrgBaseTreeInfoDto;
+import com.huaxu.dto.generalView.WaterSupplyChart;
 import com.huaxu.dto.homePage.WaterQualityRate;
+import com.huaxu.dto.homePage.WaterQualityRateForScene;
 import com.huaxu.entity.SceneEntity;
 import com.huaxu.model.AjaxMessage;
 import com.huaxu.model.ResultStatus;
@@ -49,32 +51,54 @@ public class AppReportMonitorController {
     @ApiOperation(value = "App报表展示————公司查询(条件查询)")
     public AjaxMessage<CompanySceneInfoDto> getSceneByCompanyBySearch(
             @ApiParam(value = "场景类型名称:水源、水厂、泵站、管网") @RequestParam String sceneTypeName,
-            @ApiParam(value = "查询条件") @RequestParam String condition){
+            @ApiParam(value = "查询条件") @RequestParam(required = false) String condition){
         return new AjaxMessage<>(ResultStatus.OK,appReportMonitorService.getSceneByCompanyBySearch(sceneTypeName,condition));
     }
 
 
-
-
-
-
-
-
-
-
     @RequestMapping(value = "getWaterQualification",method = RequestMethod.GET)
-    @ApiOperation(value = "综合展示——水质安全")
-    public AjaxMessage<WaterQualityRate> getWaterQualification(
-            @ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Integer companyOrgId){
-        return new AjaxMessage<>(ResultStatus.OK,homePageReportService.getWaterQualification(companyOrgId));
+    @ApiOperation(value = "App报表展示——综合水质情况")
+    public AjaxMessage<WaterQualityRate> getWaterQualification(){
+        return new AjaxMessage<>(ResultStatus.OK,homePageReportService.getWaterQualification(null));
     }
 
 
+    @RequestMapping(value = "getWaterQualityRateForWaterSource",method = RequestMethod.GET)
+    @ApiOperation(value = "App报表展示——水库本月水质合格率")
+    public AjaxMessage<WaterQualityRateForScene> waterQualityRateForWaterSource(
+            @ApiParam(value = "水库id",required = true) @RequestParam Integer sceneId){
+        return new AjaxMessage<>(ResultStatus.OK,homePageReportService.waterQualityRateForWaterSource(sceneId));
+    }
 
+    @RequestMapping(value = "waterQualityRateForWaterFactory",method = RequestMethod.GET)
+    @ApiOperation(value = "App报表展示——水厂本月水质合格率")
+    public AjaxMessage<WaterQualityRateForScene> waterQualityRateForWaterFactory(
+            @ApiParam(value = "水厂id",required = true) @RequestParam Integer sceneId){
+        return new AjaxMessage<>(ResultStatus.OK,homePageReportService.waterQualityRateForWaterFactory(sceneId));
+    }
 
+    @RequestMapping(value = "waterQualityRateForPumpingStation",method = RequestMethod.GET)
+    @ApiOperation(value = "App报表展示——泵站本月水质合格率")
+    public AjaxMessage<WaterQualityRateForScene> waterQualityRateForPumpingStation(
+            @ApiParam(value = "泵站id",required = true) @RequestParam Integer sceneId){
+        return new AjaxMessage<>(ResultStatus.OK,homePageReportService.waterQualityRateForPumpingStation(sceneId));
+    }
 
 
+    @RequestMapping(value = "waterEnergyConsumption",method = RequestMethod.GET)
+    @ApiOperation(value = "App报表展示——水源本月取水情况")
+    public AjaxMessage<List<WaterSupplyChart>> waterEnergyConsumption(
+            @ApiParam(value = "泵站id",required = true) @RequestParam Integer sceneId){
+        return new AjaxMessage<>(ResultStatus.OK,appReportMonitorService.waterEnergyConsumption(sceneId));
+    }
+
 
+    @RequestMapping(value = "getWaterLevelForWaterSource",method = RequestMethod.GET)
+    @ApiOperation(value = "App报表展示——水源本月水位变化")
+    public AjaxMessage<List<WaterSupplyChart>> getWaterLevelForWaterSource(
+            @ApiParam(value = "泵站id",required = true) @RequestParam Integer sceneId){
+        return new AjaxMessage<>(ResultStatus.OK,appReportMonitorService.getWaterLevelForWaterSource(sceneId));
+    }
 
 
 

+ 15 - 0
sms_water/src/main/java/com/huaxu/controller/OnlineMonitorController.java

@@ -252,6 +252,21 @@ public class OnlineMonitorController {
         onlineDataDto.setFlag(1);
         onlineDataDto.setSceneIds(sceneService.findByParentIdsLike(null));
         List<DeviceCountStatsDto> result=onlineMonitorService.statsDeviceQualified(onlineDataDto);
+        for(DeviceCountStatsDto item : result){
+            if(item.getType().equals("流量"))
+                continue;
+            onlineDataDto.setFlag(null);
+            onlineDataDto.setSceneTypeName(item.getType());
+            List<DeviceCountStatsDto> itemResult=onlineMonitorService.statsDeviceQualified(onlineDataDto);
+            if(itemResult.size()>0){
+                if(item.getType().equals("压力")){
+                    DeviceCountStatsDto pressQualified=itemResult.get(0).getParmQualified().size()>0?itemResult.get(0).getParmQualified().get(0):null;
+                    item.setQualifiedRate(pressQualified==null?100:(double)pressQualified.getNormalCount()/itemResult.get(0).getTotalCount()*100);
+                }else if(item.getType().equals("水质")){
+                    item.setQualifiedRate((double)itemResult.get(0).getNormalCount()/itemResult.get(0).getTotalCount()*100);
+                }
+            }
+        }
         return new AjaxMessage<>(ResultStatus.OK, result);
     }
 

+ 1 - 1
sms_water/src/main/java/com/huaxu/dao/HomePageReportMapper.java

@@ -36,7 +36,7 @@ public interface HomePageReportMapper {
                                                       @Param("month")Integer month);
 
 
-    List<DeviceWaterSupply> deviceWaterReportForDay(@Param("companyOrgId")Integer companyOrgId,
+    List<DeviceWaterSupply> getDeviceWaterForDay(@Param("companyOrgId")Integer companyOrgId,
                                                  @Param("sceneType")String sceneType, @Param("parmType")Integer parmType,
                                                  @Param("tenantId")String tenantId, @Param("userType")String userType,
                                                  @Param("permissonType")Integer permissonType,

+ 8 - 0
sms_water/src/main/java/com/huaxu/dto/DeviceCountStatsDto.java

@@ -1,5 +1,7 @@
 package com.huaxu.dto;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.huaxu.common.converter.Double2Serializer;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -35,6 +37,12 @@ public class DeviceCountStatsDto {
      */
     @ApiModelProperty(value = "离线设备数量")
     private Integer offlineCount;
+    /**
+     * 合格率
+     */
+    @JsonSerialize(using = Double2Serializer.class)
+    @ApiModelProperty(value = "合格率")
+    private Double qualifiedRate;
     /**
      * 设备属性合格数据
      */

+ 3 - 0
sms_water/src/main/java/com/huaxu/dto/generalView/DeviceWaterSupply.java

@@ -31,6 +31,9 @@ public class DeviceWaterSupply implements Serializable {
     @ApiModelProperty("量")
     @JsonSerialize(using = BigDecimalJsonSerializer.class)
     private BigDecimal amount = BigDecimal.ZERO;
+    @ApiModelProperty("量2")
+    @JsonSerialize(using = BigDecimalJsonSerializer.class)
+    private BigDecimal amount2 = BigDecimal.ZERO;
     @ApiModelProperty("日期")
     private LocalDate date;
     @ApiModelProperty("日期格式化")

+ 1 - 1
sms_water/src/main/java/com/huaxu/dto/generalView/WaterSupplyChart.java

@@ -26,7 +26,7 @@ public class WaterSupplyChart implements Serializable {
     private Integer sort;
     @ApiModelProperty("日期")
     private String date;
-    @ApiModelProperty("制水量")
+    @ApiModelProperty("制水量/取水量")
     @JsonSerialize(using = BigDecimalJsonSerializer.class)
     private BigDecimal waterData = BigDecimal.ZERO;
     @ApiModelProperty("电耗")

+ 3 - 5
sms_water/src/main/java/com/huaxu/service/AppPageReportService.java

@@ -1,10 +1,8 @@
 package com.huaxu.service;
 
-import com.huaxu.dto.MonthRevenueDto;
 import com.huaxu.dto.generalView.DeviceWaterSupply;
 
 import java.math.BigDecimal;
-import java.time.LocalDate;
 import java.util.List;
 import java.util.Map;
 
@@ -13,6 +11,9 @@ public interface AppPageReportService {
     //App数据总览-生产数据-前N个月的售水量
     List<DeviceWaterSupply> deviceSellerWaterReportForMonth(Integer companyOrgId,Integer month);
 
+    //App数据总览-营收数据-前N个月的营收金额
+    List<DeviceWaterSupply> deviceSellerAmountReportForMonth(Integer companyOrgId,Integer month);
+
     //App数据总览-生产数据-前N个月的去取水量(水源:4)
     //前N个月的去制水量(水厂:3)
     List<DeviceWaterSupply> deviceWaterReportForMonth(Integer companyOrgId,String sceneType, Integer parmType,Integer month);
@@ -20,9 +21,6 @@ public interface AppPageReportService {
     //App数据总览-生产数据-环比-查询时间段内的取水量供水量
     List<DeviceWaterSupply> deviceWaterReportForDay(Integer companyOrgId, String sceneType, Integer parmType, Integer startYear, Integer startMonth, Integer startDay, Integer endYear, Integer endMonth, Integer endDay) ;
 
-    //App数据总览-生产数据-环比
-    //Map<String,Object> getComparison(Integer companyOrgId, LocalDate now, LocalDate last);
-
     BigDecimal CalculationComparison(List<DeviceWaterSupply> sameWaterList, List<DeviceWaterSupply> lastWaterList);
 
     void CalculationNrw(List<DeviceWaterSupply> supplyWaterList, List<DeviceWaterSupply> makingWaterList,List<DeviceWaterSupply> sellerWaterList,Map<String,Object> map);

+ 4 - 0
sms_water/src/main/java/com/huaxu/service/AppReportMonitorService.java

@@ -1,6 +1,8 @@
 package com.huaxu.service;
 
 import com.huaxu.dto.CompanySceneInfoDto;
+import com.huaxu.dto.generalView.WaterSupplyChart;
+import com.huaxu.dto.homePage.WaterQualityRate;
 import com.huaxu.entity.SceneEntity;
 
 import java.util.List;
@@ -22,7 +24,9 @@ public interface AppReportMonitorService {
 
     CompanySceneInfoDto getSceneByCompanyBySearch(String sceneTypeName, String condition);
 
+    List<WaterSupplyChart> waterEnergyConsumption(Integer sceneId );
 
+    List<WaterSupplyChart> getWaterLevelForWaterSource(Integer sceneId );
 
 
 }

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

@@ -3,7 +3,6 @@ package com.huaxu.service.impl;
 
 import com.huaxu.dao.HomePageReportMapper;
 
-import com.huaxu.dao.RevenueMapper;
 import com.huaxu.dto.MonthRevenueDto;
 import com.huaxu.dto.generalView.DeviceWaterSupply;
 import com.huaxu.model.LoginUser;
@@ -38,9 +37,6 @@ public class AppPageReportServiceImpl implements AppPageReportService {
     @Resource
     private HomePageReportMapper homePageReportMapper;
 
-//    @Resource
-//    private RevenueMapper revenueMapper;
-
     /**
      * App 总览 前N个月的售水量
      * @param companyOrgId
@@ -72,7 +68,6 @@ public class AppPageReportServiceImpl implements AppPageReportService {
         return deviceWaterSupplies;
     }
 
-
     /**
      * App 总览 前N个月的取水量、制水量
      * @param companyOrgId
@@ -85,11 +80,8 @@ public class AppPageReportServiceImpl implements AppPageReportService {
         LoginUser loginUser = UserUtil.getCurrentUser();
         String tenantId = loginUser.getTenantId();
         LocalDate localDate = LocalDate.now();
-
         List<DeviceWaterSupply> deviceWaterSupplies = homePageReportMapper.getDeviceWaterForMonth(companyOrgId,sceneType,parmType ,tenantId,loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),month);
-
         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);
@@ -104,7 +96,6 @@ public class AppPageReportServiceImpl implements AppPageReportService {
             if (i == deviceWaterSupplies.size()
                     || newLocalDate.getMonthValue() != deviceWaterSupplies.get(i).getMonth().intValue()
                     || newLocalDate.getYear() != deviceWaterSupplies.get(i).getYear().intValue()) {
-
                 DeviceWaterSupply deviceWaterSupply = new DeviceWaterSupply();
                 deviceWaterSupply.setOrderNo(i + 1);
                 deviceWaterSupply.setAmount(BigDecimal.ZERO);
@@ -128,7 +119,7 @@ public class AppPageReportServiceImpl implements AppPageReportService {
     public List<DeviceWaterSupply> deviceWaterReportForDay(Integer companyOrgId, String sceneType, Integer parmType, Integer startYear, Integer startMonth, Integer startDay, Integer endYear, Integer endMonth, Integer endDay) {
         LoginUser loginUser = UserUtil.getCurrentUser();
         String tenantId = loginUser.getTenantId();
-        List<DeviceWaterSupply> deviceWaterSupplyList = homePageReportMapper.deviceWaterReportForDay(companyOrgId,
+        List<DeviceWaterSupply> deviceWaterSupplyList = homePageReportMapper.getDeviceWaterForDay(companyOrgId,
                 sceneType,parmType ,
                 tenantId,loginUser.getType(),
                 loginUser.getPermissonType(),
@@ -142,26 +133,6 @@ public class AppPageReportServiceImpl implements AppPageReportService {
         return deviceWaterSupplyList;
     }
 
-//    @Override
-//    public Map<String, Object> getComparison(Integer companyOrgId,LocalDate now, LocalDate last) {
-//
-//        Map<String,Object> map = new HashMap<>();
-//        List<DeviceWaterSupply> sameMakingWaterList = deviceWaterReportForDay(companyOrgId,"水源",4, now.getYear(),now.getMonthValue(),1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
-//
-//        List<DeviceWaterSupply> lastMakingWaterList = deviceWaterReportForDay(companyOrgId,"水源",4, last.getYear(),last.getMonthValue(),1, last.getYear(),last.getMonthValue(),last.getDayOfMonth());
-//
-//        List<DeviceWaterSupply> sameSupplyWaterList = deviceWaterReportForDay(companyOrgId,"水厂",3, now.getYear(),now.getMonthValue(),1, now.getYear(),now.getMonthValue(),now.getDayOfMonth());
-//
-//        List<DeviceWaterSupply> lastSupplyWaterList = deviceWaterReportForDay(companyOrgId,"水厂",3, last.getYear(),last.getMonthValue(),1, last.getYear(),last.getMonthValue(),last.getDayOfMonth());
-//
-//        map.put("intakeComparison",CalculationComparison(sameMakingWaterList,lastMakingWaterList));
-//
-//        map.put("makingComparison",CalculationComparison(sameSupplyWaterList,lastSupplyWaterList));
-//
-//
-//        return map;
-//    }
-
     /**
      * @Author wangbo
      * @Description 计算产销差
@@ -184,7 +155,7 @@ public class AppPageReportServiceImpl implements AppPageReportService {
         for(DeviceWaterSupply water : sellerWaterList){
             sellerWaterAmount = sellerWaterAmount.add(water.getAmount());
         }
-        BigDecimal nrw = makingWaterAmount ==BigDecimal.ZERO ? BigDecimal.ZERO : makingWaterAmount.subtract(sellerWaterAmount).multiply(new BigDecimal(100)).divide(makingWaterAmount,2);
+        BigDecimal nrw = makingWaterAmount.compareTo(BigDecimal.ZERO) == 0  ? BigDecimal.ZERO : makingWaterAmount.subtract(sellerWaterAmount).multiply(new BigDecimal(100)).divide(makingWaterAmount,2);
         map.put("totalIntake",supplyWaterAmount);
         map.put("totalMaking",makingWaterAmount);
         map.put("totallSeller",sellerWaterAmount);
@@ -207,10 +178,43 @@ public class AppPageReportServiceImpl implements AppPageReportService {
         for(DeviceWaterSupply water : lastWaterList){
             lastWaterAmount = lastWaterAmount.add(water.getAmount());
         }
-        BigDecimal comparison = lastWaterAmount ==BigDecimal.ZERO ? BigDecimal.ZERO : sameWaterAmount.multiply(new BigDecimal(100)).divide(lastWaterAmount,2);
+        BigDecimal comparison = lastWaterAmount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : sameWaterAmount.multiply(new BigDecimal(100)).divide(lastWaterAmount,2);
         return comparison;
     }
 
+    /**
+     * App 总览 前N个月的应收实收金额
+     * @param companyOrgId
+     * @return
+     */
+    @Override
+    public List<DeviceWaterSupply> deviceSellerAmountReportForMonth(Integer companyOrgId,Integer month) {
+        LocalDate localDate = LocalDate.now();
+        List<DeviceWaterSupply> deviceWaterSupplies = new ArrayList<DeviceWaterSupply>();
+        List<MonthRevenueDto> sellerWater = revenueService.selectOverviewRevenue(companyOrgId,month);
+        for (int i = 0; i < month; i++) {
+            LocalDate newLocalDate = localDate.plusMonths(-i);
+            MonthRevenueDto revenue = findRevenue(sellerWater,newLocalDate);
+            DeviceWaterSupply deviceWaterSupply = new DeviceWaterSupply();
+            deviceWaterSupply.setOrderNo(i+1);
+            deviceWaterSupply.setYear(newLocalDate.getYear());
+            deviceWaterSupply.setMonth(newLocalDate.getMonthValue());
+            deviceWaterSupply.setDate(newLocalDate);
+            deviceWaterSupply.setDateLabel(newLocalDate.getYear()+"-"+newLocalDate.getMonthValue());
+            if(revenue == null){
+                deviceWaterSupply.setAmount(BigDecimal.ZERO);
+                deviceWaterSupply.setAmount2(BigDecimal.ZERO);
+            }
+            else{
+                deviceWaterSupply.setAmount(new BigDecimal(revenue.getReceivableTotalAmount()));
+                deviceWaterSupply.setAmount2(new BigDecimal(revenue.getReceivedTotalAmount()));
+            }
+            deviceWaterSupplies.add(i, deviceWaterSupply);
+        }
+        deviceWaterSupplies.sort(Comparator.comparing(DeviceWaterSupply::getOrderNo).reversed());
+        return deviceWaterSupplies;
+    }
+
     public MonthRevenueDto findRevenue(List<MonthRevenueDto> sellerWater,LocalDate localDate) {
         String dateString = String.format("%s-%s", localDate.getYear(),new DecimalFormat("#00").format(localDate.getMonthValue()));
         for (MonthRevenueDto revenue : sellerWater) {

+ 125 - 2
sms_water/src/main/java/com/huaxu/service/impl/AppReportMonitorServiceImpl.java

@@ -2,15 +2,28 @@ package com.huaxu.service.impl;
 
 import com.huaxu.client.UserCenterClient;
 import com.huaxu.dao.AppReportMonitorMapper;
+import com.huaxu.dao.HomePageReportMapper;
 import com.huaxu.dto.CompanySceneInfoDto;
 import com.huaxu.dto.OrgBaseTreeInfoDto;
+import com.huaxu.dto.generalView.WaterSupplyChart;
+import com.huaxu.dto.generalView.WaterSupplyData;
+import com.huaxu.dto.homePage.WaterQualityRate;
 import com.huaxu.entity.SceneEntity;
+import com.huaxu.model.LoginUser;
 import com.huaxu.service.AppReportMonitorService;
+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.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -28,6 +41,12 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
     @Autowired
     private UserCenterClient userCenterClient;
 
+    @Resource
+    private HomePageReportMapper homePageReportMapper;
+
+    @Autowired
+    private MonitorDataReportService monitorDataReportService;
+
 
     @Override
     public List<SceneEntity> getSceneByCompany(String sceneTypeName,Integer companyOrgId) {
@@ -38,7 +57,7 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
     @Override
     public CompanySceneInfoDto getSceneByCompanyBySearch(String sceneTypeName, String condition) {
         //先查询公司
-        List<OrgBaseTreeInfoDto> orgBaseTreeInfoDtos = userCenterClient.getCompanyByUser(condition,null);
+        List<OrgBaseTreeInfoDto> orgBaseTreeInfoDtos = userCenterClient.getCompanyByUser(condition,new ArrayList<>());
         //有公司的展示第一个公司信息
         if(orgBaseTreeInfoDtos.size() > 0){
             List<SceneEntity> sceneEntities = appReportMonitorMapper.getSceneByCompany(sceneTypeName,orgBaseTreeInfoDtos.get(0).getId());
@@ -48,7 +67,7 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
         List<Integer> companyIds = appReportMonitorMapper.getCompanyBySceneCondition(sceneTypeName,condition);
         if(companyIds.size() > 0){
             //根据场景的公司id查询公司
-            orgBaseTreeInfoDtos = userCenterClient.getCompanyByUser(null,companyIds);
+            orgBaseTreeInfoDtos = userCenterClient.getCompanyByUser("",companyIds);
             //有公司的展示第一个公司信息
             if(orgBaseTreeInfoDtos.size() > 0){
                 List<SceneEntity> sceneEntities = appReportMonitorMapper.getSceneByCompany(sceneTypeName,orgBaseTreeInfoDtos.get(0).getId());
@@ -58,4 +77,108 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
 
         return new CompanySceneInfoDto();
     }
+
+    //水源取水、电耗对比曲线
+    @Override
+    public List<WaterSupplyChart> waterEnergyConsumption(Integer sceneId ) {
+
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        String tenantId = loginUser.getTenantId();
+
+        List<WaterSupplyData> waterSupplyDatas = homePageReportMapper.getWaterSupplyData(sceneId,"水源",tenantId,loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
+
+        LocalDate localDate = LocalDate.now();
+        //当天数据
+        BigDecimal waterDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, "水源", 4,1 );
+        BigDecimal powerDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, "水源", 5,1 );
+//        BigDecimal drugDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, sceneType, 6,1 );
+        WaterSupplyChart waterSupplyChartToday = new WaterSupplyChart();
+        waterSupplyChartToday.setSort(localDate.getDayOfMonth());
+        waterSupplyChartToday.setDate(DateTimeFormatter.ofPattern("yyyy-MM-dd").format(localDate));
+        waterSupplyChartToday.setWaterData(waterDataCountDay);
+        waterSupplyChartToday.setPowerData(powerDataCountDay);
+//        waterSupplyChartToday.setDrugData(drugDataCountDay);
+
+
+
+        List<WaterSupplyChart> waterSupplyCharts = new ArrayList<>();
+        waterSupplyDatas.stream()
+                .collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth() + "-" + item.getDay()))
+                .forEach((key, value) -> {
+                    WaterSupplyChart waterSupplyChart = new WaterSupplyChart();
+                    waterSupplyChart.setDate(key);
+                    value.stream().forEach(waterSupplyData -> {
+                        waterSupplyChart.setSort(waterSupplyData.getDay());
+
+                        if (waterSupplyData.getParmType() == 3) { //供水
+                            waterSupplyChart.setWaterData(waterSupplyData.getAmount());
+                        } else if (waterSupplyData.getParmType() == 5) {//电耗
+                            waterSupplyChart.setPowerData(waterSupplyData.getAmount());
+                        }
+//                        else if (waterSupplyData.getParmType() == 6) {//药耗
+//                            waterSupplyChart.setDrugData(waterSupplyData.getAmount());
+//                        }
+                    });
+                    waterSupplyCharts.add(waterSupplyChart);
+                });
+
+        waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort));
+
+        Integer maxDay =  LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth();
+        for(int i=0;i<maxDay;i++){
+            if(i+1 == localDate.getDayOfMonth()){
+                waterSupplyCharts.add(i,waterSupplyChartToday);
+            }else if(i == waterSupplyCharts.size() || !waterSupplyCharts.get(i).getSort().equals(i+1)){
+                waterSupplyCharts.add(i,new WaterSupplyChart(i+1, localDate.getYear()+"-"+localDate.getMonthValue()+"-"+(i+1)));
+            }
+
+        }
+//        waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort).reversed());
+        return waterSupplyCharts;
+    }
+
+    public List<WaterSupplyChart> getWaterLevelForWaterSource(Integer sceneId ){
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        String tenantId = loginUser.getTenantId();
+
+        List<WaterSupplyData> waterSupplyDatas = homePageReportMapper.getWaterSupplyData(sceneId,"水源",tenantId,loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
+
+        LocalDate localDate = LocalDate.now();
+        //当天数据
+        BigDecimal waterDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, "水源", 12,1 );
+//        BigDecimal drugDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, sceneType, 6,1 );
+        WaterSupplyChart waterSupplyChartToday = new WaterSupplyChart();
+        waterSupplyChartToday.setSort(localDate.getDayOfMonth());
+        waterSupplyChartToday.setDate(DateTimeFormatter.ofPattern("yyyy-MM-dd").format(localDate));
+        waterSupplyChartToday.setWaterData(waterDataCountDay);
+
+
+
+        List<WaterSupplyChart> waterSupplyCharts = new ArrayList<>();
+        waterSupplyDatas.stream()
+                .collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth() + "-" + item.getDay()))
+                .forEach((key, value) -> {
+                    WaterSupplyChart waterSupplyChart = new WaterSupplyChart();
+                    waterSupplyChart.setDate(key);
+                    value.stream().forEach(waterSupplyData -> {
+                        waterSupplyChart.setSort(waterSupplyData.getDay());
+                        if (waterSupplyData.getParmType() == 3) { //供水
+                            waterSupplyChart.setWaterData(waterSupplyData.getAmount());
+                        }
+                    });
+                    waterSupplyCharts.add(waterSupplyChart);
+                });
+
+        waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort));
+
+        Integer maxDay =  LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth();
+        for(int i=0;i<maxDay;i++){
+            if(i+1 == localDate.getDayOfMonth()){
+                waterSupplyCharts.add(i,waterSupplyChartToday);
+            }else if(i == waterSupplyCharts.size() || !waterSupplyCharts.get(i).getSort().equals(i+1)){
+                waterSupplyCharts.add(i,new WaterSupplyChart(i+1, localDate.getYear()+"-"+localDate.getMonthValue()+"-"+(i+1)));
+            }
+        }
+        return waterSupplyCharts;
+    }
 }

+ 1 - 0
sms_water/src/main/resources/mapper/AppReportMonitorMapper.xml

@@ -17,6 +17,7 @@
 
     <select id="getCompanyBySceneCondition" resultType="java.lang.Integer">
         select
+        distinct
          s.COMPANY_ORG_ID
         from sms_scene_type st
         left join sms_scene s on st.id=s.SCENE_TYPE_ID

+ 2 - 2
sms_water/src/main/resources/mapper/HomePageReportMapper.xml

@@ -486,8 +486,8 @@
             and s.COMPANY_ORG_ID = #{companyOrgId}
         </if>
         and dp.PARM_TYPE = #{parmType} and st.SCENE_TYPE_NAME = #{sceneType}
-        and r.year &gt;= #{startYear} and r.month &gt;= #{startMonth} and r.day &gt;= #{startDay}
-        and r.year &lt;= #{endYear} and r.moth &lt;= #{endMonth} and r.day &lt;= #{endDay}
+        and r.year*365 + r.month*30 +r.day >= #{startYear}*365 + #{startMonth} *30 + #{startDay}
+        and r.year*365 + r.month*30 +r.day &lt;= #{endYear}*365 + #{endMonth} *30 + #{endDay}
         <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
             <if test="permissonType == 5 or permissonType == 2">
                 and ( s.DEPT_ORG_ID in

+ 9 - 4
sms_water/src/main/resources/mapper/RevenueMapper.xml

@@ -99,7 +99,10 @@
 
     <!--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
+        select date_format(t1.collect_date, '%Y-%m' ) collect_date_string,
+        sum(METER_READING_USAGE) meter_reading_usage,
+        sum(RECEIVABLE_TOTAL_AMOUNT) receivable_total_amount,
+        sum(RECEIVED_TOTAL_AMOUNT) received_total_amount
         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 != ''">
@@ -122,9 +125,12 @@
 
     <!--App总览-生产数据-按时间段查询(环比)-->
     <select id="selectRevenueByDate" resultType="com.huaxu.dto.MonthRevenueDto">
-        select date_format(t1.collect_date, '%Y-%m' ) collect_date_string,sum(METER_READING_USAGE) meter_reading_usage
+        select date_format(t1.collect_date, '%Y-%m' ) collect_date_string,
+        sum(METER_READING_USAGE) meter_reading_usage,
+        sum(RECEIVABLE_TOTAL_AMOUNT) receivable_total_amount,
+        sum(RECEIVED_TOTAL_AMOUNT) received_total_amount
         from sms_month_revenue t1
-        where t1.collect_date>=date_format(#{startDate}, '%y-%m-1' ) and t1.collect_date &lt; date_format(#{endDate}, '%y-%m-1')
+        where t1.collect_date>=date_format(#{startDate}, '%y-%m-1' ) and t1.collect_date &lt;= date_format(#{endDate}, '%y-%m-1')
         <if test="tenantId != null and tenantId != ''">
             and t1.tenant_id=#{tenantId}
         </if>
@@ -142,5 +148,4 @@
         group by collect_date_string
         order by collect_date_string
     </select>
-
 </mapper>

+ 1 - 1
user_center/src/main/java/com/huaxu/controller/OrgController.java

@@ -167,7 +167,7 @@ public class OrgController {
 
 
     @RequestMapping(value = "getCompanyByUser", method = RequestMethod.POST)
-    public List<OrgBaseTreeInfoDto> getCompanyByUser(@RequestParam("condition") String condition,@RequestParam("companyIds") List<Integer> companyIds ) {
+    public List<OrgBaseTreeInfoDto> getCompanyByUser(@RequestParam(value = "condition" ,required =  false) String condition,@RequestBody List<Integer> companyIds ) {
         return orgService.getCompanyByUser(condition,companyIds);
     }
 }

+ 1 - 1
user_center/src/main/resources/mapper/OrgMapper.xml

@@ -325,7 +325,7 @@
             p.ORG_TYPE as "orgType"
         from uims_org p
         where p.`STATUS` = 1
-        and p.PARENT_ORG_ID != 0 and p.ORG_TYPE = 'company'
+        and p.ORG_TYPE = 'company'
         and p.TENANT_ID = #{tenantId}
         <if test="condition != null and condition != ''">
             and p.org_name like concat('%', #{condition},'%')

+ 4 - 2
user_center/src/main/resources/mapper/TenantMapper.xml

@@ -162,7 +162,7 @@
     <!-- 生成租户菜单 -->
     <insert id="createTenantMenu">
         insert into uims_tenant_menu (TENANT_ID ,MENU_ID ,MENU_NAME ,MENU_IMAGE ,MENU_SEQ ,LINK_PATH ,STATUS
-        ,DATE_CREATE ,CREATE_BY ,DATE_UPDATE ,UPDATE_BY,REMARK)
+        ,DATE_CREATE ,CREATE_BY ,DATE_UPDATE ,UPDATE_BY,REMARK ,ENGLISH_NAME ,MENU_DYNAMIC_IMAGE)
         select
             #{tenantId},
             id,
@@ -175,7 +175,9 @@
             #{userName},
             now(),
             #{userName},
-            remark
+            remark,
+            ENGLISH_NAME,
+            MENU_DYNAMIC_IMAGE
         from uims_menu
         where id in (
         <foreach collection="menuIds" item="item" index="index" separator=",">