|
|
@@ -82,7 +82,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
private DeviceProductBindDeviceService deviceProductBindDeviceService;
|
|
|
|
|
|
/**
|
|
|
- * 同步设备 (设备基础信息)
|
|
|
+ * 同步设备 (设备基础信息) 从物联网来
|
|
|
*
|
|
|
* @param param
|
|
|
* @return
|
|
|
@@ -90,6 +90,17 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
@Override
|
|
|
public ResultContent syncDeviceInfo(DeviceInfoSyncParam param) {
|
|
|
Assert.hasText(param.getDeviceId(), "deviceId不能为空");
|
|
|
+ if (StringUtils.isEmpty(param.getProjectInfoCode())) {
|
|
|
+ return ResultContent.buildFail("projectInfoCode不能为空");
|
|
|
+ }
|
|
|
+ Organization projectInfo = null;
|
|
|
+ if (StringUtils.isNotEmpty(param.getProjectInfoCode())) {
|
|
|
+ projectInfo = organizationDao.findTopByCode(param.getProjectInfoCode());
|
|
|
+ if (ObjectUtils.isEmpty(projectInfo)) {
|
|
|
+ return ResultContent.buildFail("所属项目未找到,同步失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 设备号
|
|
|
String deviceId = param.getDeviceId();
|
|
|
DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
|
|
|
@@ -102,16 +113,14 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
|
|
|
initEntityNoCheckOid(deviceInfo);
|
|
|
BeanUtils.copyProperties(param, deviceInfo, "id");
|
|
|
}
|
|
|
- deviceInfo.setProjectInfoName(organizationServiceImpl.getOrgNameByCode(param.getProjectInfoCode()));
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(param.getProjectInfoCode())) {
|
|
|
- Organization projectInfo = organizationDao.findTopByCode(param.getProjectInfoCode());
|
|
|
- if (ObjectUtils.isNotEmpty(projectInfo)) {
|
|
|
- deviceInfo.setProjectOid(projectInfo.getOid());
|
|
|
- deviceInfo.setAboutOid(projectInfo.getOid());
|
|
|
- deviceInfo.setAboutAuthType(projectInfo.getAuthType());
|
|
|
- }
|
|
|
+ // 所属项目信息
|
|
|
+ if (ObjectUtils.isNotEmpty(projectInfo)) {
|
|
|
+ deviceInfo.setProjectOid(projectInfo.getOid());
|
|
|
+ deviceInfo.setAboutOid(projectInfo.getOid());
|
|
|
+ deviceInfo.setAboutAuthType(projectInfo.getAuthType());
|
|
|
+ deviceInfo.setProjectInfoName(projectInfo.getName());
|
|
|
}
|
|
|
+
|
|
|
deviceInfoDao.save(deviceInfo);
|
|
|
|
|
|
// 修改其他的关联设备信息
|