|
@@ -336,9 +336,9 @@ public class ProjectService {
|
|
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public HttpResult deviceBind(BindDevice bindDevice, HttpServletRequest request) {
|
|
public HttpResult deviceBind(BindDevice bindDevice, HttpServletRequest request) {
|
|
|
-// if (org.apache.commons.lang3.StringUtils.isBlank(bindDevice.getInstallTime())) {
|
|
|
|
|
-// return HttpResult.error("安装设备时间不能为空");
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isBlank(bindDevice.getInstallTime())) {
|
|
|
|
|
+ return HttpResult.error("安装设备时间不能为空");
|
|
|
|
|
+ }
|
|
|
HeaderData headerData = commonService.getHeaderData(request);
|
|
HeaderData headerData = commonService.getHeaderData(request);
|
|
|
Long projectId = Long.parseLong(bindDevice.getProjectId());
|
|
Long projectId = Long.parseLong(bindDevice.getProjectId());
|
|
|
KwsProject project = projectMapper.selectOne(new LambdaQueryWrapper<KwsProject>().eq(KwsProject::getId, projectId));
|
|
KwsProject project = projectMapper.selectOne(new LambdaQueryWrapper<KwsProject>().eq(KwsProject::getId, projectId));
|
|
@@ -428,7 +428,7 @@ public class ProjectService {
|
|
|
deviceMapper.update(null, new LambdaUpdateWrapper<KwsDevice>()
|
|
deviceMapper.update(null, new LambdaUpdateWrapper<KwsDevice>()
|
|
|
.eq(KwsDevice::getId, id)
|
|
.eq(KwsDevice::getId, id)
|
|
|
.set(KwsDevice::getRelevanceLevel, level)
|
|
.set(KwsDevice::getRelevanceLevel, level)
|
|
|
- .set(KwsDevice::getInstallTime,localDateTime)
|
|
|
|
|
|
|
+ .set(KwsDevice::getInstallTime, localDateTime)
|
|
|
.set(KwsDevice::getStatus, DeviceEnum.BE_CHECKING.getCode())
|
|
.set(KwsDevice::getStatus, DeviceEnum.BE_CHECKING.getCode())
|
|
|
.set(KwsDevice::getOnline, 1)
|
|
.set(KwsDevice::getOnline, 1)
|
|
|
.set(KwsDevice::getAlias, bindDevice.getAlias() == null ? kwsDevice.getName() : bindDevice.getAlias())
|
|
.set(KwsDevice::getAlias, bindDevice.getAlias() == null ? kwsDevice.getName() : bindDevice.getAlias())
|
|
@@ -1581,9 +1581,9 @@ public class ProjectService {
|
|
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public HttpResult updateDeviceBind(BindDevice bindDevice, HttpServletRequest request) {
|
|
public HttpResult updateDeviceBind(BindDevice bindDevice, HttpServletRequest request) {
|
|
|
-// if (org.apache.commons.lang3.StringUtils.isBlank(bindDevice.getInstallTime())) {
|
|
|
|
|
-// return HttpResult.error("安装设备时间不能为空");
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isBlank(bindDevice.getInstallTime())) {
|
|
|
|
|
+ return HttpResult.error("安装设备时间不能为空");
|
|
|
|
|
+ }
|
|
|
String deviceRelationId = bindDevice.getDeviceRelationId();
|
|
String deviceRelationId = bindDevice.getDeviceRelationId();
|
|
|
if (StringUtils.isBlank(deviceRelationId)) {
|
|
if (StringUtils.isBlank(deviceRelationId)) {
|
|
|
return HttpResult.error("关联主键id不能为空");
|
|
return HttpResult.error("关联主键id不能为空");
|
|
@@ -1591,6 +1591,13 @@ public class ProjectService {
|
|
|
String bindDeviceId = bindDevice.getBindDeviceId();
|
|
String bindDeviceId = bindDevice.getBindDeviceId();
|
|
|
String deviceIds = bindDevice.getDeviceIds();
|
|
String deviceIds = bindDevice.getDeviceIds();
|
|
|
String alias = bindDevice.getAlias();
|
|
String alias = bindDevice.getAlias();
|
|
|
|
|
+ KwsDeviceRelation kwsDeviceRelation = deviceRelationMapper.selectOne(new LambdaQueryWrapper<KwsDeviceRelation>()
|
|
|
|
|
+ .eq(KwsDeviceRelation::getId, Long.parseLong(bindDeviceId))
|
|
|
|
|
+ .eq(KwsDeviceRelation::getDelFlag, NumberConstant.ZERO)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (kwsDeviceRelation == null) {
|
|
|
|
|
+ return HttpResult.error("修改id传递错误");
|
|
|
|
|
+ }
|
|
|
HeaderData headerData = commonService.getHeaderData(request);
|
|
HeaderData headerData = commonService.getHeaderData(request);
|
|
|
/**验证主设备是否存在子设备*/
|
|
/**验证主设备是否存在子设备*/
|
|
|
// List<KwsDeviceRelation> deviceRelations = deviceRelationMapper.selectList(
|
|
// List<KwsDeviceRelation> deviceRelations = deviceRelationMapper.selectList(
|