Browse Source

数据库改造代码提交

pengdi@zoniot.com 4 years ago
parent
commit
63e7fd60bb

+ 3 - 2
smart-city-platform/src/main/java/com/bz/smart_city/controller/RealTimeMonitorController.java

@@ -115,10 +115,11 @@ public class RealTimeMonitorController {
     }
 
     /**
-     * 查询设备实时数据,最小粒度可以查询到某个楼层所有设备数据
-     *
+     * <p>查询设备实时数据,最小粒度可以查询到某个楼层所有设备数据</p>
+     * 水务数据库改造版本此接口已废弃
      * @throws ParseException
      */
+    @Deprecated
     @GetMapping("/realtime/device/data/{system}/{building}/{floor}/{startDate}/{endDate}/")
     @ApiOperation(value = "查询设备实时数据,最小粒度可以查询到某个楼层所有设备数据")
     public AjaxMessage<List<DeviceData>> queryDeviceRealtimeData(

+ 37 - 4
smart-city-platform/src/main/java/com/bz/smart_city/dao/DeviceDataDimMapper.java

@@ -11,26 +11,45 @@ import java.util.Map;
 
 import com.bz.smart_city.entity.DeviceDataDim;
 
+@Deprecated
 @Mapper
 public interface DeviceDataDimMapper {
+    @Deprecated
     int insert(@Param("deviceDataDim") DeviceDataDim deviceDataDim);
 
+    @Deprecated
     int insertSelective(@Param("deviceDataDim") DeviceDataDim deviceDataDim);
 
+    @Deprecated
     int insertList(@Param("deviceDataDims") List<DeviceDataDim> deviceDataDims);
 
+    @Deprecated
     List<DeviceData> queryDeviceRealtimeData(@Param("system") Integer system, @Param("building") Integer building, @Param("floor") Integer floor, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate, @Param("measuring") Integer measuring, @Param("deviceId") Long deviceId);
 
+
     List<DeviceDataDim> queryDeviceDataDim(@Param("param") DeviceDataDim deviceDataDim, @Param("limit") Integer limit);
 
     List<DeviceDataDim> getDeviceDataBetweenDate(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, @Param("deviceId") Long deviceId);
 
-
+    /**
+     * 已迁移
+     * @param system
+     * @param deviceId
+     * @return
+     */
+    @Deprecated
     int updateChannel(@Param("sysId") Integer system,@Param("deviceId") Long deviceId);
-    
+
+    /**
+     * 已迁移
+     * @param deviceId
+     * @return
+     */
+    @Deprecated
     DeviceDataDim queryMeterLastData(@Param("deviceId") Long deviceId);
     
     /**
+     * 已迁移
      * <p>计算数据条数</p>
      * @param customers 客户
      * @param communitys 小区
@@ -39,12 +58,25 @@ public interface DeviceDataDimMapper {
      * @param endDate 上报结束时间
      * @return
      */
+    @Deprecated
     int countDataSize(@Param("customers") String customers, 
     		@Param("communitys") String communitys,
     		@Param("buildings") String buildings,
     		@Param("beginDate") Date beginDate,
     		@Param("endDate") Date endDate);
-    
+
+    /**
+     * 已迁移
+     * @param customers
+     * @param communitys
+     * @param buildings
+     * @param beginDate
+     * @param endDate
+     * @param offset
+     * @param limit
+     * @return
+     */
+    @Deprecated
     List<DeviceDataDim> queryDataWithPage(
     		@Param("customers") String customers, 
     		@Param("communitys") String communitys,
@@ -54,7 +86,8 @@ public interface DeviceDataDimMapper {
     		@Param("offset") Integer offset,
     		@Param("limit") Integer limit
     		);
-    
+
+    @Deprecated
     List<Map<String,Object>> getDeviceDataByTime(@Param("deviceId") Long deviceId , @Param("sendTime") Date sendTime,@Param("deviceTypeId") Integer deviceTypeId);
 
 }

+ 35 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/DeviceDataDimService.java

@@ -2,17 +2,51 @@ package com.bz.smart_city.service;
 
 import java.util.List;
 
-import com.bz.smart_city.dto.MeterReadData;
 import com.bz.smart_city.entity.DeviceData;
 import com.bz.smart_city.entity.DeviceDataDim;
+
+/**
+ *<p>该类已由com.bz.smart_city.service.DeviceDataService替换</p>
+ */
+@Deprecated
 public interface DeviceDataDimService{
 
+    /**
+     * <p>已废弃</p>
+     * @param deviceDataDim
+     * @return
+     */
+    @Deprecated
     int insert(DeviceDataDim deviceDataDim);
 
+    /**
+     * <p>已废弃</p>
+     * @param deviceDataDim
+     * @return
+     */
+    @Deprecated
     int insertSelective(DeviceDataDim deviceDataDim);
 
+    /**
+     * <p>已废弃</p>
+     * @param deviceDataDims
+     * @return
+     */
+    @Deprecated
     int insertList(List<DeviceDataDim> deviceDataDims);
 
+    /**
+     * <p>已废弃</p>
+     * @param system
+     * @param building
+     * @param floor
+     * @param startDate
+     * @param endDate
+     * @param measuring
+     * @param deviceId
+     * @return
+     */
+    @Deprecated
     List<DeviceData> queryDeviceRealtimeData(Integer system, Integer building, Integer floor, Integer startDate, Integer endDate, Integer measuring, Long deviceId);
 
 }

+ 55 - 4
smart-city-platform/src/main/java/com/bz/smart_city/service/DeviceDataService.java

@@ -1,12 +1,63 @@
 package com.bz.smart_city.service;
-
-
-
 import com.zcxk.zoniot.smartcity.common.dto.DeviceMeasuringDataDTO;
-
+import com.zcxk.zoniot.smartcity.common.model.DeviceData;
+import java.util.Date;
 import java.util.List;
 
+/**
+ * @author pengdi
+ */
 public interface DeviceDataService {
     List<DeviceMeasuringDataDTO> getData(Long deviceId, String measuringCode, Integer startDate, Integer endDate);
 
+    /**
+     * <p>更新设备数据</p>
+     * @param deviceId
+     * @param param
+     * @return
+     */
+    Long updateDeviceData(Long deviceId , DeviceData param);
+
+    /**
+     * <P>查询设备最后一次上报数据</P>
+     * @param deviceId
+     * @return
+     */
+    DeviceData queryDeviceLastData(Long deviceId);
+
+    /**
+     * <p>查询设备数据数量</p>
+     * @param customers
+     * @param communitys
+     * @param buildings
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    Long countDeviceDataSize(String customers,
+                             String communitys,
+                             String buildings,
+                             Date beginDate,
+                             Date endDate);
+
+    /**
+     * <p>分页查询设备数据</p>
+     * @param customers
+     * @param communitys
+     * @param buildings
+     * @param beginDate
+     * @param endDate
+     * @param index
+     * @param pageSize
+     * @return
+     */
+    List<DeviceData> queryDataWithPage(
+             String customers,
+             String communitys,
+             String buildings,
+             Date beginDate,
+             Date endDate,
+             Integer index,
+             Integer pageSize
+    );
 }

+ 82 - 22
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/DeviceDataPushServiceImpl.java

@@ -12,6 +12,10 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.bz.smart_city.dto.MeterReadData;
+import com.bz.smart_city.service.DeviceDataService;
+import com.zcxk.zoniot.smartcity.common.model.DeviceData;
+import com.zcxk.zoniot.smartcity.common.model.DeviceMeasuringData;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.InitializingBean;
@@ -78,12 +82,16 @@ public class DeviceDataPushServiceImpl implements DeviceDataPushService , Initia
 	
 	@Autowired
 	JobAndTriggerService jobAndTriggerService;
-	
+
+	@Autowired
+	DeviceDataService deviceDataService ;
+
 	@Override
 	public void generalPushMethod(DeviceDataPushConfig config) {
 		log.info("begin generalPushMethod ,config = {}",JSON.toJSONString(config));
-		// 1,查询推送记录 
-		PushLog lastLog = pushLogMapper.findLastRecord(config.getId(), 2); // 1档案;2数据
+		// 1,查询推送记录
+		// 1档案;2数据
+		PushLog lastLog = pushLogMapper.findLastRecord(config.getId(), 2);
 		// 2,计算推送数据时间;如果为首次推送,则判断是否需要将历史数据推送给对方;
 		Date beginDate = null ;
 		Date endDate = new Date();
@@ -91,7 +99,8 @@ public class DeviceDataPushServiceImpl implements DeviceDataPushService , Initia
 			beginDate = lastLog.getPushTime() ; 
 		}
 		else {
-			Integer isNeedHistory = config.getIsNeedHistory(); // 是否需要历史数据  1是  ; 0否
+			// 是否需要历史数据  1是  ; 0否
+			Integer isNeedHistory = config.getIsNeedHistory();
 			if(isNeedHistory == 1) {
 				beginDate = DateTimeUtil.parseDate("1900-01-01", "yyyy-MM-dd");
 			}
@@ -106,7 +115,8 @@ public class DeviceDataPushServiceImpl implements DeviceDataPushService , Initia
 		String pushBuildings = config.getPushBuildings();
 		log.info("begin query push data size , pushCustomers ={}, pushCommunitys={}, pushBuildings={}, beginDate={}, endDate={}",
 				pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate);
-		int dataSize = deviceDataDimMapper.countDataSize(pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate);
+		int dataSize = deviceDataService.countDeviceDataSize(pushCustomers,pushCommunitys, pushBuildings, beginDate, endDate).intValue();
+		//int dataSize = deviceDataDimMapper.countDataSize(pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate);
 		log.info("end query push data size , size = {}",dataSize);
 		// 4,判断是否需要分批次进行推送
 		if(dataSize != 0) {
@@ -114,19 +124,29 @@ public class DeviceDataPushServiceImpl implements DeviceDataPushService , Initia
 				int batch = dataSize % config.getMaxLimit() == 0 ? dataSize / config.getMaxLimit() : dataSize / config.getMaxLimit() + 1 ;
 				// 按批次进行推送
 				for(int i = 1 ;i <= batch; i++) {
-					int offset = (i - 1) * config.getMaxLimit();
+					//int offset = (i - 1) * config.getMaxLimit();
+					int index = i-1;
 					int limit = config.getMaxLimit(); 
-					List<DeviceDataDim> conditionList = deviceDataDimMapper.queryDataWithPage(pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate, offset, limit);
+					//List<DeviceDataDim> conditionList = deviceDataDimMapper.queryDataWithPage(pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate, offset, limit);
+					List<DeviceData> deviceDataList = deviceDataService.queryDataWithPage(pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate, index, limit);
 					List<Map<String,Object>> dataMapList = new ArrayList<Map<String,Object>>();
 					// 查询测点数据
-					for(DeviceDataDim  condition : conditionList) {
+//					for(DeviceDataDim  condition : conditionList) {
+//						Map<String,Object> dataMap = new HashMap<String,Object>();
+//						dataMap.put("deviceNo", condition.getDeviceNo());
+//						dataMap.put("deviceType", condition.getEquipmentType());
+//						dataMap.put("sendTime", DateTimeUtil.formatDate(condition.getSendTime(), DateTimeUtil.DATE_TIME_FORMAT));
+//						List<Map<String, Object>> datas = deviceDataDimMapper.getDeviceDataByTime(condition.getDeviceId(), condition.getSendTime(), condition.getDeviceType());
+//						dataMap.put("datas", datas);
+//
+//						dataMapList.add(dataMap);
+//					}
+					for(DeviceData deviceData : deviceDataList){
 						Map<String,Object> dataMap = new HashMap<String,Object>();
-						dataMap.put("deviceNo", condition.getDeviceNo());
-						dataMap.put("deviceType", condition.getEquipmentType());
-						dataMap.put("sendTime", DateTimeUtil.formatDate(condition.getSendTime(), DateTimeUtil.DATE_TIME_FORMAT));
-						List<Map<String, Object>> datas = deviceDataDimMapper.getDeviceDataByTime(condition.getDeviceId(), condition.getSendTime(), condition.getDeviceType());
-						dataMap.put("datas", datas);
-						
+						dataMap.put("deviceNo", deviceData.getDeviceNo());
+						dataMap.put("deviceType", deviceData.getDeviceTypeName());
+						dataMap.put("sendTime",DateTimeUtil.formatDate(deviceData.getReceiveTime(), DateTimeUtil.DATE_TIME_FORMAT));
+						dataMap.put("datas", deviceData.getData());
 						dataMapList.add(dataMap);
 					}
 					// 发送数据
@@ -135,16 +155,25 @@ public class DeviceDataPushServiceImpl implements DeviceDataPushService , Initia
 			}
 			else {
 				// 不需要分批次进行发送
-				List<DeviceDataDim> conditionList = deviceDataDimMapper.queryDataWithPage(pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate, 0, dataSize);
+				//List<DeviceDataDim> conditionList = deviceDataDimMapper.queryDataWithPage(pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate, 0, dataSize);
+				List<DeviceData> deviceDataList = deviceDataService.queryDataWithPage(pushCustomers, pushCommunitys, pushBuildings, beginDate, endDate, 0, dataSize);
 				List<Map<String,Object>> dataMapList = new ArrayList<Map<String,Object>>();
 				// 查询测点数据
-				for(DeviceDataDim  condition : conditionList) {
+//				for(DeviceDataDim  condition : conditionList) {
+//					Map<String,Object> dataMap = new HashMap<String,Object>();
+//					dataMap.put("deviceNo", condition.getDeviceNo());
+//					dataMap.put("deviceType", condition.getEquipmentType());
+//					dataMap.put("sendTime", DateTimeUtil.formatDate(condition.getSendTime(), DateTimeUtil.DATE_TIME_FORMAT));
+//					List<Map<String, Object>> datas = deviceDataDimMapper.getDeviceDataByTime(condition.getDeviceId(), condition.getSendTime(), condition.getDeviceType());
+//					dataMap.put("datas", datas);
+//					dataMapList.add(dataMap);
+//				}
+				for(DeviceData deviceData : deviceDataList){
 					Map<String,Object> dataMap = new HashMap<String,Object>();
-					dataMap.put("deviceNo", condition.getDeviceNo());
-					dataMap.put("deviceType", condition.getEquipmentType());
-					dataMap.put("sendTime", DateTimeUtil.formatDate(condition.getSendTime(), DateTimeUtil.DATE_TIME_FORMAT));
-					List<Map<String, Object>> datas = deviceDataDimMapper.getDeviceDataByTime(condition.getDeviceId(), condition.getSendTime(), condition.getDeviceType());
-					dataMap.put("datas", datas);
+					dataMap.put("deviceNo", deviceData.getDeviceNo());
+					dataMap.put("deviceType", deviceData.getDeviceTypeName());
+					dataMap.put("sendTime",DateTimeUtil.formatDate(deviceData.getReceiveTime(), DateTimeUtil.DATE_TIME_FORMAT));
+					dataMap.put("datas", deviceData.getData());
 					dataMapList.add(dataMap);
 				}
 				// 发送数据
@@ -268,12 +297,17 @@ public class DeviceDataPushServiceImpl implements DeviceDataPushService , Initia
 				index = start + j;
 				d = (DeviceDto)deviceList.get(index);
 				index++;
-				DeviceDataDim deviceData = deviceDataDimMapper.queryMeterLastData(d.getId());
+				// 数据库改造修改
+				// DeviceDataDim deviceData = deviceDataDimMapper.queryMeterLastData(d.getId());
+				DeviceData data = deviceDataService.queryDeviceLastData(d.getId());
+				DeviceDataDim deviceData = buildDeviceDataDim(data);
 				if (deviceData != null)
 				{
 					deviceData.setMeterCode(d.getWaterMeterNo());
 					records.add(deviceData);
 				}
+
+
 			}
 			PostData postData = new PostData();
 			postData.companyId = this.companyId;
@@ -313,6 +347,32 @@ public class DeviceDataPushServiceImpl implements DeviceDataPushService , Initia
 			}
 		}
 	}
+	protected DeviceDataDim buildDeviceDataDim(DeviceData data){
+		DeviceDataDim ddd = null;
+		if(data != null){
+			ddd = new DeviceDataDim();
+			ddd.setDeviceId(data.getDeviceId());
+			ddd.setDeviceNo(data.getDeviceNo());
+			ddd.setSendTime(data.getReceiveTime());
+			List<DeviceMeasuringData> measuringDataList = data.getData();
+			// 富锦目前只有LoRa表
+			ddd.setMeasuringData(getMeasuringDataValue(measuringDataList,"WSV"));
+			ddd.setMeasuringCode("WSV");
+		}
+		return ddd;
+	}
+	protected  String getMeasuringDataValue(List<DeviceMeasuringData> measuringDataList , String measuringCode){
+		String measuringValue = "";
+		if(measuringDataList != null && measuringDataList.size() != 0){
+			for(DeviceMeasuringData measuringData : measuringDataList){
+				if(measuringData.getMeasuringCode().equals(measuringCode)){
+					measuringValue = measuringData.getMeasuringData();
+					break;
+				}
+			}
+		}
+		return measuringValue ;
+	}
 	public static String formatDate(Date date, String format) {
 		SimpleDateFormat sdf = new SimpleDateFormat(format);
 		String formatStr = sdf.format(date);

+ 87 - 2
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/DeviceDataServiceImpl.java

@@ -1,21 +1,26 @@
 package com.bz.smart_city.service.impl;
 
 
-import com.bz.smart_city.commom.util.SnowflakeIdWorker;
+import com.bz.smart_city.dao.DeviceMapper;
+import com.bz.smart_city.dto.MeterReadData;
 import com.bz.smart_city.service.DeviceDataService;
+import com.mongodb.client.result.UpdateResult;
 import com.zcxk.zoniot.smartcity.common.dto.DeviceMeasuringDataDTO;
 import com.zcxk.zoniot.smartcity.common.model.DeviceData;
 import com.zcxk.zoniot.smartcity.common.model.DeviceMeasuringData;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Sort;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.data.mongodb.core.query.Criteria;
 import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.data.mongodb.core.query.Update;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -28,6 +33,8 @@ public class DeviceDataServiceImpl implements DeviceDataService {
     @Autowired
     protected MongoTemplate mongoTemplate;
 
+    @Autowired
+    DeviceMapper deviceMapper ;
 
 
     @Override
@@ -70,5 +77,83 @@ public class DeviceDataServiceImpl implements DeviceDataService {
         return deviceDataDTOList;
     }
 
+    @Override
+    public Long updateDeviceData(Long deviceId, DeviceData param) {
+        Query query = new Query();
+        query.addCriteria(Criteria.where("deviceId").is(deviceId));
+
+        Update update = new Update();
+        if(param.getChannelId() != null && param.getChannelId() != 0){
+            update.set("channelId",param.getChannelId());
+        }
+
+        UpdateResult result = mongoTemplate.updateMulti(query, update, DeviceData.class);
+        return result.getModifiedCount();
+    }
+
+    @Override
+    public DeviceData queryDeviceLastData(Long deviceId) {
+        Query query = new Query();
+        query.addCriteria(Criteria.where("deviceId").is(deviceId));
+        Sort sort = new Sort(Sort.Direction.DESC, "receiveTime");
+
+        DeviceData result = mongoTemplate.findOne(query.with(sort).limit(1), DeviceData.class);
+        return result;
+    }
+
+    /**
+     *
+     * @param customers,多个客户ID,使用逗号隔开
+     * @param communitys,多个小区Id,使用逗号隔开
+     * @param buildings,多个建筑Id,使用逗号隔开
+     * @param beginDate 开始日期
+     * @param endDate  结束日期
+     * @return
+     */
+    @Override
+    public Long countDeviceDataSize(String customers, String communitys, String buildings, Date beginDate, Date endDate) {
+        Query query = buildQuery(customers,communitys,buildings,beginDate,endDate);
+        long count = mongoTemplate.count(query, DeviceData.class);
+        return count;
+    }
 
+    @Override
+    public List<DeviceData> queryDataWithPage(String customers, String communitys, String buildings, Date beginDate, Date endDate, Integer index, Integer pageSize) {
+        Query query = buildQuery(customers,communitys,buildings,beginDate,endDate);
+        Pageable pageable =PageRequest.of(index, pageSize);
+        query.with(pageable);
+        List<DeviceData> deviceDataList = mongoTemplate.find(query, DeviceData.class);
+        return deviceDataList;
+    }
+    protected  Query buildQuery(String customers, String communitys, String buildings, Date beginDate, Date endDate){
+        Query query = new Query();
+        if(StringUtils.isNotBlank(customers)){
+            String[]  customerArray = customers.split(",");
+            List<Integer> customerIdList = new ArrayList<>();
+            for(String customer :customerArray){
+                customerIdList.add(Integer.parseInt(customer));
+            }
+            query.addCriteria(Criteria.where("customerId").in(customerIdList));
+        }
+        if(StringUtils.isNotBlank(communitys)){
+            String[]  communityArray = communitys.split(",");
+            List<Integer>  communityIdList = new ArrayList<>();
+            for(String community : communityArray ){
+                communityIdList.add(Integer.parseInt(community));
+            }
+            query.addCriteria(Criteria.where("communityId").in(communityIdList));
+        }
+        if(StringUtils.isNotBlank(buildings)){
+            String[]  buildingArray = communitys.split(",");
+            List<Integer>  buildingIdList = new ArrayList<>();
+            for(String building : buildingArray ){
+                buildingIdList.add(Integer.parseInt(building));
+            }
+            query.addCriteria(Criteria.where("buildingId").in(buildingIdList));
+        }
+        if(beginDate != null && endDate != null){
+            query.addCriteria(Criteria.where("receiveTime").gte(beginDate).lte(endDate));
+        }
+        return query ;
+    }
 }

+ 10 - 3
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/assistant/AcceptManagerServiceImpl.java

@@ -16,6 +16,7 @@ import com.bz.smart_city.dto.DeviceDto;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.entity.*;
 import com.bz.smart_city.entity.assistant.AcceptPlan;
+import com.bz.smart_city.service.DeviceDataService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.InitializingBean;
@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
+import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.kafka.core.KafkaTemplate;
 import org.springframework.stereotype.Service;
 
@@ -93,7 +95,10 @@ public class AcceptManagerServiceImpl implements AcceptManagerService,Initializi
 
 	@Value("${spring.profiles.active}")
 	private String active;
-	
+
+	@Autowired
+	DeviceDataService deviceDataService ;
+
 	@Override
 	public boolean createAcceptPlan(AcceptPlanDTO dto) {
 		log.info("begin AcceptManagerService createAcceptPlan,dto ={}",JSON.toJSONString(dto));
@@ -163,8 +168,10 @@ public class AcceptManagerServiceImpl implements AcceptManagerService,Initializi
 			mr.setSysId(channelId);
 			meterReadRecordMapper.updateHitoryData(mr);
 			// 3.3,更改上报数据后的场景
-			deviceDataDimMapper.updateChannel(channelId, install.getDeviceId());
-
+			// deviceDataDimMapper.updateChannel(channelId, install.getDeviceId());
+			com.zcxk.zoniot.smartcity.common.model.DeviceData p = new com.zcxk.zoniot.smartcity.common.model.DeviceData();
+			p.setChannelId(channelId);
+			deviceDataService.updateDeviceData(install.getDeviceId(),p);
 			AcceptListData acceptListData = new AcceptListData();
 			acceptListData.setDeviceNo(install.getDeviceNo());
 			acceptListData.setWaterMeterNo(install.getElectronicNo());