瀏覽代碼

集中器抄表率bug修复 PengDi@2021/1/4

pengdi@zoniot.com 4 年之前
父節點
當前提交
db68a03086

+ 3 - 1
smart-city-platform/src/main/java/com/bz/smart_city/controller/water/WaterMeterReadController.java

@@ -590,8 +590,10 @@ public class WaterMeterReadController {
 		List<ProgramItem> programItems = loginUser.getDataPermissionMap().get(loginUser.getSiteId());
 		// 1,设置数据权限
 		CommonQueryCondition condition = new CommonQueryCondition();
-		condition.setProgramItems(programItems);
+		// 修改为只按照客户数据权限控制
+		// condition.setProgramItems(programItems);
 		condition.setSiteId(loginUser.getSiteId());
+		condition.setCustomerIds(UserUtil.getCustomerIds());
 		// 2,设置其他查询条件
 		condition.setDeviceTypeId(deviceTypeId);
 		condition.setPeriod(period);

+ 30 - 0
smart-city-platform/src/main/resources/mapper/StatMeterReadRateByConcentratorMapper.xml

@@ -400,6 +400,10 @@
 					</if> 
 					<!-- 数据权限 -->
 					<if test="param.siteId != null and param.siteId != 0 "> and site_id = #{param.siteId} </if>
+					<if test="param.customerIds != null and param.customerIds.size() != 0">
+						and customer_id in <foreach collection="param.customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
+					</if>
+					<!--
 					<if test='param.programItems != null and param.programItems.size() != 0' >
 						and concentrator_id IN (
 								SELECT DISTINCT
@@ -422,6 +426,7 @@
 									) 
 								)
 					</if>
+					-->
 					<if test = "param.statDay != null and param.statDay != 0"> and stat_day = #{param.statDay}</if>
 				GROUP BY
 					customer_id,
@@ -486,6 +491,10 @@
 					</if> 
 					<!-- 数据权限 -->
 					<if test="param.siteId != null and param.siteId != 0 "> and site_id = #{param.siteId} </if>
+					<if test="param.customerIds != null and param.customerIds.size() != 0">
+						and customer_id in <foreach collection="param.customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
+					</if>
+					<!--
 					<if test='param.programItems != null and param.programItems.size() != 0' >
 						and concentrator_id IN (
 								SELECT DISTINCT
@@ -508,6 +517,7 @@
 									) 
 								)
 					</if>
+					-->
 					<if test = "param.statDay != null and param.statDay != 0"> and stat_day = #{param.statDay}</if>
 				GROUP BY
 					customer_id,
@@ -572,6 +582,10 @@
 					</if> 
 					<!-- 数据权限 -->
 					<if test="param.siteId != null and param.siteId != 0 "> and site_id = #{param.siteId} </if>
+					<if test="param.customerIds != null and param.customerIds.size() != 0">
+						and customer_id in <foreach collection="param.customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
+					</if>
+					<!--
 					<if test='param.programItems != null and param.programItems.size() != 0' >
 						and concentrator_id IN (
 								SELECT DISTINCT
@@ -594,6 +608,7 @@
 									) 
 								)
 					</if>
+					-->
 					<if test = "param.statDay != null and param.statDay != 0"> and stat_day = #{param.statDay}</if>
 				GROUP BY
 					customer_id,
@@ -659,6 +674,10 @@
 		</if>
 		<!-- 数据权限 -->
 		<if test="param.siteId != null and param.siteId != 0 "> and site_id = #{param.siteId} </if>
+		<if test="param.customerIds != null and param.customerIds.size() != 0">
+			and customer_id in <foreach collection="param.customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
+		</if>
+		<!--
 		<if test='param.programItems != null and param.programItems.size() != 0' >
 			and concentrator_id IN (
 			SELECT DISTINCT
@@ -681,6 +700,7 @@
 				)
 			)
 		</if>
+		-->
 		<if test = "param.statDay != null and param.statDay != 0"> and read_date = #{param.statDay}</if>
 		GROUP BY
 		customer_id,
@@ -716,6 +736,10 @@
 			</if>
 			<!-- 数据权限 -->
 			<if test="param.siteId != null and param.siteId != 0 "> and site_id = #{param.siteId} </if>
+			<if test="param.customerIds != null and param.customerIds.size() != 0">
+				and customer_id in <foreach collection="param.customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
+			</if>
+			<!--
 			<if test='param.programItems != null and param.programItems.size() != 0' >
 				and concentrator_id IN (
 				SELECT DISTINCT
@@ -738,6 +762,7 @@
 				)
 				)
 			</if>
+			-->
 			<if test = "param.statDay != null and param.statDay != 0"> and read_date = #{param.statDay}</if>
 		GROUP BY
 			customer_id,
@@ -805,6 +830,10 @@
 			</if>
 			<!-- 数据权限 -->
 			<if test="param.siteId != null and param.siteId != 0 "> and site_id = #{param.siteId} </if>
+			<if test="param.customerIds != null and param.customerIds.size() != 0">
+				and customer_id in <foreach collection="param.customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
+			</if>
+			<!--
 			<if test='param.programItems != null and param.programItems.size() != 0' >
 				and concentrator_id IN (
 					SELECT DISTINCT
@@ -827,6 +856,7 @@
 					)
 				)
 			</if>
+			-->
 			<if test = "param.statDay != null and param.statDay != 0"> and stat_month = #{param.statDay}</if>
 			GROUP BY
 			customer_id,