0
0

1 Commits

Author SHA1 Message Date
7773cae0ea 配置文件提交2 2025-09-05 10:52:53 +08:00
28 changed files with 142 additions and 983 deletions

View File

@ -16,4 +16,5 @@ public class MqttPropertiesConfig {
private String subTopic;
private String pubClientId;
private String pubTopic;
private String enabled;
}

View File

@ -1,106 +0,0 @@
package com.fuyuanshen.web.controller.device;
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.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
import com.fuyuanshen.equipment.service.IDeviceAlarmService;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
/**
* 设备告警
*
* @author Lion Li
* @date 2025-08-28
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("api/equipment/alarm")
public class DeviceAlarmController extends BaseController {
private final IDeviceAlarmService deviceAlarmService;
/**
* 查询设备告警列表
*/
// @SaCheckPermission("equipment:alarm:list")
@GetMapping("/list")
public TableDataInfo<DeviceAlarmVo> list(DeviceAlarmBo bo, PageQuery pageQuery) {
return deviceAlarmService.queryPageList(bo, pageQuery);
}
/**
* 导出设备告警列表
*/
// @SaCheckPermission("equipment:alarm:export")
@Log(title = "导出设备告警列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DeviceAlarmBo bo, HttpServletResponse response) {
List<DeviceAlarmVo> list = deviceAlarmService.queryList(bo);
ExcelUtil.exportExcel(list, "设备告警", DeviceAlarmVo.class, response);
}
/**
* 获取设备告警详细信息
*
* @param id 主键
*/
// @SaCheckPermission("equipment:alarm:query")
@GetMapping("/{id}")
public R<DeviceAlarmVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(deviceAlarmService.queryById(id));
}
/**
* 新增设备告警
*/
// @SaCheckPermission("equipment:alarm:add")
@Log(title = "设备告警", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceAlarmBo bo) {
return toAjax(deviceAlarmService.insertByBo(bo));
}
/**
* 修改设备告警
*/
// @SaCheckPermission("equipment:alarm:edit")
@Log(title = "设备告警", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceAlarmBo bo) {
return toAjax(deviceAlarmService.updateByBo(bo));
}
/**
* 删除设备告警
*
* @param ids 主键串
*/
// @SaCheckPermission("equipment:alarm:remove")
@Log(title = "设备告警", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(deviceAlarmService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@ -32,8 +32,6 @@ import java.util.Map;
public class DeviceControlCenterController extends BaseController {
private final DeviceBizService appDeviceService;
/**
* 查询设备列表
*/

View File

@ -1,43 +0,0 @@
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);
}
}

View File

