|
@@ -24,13 +24,12 @@ import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 设备类型Service业务层处理
|
|
* 设备类型Service业务层处理
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @author 杨晓辉
|
|
* @author 杨晓辉
|
|
|
* @date 2024-11-06
|
|
* @date 2024-11-06
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
-public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
|
|
-{
|
|
|
|
|
|
|
+public class TosDevicetypeServiceImpl implements ITosDevicetypeService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TosDevicetypeMapper tosDevicetypeMapper;
|
|
private TosDevicetypeMapper tosDevicetypeMapper;
|
|
|
@Resource
|
|
@Resource
|
|
@@ -41,12 +40,13 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
private SendToIotsMsgService sendToIotsMsgService;
|
|
private SendToIotsMsgService sendToIotsMsgService;
|
|
|
|
|
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
|
- public void init(){
|
|
|
|
|
|
|
+ public void init() {
|
|
|
List<TosDevicetype> tosDevicetypeList = tosDevicetypeMapper.selectTosDevicetypeList(null);
|
|
List<TosDevicetype> tosDevicetypeList = tosDevicetypeMapper.selectTosDevicetypeList(null);
|
|
|
- for(TosDevicetype tosDevicetype : tosDevicetypeList){
|
|
|
|
|
|
|
+ for (TosDevicetype tosDevicetype : tosDevicetypeList) {
|
|
|
typeCacheService.setCache(tosDevicetype);
|
|
typeCacheService.setCache(tosDevicetype);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询设备类型
|
|
* 查询设备类型
|
|
@@ -55,29 +55,29 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
* @return 设备类型
|
|
* @return 设备类型
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public TosDevicetype selectTosDevicetypeByDevtypeBid(String devtypeBid){
|
|
|
|
|
|
|
+ public TosDevicetype selectTosDevicetypeByDevtypeBid(String devtypeBid) {
|
|
|
return tosDevicetypeMapper.selectTosDevicetypeByDevtypeBid(devtypeBid);
|
|
return tosDevicetypeMapper.selectTosDevicetypeByDevtypeBid(devtypeBid);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询设备类型列表
|
|
* 查询设备类型列表
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @param tosDevicetype 设备类型
|
|
* @param tosDevicetype 设备类型
|
|
|
* @return 设备类型
|
|
* @return 设备类型
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public List<TosDevicetype> selectTosDevicetypeList(TosDevicetype tosDevicetype){
|
|
|
|
|
|
|
+ public List<TosDevicetype> selectTosDevicetypeList(TosDevicetype tosDevicetype) {
|
|
|
return tosDevicetypeMapper.selectTosDevicetypeList(tosDevicetype);
|
|
return tosDevicetypeMapper.selectTosDevicetypeList(tosDevicetype);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 新增设备类型
|
|
* 新增设备类型
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @param tosDevicetype 设备类型
|
|
* @param tosDevicetype 设备类型
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int insertTosDevicetypeByTosMsg(TosDevicetype tosDevicetype){
|
|
|
|
|
|
|
+ public int insertTosDevicetypeByTosMsg(TosDevicetype tosDevicetype) {
|
|
|
int result = tosDevicetypeMapper.insertTosDevicetype(tosDevicetype);
|
|
int result = tosDevicetypeMapper.insertTosDevicetype(tosDevicetype);
|
|
|
typeCacheService.setCache(tosDevicetype);
|
|
typeCacheService.setCache(tosDevicetype);
|
|
|
return result;
|
|
return result;
|
|
@@ -85,24 +85,24 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 修改设备类型
|
|
* 修改设备类型
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @param tosDevicetype 设备类型
|
|
* @param tosDevicetype 设备类型
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int updateTosDevicetypeByTosMsg(TosDevicetype tosDevicetype){
|
|
|
|
|
|
|
+ public int updateTosDevicetypeByTosMsg(TosDevicetype tosDevicetype) {
|
|
|
TosDevicetype oldTosDeviceType = tosDevicetypeMapper.selectTosDevicetypeByDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
TosDevicetype oldTosDeviceType = tosDevicetypeMapper.selectTosDevicetypeByDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
|
int result = tosDevicetypeMapper.updateTosDevicetype(tosDevicetype);
|
|
int result = tosDevicetypeMapper.updateTosDevicetype(tosDevicetype);
|
|
|
typeCacheService.setCache(tosDevicetype);
|
|
typeCacheService.setCache(tosDevicetype);
|
|
|
- if(oldTosDeviceType!= null&&!oldTosDeviceType.getDevTypeConfig().equals(tosDevicetype.getDevTypeConfig())) {
|
|
|
|
|
|
|
+ if (oldTosDeviceType != null && !oldTosDeviceType.getDevTypeConfig().equals(tosDevicetype.getDevTypeConfig())) {
|
|
|
IotDeviceconn iotDeviceConnQuery = new IotDeviceconn();
|
|
IotDeviceconn iotDeviceConnQuery = new IotDeviceconn();
|
|
|
iotDeviceConnQuery.setDevconnType(IotDeviceconnTypeEnum.COMMON.getCode());
|
|
iotDeviceConnQuery.setDevconnType(IotDeviceconnTypeEnum.COMMON.getCode());
|
|
|
- iotDeviceConnQuery.setDevtypeBid(iotDeviceConnQuery.getDevconnBid());
|
|
|
|
|
|
|
+ iotDeviceConnQuery.setDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
|
List<IotDeviceconn> iotDeviceconnList = iotDeviceconnMapper.selectIotDeviceconnList(iotDeviceConnQuery);
|
|
List<IotDeviceconn> iotDeviceconnList = iotDeviceconnMapper.selectIotDeviceconnList(iotDeviceConnQuery);
|
|
|
- for(IotDeviceconn iotDeviceconn : iotDeviceconnList){
|
|
|
|
|
|
|
+ for (IotDeviceconn iotDeviceconn : iotDeviceconnList) {
|
|
|
iotDeviceconn.setDevconnConfig(tosDevicetype.getDevTypeConfig());
|
|
iotDeviceconn.setDevconnConfig(tosDevicetype.getDevTypeConfig());
|
|
|
}
|
|
}
|
|
|
- if(!iotDeviceconnList.isEmpty()){
|
|
|
|
|
|
|
+ if (!iotDeviceconnList.isEmpty()) {
|
|
|
iotDeviceconnMapper.updateBatchByBid(iotDeviceconnList);
|
|
iotDeviceconnMapper.updateBatchByBid(iotDeviceconnList);
|
|
|
}
|
|
}
|
|
|
sendToIotsMsgService.sendTosDeviceTypeUpdate(tosDevicetype);
|
|
sendToIotsMsgService.sendTosDeviceTypeUpdate(tosDevicetype);
|
|
@@ -111,23 +111,22 @@ public class TosDevicetypeServiceImpl implements ITosDevicetypeService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 删除设备类型信息
|
|
* 删除设备类型信息
|
|
|
- *
|
|
|
|
|
- * @param id 设备类型主键
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param devtypeBid 设备类型主键
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int deleteTosDevicetypeByDevtypeBid(String devtypeBid){
|
|
|
|
|
|
|
+ public int deleteTosDevicetypeByDevtypeBid(String devtypeBid) {
|
|
|
return tosDevicetypeMapper.deleteTosDevicetypeByDevtypeBid(devtypeBid);
|
|
return tosDevicetypeMapper.deleteTosDevicetypeByDevtypeBid(devtypeBid);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int deleteTosDevicetypeByTosMsg(TosDevicetype tosDevicetype) {
|
|
public int deleteTosDevicetypeByTosMsg(TosDevicetype tosDevicetype) {
|
|
|
int result = 0;
|
|
int result = 0;
|
|
|
- if(null == tosDevicetype){
|
|
|
|
|
- return result;
|
|
|
|
|
|
|
+ if (null == tosDevicetype) {
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
result = tosDevicetypeMapper.deleteTosDevicetypeByDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
result = tosDevicetypeMapper.deleteTosDevicetypeByDevtypeBid(tosDevicetype.getDevtypeBid());
|
|
|
typeCacheService.deleteCache(tosDevicetype);
|
|
typeCacheService.deleteCache(tosDevicetype);
|