Merge remote-tracking branch 'origin/6170' into 6170
This commit is contained in:
@ -82,6 +82,22 @@ public class DeviceBJQController extends BaseController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上传设备logo图片
|
||||
*/
|
||||
@PostMapping("/batchUploadLogo")
|
||||
@FunctionAccessAnnotation("batchUploadLogo")
|
||||
public R<Void> batchUploadLogo(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) {
|
||||
|
||||
MultipartFile file = bo.getFile();
|
||||
if(file.getSize()>1024*1024*2){
|
||||
return R.warn("图片不能大于2M");
|
||||
}
|
||||
appDeviceService.batchUploadLogo(bo);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 灯光模式
|
||||
* 0(关灯),1(强光模式),2(弱光模式), 3(爆闪模式), 4(泛光模式)
|
||||
|
||||
@ -15,6 +15,7 @@ import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
|
||||
import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper;
|
||||
import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper;
|
||||
import com.fuyuanshen.common.core.constant.GlobalConstants;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.core.exception.ServiceException;
|
||||
import com.fuyuanshen.common.core.utils.*;
|
||||
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
||||
@ -172,10 +173,13 @@ public class DeviceBJQBizService {
|
||||
}
|
||||
//设备在线状态
|
||||
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + device.getDeviceImei()+ DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
|
||||
if(StringUtils.isNotBlank(onlineStatus)){
|
||||
vo.setOnlineStatus(1);
|
||||
//设备在线状态
|
||||
if("1".equals(onlineStatus)){
|
||||
vo.setOnlineStatus(1);
|
||||
}else if("2".equals(onlineStatus)){
|
||||
vo.setOnlineStatus(2);
|
||||
}else{
|
||||
vo.setOnlineStatus(0);
|
||||
vo.setOnlineStatus(0);
|
||||
}
|
||||
String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_STATUS_KEY_PREFIX);
|
||||
// 获取电量
|
||||
@ -334,7 +338,10 @@ public class DeviceBJQBizService {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
if(getDeviceStatus(device.getDeviceImei())){
|
||||
throw new ServiceException(device.getDeviceName()+",设备已断开连接");
|
||||
// throw new ServiceException(device.getDeviceName()+",设备已断开连接");
|
||||
log.info(device.getDeviceName()+",设备已断开连接");
|
||||
recordDeviceLog(device.getId(), device.getDeviceName(), "上传开机画面", device.getDeviceName()+",设备已断开连接", AppLoginHelper.getUserId());
|
||||
return;
|
||||
}
|
||||
MultipartFile file = bo.getFile();
|
||||
|
||||
@ -546,4 +553,19 @@ public class DeviceBJQBizService {
|
||||
String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ deviceImei + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ;
|
||||
return RedisUtils.getCacheObject(deviceOnlineStatusRedisKey) == null;
|
||||
}
|
||||
|
||||
public void batchUploadLogo(AppDeviceLogoUploadDto bo) {
|
||||
|
||||
List<Long> deviceIds = bo.getDeviceIds();
|
||||
MultipartFile file = bo.getFile();
|
||||
if (deviceIds == null || deviceIds.isEmpty()) {
|
||||
throw new ServiceException("请选择设备");
|
||||
}
|
||||
for (Long deviceId : deviceIds) {
|
||||
AppDeviceLogoUploadDto dto = new AppDeviceLogoUploadDto();
|
||||
dto.setDeviceId(deviceId);
|
||||
dto.setFile(file);
|
||||
uploadDeviceLogo(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user