Przeglądaj źródła

增加单个详细信息查询接口

wangyangyang 4 lat temu
rodzic
commit
014bd69af3

+ 20 - 0
sms_water/src/main/java/com/huaxu/controller/ComDisplayController.java

@@ -163,6 +163,26 @@ public class ComDisplayController {
         return new AjaxMessage<>(ResultStatus.OK, receFee);
     }
 
+    @RequestMapping(value="selectMapDataForSingleCompany" , method = RequestMethod.GET)
+    @ApiOperation(value = "地图详细信息展示-按子公司查询")
+    public AjaxMessage<ComdisplayInfoDto> selectMapDataForSinggleCompany(@RequestParam(required = true) Integer companyOrgId) {
+        List<ComdisplayInfoDto> receFee = comdisplayMapLocationService.selectMapDataForSingleCompany(companyOrgId);
+        if (receFee.size() > 0) {
+            receFee.get(0).setCompanyOrgName(orgInfoUtil.getOrgName(receFee.get(0).getCompanyOrgId()));
+            Double waterUsage = receFee.get(0).getWaterUsage() != null ? receFee.get(0).getWaterUsage() : 0d;//售水量
+            //查询子公司的取水量、制水量 产销差(制水量-售水量)/制水量  X 100%
+            ComdisplayInfoDto comdisplayInfoDto = comdisplayMapLocationService.selectMapDataForCompany(Long.valueOf(receFee.get(0).getCompanyOrgId()));
+            if (comdisplayInfoDto != null) {
+                receFee.get(0).setIntakeWaterUsage(comdisplayInfoDto.getIntakeWaterUsage());
+                receFee.get(0).setYieldWaterUsage(comdisplayInfoDto.getYieldWaterUsage());
+                if (comdisplayInfoDto.getYieldWaterUsage() != null && comdisplayInfoDto.getYieldWaterUsage() > 0d) {
+                    receFee.get(0).setWaterFeeRecoveryRate(Double.valueOf(Math.round(((comdisplayInfoDto.getYieldWaterUsage() - waterUsage) / comdisplayInfoDto.getYieldWaterUsage()) * 100)));
+                }
+            }
+        }
+        return new AjaxMessage<>(ResultStatus.OK, receFee.get(0));
+    }
+
     @RequestMapping(value="selectPipeNetLayer" , method = RequestMethod.GET)
     @ApiOperation(value = "查询管网地图图层及设备")
     public AjaxMessage<List<PipeNetLayerDto>> selectPipeNetLayer(

+ 2 - 0
sms_water/src/main/java/com/huaxu/dao/ComdisplayMapLocationMapper.java

@@ -26,5 +26,7 @@ public interface ComdisplayMapLocationMapper extends BaseMapper<ComdisplayMapLoc
 
      List<ComdisplayInfoDto> selectMapDataForCompany(@Param(value = "tenantId") String tenantId);
 
+    List<ComdisplayInfoDto> selectMapDataForSingleCompany(@Param(value = "tenantId")String tenantId, @Param(value = "companyOrgId")Integer companyOrgId);
+
     /**删除相关方法  使用mybatis-plus集成的 **/
 }

+ 5 - 0
sms_water/src/main/java/com/huaxu/service/ComdisplayMapLocationService.java

@@ -161,4 +161,9 @@ public class ComdisplayMapLocationService extends ServiceImpl<ComdisplayMapLocat
         }
         return sceneUsageDto;
     }
+
+    public List<ComdisplayInfoDto> selectMapDataForSingleCompany(Integer companyOrgId) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        return  comdisplayMapLocationMapper.selectMapDataForSingleCompany(currentUser.getTenantId(),companyOrgId);
+    }
 }

+ 20 - 0
sms_water/src/main/resources/mapper/ComdisplayMapLocationMapper.xml

@@ -85,4 +85,24 @@
       where a.`STATUS`=1
      <if test="tenantId != null  and tenantId != ''">and a.TENANT_ID = #{tenantId}</if>
     </select>
+    <select id="selectMapDataForSingleCompany" resultType="com.huaxu.dto.ComdisplayInfoDto">
+        select a.COMPANY_ORG_ID as 'companyOrgId',a.POINT_LEFT as 'pointLeft',
+        a.POINT_TOP as 'pointTop',e.meterReadingArrivalRate,e.receivableTotalAmount,
+        e.receivedTotalAmount,e.userMeterCount,e.waterUsage
+        from  sms_comdisplay_map_location a
+        left join (select c.company_org_id,c.USER_METER_COUNT as 'userMeterCount',c.METER_READING_ARRIVAL_RATE  as 'meterReadingArrivalRate',
+        c.RECEIVABLE_TOTAL_AMOUNT as 'receivableTotalAmount',c.RECEIVED_TOTAL_AMOUNT as 'receivedTotalAmount',
+        c.METER_READING_USAGE as 'waterUsage'
+        from sms_month_revenue c
+        inner join (select b.company_org_id,max(b.collect_date) as  collect_date
+        from sms_month_revenue b
+        <if test="tenantId != null  and tenantId != ''">where b.TENANT_ID = #{tenantId}</if>
+        group by b.company_org_id ) d
+        on c.company_org_id=d.company_org_id and c.collect_date=d.collect_date
+        <if test="tenantId != null  and tenantId != ''">where c.TENANT_ID = #{tenantId}</if>
+        ) e on a.COMPANY_ORG_ID=e.company_org_id
+        where a.`STATUS`=1
+        <if test="tenantId != null  and tenantId != ''">and a.TENANT_ID = #{tenantId}</if>
+        <if test="companyOrgId != null  and companyOrgId != ''">and a.COMPANY_ORG_ID = #{companyOrgId}</if>
+    </select>
 </mapper>