web端控制中心2
This commit is contained in:
@ -0,0 +1,47 @@
|
|||||||
|
package com.fuyuanshen.app.controller.device;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
|
||||||
|
import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto;
|
||||||
|
import com.fuyuanshen.app.domain.dto.DeviceInstructDto;
|
||||||
|
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
|
||||||
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
|
import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessAnnotation;
|
||||||
|
import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessBatcAnnotation;
|
||||||
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
|
import com.fuyuanshen.equipment.domain.dto.AppDeviceSendMsgBo;
|
||||||
|
import com.fuyuanshen.web.service.device.DeviceBJQBizService;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BJQ6170设备控制类
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/test")
|
||||||
|
public class TestController extends BaseController {
|
||||||
|
|
||||||
|
private final DeviceBJQBizService appDeviceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传设备logo图片
|
||||||
|
*/
|
||||||
|
@PostMapping("/uploadLogo")
|
||||||
|
@FunctionAccessAnnotation("uploadLogo")
|
||||||
|
public R<Void> upload(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) {
|
||||||
|
|
||||||
|
MultipartFile file = bo.getFile();
|
||||||
|
if(file.getSize()>1024*1024*2){
|
||||||
|
return R.warn("图片不能大于2M");
|
||||||
|
}
|
||||||
|
appDeviceService.uploadDeviceLogo2(bo);
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -14,4 +14,5 @@ public class AppDeviceLogoUploadDto {
|
|||||||
*/
|
*/
|
||||||
private MultipartFile file;
|
private MultipartFile file;
|
||||||
|
|
||||||
|
private Integer chunkSize;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BJQ6170设备控制类
|
* web后台:设备控制类
|
||||||
*/
|
*/
|
||||||
@Validated
|
@Validated
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|||||||
@ -1,9 +1,22 @@
|
|||||||
package com.fuyuanshen.web.controller.device;
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.domain.dto.APPReNameDTO;
|
||||||
|
import com.fuyuanshen.app.domain.dto.AppRealTimeStatusDto;
|
||||||
|
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
|
||||||
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
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.dto.AppDeviceBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
||||||
|
import com.fuyuanshen.web.service.device.DeviceBizService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -12,199 +25,74 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: 默苍璃
|
* web后台:设备控制中心
|
||||||
* @date: 2025-08-0810:40
|
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Tag(name = "web后台:设备控制中心", description = "web后台:设备控制中心")
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/api/device/controlCenter")
|
@RequestMapping("/api/device/controlCenter")
|
||||||
public class DeviceControlCenterController {
|
public class DeviceControlCenterController extends BaseController {
|
||||||
|
|
||||||
|
private final DeviceBizService appDeviceService;
|
||||||
/**
|
/**
|
||||||
* 获取设备基本信息
|
* 查询设备列表
|
||||||
* @param deviceId 设备ID
|
|
||||||
* @return 设备基本信息
|
|
||||||
*/
|
*/
|
||||||
@GetMapping("/info/{deviceId}")
|
@GetMapping("/list")
|
||||||
public ResponseEntity<Map<String, Object>> getDeviceInfo(@PathVariable String deviceId) {
|
public TableDataInfo<WebDeviceVo> list(DeviceQueryCriteria bo, PageQuery pageQuery) {
|
||||||
// 实际应用中这里会从数据库查询设备信息
|
return appDeviceService.queryWebDeviceList(bo, pageQuery);
|
||||||
Map<String, Object> deviceInfo = new HashMap<>();
|
|
||||||
deviceInfo.put("deviceName", "6170零零一");
|
|
||||||
deviceInfo.put("deviceModel", "BJQ6170");
|
|
||||||
deviceInfo.put("deviceId", deviceId);
|
|
||||||
deviceInfo.put("status", "在线");
|
|
||||||
deviceInfo.put("batteryLevel", 85);
|
|
||||||
|
|
||||||
return ResponseEntity.ok(deviceInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置灯光模式
|
* 绑定设备
|
||||||
* @param lightModeRequest 灯光模式请求
|
|
||||||
* @return 操作结果
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/light-mode")
|
@PostMapping("/bind")
|
||||||
public ResponseEntity<Map<String, Object>> setLightMode(@RequestBody LightModeRequest lightModeRequest) {
|
public R<Void> bind(@RequestBody AppDeviceBo bo) {
|
||||||
// 实际应用中这里会控制设备灯光
|
return toAjax(appDeviceService.bindDevice(bo));
|
||||||
Map<String, Object> response = new HashMap<>();
|
}
|
||||||
response.put("code", 200);
|
|
||||||
// response.put("message", "灯光模式已设置为: " + lightModeRequest.getMode());
|
|
||||||
// response.put("deviceId", lightModeRequest.getDeviceId());
|
|
||||||
// response.put("mode", lightModeRequest.getMode());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
|
/**
|
||||||
|
* 解绑设备
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/unBind")
|
||||||
|
public R<Void> unBind(Long id) {
|
||||||
|
return toAjax(appDeviceService.unBindDevice(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新人员信息
|
* 查询设备类型列表
|
||||||
* @param personInfo 人员信息
|
|
||||||
* @return 操作结果
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/person-info")
|
@GetMapping(value = "/typeList")
|
||||||
public ResponseEntity<Map<String, Object>> updatePersonInfo(@RequestBody PersonInfo personInfo) {
|
public R<List<APPDeviceTypeVo>> getTypeList() {
|
||||||
// 实际应用中这里会更新数据库
|
List<APPDeviceTypeVo> typeList = appDeviceService.getTypeList();
|
||||||
Map<String, Object> response = new HashMap<>();
|
return R.ok(typeList);
|
||||||
response.put("code", 200);
|
|
||||||
response.put("message", "人员信息已更新");
|
|
||||||
// response.put("unit", personInfo.getUnit());
|
|
||||||
// response.put("position", personInfo.getPosition());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理开机画面内容
|
* 重命名设备
|
||||||
* @param bootScreenRequest 开机画面请求
|
*
|
||||||
* @return 操作结果
|
* @param reNameDTO
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/boot-screen")
|
@PostMapping(value = "/reName")
|
||||||
public ResponseEntity<Map<String, Object>> manageBootScreen(@RequestBody BootScreenRequest bootScreenRequest) {
|
public R<String> reName(@Validated @RequestBody APPReNameDTO reNameDTO) {
|
||||||
// 实际应用中这里会更新设备开机画面
|
appDeviceService.reName(reNameDTO);
|
||||||
Map<String, Object> response = new HashMap<>();
|
return R.ok("重命名成功!!!");
|
||||||
response.put("code", 200);
|
}
|
||||||
response.put("message", "开机画面内容已更新");
|
|
||||||
// response.put("deviceId", bootScreenRequest.getDeviceId());
|
|
||||||
// response.put("screens", bootScreenRequest.getScreens());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
|
@GetMapping("/realTimeStatus")
|
||||||
|
public R<Map<String, Object>> getRealTimeStatus(AppRealTimeStatusDto statusDto) {
|
||||||
|
Map<String, Object> status = appDeviceService.getRealTimeStatus(statusDto);
|
||||||
|
return R.ok(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置灯光亮度
|
* 根据mac查询设备信息
|
||||||
* @param brightnessRequest 亮度请求
|
|
||||||
* @return 操作结果
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/brightness")
|
@GetMapping("/getDeviceInfoByDeviceMac")
|
||||||
public ResponseEntity<Map<String, Object>> setBrightness(@RequestBody BrightnessRequest brightnessRequest) {
|
public R<AppDeviceVo> getDeviceInfo(String deviceMac) {
|
||||||
// 实际应用中这里会控制设备亮度
|
return R.ok(appDeviceService.getDeviceInfo(deviceMac));
|
||||||
Map<String, Object> response = new HashMap<>();
|
|
||||||
response.put("code", 200);
|
|
||||||
// response.put("message", "灯光亮度已设置为: " + brightnessRequest.getBrightness() + "%");
|
|
||||||
// response.put("deviceId", brightnessRequest.getDeviceId());
|
|
||||||
// response.put("brightness", brightnessRequest.getBrightness());
|
|
||||||
// response.put("forceAlarm", brightnessRequest.isForceAlarm());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设备位置信息
|
|
||||||
* @param deviceId 设备ID
|
|
||||||
* @return 位置信息
|
|
||||||
*/
|
|
||||||
@GetMapping("/location/{deviceId}")
|
|
||||||
public ResponseEntity<Map<String, Object>> getLocation(@PathVariable String deviceId) {
|
|
||||||
// 实际应用中这里会从设备获取实时位置
|
|
||||||
Map<String, Object> locationInfo = new HashMap<>();
|
|
||||||
locationInfo.put("deviceId", deviceId);
|
|
||||||
locationInfo.put("longitude", "114°7'E");
|
|
||||||
locationInfo.put("latitude", "30'28'N");
|
|
||||||
locationInfo.put("address", "湖北省武汉市洪山区光谷大道国际企业中心");
|
|
||||||
locationInfo.put("timestamp", new Date());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(locationInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送紧急消息
|
|
||||||
* @param messageRequest 消息请求
|
|
||||||
* @return 操作结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/send-message")
|
|
||||||
public ResponseEntity<Map<String, Object>> sendMessage(@RequestBody MessageRequest messageRequest) {
|
|
||||||
// 实际应用中这里会向设备发送消息
|
|
||||||
Map<String, Object> response = new HashMap<>();
|
|
||||||
response.put("code", 200);
|
|
||||||
response.put("message", "消息已发送");
|
|
||||||
// response.put("deviceId", messageRequest.getDeviceId());
|
|
||||||
// response.put("content", messageRequest.getContent());
|
|
||||||
response.put("timestamp", new Date());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理操作视频
|
|
||||||
* @param videoRequest 视频请求
|
|
||||||
* @return 操作结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/operation-video")
|
|
||||||
public ResponseEntity<Map<String, Object>> manageOperationVideo(@RequestBody VideoRequest videoRequest) {
|
|
||||||
// 实际应用中这里会更新设备操作视频
|
|
||||||
Map<String, Object> response = new HashMap<>();
|
|
||||||
response.put("code", 200);
|
|
||||||
response.put("message", "操作视频已更新");
|
|
||||||
// response.put("deviceId", videoRequest.getDeviceId());
|
|
||||||
// response.put("videoUrl", videoRequest.getVideoUrl());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 请求对象类定义
|
|
||||||
public static class LightModeRequest {
|
|
||||||
private String deviceId;
|
|
||||||
private String mode; // 强光、弱光、爆闪、泛光、激光
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PersonInfo {
|
|
||||||
private String deviceId;
|
|
||||||
private String unit; // 单位
|
|
||||||
private String position; // 职位
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BootScreenRequest {
|
|
||||||
private String deviceId;
|
|
||||||
private List<String> screens; // 产品参数、操作说明等
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BrightnessRequest {
|
|
||||||
private String deviceId;
|
|
||||||
private int brightness; // 0-100
|
|
||||||
private boolean forceAlarm; // 强制报警
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class MessageRequest {
|
|
||||||
private String deviceId;
|
|
||||||
private String content; // 消息内容
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class VideoRequest {
|
|
||||||
private String deviceId;
|
|
||||||
private String videoUrl; // 视频链接
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import java.util.Map;
|
|||||||
public class WEBDeviceController extends BaseController {
|
public class WEBDeviceController extends BaseController {
|
||||||
|
|
||||||
private final WEBDeviceService deviceService;
|
private final WEBDeviceService deviceService;
|
||||||
private final DeviceBizService appDeviceService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,66 +53,7 @@ public class WEBDeviceController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询设备列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo<AppDeviceVo> list(DeviceQueryCriteria bo, PageQuery pageQuery) {
|
|
||||||
return appDeviceService.queryAppDeviceList(bo, pageQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定设备
|
|
||||||
*/
|
|
||||||
@PostMapping("/bind")
|
|
||||||
public R<Void> bind(@RequestBody AppDeviceBo bo) {
|
|
||||||
return toAjax(appDeviceService.bindDevice(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解绑设备
|
|
||||||
*/
|
|
||||||
@DeleteMapping("/unBind")
|
|
||||||
public R<Void> unBind(Long id) {
|
|
||||||
return toAjax(appDeviceService.unBindDevice(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询设备类型列表
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/typeList")
|
|
||||||
public R<List<APPDeviceTypeVo>> getTypeList() {
|
|
||||||
List<APPDeviceTypeVo> typeList = appDeviceService.getTypeList();
|
|
||||||
return R.ok(typeList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 重命名设备
|
|
||||||
*
|
|
||||||
* @param reNameDTO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping(value = "/reName")
|
|
||||||
public R<String> reName(@Validated @RequestBody APPReNameDTO reNameDTO) {
|
|
||||||
appDeviceService.reName(reNameDTO);
|
|
||||||
return R.ok("重命名成功!!!");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/realTimeStatus")
|
|
||||||
public R<Map<String, Object>> getRealTimeStatus(AppRealTimeStatusDto statusDto) {
|
|
||||||
Map<String, Object> status = appDeviceService.getRealTimeStatus(statusDto);
|
|
||||||
return R.ok(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据mac查询设备信息
|
|
||||||
*/
|
|
||||||
@GetMapping("/getDeviceInfoByDeviceMac")
|
|
||||||
public R<AppDeviceVo> getDeviceInfo(String deviceMac) {
|
|
||||||
return R.ok(appDeviceService.getDeviceInfo(deviceMac));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,19 @@
|
|||||||
package com.fuyuanshen.web.service.device;
|
package com.fuyuanshen.web.service.device;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.fuyuanshen.app.domain.AppPersonnelInfo;
|
import com.fuyuanshen.app.domain.AppPersonnelInfo;
|
||||||
|
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||||
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
|
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
|
||||||
import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto;
|
import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto;
|
||||||
import com.fuyuanshen.app.domain.dto.DeviceInstructDto;
|
import com.fuyuanshen.app.domain.dto.DeviceInstructDto;
|
||||||
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
|
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
|
||||||
import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
|
import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
|
||||||
import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper;
|
import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper;
|
||||||
|
import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper;
|
||||||
import com.fuyuanshen.common.core.constant.GlobalConstants;
|
import com.fuyuanshen.common.core.constant.GlobalConstants;
|
||||||
import com.fuyuanshen.common.core.exception.ServiceException;
|
import com.fuyuanshen.common.core.exception.ServiceException;
|
||||||
import com.fuyuanshen.common.core.utils.*;
|
import com.fuyuanshen.common.core.utils.*;
|
||||||
@ -50,6 +53,7 @@ public class DeviceBJQBizService {
|
|||||||
|
|
||||||
private final DeviceMapper deviceMapper;
|
private final DeviceMapper deviceMapper;
|
||||||
private final AppPersonnelInfoMapper appPersonnelInfoMapper;
|
private final AppPersonnelInfoMapper appPersonnelInfoMapper;
|
||||||
|
private final AppPersonnelInfoRecordsMapper appPersonnelInfoRecordsMapper;
|
||||||
private final DeviceTypeMapper deviceTypeMapper;
|
private final DeviceTypeMapper deviceTypeMapper;
|
||||||
private final MqttGateway mqttGateway;
|
private final MqttGateway mqttGateway;
|
||||||
private final DeviceLogMapper deviceLogMapper;
|
private final DeviceLogMapper deviceLogMapper;
|
||||||
@ -242,11 +246,18 @@ public class DeviceBJQBizService {
|
|||||||
map.put("instruct", intData);
|
map.put("instruct", intData);
|
||||||
mqttGateway.sendMsgToMqtt(MqttConstants.GLOBAL_PUB_KEY + deviceObj.getDeviceImei(), 1, JSON.toJSONString(map));
|
mqttGateway.sendMsgToMqtt(MqttConstants.GLOBAL_PUB_KEY + deviceObj.getDeviceImei(), 1, JSON.toJSONString(map));
|
||||||
log.info("发送点阵数据到设备消息=>topic:{},payload:{}", MqttConstants.GLOBAL_PUB_KEY + deviceObj.getDeviceImei(), bo);
|
log.info("发送点阵数据到设备消息=>topic:{},payload:{}", MqttConstants.GLOBAL_PUB_KEY + deviceObj.getDeviceImei(), bo);
|
||||||
|
String logContent = "单位:"+bo.getUnitName()+",职位:"+bo.getPosition()+",姓名:"+bo.getName()+",ID:"+bo.getCode();
|
||||||
recordDeviceLog(deviceId, deviceObj.getDeviceName(), "人员信息登记", JSON.toJSONString(bo), AppLoginHelper.getUserId());
|
recordDeviceLog(deviceId, deviceObj.getDeviceName(), "人员信息登记", logContent, AppLoginHelper.getUserId());
|
||||||
if (ObjectUtils.length(appPersonnelInfoVos) == 0) {
|
if (ObjectUtils.length(appPersonnelInfoVos) == 0) {
|
||||||
AppPersonnelInfo appPersonnelInfo = MapstructUtils.convert(bo, AppPersonnelInfo.class);
|
AppPersonnelInfo appPersonnelInfo = MapstructUtils.convert(bo, AppPersonnelInfo.class);
|
||||||
return appPersonnelInfoMapper.insertOrUpdate(appPersonnelInfo);
|
appPersonnelInfoMapper.insertOrUpdate(appPersonnelInfo);
|
||||||
|
|
||||||
|
AppPersonnelInfoRecords appPersonnelInfoRecords = new AppPersonnelInfoRecords();
|
||||||
|
BeanUtil.copyProperties(appPersonnelInfo, appPersonnelInfoRecords);
|
||||||
|
appPersonnelInfoRecords.setId(null);
|
||||||
|
appPersonnelInfoRecords.setPersonnelId(appPersonnelInfo.getId());
|
||||||
|
|
||||||
|
appPersonnelInfoRecordsMapper.insert(appPersonnelInfoRecords);
|
||||||
} else {
|
} else {
|
||||||
UpdateWrapper<AppPersonnelInfo> uw = new UpdateWrapper<>();
|
UpdateWrapper<AppPersonnelInfo> uw = new UpdateWrapper<>();
|
||||||
uw.eq("device_id", deviceId)
|
uw.eq("device_id", deviceId)
|
||||||
@ -254,10 +265,52 @@ public class DeviceBJQBizService {
|
|||||||
.set("position", bo.getPosition())
|
.set("position", bo.getPosition())
|
||||||
.set("unit_name", bo.getUnitName())
|
.set("unit_name", bo.getUnitName())
|
||||||
.set("code", bo.getCode());
|
.set("code", bo.getCode());
|
||||||
return appPersonnelInfoMapper.update(null, uw) > 0;
|
appPersonnelInfoMapper.update(null, uw);
|
||||||
|
|
||||||
|
AppPersonnelInfoVo personnelInfoVo = appPersonnelInfoVos.get(0);
|
||||||
|
AppPersonnelInfo appPersonnelInfo = MapstructUtils.convert(bo, AppPersonnelInfo.class);
|
||||||
|
AppPersonnelInfoRecords appPersonnelInfoRecords = new AppPersonnelInfoRecords();
|
||||||
|
BeanUtil.copyProperties(appPersonnelInfo, appPersonnelInfoRecords);
|
||||||
|
appPersonnelInfoRecords.setId(null);
|
||||||
|
appPersonnelInfoRecords.setPersonnelId(personnelInfoVo.getId());
|
||||||
|
appPersonnelInfoRecordsMapper.insert(appPersonnelInfoRecords);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public void uploadDeviceLogo2(AppDeviceLogoUploadDto bo) {
|
||||||
|
try {
|
||||||
|
Device device = deviceMapper.selectById(bo.getDeviceId());
|
||||||
|
if (device == null) {
|
||||||
|
throw new ServiceException("设备不存在");
|
||||||
|
}
|
||||||
|
MultipartFile file = bo.getFile();
|
||||||
|
|
||||||
|
byte[] largeData = ImageToCArrayConverter.convertImageToCArray(file.getInputStream(), 160, 80, 25600);
|
||||||
|
|
||||||
|
log.info("长度:" + largeData.length);
|
||||||
|
// 在获取 largeData 后,将其与前缀合并
|
||||||
|
byte[] prefix = new byte[]{0x50, 0x49, 0x43, 0x54, 0x55, 0x52, 0x45}; // "PICTURE"
|
||||||
|
byte[] combinedData = new byte[prefix.length + largeData.length];
|
||||||
|
System.arraycopy(prefix, 0, combinedData, 0, prefix.length);
|
||||||
|
System.arraycopy(largeData, 0, combinedData, prefix.length, largeData.length);
|
||||||
|
|
||||||
|
// 将 combinedData 转换为十六进制表示
|
||||||
|
String[] hexArray = new String[combinedData.length];
|
||||||
|
for (int i = 0; i < combinedData.length; i++) {
|
||||||
|
hexArray[i] = String.format("0x%02X", combinedData[i]);
|
||||||
|
}
|
||||||
|
// Map<String, Object> map = new HashMap<>();
|
||||||
|
// map.put("instruct", combinedData);
|
||||||
|
String[] specificChunk = ImageToCArrayConverter.getChunk2(hexArray, 0, bo.getChunkSize());
|
||||||
|
mqttGateway.sendMsgToMqtt(MqttConstants.GLOBAL_PUB_KEY+device.getDeviceImei(), 1 , Arrays.toString(specificChunk));
|
||||||
|
log.info("发送点阵数据到设备消息=>topic:{},payload:{}", MqttConstants.GLOBAL_PUB_KEY+device.getDeviceImei(),Arrays.toString(specificChunk));
|
||||||
|
|
||||||
|
recordDeviceLog(device.getId(), device.getDeviceName(), "上传开机画面", "上传开机画面", AppLoginHelper.getUserId());
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new ServiceException("发送指令失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadDeviceLogo(AppDeviceLogoUploadDto bo) {
|
public void uploadDeviceLogo(AppDeviceLogoUploadDto bo) {
|
||||||
try {
|
try {
|
||||||
Device device = deviceMapper.selectById(bo.getDeviceId());
|
Device device = deviceMapper.selectById(bo.getDeviceId());
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import com.fuyuanshen.equipment.domain.Device;
|
|||||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
||||||
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||||
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceLogMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceLogMapper;
|
||||||
@ -123,6 +124,47 @@ public class DeviceBizService {
|
|||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TableDataInfo<WebDeviceVo> queryWebDeviceList(DeviceQueryCriteria bo, PageQuery pageQuery) {
|
||||||
|
Page<WebDeviceVo> result = deviceMapper.queryWebDeviceList(pageQuery.build(), bo);
|
||||||
|
List<WebDeviceVo> records = result.getRecords();
|
||||||
|
if(records != null && !records.isEmpty()){
|
||||||
|
records.forEach(item -> {
|
||||||
|
if(item.getCommunicationMode()!=null && item.getCommunicationMode() == 0){
|
||||||
|
|
||||||
|
//设备在线状态
|
||||||
|
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ item.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
|
||||||
|
if(StringUtils.isNotBlank(onlineStatus)){
|
||||||
|
|
||||||
|
item.setOnlineStatus(1);
|
||||||
|
}else{
|
||||||
|
item.setOnlineStatus(0);
|
||||||
|
}
|
||||||
|
String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX+ item.getDeviceImei() + DEVICE_STATUS_KEY_PREFIX);
|
||||||
|
// 获取电量
|
||||||
|
if(StringUtils.isNotBlank(deviceStatus)){
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(deviceStatus);
|
||||||
|
item.setBattery(jsonObject.getString("batteryPercentage"));
|
||||||
|
}else{
|
||||||
|
item.setBattery("0");
|
||||||
|
}
|
||||||
|
|
||||||
|
String location = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ item.getDeviceImei()+ DEVICE_LOCATION_KEY_PREFIX);
|
||||||
|
if(StringUtils.isNotBlank(location)){
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(location);
|
||||||
|
item.setLatitude(jsonObject.getString("latitude"));
|
||||||
|
item.setLongitude(jsonObject.getString("longitude"));
|
||||||
|
}
|
||||||
|
|
||||||
|
String alarmStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ item.getDeviceImei()+ DEVICE_ALARM_KEY_PREFIX);
|
||||||
|
if(StringUtils.isNotBlank(alarmStatus)){
|
||||||
|
item.setAlarmStatus(alarmStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
public int bindDevice(AppDeviceBo bo) {
|
public int bindDevice(AppDeviceBo bo) {
|
||||||
Integer mode = bo.getCommunicationMode();
|
Integer mode = bo.getCommunicationMode();
|
||||||
Long userId = AppLoginHelper.getUserId();
|
Long userId = AppLoginHelper.getUserId();
|
||||||
|
|||||||
@ -88,6 +88,24 @@ public class ImageToCArrayConverter {
|
|||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[] getChunk2(String[] data, int chunkIndex, int chunkSize) {
|
||||||
|
if (data == null || chunkSize <= 0 || chunkIndex < 0) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
int start = chunkIndex * chunkSize;
|
||||||
|
if (start >= data.length) {
|
||||||
|
return new String[0]; // 索引超出范围
|
||||||
|
}
|
||||||
|
|
||||||
|
int end = Math.min(start + chunkSize, data.length);
|
||||||
|
int length = end - start;
|
||||||
|
|
||||||
|
String[] chunk = new String[length];
|
||||||
|
System.arraycopy(data, start, chunk, 0, length);
|
||||||
|
return chunk;
|
||||||
|
}
|
||||||
|
|
||||||
public static void buildArr(int[] data,List<Integer> intData){
|
public static void buildArr(int[] data,List<Integer> intData){
|
||||||
for (int datum : data) {
|
for (int datum : data) {
|
||||||
intData.add(datum);
|
intData.add(datum);
|
||||||
|
|||||||
@ -0,0 +1,105 @@
|
|||||||
|
package com.fuyuanshen.app.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import com.fuyuanshen.common.log.annotation.Log;
|
||||||
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
|
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||||
|
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||||
|
import com.fuyuanshen.app.domain.vo.AppPersonnelInfoRecordsVo;
|
||||||
|
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoRecordsBo;
|
||||||
|
import com.fuyuanshen.app.service.IAppPersonnelInfoRecordsService;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息登记记录
|
||||||
|
*
|
||||||
|
* @author CYT
|
||||||
|
* @date 2025-08-22
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/personnelInfoRecords")
|
||||||
|
public class AppPersonnelInfoRecordsController extends BaseController {
|
||||||
|
|
||||||
|
private final IAppPersonnelInfoRecordsService appPersonnelInfoRecordsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询人员信息登记记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("app:personnelInfoRecords:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<AppPersonnelInfoRecordsVo> list(AppPersonnelInfoRecordsBo bo, PageQuery pageQuery) {
|
||||||
|
return appPersonnelInfoRecordsService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出人员信息登记记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("app:personnelInfoRecords:export")
|
||||||
|
@Log(title = "人员信息登记记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(AppPersonnelInfoRecordsBo bo, HttpServletResponse response) {
|
||||||
|
List<AppPersonnelInfoRecordsVo> list = appPersonnelInfoRecordsService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "人员信息登记记录", AppPersonnelInfoRecordsVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取人员信息登记记录详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("app:personnelInfoRecords:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<AppPersonnelInfoRecordsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(appPersonnelInfoRecordsService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增人员信息登记记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("app:personnelInfoRecords:add")
|
||||||
|
@Log(title = "人员信息登记记录", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody AppPersonnelInfoRecordsBo bo) {
|
||||||
|
return toAjax(appPersonnelInfoRecordsService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人员信息登记记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("app:personnelInfoRecords:edit")
|
||||||
|
@Log(title = "人员信息登记记录", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AppPersonnelInfoRecordsBo bo) {
|
||||||
|
return toAjax(appPersonnelInfoRecordsService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除人员信息登记记录
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("app:personnelInfoRecords:remove")
|
||||||
|
@Log(title = "人员信息登记记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(appPersonnelInfoRecordsService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package com.fuyuanshen.app.domain;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息登记记录对象 app_personnel_info_records
|
||||||
|
*
|
||||||
|
* @author CYT
|
||||||
|
* @date 2025-08-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("app_personnel_info_records")
|
||||||
|
public class AppPersonnelInfoRecords extends TenantEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long personnelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位
|
||||||
|
*/
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位名称
|
||||||
|
*/
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送信息
|
||||||
|
*/
|
||||||
|
private String sendMsg;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
package com.fuyuanshen.app.domain.bo;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||||
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息登记记录业务对象 app_personnel_info_records
|
||||||
|
*
|
||||||
|
* @author CYT
|
||||||
|
* @date 2025-08-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = AppPersonnelInfoRecords.class, reverseConvertGenerate = false)
|
||||||
|
public class AppPersonnelInfoRecordsBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long personnelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位
|
||||||
|
*/
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位名称
|
||||||
|
*/
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送信息
|
||||||
|
*/
|
||||||
|
private String sendMsg;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
package com.fuyuanshen.app.domain.vo;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息登记记录视图对象 app_personnel_info_records
|
||||||
|
*
|
||||||
|
* @author CYT
|
||||||
|
* @date 2025-08-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = AppPersonnelInfoRecords.class)
|
||||||
|
public class AppPersonnelInfoRecordsVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备id")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键")
|
||||||
|
private Long personnelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员姓名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "人员姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "职位")
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "单位名称")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "ID号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送信息
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "发送信息")
|
||||||
|
private String sendMsg;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.fuyuanshen.app.mapper;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||||
|
import com.fuyuanshen.app.domain.vo.AppPersonnelInfoRecordsVo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息登记记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author CYT
|
||||||
|
* @date 2025-08-22
|
||||||
|
*/
|
||||||
|
public interface AppPersonnelInfoRecordsMapper extends BaseMapperPlus<AppPersonnelInfoRecords, AppPersonnelInfoRecordsVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.fuyuanshen.app.service;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.domain.vo.AppPersonnelInfoRecordsVo;
|
||||||
|
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoRecordsBo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息登记记录Service接口
|
||||||
|
*
|
||||||
|
* @author CYT
|
||||||
|
* @date 2025-08-22
|
||||||
|
*/
|
||||||
|
public interface IAppPersonnelInfoRecordsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询人员信息登记记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 人员信息登记记录
|
||||||
|
*/
|
||||||
|
AppPersonnelInfoRecordsVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询人员信息登记记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 人员信息登记记录分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<AppPersonnelInfoRecordsVo> queryPageList(AppPersonnelInfoRecordsBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的人员信息登记记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 人员信息登记记录列表
|
||||||
|
*/
|
||||||
|
List<AppPersonnelInfoRecordsVo> queryList(AppPersonnelInfoRecordsBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增人员信息登记记录
|
||||||
|
*
|
||||||
|
* @param bo 人员信息登记记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(AppPersonnelInfoRecordsBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人员信息登记记录
|
||||||
|
*
|
||||||
|
* @param bo 人员信息登记记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(AppPersonnelInfoRecordsBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除人员信息登记记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
package com.fuyuanshen.app.service.impl;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||||
|
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoRecordsBo;
|
||||||
|
import com.fuyuanshen.app.domain.vo.AppPersonnelInfoRecordsVo;
|
||||||
|
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||||
|
import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper;
|
||||||
|
import com.fuyuanshen.app.service.IAppPersonnelInfoRecordsService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息登记记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author CYT
|
||||||
|
* @date 2025-08-22
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class AppPersonnelInfoRecordsServiceImpl implements IAppPersonnelInfoRecordsService {
|
||||||
|
|
||||||
|
private final AppPersonnelInfoRecordsMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询人员信息登记记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 人员信息登记记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AppPersonnelInfoRecordsVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询人员信息登记记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 人员信息登记记录分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<AppPersonnelInfoRecordsVo> queryPageList(AppPersonnelInfoRecordsBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<AppPersonnelInfoRecords> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<AppPersonnelInfoRecordsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的人员信息登记记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 人员信息登记记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AppPersonnelInfoRecordsVo> queryList(AppPersonnelInfoRecordsBo bo) {
|
||||||
|
LambdaQueryWrapper<AppPersonnelInfoRecords> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<AppPersonnelInfoRecords> buildQueryWrapper(AppPersonnelInfoRecordsBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<AppPersonnelInfoRecords> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(AppPersonnelInfoRecords::getId);
|
||||||
|
lqw.eq(bo.getDeviceId() != null, AppPersonnelInfoRecords::getDeviceId, bo.getDeviceId());
|
||||||
|
lqw.eq(bo.getPersonnelId() != null, AppPersonnelInfoRecords::getPersonnelId, bo.getPersonnelId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getName()), AppPersonnelInfoRecords::getName, bo.getName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getPosition()), AppPersonnelInfoRecords::getPosition, bo.getPosition());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getUnitName()), AppPersonnelInfoRecords::getUnitName, bo.getUnitName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getCode()), AppPersonnelInfoRecords::getCode, bo.getCode());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getSendMsg()), AppPersonnelInfoRecords::getSendMsg, bo.getSendMsg());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增人员信息登记记录
|
||||||
|
*
|
||||||
|
* @param bo 人员信息登记记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(AppPersonnelInfoRecordsBo bo) {
|
||||||
|
AppPersonnelInfoRecords add = MapstructUtils.convert(bo, AppPersonnelInfoRecords.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人员信息登记记录
|
||||||
|
*
|
||||||
|
* @param bo 人员信息登记记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(AppPersonnelInfoRecordsBo bo) {
|
||||||
|
AppPersonnelInfoRecords update = MapstructUtils.convert(bo, AppPersonnelInfoRecords.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(AppPersonnelInfoRecords entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除人员信息登记记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -66,8 +66,14 @@ public class DeviceQueryCriteria extends BaseEntity {
|
|||||||
/* app绑定用户id */
|
/* app绑定用户id */
|
||||||
private Long bindingUserId;
|
private Long bindingUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用人员
|
||||||
|
*/
|
||||||
|
private String personnelBy;
|
||||||
|
|
||||||
/* 是否为管理员 */
|
/* 是否为管理员 */
|
||||||
private Boolean isAdmin = false;
|
private Boolean isAdmin = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,95 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WebDeviceVo implements Serializable {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备IMEI
|
||||||
|
*/
|
||||||
|
private String deviceImei;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
*/
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通讯方式 0:4G;1:蓝牙
|
||||||
|
*/
|
||||||
|
private Integer communicationMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备图片
|
||||||
|
*/
|
||||||
|
private String devicePic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型
|
||||||
|
*/
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 蓝牙名称
|
||||||
|
*/
|
||||||
|
private String bluetoothName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用人员
|
||||||
|
*/
|
||||||
|
private String personnelBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态
|
||||||
|
* 0 失效
|
||||||
|
* 1 正常
|
||||||
|
*/
|
||||||
|
private Integer deviceStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定时间
|
||||||
|
*/
|
||||||
|
private Date bindingTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线状态(0离线,1在线)
|
||||||
|
*/
|
||||||
|
private Integer onlineStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电量 百分比
|
||||||
|
*/
|
||||||
|
private String battery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private String latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private String longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警状态(0解除告警,1告警)
|
||||||
|
*/
|
||||||
|
private String alarmStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备详情页面
|
||||||
|
*/
|
||||||
|
private String detailPageUrl;
|
||||||
|
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.fuyuanshen.equipment.domain.Device;
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -68,4 +69,6 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
|||||||
List<Device> findByOriginalDeviceId(Long originalDeviceId);
|
List<Device> findByOriginalDeviceId(Long originalDeviceId);
|
||||||
|
|
||||||
AppDeviceVo getDeviceInfo(@Param("deviceMac") String deviceMac);
|
AppDeviceVo getDeviceInfo(@Param("deviceMac") String deviceMac);
|
||||||
|
|
||||||
|
Page<WebDeviceVo> queryWebDeviceList(Page<Object> build, DeviceQueryCriteria bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -232,5 +232,46 @@
|
|||||||
inner join device_type dt on d.device_type = dt.id
|
inner join device_type dt on d.device_type = dt.id
|
||||||
where d.device_mac = #{deviceMac}
|
where d.device_mac = #{deviceMac}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryWebDeviceList" resultType="com.fuyuanshen.equipment.domain.vo.WebDeviceVo">
|
||||||
|
select d.id, d.device_name, d.device_name,
|
||||||
|
d.device_name,
|
||||||
|
d.device_mac,
|
||||||
|
d.device_sn,
|
||||||
|
d.device_imei,
|
||||||
|
d.device_pic,
|
||||||
|
dt.type_name,
|
||||||
|
dt.communication_mode,
|
||||||
|
d.bluetooth_name,
|
||||||
|
dt.model_dictionary detailPageUrl,
|
||||||
|
ap.name personnelBy,
|
||||||
|
d.device_status,
|
||||||
|
c.binding_time
|
||||||
|
from device d
|
||||||
|
inner join device_type dt on d.device_type = dt.id
|
||||||
|
inner join app_device_bind_record c on d.id = c.device_id
|
||||||
|
left join app_personnel_info ap on ap.device_id = d.id
|
||||||
|
where dt.communication_mode = 0
|
||||||
|
<if test="criteria.deviceType != null">
|
||||||
|
and d.device_type = #{criteria.deviceType}
|
||||||
|
</if>
|
||||||
|
<if test="criteria.deviceName != null">
|
||||||
|
and d.device_name like concat('%', #{criteria.deviceName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="criteria.deviceMac != null">
|
||||||
|
and d.device_mac = #{criteria.deviceMac}
|
||||||
|
</if>
|
||||||
|
<if test="criteria.deviceImei != null">
|
||||||
|
and d.device_imei = #{criteria.deviceImei}
|
||||||
|
</if>
|
||||||
|
<if test="criteria.deviceStatus != null">
|
||||||
|
and d.device_status = #{criteria.deviceStatus}
|
||||||
|
</if>
|
||||||
|
<if test="criteria.personnelBy != null and criteria.personnelBy != ''">
|
||||||
|
and ap.name like concat('%', #{criteria.personnelBy}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="criteria.communicationMode != null">
|
||||||
|
and dt.communication_mode, = #{criteria.communicationMode}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user