@ -4,8 +4,6 @@ package com.fuyuanshen.web.controller.device;
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.web.core.BaseController;
import com.fuyuanshen.equipment.domain.DeviceLog;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
import com.fuyuanshen.web.service.WEBDeviceService;
import io.swagger.v3.oas.annotations.Operation;
@ -62,46 +60,17 @@ public class WEBDeviceController extends BaseController {
/**
* 设备用户详情
*
* @param deviceId
* @param id
* @return
*/
@Operation(summary = "设备详情")
@GetMapping(value = "/getDeviceUser/{deviceId}")
public R<List<AppPersonnelInfoRecords>> getDeviceUser(@PathVariable Long deviceId) {
List<AppPersonnelInfoRecords> device = deviceService.getDeviceUser(deviceId);
@GetMapping(value = "/getDeviceUser/{id}")
public R<List<AppPersonnelInfoRecords>> getDeviceUser(@PathVariable Long id) {
List<AppPersonnelInfoRecords> device = deviceService.getDeviceUser(id);
return R.ok(device);
}
/**
* 设备操作记录
*
* @param deviceId
* @return
*/
@Operation(summary = "设备操作记录")
@GetMapping(value = "/getOperationRecord/{deviceId}")
public R<List<DeviceLog>> getOperationRecord(@PathVariable Long deviceId) {
List<DeviceLog> device = deviceService.getOperationRecord(deviceId);
return R.ok(device);
}
/**
* 设备告警记录
*
* @param deviceId
* @return
*/
@Operation(summary = "设备告警记录")
@GetMapping(value = "/getAlarmRecord/{deviceId}")
public R<List<DeviceAlarmVo>> getAlarmRecord(@PathVariable Long deviceId) {
List<DeviceAlarmVo> device = deviceService.getAlarmRecord(deviceId);
return R.ok(device);
}
}

View File

@ -79,7 +79,8 @@ public class AppRegisterService {
boolean exist = TenantHelper.dynamic(tenantId, () -> {
return appUserMapper.exists(new LambdaQueryWrapper<AppUser>()
.eq(AppUser::getUserName, appUser.getUserName()));
.eq(AppUser::getUserName, appUser.getUserName())
.eq(AppUser::getUserType, UserType.APP_USER.getUserType()));
});
if (exist) {
throw new UserException("user.register.save.error", username);

View File

@ -43,7 +43,7 @@ import static com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants.*;
public class DeviceShareService {
private final AppDeviceShareMapper appDeviceShareMapper;
private final DeviceMapper deviceMapper;
private final DeviceTypeMapper deviceTypeMapper;
@ -61,32 +61,32 @@ public class DeviceShareService {
}
private static void buildDeviceStatus(AppDeviceShareVo item) {
// 设备在线状态
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + item.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
if (StringUtils.isNotBlank(onlineStatus)) {
//设备在线状态
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 {
}else{
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);
item.setBattery(jsonObject.getString("batteryPercentage"));
} else {
}else{
item.setBattery("0");
}
String location = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + item.getDeviceImei() + DEVICE_LOCATION_KEY_PREFIX);
if (StringUtils.isNotBlank(location)) {
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)) {
String alarmStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ item.getDeviceImei()+ DEVICE_ALARM_KEY_PREFIX);
if(StringUtils.isNotBlank(alarmStatus)){
item.setAlarmStatus(alarmStatus);
}
}
@ -96,7 +96,7 @@ public class DeviceShareService {
LambdaQueryWrapper<AppDeviceShare> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AppDeviceShare::getId, id);
List<AppDeviceShareVo> appDeviceShareVos = appDeviceShareMapper.selectVoList(queryWrapper);
if (appDeviceShareVos == null || appDeviceShareVos.isEmpty()) {
if(appDeviceShareVos==null || appDeviceShareVos.isEmpty()){
return null;
}
@ -113,7 +113,7 @@ public class DeviceShareService {
shareDetailVo.setDeviceMac(device.getDeviceMac());
DeviceType deviceType = deviceTypeMapper.selectById(device.getDeviceType());
if (deviceType != null) {
if(deviceType!=null){
shareDetailVo.setCommunicationMode(Integer.valueOf(deviceType.getCommunicationMode()));
}
shareDetailVo.setDevicePic(device.getDevicePic());
@ -125,53 +125,52 @@ public class DeviceShareService {
LambdaQueryWrapper<AppPersonnelInfo> qw = new LambdaQueryWrapper<>();
qw.eq(AppPersonnelInfo::getDeviceId, device.getId());
List<AppPersonnelInfoVo> appPersonnelInfoVos = appPersonnelInfoMapper.selectVoList(qw);
if (appPersonnelInfoVos != null && !appPersonnelInfoVos.isEmpty()) {
if(appPersonnelInfoVos!=null && !appPersonnelInfoVos.isEmpty()){
shareDetailVo.setPersonnelInfo(appPersonnelInfoVos.get(0));
}
// 设备在线状态
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
if (StringUtils.isNotBlank(onlineStatus)) {
//设备在线状态
String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + device.getDeviceImei()+ DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX);
if(StringUtils.isNotBlank(onlineStatus)){
shareDetailVo.setOnlineStatus(1);
} else {
}else{
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);
shareDetailVo.setMainLightMode(jsonObject.getString("mainLightMode"));
shareDetailVo.setLaserLightMode(jsonObject.getString("laserLightMode"));
shareDetailVo.setBatteryPercentage(jsonObject.getString("batteryPercentage"));
shareDetailVo.setChargeState(jsonObject.getString("chargeState"));
shareDetailVo.setBatteryRemainingTime(jsonObject.getString("batteryRemainingTime"));
} else {
}else{
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);
if (StringUtils.isNotBlank(locationInfo)) {
if(StringUtils.isNotBlank(locationInfo)){
JSONObject jsonObject = JSONObject.parseObject(locationInfo);
shareDetailVo.setLongitude(jsonObject.get("longitude").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);
if (StringUtils.isNotBlank(alarmStatus)) {
String alarmStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ device.getDeviceImei()+ DEVICE_ALARM_KEY_PREFIX);
if(StringUtils.isNotBlank(alarmStatus)){
shareDetailVo.setAlarmStatus(alarmStatus);
}
String lightBrightness = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DEVICE_LIGHT_BRIGHTNESS_KEY_PREFIX);
if (StringUtils.isNotBlank(lightBrightness)) {
String lightBrightness = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY +DEVICE_KEY_PREFIX+ device.getDeviceImei()+ DEVICE_LIGHT_BRIGHTNESS_KEY_PREFIX);
if(StringUtils.isNotBlank(lightBrightness)){
shareDetailVo.setLightBrightness(lightBrightness);
}
return shareDetailVo;
}
/**
* 校验短信验证码
*/
@ -182,15 +181,14 @@ public class DeviceShareService {
}
return code.equals(smsCode);
}
public int deviceShare(AppDeviceShareBo bo) {
boolean flag = validateSmsCode(AppLoginHelper.getTenantId(), bo.getPhonenumber(), bo.getSmsCode());
if (!flag) {
if(!flag){
throw new ServiceException("验证码错误");
}
Device device = deviceMapper.selectById(bo.getDeviceId());
if (device == null) {
if(device==null){
throw new ServiceException("设备不存在");
}
Long userId = AppLoginHelper.getUserId();
@ -198,7 +196,7 @@ public class DeviceShareService {
lqw.eq(AppDeviceShare::getDeviceId, bo.getDeviceId());
lqw.eq(AppDeviceShare::getPhonenumber, bo.getPhonenumber());
Long count = appDeviceShareMapper.selectCount(lqw);
if (count > 0) {
if(count>0){
UpdateWrapper<AppDeviceShare> uw = new UpdateWrapper<>();
uw.eq("device_id", bo.getDeviceId());
@ -208,7 +206,7 @@ public class DeviceShareService {
uw.set("update_time", new Date());
return appDeviceShareMapper.update(uw);
} else {
}else {
AppDeviceShare appDeviceShare = new AppDeviceShare();
appDeviceShare.setDeviceId(bo.getDeviceId());
appDeviceShare.setPhonenumber(bo.getPhonenumber());
@ -234,19 +232,4 @@ 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);
}
}

View File

@ -6,13 +6,11 @@ import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.DeviceLog;
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
import com.fuyuanshen.equipment.domain.form.DeviceForm;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
import java.io.IOException;
@ -47,22 +45,6 @@ public interface WEBDeviceService extends IService<Device> {
* @param id
* @return
*/
List<AppPersonnelInfoRecords> getDeviceUser(Long id);
List<AppPersonnelInfoRecords> getDeviceUser(Long id);
/**
* 设备操作记录
*
* @param deviceId
* @return
*/
List<DeviceLog> getOperationRecord(Long deviceId);
/**
* 设备告警记录
*
* @param deviceId
* @return
*/
List<DeviceAlarmVo> getAlarmRecord(Long deviceId);
}

View File

@ -12,15 +12,10 @@ import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper;
import com.fuyuanshen.app.mapper.AppDeviceShareMapper;
import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.DeviceAlarm;
import com.fuyuanshen.equipment.domain.DeviceAssignments;
import com.fuyuanshen.equipment.domain.DeviceLog;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
import com.fuyuanshen.equipment.mapper.DeviceAlarmMapper;
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
import com.fuyuanshen.equipment.mapper.DeviceLogMapper;
import com.fuyuanshen.equipment.mapper.DeviceMapper;
import com.fuyuanshen.web.service.WEBDeviceService;
import com.fuyuanshen.web.service.device.DeviceBizService;
@ -45,8 +40,6 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
private final AppDeviceBindRecordMapper appDeviceBindRecordMapper;
private final AppPersonnelInfoRecordsMapper infoRecordsMapper;
private final DeviceLogMapper deviceLogMapper;
private final DeviceAlarmMapper deviceAlarmMapper;
private final DeviceMapper deviceMapper;
private final AppDeviceShareMapper appDeviceShareMapper;
@ -122,35 +115,4 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
}
/**
* 设备操作记录
*
* @param deviceId
* @return
*/
@Override
public List<DeviceLog> getOperationRecord(Long deviceId) {
List<DeviceLog> logList = deviceLogMapper.selectList(
new QueryWrapper<DeviceLog>().eq("device_id", deviceId)
.orderByDesc("create_time"));
return logList;
}
/**
* 设备告警记录
*
* @param deviceId
* @return
*/
@Override
public List<DeviceAlarmVo> getAlarmRecord(Long deviceId) {
List<DeviceAlarm> alarmList = deviceAlarmMapper.selectList(
new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId)
.orderByDesc("create_time"));
List<DeviceAlarmVo> deviceAlarmVoList = BeanUtil.copyToList(alarmList, DeviceAlarmVo.class);
return deviceAlarmVoList;
}
}

View File

@ -1,3 +1,6 @@
--- # 临时文件存储位置 避免临时文件被系统清理报错
spring.servlet.multipart.location: /fys/server/temp
--- # 监控中心配置
spring.boot.admin.client:
# 增加客户端开关
@ -8,15 +11,15 @@ spring.boot.admin.client:
metadata:
username: ${spring.boot.admin.client.username}
userpassword: ${spring.boot.admin.client.password}
username: ${monitor.username}
password: ${monitor.password}
username: @monitor.username@
password: @monitor.password@
--- # snail-job 配置
snail-job:
enabled: false
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
group: "fys_group"
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`表
token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT"
server:
host: 127.0.0.1
@ -37,7 +40,7 @@ spring:
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
dynamic:
# 性能分析插件(有性能损耗 不建议生产环境使用)
p6spy: true
p6spy: false
# 设置默认的数据源或者数据源组,默认值即为 master
primary: master
# 严格模式 匹配不到数据源则报错
@ -49,35 +52,35 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://120.79.224.186:3366/fys-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
url: jdbc:mysql://47.107.152.87:3306/fys-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: root
password: 1fys@QWER..
# # 从库数据源
# slave:
# lazy: true
# type: ${spring.datasource.type}
# driverClassName: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# username:
# password:
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT
# password: root
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
# username: root
# password: root
# sqlserver:
# type: ${spring.datasource.type}
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
# username: SA
# password: root
password: Jz_5623_cl1
# # 从库数据源
# slave:
# lazy: true
# type: ${spring.datasource.type}
# driverClassName: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# username:
# password:
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT
# password: root
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
# username: root
# password: root
# sqlserver:
# type: ${spring.datasource.type}
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
# username: SA
# password: root
hikari:
# 最大连接池数量
maxPoolSize: 20
@ -98,13 +101,13 @@ spring:
spring.data:
redis:
# 地址
host: 120.79.224.186
host: 47.107.152.87
# 端口默认为6379
port: 26379
port: 6379
# 数据库索引
database: 2
database: 1
# redis 密码必须配置
password: 1fys@QWER..
password: re_fs_11520631
# 连接超时时间
timeout: 10s
# 是否开启ssl
@ -115,17 +118,17 @@ redisson:
# redis key前缀
keyPrefix:
# 线程池数量
threads: 4
threads: 16
# Netty线程池数量
nettyThreads: 8
nettyThreads: 32
# 单节点配置
singleServerConfig:
# 客户端名称 不能用中文
clientName: fys-Vue-Plus
# 最小空闲连接数
connectionMinimumIdleSize: 8
connectionMinimumIdleSize: 32
# 连接池大小
connectionPoolSize: 32
connectionPoolSize: 64
# 连接空闲超时,单位:毫秒
idleConnectionTimeout: 10000
# 命令等待超时,单位:毫秒
@ -177,12 +180,11 @@ sms:
access-key-id: LTAI5tDGfJd4kMvrGtvyzCHz
# 称为accessSecret有些称之为apiSecret
access-key-secret: a4ZlVHVSYeMQHn0p1R18thA6xCdHQh
#模板ID 非必须配置如果使用sendMessage的快速发送需此配置
#模板ID 非必须配置如果使用sendMessage的快速发送需此配置
template-id: SMS_324526343
#模板变量 上述模板的变量
#模板变量 上述模板的变量
templateName: code
signature: 深圳市富源晟科技
# sdk-app-id: 您的sdkAppId
config2:
# 厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
supplier: tencent
@ -191,7 +193,6 @@ sms:
signature: 您的短信签名
sdk-app-id: 您的sdkAppId
--- # 三方授权
justauth:
# 前端外网访问地址
@ -206,11 +207,11 @@ justauth:
redirect-uri: ${justauth.address}/social-callback?source=maxkey
topiam:
# topiam 服务器地址
server-url: http://127.0.0.1:1898/api/v1/authorize/y0q************spq***********8ol
server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol
client-id: 449c4*********937************759
client-secret: ac7***********1e0************28d
redirect-uri: ${justauth.address}/social-callback?source=topiam
scopes: [openid, email, phone, profile]
scopes: [ openid, email, phone, profile ]
qq:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
@ -276,6 +277,18 @@ justauth:
redirect-uri: ${justauth.address}/social-callback?source=gitea
# MQTT配置
mqtt:
username: admin
password: fys123456
url: tcp://47.107.152.87:1883
subClientId: fys_subClient
subTopic: worker/location/#
pubTopic: B/#
pubClientId: fys_pubClient
enabled: false
# 文件存储路径
file:
mac:
@ -296,13 +309,4 @@ file:
app_avatar:
pic: C:\eladmin\file\ #设备图片存储路径
#ip: http://fuyuanshen.com:81/ #服务器地址
ip: https://fuyuanshen.com/ #服务器地址
# MQTT配置
mqtt:
username: admin
password: fys123456
url: tcp://47.107.152.87:1883
subClientId: fys_subClient
subTopic: worker/location/#
pubTopic: B/#
pubClientId: fys_pubClient
ip: https://fuyuanshen.com/ #服务器地址

View File

@ -99,6 +99,6 @@ public class AppUser extends TenantEntity {
/**
* 地区
*/
private String region;
// private String region;
}

View File

@ -1,7 +1,5 @@
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.common.mybatis.core.domain.BaseEntity;
import io.github.linpeilie.annotations.AutoMapper;
@ -9,8 +7,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.Date;
/**
* 设备分享业务对象 app_device_share
*
@ -39,16 +35,10 @@ public class AppDeviceShareBo extends BaseEntity {
/**
* 功能权限1灯光模式2激光模式3开机画面4人员信息登记5发送信息6产品信息
* 以逗号分隔
以逗号分隔
*/
private String permission;
/**
* 分享用户
* share_user
*/
private String shareUser;
/**
* 备注
*/
@ -56,11 +46,4 @@ public class AppDeviceShareBo extends BaseEntity {
private String smsCode;
/**
* 分享时间
*/
private Date shareStartTime;
private Date shareEndTime;
}

View File

@ -5,6 +5,8 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fuyuanshen.app.domain.AppUser;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
@ -87,6 +89,8 @@ public class AppUserVo implements Serializable {
* 密码
*/
@ExcelProperty(value = "密码")
@JsonIgnore
@JsonProperty
private String password;
/**

View File

@ -18,13 +18,5 @@ import org.apache.ibatis.annotations.Param;
public interface AppDeviceShareMapper extends BaseMapperPlus<AppDeviceShare, AppDeviceShareVo> {
IPage<AppDeviceShareVo> otherDeviceShareList(@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);
Page<AppDeviceShareVo> selectAppDeviceShareList(@Param("bo") AppDeviceShareBo bo,Page<AppDeviceShareVo> page);
}

View File

@ -177,7 +177,7 @@ public class AppUserServiceImpl implements IAppUserService {
appUserVo.setNickName(user.getNickName());
appUserVo.setGender(user.getSex());
appUserVo.setPhone(user.getPhonenumber());
appUserVo.setRegion(user.getRegion());
// appUserVo.setRegion(user.getRegion());
if(user.getAvatar() != null){
SysOssVo oss = sysOssService.getById(user.getAvatar());
if(oss != null){
@ -203,7 +203,7 @@ public class AppUserServiceImpl implements IAppUserService {
updUser.setAvatar(oss.getOssId());
}
updUser.setRegion(bo.getRegion());
// updUser.setRegion(bo.getRegion());
updUser.setSex(bo.getGender());
return baseMapper.update(updUser, new LambdaQueryWrapper<AppUser>().eq(AppUser::getUserId, appUser.getUserId()));
}

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.id,a.business_id,a.file_id,b.file_name,b.url fileUrl from app_business_file a left join sys_oss b on a.file_id = b.oss_id
where 1=1
<if test="createBy != null">
a.create_by = #{createBy}
and a.create_by = #{createBy}
</if>
<if test="businessId != null">
and a.business_id = #{businessId}
@ -19,9 +19,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileType != null">
and a.file_type = #{fileType}
</if>
<if test="createBy != null">
and a.create_by = #{createBy}
</if>
order by a.create_time desc
</select>
</mapper>

View File

@ -1,27 +1,27 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceShareMapper">
<select id="otherDeviceShareList" resultType="com.fuyuanshen.app.domain.vo.AppDeviceShareVo">
select d.device_name,
d.device_mac,
d.device_sn,
d.device_imei,
d.device_pic,
dt.type_name,
dt.communication_mode,
dt.app_model_dictionary detailPageUrl,
d.bluetooth_name,
c.binding_time,
ad.*,
u.user_name otherPhonenumber
from app_device_share ad
left join device d on ad.device_id = d.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 app_device_bind_record c on d.id = c.device_id
d.device_mac,
d.device_sn,
d.device_imei,
d.device_pic,
dt.type_name,
dt.communication_mode,
dt.app_model_dictionary detailPageUrl,
d.bluetooth_name,
c.binding_time,
ad.*,u.user_name otherPhonenumber
from
app_device_share ad
left join device d on ad.device_id = d.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 app_device_bind_record c on d.id = c.device_id
where ad.phonenumber = #{bo.phonenumber}
</select>
<select id="selectAppDeviceShareList" resultType="com.fuyuanshen.app.domain.vo.AppDeviceShareVo">
@ -47,23 +47,4 @@
and ad.device_id = #{bo.deviceId}
</if>
</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>

View File

@ -1,99 +0,0 @@
package com.fuyuanshen.equipment.domain;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serial;
/**
* 设备告警对象 device_alarm
*
* @author Lion Li
* @date 2025-08-28
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("device_alarm")
public class DeviceAlarm extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId(value = "id")
private Long id;
/**
* 设备ID
*/
private Long deviceId;
/**
* 报警事项
*/
private String deviceAction;
/**
* 设备名称
*/
private String deviceName;
/**
* 数据来源
*/
private String dataSource;
/**
* 内容
*/
private String content;
/**
* 设备类型
*/
private Long deviceType;
/**
* 经度
*/
private Long longitude;
/**
* 纬度
*/
private Long latitude;
/**
* 报警位置
*/
private String location;
/**
* 报警开始时间
*/
private Date startTime;
/**
* 报警结束时间
*/
private Date finishTime;
/**
* 报警持续时间
*/
private Date durationTime;
/**
* 0已处理1未处理
*/
private Long treatmentState;
}

View File

@ -21,12 +21,6 @@ public class DeviceType extends TenantEntity {
@Schema(title = "ID", hidden = true)
private Long id;
/**
* 设备类型ID
*/
@TableField(exist = false)
private Long deviceTypeId;
@Schema(title = "客户号")
private Long customerId;

View File

@ -1,97 +0,0 @@
package com.fuyuanshen.equipment.domain.bo;
import com.fuyuanshen.common.core.validate.EditGroup;
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
import com.fuyuanshen.equipment.domain.DeviceAlarm;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 设备告警业务对象 device_alarm
*
* @author Lion Li
* @date 2025-08-28
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = DeviceAlarm.class, reverseConvertGenerate = false)
public class DeviceAlarmBo extends BaseEntity {
/**
* ID
*/
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
private Long id;
/**
* 设备ID
*/
private Long deviceId;
/**
* 报警事项
*/
private String deviceAction;
/**
* 设备名称
*/
private String deviceName;
/**
* 数据来源
*/
private String dataSource;
/**
* 内容
*/
private String content;
/**
* 设备类型
*/
private Long deviceType;
/**
* 经度
*/
private Long longitude;
/**
* 纬度
*/
private Long latitude;
/**
* 报警位置
*/
private String location;
/**
* 报警开始时间
*/
private Date startTime;
/**
* 报警结束时间
*/
private Date finishTime;
/**
* 报警持续时间
*/
private Date durationTime;
/**
* 0已处理1未处理
*/
private Long treatmentState;
}

View File

@ -57,6 +57,11 @@ public class AppDeviceVo implements Serializable {
*/
private Date bindingTime;
/**
* 绑定人
*/
private Date bindingBy;
/**
* 在线状态(0离线1在线)
*/

View File

@ -1,118 +0,0 @@
package com.fuyuanshen.equipment.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuyuanshen.equipment.domain.DeviceAlarm;
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;
/**
* 设备告警视图对象 device_alarm
*
* @author Lion Li
* @date 2025-08-28
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = DeviceAlarm.class)
public class DeviceAlarmVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@ExcelProperty(value = "ID")
private Long id;
/**
* 设备ID
*/
@ExcelProperty(value = "设备ID")
private Long deviceId;
/**
* 报警事项
*/
@ExcelProperty(value = "报警事项")
private String deviceAction;
/**
* 设备名称
*/
@ExcelProperty(value = "设备名称")
private String deviceName;
/**
* 数据来源
*/
@ExcelProperty(value = "数据来源")
private String dataSource;
/**
* 内容
*/
@ExcelProperty(value = "内容")
private String content;
/**
* 设备类型
*/
@ExcelProperty(value = "设备类型")
private Long deviceType;
/**
* 经度
*/
@ExcelProperty(value = "经度")
private Long longitude;
/**
* 纬度
*/
@ExcelProperty(value = "纬度")
private Long latitude;
/**
* 报警位置
*/
@ExcelProperty(value = "报警位置")
private String location;
/**
* 报警开始时间
*/
@ExcelProperty(value = "报警开始时间")
private Date startTime;
/**
* 报警结束时间
*/
@ExcelProperty(value = "报警结束时间")
private Date finishTime;
/**
* 报警持续时间
*/
@ExcelProperty(value = "报警持续时间")
private Date durationTime;
/**
* 0已处理1未处理
*/
@ExcelProperty(value = "0已处理1未处理")
private Long treatmentState;
}

View File

@ -1,15 +0,0 @@
package com.fuyuanshen.equipment.mapper;
import com.fuyuanshen.equipment.domain.DeviceAlarm;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 设备告警Mapper接口
*
* @author Lion Li
* @date 2025-08-28
*/
public interface DeviceAlarmMapper extends BaseMapperPlus<DeviceAlarm, DeviceAlarmVo> {
}

View File

@ -1,68 +0,0 @@
package com.fuyuanshen.equipment.service;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
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 Lion Li
* @date 2025-08-28
*/
public interface IDeviceAlarmService {
/**
* 查询设备告警
*
* @param id 主键
* @return 设备告警
*/
DeviceAlarmVo queryById(Long id);
/**
* 分页查询设备告警列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备告警分页列表
*/
TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery);
/**
* 查询符合条件的设备告警列表
*
* @param bo 查询条件
* @return 设备告警列表
*/
List<DeviceAlarmVo> queryList(DeviceAlarmBo bo);
/**
* 新增设备告警
*
* @param bo 设备告警
* @return 是否新增成功
*/
Boolean insertByBo(DeviceAlarmBo bo);
/**
* 修改设备告警
*
* @param bo 设备告警
* @return 是否修改成功
*/
Boolean updateByBo(DeviceAlarmBo bo);
/**
* 校验并批量删除设备告警信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@ -1,144 +0,0 @@
package com.fuyuanshen.equipment.service.impl;
import com.fuyuanshen.common.core.utils.MapstructUtils;
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.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.equipment.domain.DeviceAlarm;
import com.fuyuanshen.equipment.mapper.DeviceAlarmMapper;
import com.fuyuanshen.equipment.service.IDeviceAlarmService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 设备告警Service业务层处理
*
* @author Lion Li
* @date 2025-08-28
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
private final DeviceAlarmMapper baseMapper;
/**
* 查询设备告警
*
* @param id 主键
* @return 设备告警
*/
@Override
public DeviceAlarmVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询设备告警列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备告警分页列表
*/
@Override
public TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<DeviceAlarm> lqw = buildQueryWrapper(bo);
Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的设备告警列表
*
* @param bo 查询条件
* @return 设备告警列表
*/
@Override
public List<DeviceAlarmVo> queryList(DeviceAlarmBo bo) {
LambdaQueryWrapper<DeviceAlarm> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<DeviceAlarm> buildQueryWrapper(DeviceAlarmBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<DeviceAlarm> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(DeviceAlarm::getId);
lqw.eq(bo.getDeviceId() != null, DeviceAlarm::getDeviceId, bo.getDeviceId());
lqw.eq(StringUtils.isNotBlank(bo.getDeviceAction()), DeviceAlarm::getDeviceAction, bo.getDeviceAction());
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAlarm::getDeviceName, bo.getDeviceName());
lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), DeviceAlarm::getDataSource, bo.getDataSource());
lqw.eq(StringUtils.isNotBlank(bo.getContent()), DeviceAlarm::getContent, bo.getContent());
lqw.eq(bo.getDeviceType() != null, DeviceAlarm::getDeviceType, bo.getDeviceType());
lqw.eq(bo.getLongitude() != null, DeviceAlarm::getLongitude, bo.getLongitude());
lqw.eq(bo.getLatitude() != null, DeviceAlarm::getLatitude, bo.getLatitude());
lqw.eq(StringUtils.isNotBlank(bo.getLocation()), DeviceAlarm::getLocation, bo.getLocation());
lqw.eq(bo.getStartTime() != null, DeviceAlarm::getStartTime, bo.getStartTime());
lqw.eq(bo.getFinishTime() != null, DeviceAlarm::getFinishTime, bo.getFinishTime());
lqw.eq(bo.getDurationTime() != null, DeviceAlarm::getDurationTime, bo.getDurationTime());
lqw.eq(bo.getTreatmentState() != null, DeviceAlarm::getTreatmentState, bo.getTreatmentState());
return lqw;
}
/**
* 新增设备告警
*
* @param bo 设备告警
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(DeviceAlarmBo bo) {
DeviceAlarm add = MapstructUtils.convert(bo, DeviceAlarm.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改设备告警
*
* @param bo 设备告警
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(DeviceAlarmBo bo) {
DeviceAlarm update = MapstructUtils.convert(bo, DeviceAlarm.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(DeviceAlarm entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除设备告警信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}

View File

@ -1,7 +0,0 @@
<?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.equipment.mapper.DeviceAlarmMapper">
</mapper>

View File

@ -4,7 +4,6 @@
<resultMap id="BaseResultMap" type="com.fuyuanshen.equipment.domain.DeviceType">
<id column="grant_id" property="id"/>
<result column="type_name" property="typeName"/>
<result column="device_type_id" property="deviceTypeId"/>
<result column="is_support_ble" property="isSupportBle"/>
<result column="locate_mode" property="locateMode"/>
<result column="network_way" property="networkWay"/>
@ -22,7 +21,7 @@
<!-- 查询所有设备类型 -->
<select id="findAll" resultMap="BaseResultMap">
SELECT DISTINCT dt.* ,dg.id AS grant_id ,dg.create_time AS Dcreate_time,dt.id AS device_type_id
SELECT DISTINCT dt.* ,dg.id AS grant_id ,dg.create_time AS Dcreate_time
FROM device_type dt
JOIN device_type_grants dg ON dt.id = dg.device_type_id
<where>
@ -45,7 +44,7 @@
</select>
<!-- 根据名称查询设备类型 -->
<select id="queryByName" resultMap="BaseResultMap"
<select id="queryByName" resultMap="BaseResultMap"
parameterType="com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria">
SELECT dt.*, dg.id AS grant_id
FROM device_type dt

11
pom.xml
View File

@ -83,6 +83,10 @@
<monitor.username>fys</monitor.username>
<monitor.password>123456</monitor.password>
</properties>
<activation>
<!-- 默认环境 -->
<activeByDefault>true</activeByDefault>
</activation>
<!-- <activation> -->
<!-- &lt;!&ndash; 默认环境 &ndash;&gt; -->
<!-- <activeByDefault>true</activeByDefault> -->
@ -92,14 +96,11 @@
<id>prod</id>
<properties>
<profiles.active>prod</profiles.active>
<logging.level>warn</logging.level>
<logging.level>info</logging.level>
<monitor.username>fys</monitor.username>
<monitor.password>123456</monitor.password>
</properties>
<activation>
<!-- 默认环境 -->
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>jingquan</id>