web:更新设备信息
This commit is contained in:
@ -32,7 +32,16 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
||||
|
||||
List<Device> findAllDevices(@Param("criteria") DeviceQueryCriteria criteria);
|
||||
|
||||
Page<AppDeviceVo> queryAppDeviceList(Page<AppDeviceVo> page,@Param("criteria") DeviceQueryCriteria criteria);
|
||||
/**
|
||||
* 根据条件查询
|
||||
*
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
List<Device> findDevices(@Param("criteria") DeviceQueryCriteria criteria);
|
||||
|
||||
Page<AppDeviceVo> queryAppDeviceList(Page<AppDeviceVo> page, @Param("criteria") DeviceQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 获取分配设备的客户
|
||||
*
|
||||
|
@ -31,7 +31,6 @@ import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
||||
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
||||
import com.fuyuanshen.equipment.enums.DeviceActiveStatusEnum;
|
||||
import com.fuyuanshen.equipment.enums.DeviceStatusEnum;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
|
||||
@ -52,7 +51,9 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
@ -205,16 +206,12 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
if (deviceTypes.isEmpty()) {
|
||||
throw new Exception("设备类型不存在!!!");
|
||||
}
|
||||
|
||||
DeviceQueryCriteria queryCriteria = new DeviceQueryCriteria();
|
||||
queryCriteria.setDeviceId(deviceAssignments.getDeviceId());
|
||||
queryCriteria.setCustomerId(LoginHelper.getUserId());
|
||||
queryCriteria.setCurrentOwnerId(LoginHelper.getUserId());
|
||||
List<Device> devices = deviceMapper.findAll(queryCriteria);
|
||||
if (devices.isEmpty()) {
|
||||
Device device = deviceMapper.selectById(deviceAssignments.getDeviceId());
|
||||
if (device == null) {
|
||||
throw new Exception("设备不存在!!!");
|
||||
}
|
||||
Device device = devices.get(0);
|
||||
// 设备类型
|
||||
Long deviceType = device.getDeviceType();
|
||||
|
||||
// 处理上传的图片
|
||||
if (deviceForm.getFile() != null) {
|
||||
@ -226,6 +223,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
// 更新字段
|
||||
BeanUtil.copyProperties(deviceForm, device, true);
|
||||
device.setId(deviceAssignments.getDeviceId());
|
||||
device.setDeviceType(deviceType);
|
||||
device.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
deviceMapper.updateById(device);
|
||||
}
|
||||
|
Reference in New Issue
Block a user