|
@@ -164,7 +164,7 @@ public class WaterMeterUnreadDeviceServiceImpl implements WaterMeterUnreadDevice
|
|
|
"siteId": "$siteId","channelId": "$channelId","customerId": "$customerId","buildingId": "$buildingId","deviceId": "$deviceId",
|
|
|
},
|
|
|
realReadTimes:{$sum:{
|
|
|
- $cond: { if: { $eq: ["$readStatus", "1"] }, then: 1, else: 0 }
|
|
|
+ $cond: { if: { $eq: ["$readStatus", 2] }, then: 1, else: 0 }
|
|
|
}}
|
|
|
}},
|
|
|
{$match:{realReadTimes:0}},
|
|
@@ -185,7 +185,7 @@ public class WaterMeterUnreadDeviceServiceImpl implements WaterMeterUnreadDevice
|
|
|
operations.add(Aggregation.match(Criteria.where("status").is(1)));
|
|
|
operations.add(Aggregation.match(Criteria.where("readDate").gte(startDate).lte(endDate)));
|
|
|
// 1,添加分组条件
|
|
|
- ConditionalOperators.Cond readTimesCond = ConditionalOperators.when(new Criteria("readStatus").is(1)).then(1).otherwise(0);
|
|
|
+ ConditionalOperators.Cond readTimesCond = ConditionalOperators.when(new Criteria("readStatus").is(2)).then(1).otherwise(0);
|
|
|
operations.add(Aggregation.group("siteId","channelId","customerId","buildingId","deviceId")
|
|
|
.sum(readTimesCond).as("realReadTimes"));
|
|
|
|