|
|
@@ -1,11 +1,16 @@
|
|
|
package com.yunfeiyun.agmp.iotm.web.service.impl;
|
|
|
|
|
|
|
|
|
+import com.yunfeiyun.agmp.iot.common.domain.IotDeviceconn;
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
|
|
|
+import com.yunfeiyun.agmp.iot.common.enums.IotDeviceconnTypeEnum;
|
|
|
import com.yunfeiyun.agmp.iot.common.service.TypeCacheService;
|
|
|
+import com.yunfeiyun.agmp.iotm.mq.service.SendToIotsMsgService;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDevicetypeListResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.web.domain.resvo.TosDevicetypeResVo;
|
|
|
+import com.yunfeiyun.agmp.iotm.web.mapper.IotDeviceconnMapper;
|
|
|
import com.yunfeiyun.agmp.iotm.web.mapper.TosDevicetypeMapper;
|
|
|
+import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceconnService;
|
|
|
import com.yunfeiyun.agmp.iotm.web.service.ITosDevicetypeService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -30,7 +35,10 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
private TosDevicetypeMapper tosDevicetypeMapper;
|
|
|
@Resource
|
|
|
private TypeCacheService typeCacheService;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private IotDeviceconnMapper iotDeviceconnMapper;
|
|
|
+ @Resource
|
|
|
+ private SendToIotsMsgService sendToIotsMsgService;
|
|
|
|
|
|
@PostConstruct
|
|
|
public void init(){
|
|
|
@@ -83,8 +91,22 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
*/
|
|
|
@Override
|
|
|
public int updateTosDevicetypeByTosMsg(TosDevicetype tosDevicetype){
|
|
|
+ TosDevicetype oldTosDeviceType = tosDevicetypeMapper.selectTosDevicetypeByDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
|
int result = tosDevicetypeMapper.updateTosDevicetype(tosDevicetype);
|
|
|
typeCacheService.setCache(tosDevicetype);
|
|
|
+ if(oldTosDeviceType!= null&&!oldTosDeviceType.getDevTypeConfig().equals(tosDevicetype.getDevTypeConfig())) {
|
|
|
+ IotDeviceconn iotDeviceConnQuery = new IotDeviceconn();
|
|
|
+ iotDeviceConnQuery.setDevconnType(IotDeviceconnTypeEnum.COMMON.getCode());
|
|
|
+ iotDeviceConnQuery.setDevtypeBid(iotDeviceConnQuery.getDevconnBid());
|
|
|
+ List<IotDeviceconn> iotDeviceconnList = iotDeviceconnMapper.selectIotDeviceconnList(iotDeviceConnQuery);
|
|
|
+ for(IotDeviceconn iotDeviceconn : iotDeviceconnList){
|
|
|
+ iotDeviceconn.setDevconnConfig(tosDevicetype.getDevTypeConfig());
|
|
|
+ }
|
|
|
+ if(!iotDeviceconnList.isEmpty()){
|
|
|
+ iotDeviceconnMapper.updateBatchByBid(iotDeviceconnList);
|
|
|
+ }
|
|
|
+ sendToIotsMsgService.sendTosDeviceTypeUpdate(tosDevicetype);
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|