|
|
@@ -27,6 +27,7 @@ import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceconnService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
@@ -63,6 +64,9 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
@Autowired
|
|
|
private IotDeviceRefreshService iotDeviceRefreshService;
|
|
|
|
|
|
+ @Value("${runMode.dev:1}")
|
|
|
+ private String runMode;
|
|
|
+
|
|
|
/**
|
|
|
* 新增设备基础
|
|
|
*
|
|
|
@@ -111,7 +115,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
selectIotDevice.setFirmBid(firmBid);
|
|
|
selectIotDevice.setDevtypeBid(devtypeBid);
|
|
|
|
|
|
- List<IotDevice> iotDeviceList = selectIotDeviceList(selectIotDevice);
|
|
|
+ List<IotDevice> iotDeviceList = checkIotDeviceList(selectIotDevice);
|
|
|
Set<String> devCodeSet = new HashSet<>();
|
|
|
for (IotDevice iotDevice : iotDeviceList) {
|
|
|
devCodeSet.add(iotDevice.getDevtypeBid() + iotDevice.getDevCode());
|
|
|
@@ -200,7 +204,7 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
selectIotDevice.setDevCode(devCode);
|
|
|
selectIotDevice.setDevtypeBid(newIotDeviceconn.getDevtypeBid());
|
|
|
|
|
|
- List<IotDevice> iotDeviceList = selectIotDeviceList(selectIotDevice);
|
|
|
+ List<IotDevice> iotDeviceList = checkIotDeviceList(selectIotDevice);
|
|
|
Set<String> devSet = new HashSet<>();
|
|
|
for (IotDevice item : iotDeviceList) {
|
|
|
devSet.add(item.getFirmBid() + item.getDevtypeBid() + item.getDevCode());
|
|
|
@@ -278,7 +282,22 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
*/
|
|
|
@Override
|
|
|
public List<IotDevice> selectIotDeviceList(IotDevice iotDevice) {
|
|
|
- iotDevice.setTid(SecurityUtils.getTid());
|
|
|
+ return selectIotDeviceList(iotDevice, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询设备基础列表
|
|
|
+ *
|
|
|
+ * @param iotDevice 设备基础
|
|
|
+ * @return 设备基础
|
|
|
+ */
|
|
|
+ public List<IotDevice> selectIotDeviceList(IotDevice iotDevice, boolean isTid) {
|
|
|
+ // 生产环境
|
|
|
+ if("0".equals(runMode) && !isTid){
|
|
|
+ iotDevice.setTid(null);
|
|
|
+ }else{
|
|
|
+ iotDevice.setTid(SecurityUtils.getTid());
|
|
|
+ }
|
|
|
return iotDeviceMapper.selectIotDeviceList(iotDevice);
|
|
|
}
|
|
|
|
|
|
@@ -368,4 +387,15 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
return iotDeviceMapper.selectIotDeviceListByType(reqVo);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 检查设备基础列表
|
|
|
+ *
|
|
|
+ * @param iotDevice 设备基础
|
|
|
+ * @return 设备基础集合
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<IotDevice> checkIotDeviceList(IotDevice iotDevice) {
|
|
|
+ return selectIotDeviceList(iotDevice, false);
|
|
|
+ }
|
|
|
+
|
|
|
}
|