feat:功能优化,设备报警信息、微信缓存用户,操作记录信息,代码提交。
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package com.intc.fishery.service;
|
||||
|
||||
import com.intc.fishery.domain.vo.DeviceWarnCombineVo;
|
||||
import com.intc.fishery.domain.bo.DeviceWarnCombineBo;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备告警信息Service接口
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
public interface IDeviceWarnCombineService {
|
||||
|
||||
/**
|
||||
* 查询设备告警信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备告警信息
|
||||
*/
|
||||
DeviceWarnCombineVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询设备告警信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备告警信息分页列表
|
||||
*/
|
||||
TableDataInfo<DeviceWarnCombineVo> queryPageList(DeviceWarnCombineBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备告警信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备告警信息列表
|
||||
*/
|
||||
List<DeviceWarnCombineVo> queryList(DeviceWarnCombineBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备告警信息
|
||||
*
|
||||
* @param bo 设备告警信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(DeviceWarnCombineBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备告警信息
|
||||
*
|
||||
* @param bo 设备告警信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(DeviceWarnCombineBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备告警信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.intc.fishery.service;
|
||||
|
||||
import com.intc.fishery.domain.vo.DeviceWarnOneVo;
|
||||
import com.intc.fishery.domain.bo.DeviceWarnOneBo;
|
||||
import com.intc.fishery.domain.bo.DeviceWarnOneBatchUpdateBo;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备报警明细Service接口
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
public interface IDeviceWarnOneService {
|
||||
|
||||
/**
|
||||
* 查询设备报警明细
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备报警明细
|
||||
*/
|
||||
DeviceWarnOneVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询设备报警明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备报警明细分页列表
|
||||
*/
|
||||
TableDataInfo<DeviceWarnOneVo> queryPageList(DeviceWarnOneBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备报警明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备报警明细列表
|
||||
*/
|
||||
List<DeviceWarnOneVo> queryList(DeviceWarnOneBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备报警明细
|
||||
*
|
||||
* @param bo 设备报警明细
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(DeviceWarnOneBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备报警明细
|
||||
*
|
||||
* @param bo 设备报警明细
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(DeviceWarnOneBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备报警明细信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.intc.fishery.service;
|
||||
|
||||
import com.intc.fishery.domain.vo.MessageOpRecordVo;
|
||||
import com.intc.fishery.domain.bo.MessageOpRecordBo;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户操作记录Service接口
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
public interface IMessageOpRecordService {
|
||||
|
||||
/**
|
||||
* 查询用户操作记录
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 用户操作记录
|
||||
*/
|
||||
MessageOpRecordVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询用户操作记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 用户操作记录分页列表
|
||||
*/
|
||||
TableDataInfo<MessageOpRecordVo> queryPageList(MessageOpRecordBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的用户操作记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 用户操作记录列表
|
||||
*/
|
||||
List<MessageOpRecordVo> queryList(MessageOpRecordBo bo);
|
||||
|
||||
/**
|
||||
* 新增用户操作记录
|
||||
*
|
||||
* @param bo 用户操作记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(MessageOpRecordBo bo);
|
||||
|
||||
/**
|
||||
* 修改用户操作记录
|
||||
*
|
||||
* @param bo 用户操作记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(MessageOpRecordBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除用户操作记录信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.intc.fishery.service;
|
||||
|
||||
import com.intc.fishery.domain.vo.TecentUserCacheVo;
|
||||
import com.intc.fishery.domain.bo.TecentUserCacheBo;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公众号用户缓存Service接口
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
public interface ITecentUserCacheService {
|
||||
|
||||
/**
|
||||
* 查询公众号用户缓存
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 公众号用户缓存
|
||||
*/
|
||||
TecentUserCacheVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询公众号用户缓存列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 公众号用户缓存分页列表
|
||||
*/
|
||||
TableDataInfo<TecentUserCacheVo> queryPageList(TecentUserCacheBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的公众号用户缓存列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 公众号用户缓存列表
|
||||
*/
|
||||
List<TecentUserCacheVo> queryList(TecentUserCacheBo bo);
|
||||
|
||||
/**
|
||||
* 新增公众号用户缓存
|
||||
*
|
||||
* @param bo 公众号用户缓存
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(TecentUserCacheBo bo);
|
||||
|
||||
/**
|
||||
* 修改公众号用户缓存
|
||||
*
|
||||
* @param bo 公众号用户缓存
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(TecentUserCacheBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除公众号用户缓存信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.intc.fishery.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.MapstructUtils;
|
||||
import com.intc.common.core.utils.StringUtils;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.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.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.intc.fishery.domain.bo.DeviceWarnCombineBo;
|
||||
import com.intc.fishery.domain.vo.DeviceWarnCombineVo;
|
||||
import com.intc.fishery.domain.DeviceWarnCombine;
|
||||
import com.intc.fishery.domain.DeviceWarnOne;
|
||||
import com.intc.fishery.mapper.DeviceWarnCombineMapper;
|
||||
import com.intc.fishery.mapper.DeviceWarnOneMapper;
|
||||
import com.intc.fishery.service.IDeviceWarnCombineService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 设备告警信息Service业务层处理
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class DeviceWarnCombineServiceImpl implements IDeviceWarnCombineService {
|
||||
|
||||
private final DeviceWarnCombineMapper baseMapper;
|
||||
private final DeviceWarnOneMapper deviceWarnOneMapper;
|
||||
|
||||
/**
|
||||
* 查询设备告警信息
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备告警信息
|
||||
*/
|
||||
@Override
|
||||
public DeviceWarnCombineVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备告警信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备告警信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<DeviceWarnCombineVo> queryPageList(DeviceWarnCombineBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<DeviceWarnCombine> wrapper = buildJoinQueryWrapper(bo);
|
||||
Page<DeviceWarnCombineVo> result = baseMapper.selectJoinPage(pageQuery.build(), DeviceWarnCombineVo.class, wrapper);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备告警信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备告警信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceWarnCombineVo> queryList(DeviceWarnCombineBo bo) {
|
||||
MPJLambdaWrapper<DeviceWarnCombine> wrapper = buildJoinQueryWrapper(bo);
|
||||
return baseMapper.selectJoinList(DeviceWarnCombineVo.class, wrapper);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<DeviceWarnCombine> buildJoinQueryWrapper(DeviceWarnCombineBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<DeviceWarnCombine> wrapper = new MPJLambdaWrapper<DeviceWarnCombine>()
|
||||
.selectAll(DeviceWarnCombine.class)
|
||||
.selectCount(DeviceWarnOne::getId, DeviceWarnCombineVo::getTotalCount)
|
||||
.leftJoin(DeviceWarnOne.class, DeviceWarnOne::getWarnCombineId, DeviceWarnCombine::getId)
|
||||
.eq(StringUtils.isNotBlank(bo.getDeviceSerialNum()), DeviceWarnCombine::getDeviceSerialNum, bo.getDeviceSerialNum())
|
||||
.eq(bo.getDeviceType() != null, DeviceWarnCombine::getDeviceType, bo.getDeviceType())
|
||||
.eq(bo.getThresholdType() != null, DeviceWarnCombine::getThresholdType, bo.getThresholdType())
|
||||
.eq(bo.getProcessStatus() != null, DeviceWarnCombine::getProcessStatus, bo.getProcessStatus())
|
||||
.eq(bo.getWarnType() != null, DeviceWarnCombine::getWarnType, bo.getWarnType())
|
||||
.groupBy(DeviceWarnCombine::getId)
|
||||
.orderByDesc(DeviceWarnCombine::getUpdateTime);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备告警信息
|
||||
*
|
||||
* @param bo 设备告警信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(DeviceWarnCombineBo bo) {
|
||||
DeviceWarnCombine add = MapstructUtils.convert(bo, DeviceWarnCombine.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备告警信息
|
||||
*
|
||||
* @param bo 设备告警信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(DeviceWarnCombineBo bo) {
|
||||
DeviceWarnCombine update = MapstructUtils.convert(bo, DeviceWarnCombine.class);
|
||||
validEntityBeforeSave(update);
|
||||
boolean result = baseMapper.updateById(update) > 0;
|
||||
|
||||
// 如果更新成功,同时批量更新关联的DeviceWarnOne记录
|
||||
if (result) {
|
||||
LambdaUpdateWrapper<DeviceWarnOne> updateWrapper = Wrappers.lambdaUpdate();
|
||||
updateWrapper.eq(DeviceWarnOne::getWarnCombineId, bo.getId());
|
||||
|
||||
// 只更新非空字段
|
||||
updateWrapper.set(bo.getProcessStatus() != null, DeviceWarnOne::getProcessStatus, bo.getProcessStatus());
|
||||
updateWrapper.set(bo.getWarnType() != null, DeviceWarnOne::getWarnType, bo.getWarnType());
|
||||
updateWrapper.set(StringUtils.isNotBlank(bo.getHandlerName()), DeviceWarnOne::getHandlerName, bo.getHandlerName());
|
||||
updateWrapper.set(bo.getProcessTime() != null, DeviceWarnOne::getProcessTime, bo.getProcessTime());
|
||||
updateWrapper.set(StringUtils.isNotBlank(bo.getRemark()), DeviceWarnOne::getRemark, bo.getRemark());
|
||||
|
||||
int updatedCount = deviceWarnOneMapper.update(null, updateWrapper);
|
||||
log.info("更新DeviceWarnCombine[id={}]成功,同时批量更新了{}条DeviceWarnOne记录", bo.getId(), updatedCount);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(DeviceWarnCombine entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备告警信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
|
||||
// 先删除关联的DeviceWarnOne记录
|
||||
LambdaQueryWrapper<DeviceWarnOne> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.in(DeviceWarnOne::getWarnCombineId, ids);
|
||||
int deletedDetailCount = deviceWarnOneMapper.delete(queryWrapper);
|
||||
log.info("删除DeviceWarnCombine记录前,先删除了{}条关联的DeviceWarnOne记录", deletedDetailCount);
|
||||
|
||||
// 再删除主表DeviceWarnCombine记录
|
||||
boolean result = baseMapper.deleteByIds(ids) > 0;
|
||||
|
||||
if (result) {
|
||||
log.info("成功删除{}条DeviceWarnCombine记录", ids.size());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.intc.fishery.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.MapstructUtils;
|
||||
import com.intc.common.core.utils.StringUtils;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.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.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.intc.fishery.domain.bo.DeviceWarnOneBo;
|
||||
import com.intc.fishery.domain.bo.DeviceWarnOneBatchUpdateBo;
|
||||
import com.intc.fishery.domain.vo.DeviceWarnOneVo;
|
||||
import com.intc.fishery.domain.DeviceWarnOne;
|
||||
import com.intc.fishery.domain.DeviceWarnCombine;
|
||||
import com.intc.fishery.mapper.DeviceWarnOneMapper;
|
||||
import com.intc.fishery.service.IDeviceWarnOneService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 设备报警明细Service业务层处理
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class DeviceWarnOneServiceImpl implements IDeviceWarnOneService {
|
||||
|
||||
private final DeviceWarnOneMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询设备报警明细
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备报警明细
|
||||
*/
|
||||
@Override
|
||||
public DeviceWarnOneVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备报警明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备报警明细分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<DeviceWarnOneVo> queryPageList(DeviceWarnOneBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<DeviceWarnOne> wrapper = buildJoinQueryWrapper(bo);
|
||||
Page<DeviceWarnOneVo> result = baseMapper.selectJoinPage(pageQuery.build(), DeviceWarnOneVo.class, wrapper);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备报警明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备报警明细列表
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceWarnOneVo> queryList(DeviceWarnOneBo bo) {
|
||||
MPJLambdaWrapper<DeviceWarnOne> wrapper = buildJoinQueryWrapper(bo);
|
||||
return baseMapper.selectJoinList(DeviceWarnOneVo.class, wrapper);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<DeviceWarnOne> buildJoinQueryWrapper(DeviceWarnOneBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
|
||||
// 从params中获取关联表查询条件并转换类型
|
||||
String deviceSerialNum = (String) params.get("deviceSerialNum");
|
||||
Integer deviceType = params.get("deviceType") != null ? Integer.parseInt(params.get("deviceType").toString()) : null;
|
||||
Integer thresholdType = params.get("thresholdType") != null ? Integer.parseInt(params.get("thresholdType").toString()) : null;
|
||||
|
||||
MPJLambdaWrapper<DeviceWarnOne> wrapper = new MPJLambdaWrapper<DeviceWarnOne>()
|
||||
.selectAll(DeviceWarnOne.class)
|
||||
.select(DeviceWarnCombine::getDeviceSerialNum)
|
||||
.select(DeviceWarnCombine::getDeviceType)
|
||||
.select(DeviceWarnCombine::getThresholdType)
|
||||
.leftJoin(DeviceWarnCombine.class, DeviceWarnCombine::getId, DeviceWarnOne::getWarnCombineId)
|
||||
.eq(bo.getWarnCombineId() != null, DeviceWarnOne::getWarnCombineId, bo.getWarnCombineId())
|
||||
.eq(bo.getUserId() != null, DeviceWarnOne::getUserId, bo.getUserId())
|
||||
.eq(bo.getProcessStatus() != null, DeviceWarnOne::getProcessStatus, bo.getProcessStatus())
|
||||
.eq(bo.getWarnType() != null, DeviceWarnOne::getWarnType, bo.getWarnType())
|
||||
.like(StringUtils.isNotBlank(bo.getHandlerName()), DeviceWarnOne::getHandlerName, bo.getHandlerName())
|
||||
.like(StringUtils.isNotBlank(deviceSerialNum), DeviceWarnCombine::getDeviceSerialNum, deviceSerialNum)
|
||||
.eq(deviceType != null, DeviceWarnCombine::getDeviceType, deviceType)
|
||||
.eq(thresholdType != null, DeviceWarnCombine::getThresholdType, thresholdType)
|
||||
.orderByDesc(DeviceWarnOne::getUpdateTime);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备报警明细
|
||||
*
|
||||
* @param bo 设备报警明细
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(DeviceWarnOneBo bo) {
|
||||
DeviceWarnOne add = MapstructUtils.convert(bo, DeviceWarnOne.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备报警明细
|
||||
*
|
||||
* @param bo 设备报警明细
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(DeviceWarnOneBo bo) {
|
||||
DeviceWarnOne update = MapstructUtils.convert(bo, DeviceWarnOne.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(DeviceWarnOne 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,159 @@
|
||||
package com.intc.fishery.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.MapstructUtils;
|
||||
import com.intc.common.core.utils.StringUtils;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.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 com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.intc.fishery.domain.bo.MessageOpRecordBo;
|
||||
import com.intc.fishery.domain.vo.MessageOpRecordVo;
|
||||
import com.intc.fishery.domain.MessageOpRecord;
|
||||
import com.intc.fishery.domain.AquUser;
|
||||
import com.intc.fishery.mapper.MessageOpRecordMapper;
|
||||
import com.intc.fishery.service.IMessageOpRecordService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 用户操作记录Service业务层处理
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class MessageOpRecordServiceImpl implements IMessageOpRecordService {
|
||||
|
||||
private final MessageOpRecordMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询用户操作记录
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 用户操作记录
|
||||
*/
|
||||
@Override
|
||||
public MessageOpRecordVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询用户操作记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 用户操作记录分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<MessageOpRecordVo> queryPageList(MessageOpRecordBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<MessageOpRecord> wrapper = buildJoinQueryWrapper(bo);
|
||||
Page<MessageOpRecordVo> result = baseMapper.selectJoinPage(pageQuery.build(), MessageOpRecordVo.class, wrapper);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的用户操作记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 用户操作记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<MessageOpRecordVo> queryList(MessageOpRecordBo bo) {
|
||||
MPJLambdaWrapper<MessageOpRecord> wrapper = buildJoinQueryWrapper(bo);
|
||||
return baseMapper.selectJoinList(MessageOpRecordVo.class, wrapper);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<MessageOpRecord> buildJoinQueryWrapper(MessageOpRecordBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
|
||||
// 获取用户关键字搜索参数
|
||||
String userKeyword = params.get("userKeyword") != null ? params.get("userKeyword").toString() : null;
|
||||
|
||||
MPJLambdaWrapper<MessageOpRecord> wrapper = new MPJLambdaWrapper<MessageOpRecord>()
|
||||
.selectAll(MessageOpRecord.class)
|
||||
// 关联查询AquUser用户信息
|
||||
.selectAs("u1.user_name", MessageOpRecordVo::getUserName)
|
||||
.selectAs("u1.mobile_phone", MessageOpRecordVo::getUserPhonenumber)
|
||||
// 关联查询操作用户信息
|
||||
.selectAs("u2.user_name", MessageOpRecordVo::getOpUserName)
|
||||
.selectAs("u2.mobile_phone", MessageOpRecordVo::getOpUserPhonenumber)
|
||||
// 关联aqu_user表(用户)
|
||||
.leftJoin("aqu_user u1 on u1.id = t.user_id")
|
||||
// 关联aqu_user表(操作用户)
|
||||
.leftJoin("aqu_user u2 on u2.id = t.op_user_id")
|
||||
.eq(bo.getUserId() != null, MessageOpRecord::getUserId, bo.getUserId())
|
||||
.eq(bo.getOpUserId() != null, MessageOpRecord::getOpUserId, bo.getOpUserId())
|
||||
.like(StringUtils.isNotBlank(bo.getTitle()), MessageOpRecord::getTitle, bo.getTitle())
|
||||
.like(StringUtils.isNotBlank(bo.getMessage()), MessageOpRecord::getMessage, bo.getMessage())
|
||||
.eq(bo.getOpType() != null, MessageOpRecord::getOpType, bo.getOpType())
|
||||
// 根据用户关键字模糊查询用户名或手机号
|
||||
.and(StringUtils.isNotBlank(userKeyword), w -> w
|
||||
.like("u1.user_name", userKeyword)
|
||||
.or()
|
||||
.like("u1.mobile_phone", userKeyword)
|
||||
)
|
||||
.orderByDesc(MessageOpRecord::getCreateTime);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户操作记录
|
||||
*
|
||||
* @param bo 用户操作记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(MessageOpRecordBo bo) {
|
||||
MessageOpRecord add = MapstructUtils.convert(bo, MessageOpRecord.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户操作记录
|
||||
*
|
||||
* @param bo 用户操作记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(MessageOpRecordBo bo) {
|
||||
MessageOpRecord update = MapstructUtils.convert(bo, MessageOpRecord.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(MessageOpRecord 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,131 @@
|
||||
package com.intc.fishery.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.MapstructUtils;
|
||||
import com.intc.common.core.utils.StringUtils;
|
||||
import com.intc.common.mybatis.core.page.TableDataInfo;
|
||||
import com.intc.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.intc.fishery.domain.bo.TecentUserCacheBo;
|
||||
import com.intc.fishery.domain.vo.TecentUserCacheVo;
|
||||
import com.intc.fishery.domain.TecentUserCache;
|
||||
import com.intc.fishery.mapper.TecentUserCacheMapper;
|
||||
import com.intc.fishery.service.ITecentUserCacheService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 公众号用户缓存Service业务层处理
|
||||
*
|
||||
* @author intc
|
||||
* @date 2025-10-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TecentUserCacheServiceImpl implements ITecentUserCacheService {
|
||||
|
||||
private final TecentUserCacheMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询公众号用户缓存
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 公众号用户缓存
|
||||
*/
|
||||
@Override
|
||||
public TecentUserCacheVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询公众号用户缓存列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 公众号用户缓存分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TecentUserCacheVo> queryPageList(TecentUserCacheBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TecentUserCache> lqw = buildQueryWrapper(bo);
|
||||
Page<TecentUserCacheVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的公众号用户缓存列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 公众号用户缓存列表
|
||||
*/
|
||||
@Override
|
||||
public List<TecentUserCacheVo> queryList(TecentUserCacheBo bo) {
|
||||
LambdaQueryWrapper<TecentUserCache> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TecentUserCache> buildQueryWrapper(TecentUserCacheBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TecentUserCache> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(TecentUserCache::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公众号用户缓存
|
||||
*
|
||||
* @param bo 公众号用户缓存
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TecentUserCacheBo bo) {
|
||||
TecentUserCache add = MapstructUtils.convert(bo, TecentUserCache.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公众号用户缓存
|
||||
*
|
||||
* @param bo 公众号用户缓存
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(TecentUserCacheBo bo) {
|
||||
TecentUserCache update = MapstructUtils.convert(bo, TecentUserCache.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(TecentUserCache entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除公众号用户缓存信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user