|
@@ -3,11 +3,11 @@ package com.bz.smart_city.service.sync;
|
|
|
import com.bz.smart_city.dao.CustomerMapper;
|
|
|
import com.bz.smart_city.dao.DeviceMapper;
|
|
|
import com.bz.smart_city.dao.OperatingValveRecordMapper;
|
|
|
+import com.bz.smart_city.dao.UserMapper;
|
|
|
import com.bz.smart_city.dao.assistant.InstallListMapper;
|
|
|
import com.bz.smart_city.dao.assistant.InstallPlanMapper;
|
|
|
-import com.bz.smart_city.entity.Customer;
|
|
|
-import com.bz.smart_city.entity.Device;
|
|
|
-import com.bz.smart_city.entity.OperatingValveRecord;
|
|
|
+import com.bz.smart_city.dto.ProgramItemDto;
|
|
|
+import com.bz.smart_city.entity.*;
|
|
|
import com.bz.smart_city.entity.assistant.InstallPlan;
|
|
|
import com.bz.smart_city.service.DeviceService;
|
|
|
import com.bz.smart_city.service.PlatformAapiService;
|
|
@@ -15,10 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.kafka.annotation.KafkaListener;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class PlatformAapiServiceImpl implements PlatformAapiService {
|
|
@@ -32,6 +30,8 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
|
|
|
private OperatingValveRecordMapper operatingValveRecordMapper;
|
|
|
@Autowired
|
|
|
private InstallListMapper installListMapper;
|
|
|
+ @Autowired
|
|
|
+ private UserMapper userMapper;
|
|
|
@Override
|
|
|
public void updateMeterNo(String meterNo, String meterCode, String customerNo) {
|
|
|
Customer customer = customerMapper.findBySiteIdAndCustomerNo(null, customerNo);
|
|
@@ -80,10 +80,30 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
|
|
|
public List<Map<String, Object>> getDeviceStatus(Map<String, Object> args) {
|
|
|
String customerNo= (String) args.get("customerNo");
|
|
|
List<String>electronicMeterNos= (List<String>) args.get("electronicMeterNos");
|
|
|
- List<Map<String,Object>> result=operatingValveRecordMapper.getDeviceStatus(electronicMeterNos,customerNo);
|
|
|
+ ;
|
|
|
+ return operatingValveRecordMapper.getDeviceStatus(electronicMeterNos,customerNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getDeviceStatistics(Map<String, Object> args) {
|
|
|
+ List<ProgramItemDto>programItemDtos = userMapper.findTenantAuthority();
|
|
|
+ List<Map<String, Object>>result=new ArrayList<>();
|
|
|
+ Map<String, List<ProgramItemDto>> detailmap = programItemDtos.stream()
|
|
|
+ .collect(Collectors.groupingBy(d -> d.getTenantId() ));
|
|
|
+ Iterator<Map.Entry<String, List<ProgramItemDto>>> iterator = detailmap.entrySet().iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ Map<String, Object>countInfo=new HashMap<>();
|
|
|
+ Map.Entry<String, List<ProgramItemDto>> next = iterator.next();
|
|
|
+ long count=deviceMapper.statisticsEquipmentTotal(next.getValue());
|
|
|
+ countInfo.put("tenantId",next.getKey());
|
|
|
+ countInfo.put("userMeterCount",count);
|
|
|
+ result.add(countInfo);
|
|
|
+ }
|
|
|
+ // ;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private Device getDevice(String meterNo, String customerNo){
|
|
|
Device device=null;
|
|
|
List<String>fileNo=new ArrayList<>();
|