|
@@ -1,6 +1,9 @@
|
|
|
package com.yunfeiyun.agmp.iotm.device.service.impl;
|
|
package com.yunfeiyun.agmp.iotm.device.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import com.yunfeiyun.agmp.common.enums.RedisCacheKey;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.framework.manager.RedisCacheManager;
|
|
|
|
|
+import com.yunfeiyun.agmp.common.utils.DictUtils;
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
|
|
import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
|
|
|
import com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDevicetypeListResVo;
|
|
import com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDevicetypeListResVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.domain.resvo.TosDevicetypeResVo;
|
|
import com.yunfeiyun.agmp.iotm.device.domain.resvo.TosDevicetypeResVo;
|
|
@@ -10,6 +13,8 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -25,7 +30,16 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
{
|
|
{
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TosDevicetypeMapper tosDevicetypeMapper;
|
|
private TosDevicetypeMapper tosDevicetypeMapper;
|
|
|
-
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private RedisCacheManager redisCacheManager;
|
|
|
|
|
+
|
|
|
|
|
+ @PostConstruct
|
|
|
|
|
+ public void init(){
|
|
|
|
|
+ List<TosDevicetype> tosDevicetypeList = tosDevicetypeMapper.selectTosDevicetypeList(null);
|
|
|
|
|
+ for(TosDevicetype tosDevicetype : tosDevicetypeList){
|
|
|
|
|
+ redisCacheManager.setCacheObject(RedisCacheKey.IOT_DEVICE_TYPE,tosDevicetype.getDevtypeCode(),tosDevicetype);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询设备类型
|
|
* 查询设备类型
|
|
@@ -57,7 +71,9 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public int insertTosDevicetypeByTosMsg(TosDevicetype tosDevicetype){
|
|
public int insertTosDevicetypeByTosMsg(TosDevicetype tosDevicetype){
|
|
|
- return tosDevicetypeMapper.insertTosDevicetype(tosDevicetype);
|
|
|
|
|
|
|
+ int result = tosDevicetypeMapper.insertTosDevicetype(tosDevicetype);
|
|
|
|
|
+ redisCacheManager.setCacheObject(RedisCacheKey.IOT_DEVICE_TYPE,tosDevicetype.getDevtypeCode(),tosDevicetype);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -68,7 +84,9 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public int updateTosDevicetypeByTosMsg(TosDevicetype tosDevicetype){
|
|
public int updateTosDevicetypeByTosMsg(TosDevicetype tosDevicetype){
|
|
|
- return tosDevicetypeMapper.updateTosDevicetype(tosDevicetype);
|
|
|
|
|
|
|
+ int result = tosDevicetypeMapper.updateTosDevicetype(tosDevicetype);
|
|
|
|
|
+ redisCacheManager.setCacheObject(RedisCacheKey.IOT_DEVICE_TYPE,tosDevicetype.getDevtypeCode(),tosDevicetype);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -86,10 +104,13 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int deleteTosDevicetypeByTosMsg(TosDevicetype tosDevicetype) {
|
|
public int deleteTosDevicetypeByTosMsg(TosDevicetype tosDevicetype) {
|
|
|
|
|
+ int result = 0;
|
|
|
if(null == tosDevicetype){
|
|
if(null == tosDevicetype){
|
|
|
- return 0;
|
|
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
- return tosDevicetypeMapper.deleteTosDevicetypeByDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
|
|
|
|
|
+ result = tosDevicetypeMapper.deleteTosDevicetypeByDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
|
|
|
+ redisCacheManager.deleteObject(RedisCacheKey.IOT_DEVICE_TYPE,tosDevicetype.getDevtypeCode());
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|