forked from dyf/fys-Multi-tenant
查询设备分享列表(web)
This commit is contained in:
@ -31,7 +31,7 @@ import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
|||||||
@Validated
|
@Validated
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/equipment/alarm")
|
@RequestMapping("api/equipment/alarm")
|
||||||
public class DeviceAlarmController extends BaseController {
|
public class DeviceAlarmController extends BaseController {
|
||||||
|
|
||||||
private final IDeviceAlarmService deviceAlarmService;
|
private final IDeviceAlarmService deviceAlarmService;
|
||||||
@ -39,17 +39,17 @@ public class DeviceAlarmController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询设备告警列表
|
* 查询设备告警列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:alarm:list")
|
// @SaCheckPermission("equipment:alarm:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<DeviceAlarmVo> list(DeviceAlarmBo bo, PageQuery pageQuery) {
|
public TableDataInfo<DeviceAlarmVo> list(DeviceAlarmBo bo, PageQuery pageQuery) {
|
||||||
return deviceAlarmService.queryPageList(bo, pageQuery);
|
return deviceAlarmService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备告警列表
|
* 导出设备告警列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:alarm:export")
|
// @SaCheckPermission("equipment:alarm:export")
|
||||||
@Log(title = "设备告警", businessType = BusinessType.EXPORT)
|
@Log(title = "导出设备告警列表", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(DeviceAlarmBo bo, HttpServletResponse response) {
|
public void export(DeviceAlarmBo bo, HttpServletResponse response) {
|
||||||
List<DeviceAlarmVo> list = deviceAlarmService.queryList(bo);
|
List<DeviceAlarmVo> list = deviceAlarmService.queryList(bo);
|
||||||
@ -61,17 +61,17 @@ public class DeviceAlarmController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:alarm:query")
|
// @SaCheckPermission("equipment:alarm:query")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<DeviceAlarmVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<DeviceAlarmVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long id) {
|
@PathVariable Long id) {
|
||||||
return R.ok(deviceAlarmService.queryById(id));
|
return R.ok(deviceAlarmService.queryById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增设备告警
|
* 新增设备告警
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:alarm:add")
|
// @SaCheckPermission("equipment:alarm:add")
|
||||||
@Log(title = "设备告警", businessType = BusinessType.INSERT)
|
@Log(title = "设备告警", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
@ -82,7 +82,7 @@ public class DeviceAlarmController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 修改设备告警
|
* 修改设备告警
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:alarm:edit")
|
// @SaCheckPermission("equipment:alarm:edit")
|
||||||
@Log(title = "设备告警", businessType = BusinessType.UPDATE)
|
@Log(title = "设备告警", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
@ -95,11 +95,12 @@ public class DeviceAlarmController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param ids 主键串
|
* @param ids 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("equipment:alarm:remove")
|
// @SaCheckPermission("equipment:alarm:remove")
|
||||||
@Log(title = "设备告警", businessType = BusinessType.DELETE)
|
@Log(title = "设备告警", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
@PathVariable Long[] ids) {
|
@PathVariable Long[] ids) {
|
||||||
return toAjax(deviceAlarmService.deleteWithValidByIds(List.of(ids), true));
|
return toAjax(deviceAlarmService.deleteWithValidByIds(List.of(ids), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
|
||||||
|
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
||||||
|
import com.fuyuanshen.web.service.DeviceShareService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备分享管理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-28
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/equipment/share")
|
||||||
|
public class DeviceShareController extends BaseController {
|
||||||
|
|
||||||
|
private final DeviceShareService appDeviceShareService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*查询设备分享列表(web)
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("equipment:alarm:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<AppDeviceShareVo> list(AppDeviceShareBo bo, PageQuery pageQuery) {
|
||||||
|
return appDeviceShareService.queryWebList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -61,32 +61,32 @@ public class DeviceShareService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void buildDeviceStatus(AppDeviceShareVo item) {
|
private static void buildDeviceStatus(AppDeviceShareVo item) {
|
||||||
//设备在线状态
|
// 设备在线状态
|
||||||
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ item.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
|
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + item.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
|
||||||
if(StringUtils.isNotBlank(onlineStatus)){
|
if (StringUtils.isNotBlank(onlineStatus)) {
|
||||||
|
|
||||||
item.setOnlineStatus(1);
|
item.setOnlineStatus(1);
|
||||||
}else{
|
} else {
|
||||||
item.setOnlineStatus(0);
|
item.setOnlineStatus(0);
|
||||||
}
|
}
|
||||||
String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX+ item.getDeviceImei() + DEVICE_STATUS_KEY_PREFIX);
|
String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + item.getDeviceImei() + DEVICE_STATUS_KEY_PREFIX);
|
||||||
// 获取电量
|
// 获取电量
|
||||||
if(StringUtils.isNotBlank(deviceStatus)){
|
if (StringUtils.isNotBlank(deviceStatus)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(deviceStatus);
|
JSONObject jsonObject = JSONObject.parseObject(deviceStatus);
|
||||||
item.setBattery(jsonObject.getString("batteryPercentage"));
|
item.setBattery(jsonObject.getString("batteryPercentage"));
|
||||||
}else{
|
} else {
|
||||||
item.setBattery("0");
|
item.setBattery("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
String location = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ item.getDeviceImei()+ DEVICE_LOCATION_KEY_PREFIX);
|
String location = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + item.getDeviceImei() + DEVICE_LOCATION_KEY_PREFIX);
|
||||||
if(StringUtils.isNotBlank(location)){
|
if (StringUtils.isNotBlank(location)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(location);
|
JSONObject jsonObject = JSONObject.parseObject(location);
|
||||||
item.setLatitude(jsonObject.getString("latitude"));
|
item.setLatitude(jsonObject.getString("latitude"));
|
||||||
item.setLongitude(jsonObject.getString("longitude"));
|
item.setLongitude(jsonObject.getString("longitude"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String alarmStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ item.getDeviceImei()+ DEVICE_ALARM_KEY_PREFIX);
|
String alarmStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + item.getDeviceImei() + DEVICE_ALARM_KEY_PREFIX);
|
||||||
if(StringUtils.isNotBlank(alarmStatus)){
|
if (StringUtils.isNotBlank(alarmStatus)) {
|
||||||
item.setAlarmStatus(alarmStatus);
|
item.setAlarmStatus(alarmStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ public class DeviceShareService {
|
|||||||
LambdaQueryWrapper<AppDeviceShare> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AppDeviceShare> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(AppDeviceShare::getId, id);
|
queryWrapper.eq(AppDeviceShare::getId, id);
|
||||||
List<AppDeviceShareVo> appDeviceShareVos = appDeviceShareMapper.selectVoList(queryWrapper);
|
List<AppDeviceShareVo> appDeviceShareVos = appDeviceShareMapper.selectVoList(queryWrapper);
|
||||||
if(appDeviceShareVos==null || appDeviceShareVos.isEmpty()){
|
if (appDeviceShareVos == null || appDeviceShareVos.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public class DeviceShareService {
|
|||||||
shareDetailVo.setDeviceMac(device.getDeviceMac());
|
shareDetailVo.setDeviceMac(device.getDeviceMac());
|
||||||
|
|
||||||
DeviceType deviceType = deviceTypeMapper.selectById(device.getDeviceType());
|
DeviceType deviceType = deviceTypeMapper.selectById(device.getDeviceType());
|
||||||
if(deviceType!=null){
|
if (deviceType != null) {
|
||||||
shareDetailVo.setCommunicationMode(Integer.valueOf(deviceType.getCommunicationMode()));
|
shareDetailVo.setCommunicationMode(Integer.valueOf(deviceType.getCommunicationMode()));
|
||||||
}
|
}
|
||||||
shareDetailVo.setDevicePic(device.getDevicePic());
|
shareDetailVo.setDevicePic(device.getDevicePic());
|
||||||
@ -125,52 +125,53 @@ public class DeviceShareService {
|
|||||||
LambdaQueryWrapper<AppPersonnelInfo> qw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AppPersonnelInfo> qw = new LambdaQueryWrapper<>();
|
||||||
qw.eq(AppPersonnelInfo::getDeviceId, device.getId());
|
qw.eq(AppPersonnelInfo::getDeviceId, device.getId());
|
||||||
List<AppPersonnelInfoVo> appPersonnelInfoVos = appPersonnelInfoMapper.selectVoList(qw);
|
List<AppPersonnelInfoVo> appPersonnelInfoVos = appPersonnelInfoMapper.selectVoList(qw);
|
||||||
if(appPersonnelInfoVos!=null && !appPersonnelInfoVos.isEmpty()){
|
if (appPersonnelInfoVos != null && !appPersonnelInfoVos.isEmpty()) {
|
||||||
shareDetailVo.setPersonnelInfo(appPersonnelInfoVos.get(0));
|
shareDetailVo.setPersonnelInfo(appPersonnelInfoVos.get(0));
|
||||||
}
|
}
|
||||||
//设备在线状态
|
// 设备在线状态
|
||||||
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + device.getDeviceImei()+ DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
|
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
|
||||||
if(StringUtils.isNotBlank(onlineStatus)){
|
if (StringUtils.isNotBlank(onlineStatus)) {
|
||||||
shareDetailVo.setOnlineStatus(1);
|
shareDetailVo.setOnlineStatus(1);
|
||||||
}else{
|
} else {
|
||||||
shareDetailVo.setOnlineStatus(0);
|
shareDetailVo.setOnlineStatus(0);
|
||||||
}
|
}
|
||||||
String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_STATUS_KEY_PREFIX);
|
String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_STATUS_KEY_PREFIX);
|
||||||
// 获取电量
|
// 获取电量
|
||||||
if(StringUtils.isNotBlank(deviceStatus)){
|
if (StringUtils.isNotBlank(deviceStatus)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(deviceStatus);
|
JSONObject jsonObject = JSONObject.parseObject(deviceStatus);
|
||||||
shareDetailVo.setMainLightMode(jsonObject.getString("mainLightMode"));
|
shareDetailVo.setMainLightMode(jsonObject.getString("mainLightMode"));
|
||||||
shareDetailVo.setLaserLightMode(jsonObject.getString("laserLightMode"));
|
shareDetailVo.setLaserLightMode(jsonObject.getString("laserLightMode"));
|
||||||
shareDetailVo.setBatteryPercentage(jsonObject.getString("batteryPercentage"));
|
shareDetailVo.setBatteryPercentage(jsonObject.getString("batteryPercentage"));
|
||||||
shareDetailVo.setChargeState(jsonObject.getString("chargeState"));
|
shareDetailVo.setChargeState(jsonObject.getString("chargeState"));
|
||||||
shareDetailVo.setBatteryRemainingTime(jsonObject.getString("batteryRemainingTime"));
|
shareDetailVo.setBatteryRemainingTime(jsonObject.getString("batteryRemainingTime"));
|
||||||
}else{
|
} else {
|
||||||
shareDetailVo.setBatteryPercentage("0");
|
shareDetailVo.setBatteryPercentage("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取经度纬度
|
// 获取经度纬度
|
||||||
String locationKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_LOCATION_KEY_PREFIX;
|
String locationKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_LOCATION_KEY_PREFIX;
|
||||||
String locationInfo = RedisUtils.getCacheObject(locationKey);
|
String locationInfo = RedisUtils.getCacheObject(locationKey);
|
||||||
if(StringUtils.isNotBlank(locationInfo)){
|
if (StringUtils.isNotBlank(locationInfo)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(locationInfo);
|
JSONObject jsonObject = JSONObject.parseObject(locationInfo);
|
||||||
shareDetailVo.setLongitude(jsonObject.get("longitude").toString());
|
shareDetailVo.setLongitude(jsonObject.get("longitude").toString());
|
||||||
shareDetailVo.setLatitude(jsonObject.get("latitude").toString());
|
shareDetailVo.setLatitude(jsonObject.get("latitude").toString());
|
||||||
shareDetailVo.setAddress((String)jsonObject.get("address"));
|
shareDetailVo.setAddress((String) jsonObject.get("address"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String alarmStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ device.getDeviceImei()+ DEVICE_ALARM_KEY_PREFIX);
|
String alarmStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DEVICE_ALARM_KEY_PREFIX);
|
||||||
if(StringUtils.isNotBlank(alarmStatus)){
|
if (StringUtils.isNotBlank(alarmStatus)) {
|
||||||
shareDetailVo.setAlarmStatus(alarmStatus);
|
shareDetailVo.setAlarmStatus(alarmStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
String lightBrightness = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ device.getDeviceImei()+ DEVICE_LIGHT_BRIGHTNESS_KEY_PREFIX);
|
String lightBrightness = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DEVICE_LIGHT_BRIGHTNESS_KEY_PREFIX);
|
||||||
if(StringUtils.isNotBlank(lightBrightness)){
|
if (StringUtils.isNotBlank(lightBrightness)) {
|
||||||
shareDetailVo.setLightBrightness(lightBrightness);
|
shareDetailVo.setLightBrightness(lightBrightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
return shareDetailVo;
|
return shareDetailVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验短信验证码
|
* 校验短信验证码
|
||||||
*/
|
*/
|
||||||
@ -181,14 +182,15 @@ public class DeviceShareService {
|
|||||||
}
|
}
|
||||||
return code.equals(smsCode);
|
return code.equals(smsCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deviceShare(AppDeviceShareBo bo) {
|
public int deviceShare(AppDeviceShareBo bo) {
|
||||||
boolean flag = validateSmsCode(AppLoginHelper.getTenantId(), bo.getPhonenumber(), bo.getSmsCode());
|
boolean flag = validateSmsCode(AppLoginHelper.getTenantId(), bo.getPhonenumber(), bo.getSmsCode());
|
||||||
if(!flag){
|
if (!flag) {
|
||||||
throw new ServiceException("验证码错误");
|
throw new ServiceException("验证码错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
Device device = deviceMapper.selectById(bo.getDeviceId());
|
Device device = deviceMapper.selectById(bo.getDeviceId());
|
||||||
if(device==null){
|
if (device == null) {
|
||||||
throw new ServiceException("设备不存在");
|
throw new ServiceException("设备不存在");
|
||||||
}
|
}
|
||||||
Long userId = AppLoginHelper.getUserId();
|
Long userId = AppLoginHelper.getUserId();
|
||||||
@ -196,7 +198,7 @@ public class DeviceShareService {
|
|||||||
lqw.eq(AppDeviceShare::getDeviceId, bo.getDeviceId());
|
lqw.eq(AppDeviceShare::getDeviceId, bo.getDeviceId());
|
||||||
lqw.eq(AppDeviceShare::getPhonenumber, bo.getPhonenumber());
|
lqw.eq(AppDeviceShare::getPhonenumber, bo.getPhonenumber());
|
||||||
Long count = appDeviceShareMapper.selectCount(lqw);
|
Long count = appDeviceShareMapper.selectCount(lqw);
|
||||||
if(count>0){
|
if (count > 0) {
|
||||||
|
|
||||||
UpdateWrapper<AppDeviceShare> uw = new UpdateWrapper<>();
|
UpdateWrapper<AppDeviceShare> uw = new UpdateWrapper<>();
|
||||||
uw.eq("device_id", bo.getDeviceId());
|
uw.eq("device_id", bo.getDeviceId());
|
||||||
@ -206,7 +208,7 @@ public class DeviceShareService {
|
|||||||
uw.set("update_time", new Date());
|
uw.set("update_time", new Date());
|
||||||
|
|
||||||
return appDeviceShareMapper.update(uw);
|
return appDeviceShareMapper.update(uw);
|
||||||
}else {
|
} else {
|
||||||
AppDeviceShare appDeviceShare = new AppDeviceShare();
|
AppDeviceShare appDeviceShare = new AppDeviceShare();
|
||||||
appDeviceShare.setDeviceId(bo.getDeviceId());
|
appDeviceShare.setDeviceId(bo.getDeviceId());
|
||||||
appDeviceShare.setPhonenumber(bo.getPhonenumber());
|
appDeviceShare.setPhonenumber(bo.getPhonenumber());
|
||||||
@ -232,4 +234,19 @@ public class DeviceShareService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备分享列表(web)
|
||||||
|
*
|
||||||
|
* @param bo
|
||||||
|
* @param pageQuery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TableDataInfo<AppDeviceShareVo> queryWebList(AppDeviceShareBo bo, PageQuery pageQuery) {
|
||||||
|
Page<AppDeviceShareVo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
||||||
|
Page<AppDeviceShareVo> result = appDeviceShareMapper.selectWebDeviceShareList(bo, page);
|
||||||
|
List<AppDeviceShareVo> records = result.getRecords();
|
||||||
|
records.forEach(DeviceShareService::buildDeviceStatus);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceAlarmVo> getAlarmRecord(Long deviceId) {
|
public List<DeviceAlarmVo> getAlarmRecord(Long deviceId) {
|
||||||
List<DeviceAlarm> alarmList = deviceAlarmMapper.selectList (
|
List<DeviceAlarm> alarmList = deviceAlarmMapper.selectList(
|
||||||
new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId)
|
new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId)
|
||||||
.orderByDesc("create_time"));
|
.orderByDesc("create_time"));
|
||||||
List<DeviceAlarmVo> deviceAlarmVoList = BeanUtil.copyToList(alarmList, DeviceAlarmVo.class);
|
List<DeviceAlarmVo> deviceAlarmVoList = BeanUtil.copyToList(alarmList, DeviceAlarmVo.class);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.fuyuanshen.app.domain.bo;
|
package com.fuyuanshen.app.domain.bo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||||
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
@ -7,6 +9,8 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备分享业务对象 app_device_share
|
* 设备分享业务对象 app_device_share
|
||||||
*
|
*
|
||||||
@ -35,10 +39,16 @@ public class AppDeviceShareBo extends BaseEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能权限(1:灯光模式;2:激光模式;3:开机画面;4:人员信息登记;5:发送信息;6:产品信息)
|
* 功能权限(1:灯光模式;2:激光模式;3:开机画面;4:人员信息登记;5:发送信息;6:产品信息)
|
||||||
以逗号分隔
|
* 以逗号分隔
|
||||||
*/
|
*/
|
||||||
private String permission;
|
private String permission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享用户
|
||||||
|
* share_user
|
||||||
|
*/
|
||||||
|
private String shareUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
@ -46,4 +56,11 @@ public class AppDeviceShareBo extends BaseEntity {
|
|||||||
|
|
||||||
|
|
||||||
private String smsCode;
|
private String smsCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享时间
|
||||||
|
*/
|
||||||
|
private Date shareStartTime;
|
||||||
|
private Date shareEndTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,13 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
public interface AppDeviceShareMapper extends BaseMapperPlus<AppDeviceShare, AppDeviceShareVo> {
|
public interface AppDeviceShareMapper extends BaseMapperPlus<AppDeviceShare, AppDeviceShareVo> {
|
||||||
IPage<AppDeviceShareVo> otherDeviceShareList(@Param("bo") AppDeviceShareBo bo, Page<AppDeviceShareVo> page);
|
IPage<AppDeviceShareVo> otherDeviceShareList(@Param("bo") AppDeviceShareBo bo, Page<AppDeviceShareVo> page);
|
||||||
|
|
||||||
Page<AppDeviceShareVo> selectAppDeviceShareList(@Param("bo") AppDeviceShareBo bo,Page<AppDeviceShareVo> page);
|
Page<AppDeviceShareVo> selectAppDeviceShareList(@Param("bo") AppDeviceShareBo bo, Page<AppDeviceShareVo> page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备分享列表(web)
|
||||||
|
*
|
||||||
|
* @param bo 设备分享
|
||||||
|
* @return 设备分享
|
||||||
|
*/
|
||||||
|
Page<AppDeviceShareVo> selectWebDeviceShareList(@Param("bo") AppDeviceShareBo bo, Page<AppDeviceShareVo> page);
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceShareMapper">
|
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceShareMapper">
|
||||||
|
|
||||||
<select id="otherDeviceShareList" resultType="com.fuyuanshen.app.domain.vo.AppDeviceShareVo">
|
<select id="otherDeviceShareList" resultType="com.fuyuanshen.app.domain.vo.AppDeviceShareVo">
|
||||||
select d.device_name,
|
select d.device_name,
|
||||||
d.device_mac,
|
d.device_mac,
|
||||||
d.device_sn,
|
d.device_sn,
|
||||||
d.device_imei,
|
d.device_imei,
|
||||||
d.device_pic,
|
d.device_pic,
|
||||||
dt.type_name,
|
dt.type_name,
|
||||||
dt.communication_mode,
|
dt.communication_mode,
|
||||||
dt.app_model_dictionary detailPageUrl,
|
dt.app_model_dictionary detailPageUrl,
|
||||||
d.bluetooth_name,
|
d.bluetooth_name,
|
||||||
c.binding_time,
|
c.binding_time,
|
||||||
ad.*,u.user_name otherPhonenumber
|
ad.*,
|
||||||
from
|
u.user_name otherPhonenumber
|
||||||
app_device_share ad
|
from app_device_share ad
|
||||||
left join device d on ad.device_id = d.id
|
left join device d on ad.device_id = d.id
|
||||||
left join app_user u on ad.create_by = u.user_id
|
left join app_user u on ad.create_by = u.user_id
|
||||||
inner join device_type dt on d.device_type = dt.id
|
inner join device_type dt on d.device_type = dt.id
|
||||||
inner join app_device_bind_record c on d.id = c.device_id
|
inner join app_device_bind_record c on d.id = c.device_id
|
||||||
where ad.phonenumber = #{bo.phonenumber}
|
where ad.phonenumber = #{bo.phonenumber}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAppDeviceShareList" resultType="com.fuyuanshen.app.domain.vo.AppDeviceShareVo">
|
<select id="selectAppDeviceShareList" resultType="com.fuyuanshen.app.domain.vo.AppDeviceShareVo">
|
||||||
@ -47,4 +47,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and ad.device_id = #{bo.deviceId}
|
and ad.device_id = #{bo.deviceId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询设备分享列表(web) -->
|
||||||
|
<select id="selectWebDeviceShareList" resultType="com.fuyuanshen.app.domain.vo.AppDeviceShareVo">
|
||||||
|
select *
|
||||||
|
from
|
||||||
|
app_device_share ad
|
||||||
|
<where>
|
||||||
|
<if test="bo.deviceId != null">
|
||||||
|
and ad.device_id = #{bo.deviceId}
|
||||||
|
</if>
|
||||||
|
<if test="bo.shareUser != null">
|
||||||
|
and ad.share_user = #{bo.shareUser}
|
||||||
|
</if>
|
||||||
|
<if test="criteria.shareStartTime != null and criteria.hareEndTime != null">
|
||||||
|
and d.create_time between #{bo.shareStartTime} and #{bo.shareEndTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Reference in New Issue
Block a user