forked from dyf/fys-Multi-tenant
feat(web): 新增设备联调中心功能
- 新增设备联调中心相关控制器、服务、DTO和VO - 实现设备列表查询、文件上传、操作视频添加、设备详情等功能 - 优化设备 logo 上传逻辑,支持批量上传 - 重构部分代码结构,提高可维护性
This commit is contained in:
@ -45,5 +45,10 @@ public class AppOperationVideoBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 多设备id
|
||||
*/
|
||||
private Long[] deviceIds;
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,10 @@ public class AppFileVo {
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
/**
|
||||
* 文件类型(1:操作说明,2:产品参数)
|
||||
*/
|
||||
private Long fileType;
|
||||
/**
|
||||
* 文件url
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuyuanshen.app.service;
|
||||
|
||||
import com.fuyuanshen.app.domain.AppBusinessFile;
|
||||
import com.fuyuanshen.app.domain.vo.AppBusinessFileVo;
|
||||
import com.fuyuanshen.app.domain.bo.AppBusinessFileBo;
|
||||
import com.fuyuanshen.app.domain.vo.AppFileVo;
|
||||
@ -50,6 +51,14 @@ public interface IAppBusinessFileService {
|
||||
*/
|
||||
Boolean insertByBo(AppBusinessFileBo bo);
|
||||
|
||||
/**
|
||||
* 批量新增app业务文件
|
||||
*
|
||||
* @param bo 批量新增app业务文件
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertBatch(Collection<AppBusinessFile> bo);
|
||||
|
||||
/**
|
||||
* 修改app业务文件
|
||||
*
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.fuyuanshen.app.service;
|
||||
|
||||
import com.fuyuanshen.app.domain.AppBusinessFile;
|
||||
import com.fuyuanshen.app.domain.AppOperationVideo;
|
||||
import com.fuyuanshen.app.domain.vo.AppOperationVideoVo;
|
||||
import com.fuyuanshen.app.domain.bo.AppOperationVideoBo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
@ -49,6 +51,14 @@ public interface IAppOperationVideoService {
|
||||
*/
|
||||
Boolean insertByBo(AppOperationVideoBo bo);
|
||||
|
||||
/**
|
||||
* 批量新增操作视频
|
||||
*
|
||||
* @param bo 批量新增操作视频
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertBatch(Collection<AppOperationVideo> bo);
|
||||
|
||||
/**
|
||||
* 修改操作视频
|
||||
*
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuyuanshen.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.fuyuanshen.app.domain.vo.AppFileVo;
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
@ -100,6 +101,20 @@ public class AppBusinessFileServiceImpl implements IAppBusinessFileService {
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertBatch(Collection<AppBusinessFile> bo) {
|
||||
// 1. 去重后的 businessId 集合
|
||||
List<Long> businessIds = bo.stream()
|
||||
.map(AppBusinessFile::getBusinessId)
|
||||
.distinct()
|
||||
.toList();
|
||||
QueryWrapper<AppBusinessFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("business_id", businessIds);
|
||||
queryWrapper.eq("file_type", bo.stream().findFirst().orElseThrow().getFileType());
|
||||
baseMapper.delete(queryWrapper);
|
||||
return baseMapper.insertBatch(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改app业务文件
|
||||
*
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.fuyuanshen.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.fuyuanshen.app.domain.AppBusinessFile;
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
@ -97,6 +99,19 @@ public class AppOperationVideoServiceImpl implements IAppOperationVideoService {
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertBatch(Collection<AppOperationVideo> bo) {
|
||||
// 1. 去重后的 businessId 集合
|
||||
List<Long> deviceIds = bo.stream()
|
||||
.map(AppOperationVideo::getDeviceId)
|
||||
.distinct()
|
||||
.toList();
|
||||
QueryWrapper<AppOperationVideo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("device_id", deviceIds);
|
||||
baseMapper.delete(queryWrapper);
|
||||
return baseMapper.insertBatch(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改操作视频
|
||||
*
|
||||
|
@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<mapper namespace="com.fuyuanshen.app.mapper.AppBusinessFileMapper">
|
||||
|
||||
<select id="queryAppFileList" resultType="com.fuyuanshen.app.domain.vo.AppFileVo">
|
||||
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
|
||||
select a.id,a.business_id,a.file_id,a.file_type,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="businessId != null">
|
||||
and a.business_id = #{businessId}
|
||||
|
@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and dr.device_id = #{criteria.deviceId}
|
||||
</if>
|
||||
<if test="criteria.repairPart != null">
|
||||
and dr.repairPart like concat('%', TRIM(#{criteria.repairPart}), '%')
|
||||
and dr.repair_part like concat('%', TRIM(#{criteria.repairPart}), '%')
|
||||
</if>
|
||||
<!-- 时间段条件 -->
|
||||
<if test="criteria.repairBeginTime != null">
|
||||
|
@ -51,5 +51,9 @@ public class SysOss extends TenantEntity {
|
||||
* 服务商
|
||||
*/
|
||||
private String service;
|
||||
/**
|
||||
* 内容哈希
|
||||
*/
|
||||
private String fileHash;
|
||||
|
||||
}
|
||||
|
@ -50,5 +50,9 @@ public class SysOssBo extends BaseEntity {
|
||||
* 服务商
|
||||
*/
|
||||
private String service;
|
||||
/**
|
||||
* 内容哈希
|
||||
*/
|
||||
private String fileHash;
|
||||
|
||||
}
|
||||
|
@ -72,6 +72,10 @@ public class SysOssVo implements Serializable {
|
||||
* 服务商
|
||||
*/
|
||||
private String service;
|
||||
/**
|
||||
* 内容哈希
|
||||
*/
|
||||
private String fileHash;
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,16 @@
|
||||
package com.fuyuanshen.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.fuyuanshen.common.mybatis.annotation.DataColumn;
|
||||
import com.fuyuanshen.common.mybatis.annotation.DataPermission;
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import com.fuyuanshen.system.domain.SysOss;
|
||||
import com.fuyuanshen.system.domain.SysUser;
|
||||
import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 文件上传 数据层
|
||||
@ -12,4 +19,20 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysOssMapper extends BaseMapperPlus<SysOss, SysOssVo> {
|
||||
|
||||
/**
|
||||
* 用内容哈希查询文件
|
||||
*
|
||||
* @param fileHash 内容哈希
|
||||
* @return 文件信息
|
||||
*/
|
||||
SysOssVo selectByHash(String fileHash);
|
||||
|
||||
/**
|
||||
* 根据主键更新内容哈希
|
||||
*
|
||||
* @param ossId 主键
|
||||
* @return 结果
|
||||
*/
|
||||
int updateHashById(long ossId,String fileHash);
|
||||
}
|
||||
|
@ -44,6 +44,22 @@ public interface ISysOssService {
|
||||
*/
|
||||
SysOssVo getById(Long ossId);
|
||||
|
||||
/**
|
||||
* 根据文件 hash 值从缓存或数据库中获取 SysOssVo 对象
|
||||
*
|
||||
* @param fileHash 文件 hash 值
|
||||
* @return 匹配的 SysOssVo 列表
|
||||
*/
|
||||
SysOssVo selectByHash(String fileHash);
|
||||
|
||||
/**
|
||||
* 更新文件 hash 值
|
||||
*
|
||||
* @param ossId OSS对象ID
|
||||
* @param fileHash 文件 hash 值
|
||||
*/
|
||||
int updateHashById(long ossId,String fileHash);
|
||||
|
||||
/**
|
||||
* 上传 MultipartFile 到对象存储服务,并保存文件信息到数据库
|
||||
*
|
||||
|
@ -162,6 +162,16 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
return baseMapper.selectVoById(ossId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysOssVo selectByHash(String fileHash) {
|
||||
return baseMapper.selectByHash(fileHash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateHashById(long ossId, String fileHash) {
|
||||
return baseMapper.updateHashById(ossId,fileHash);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文件下载方法,支持一次性下载完整文件
|
||||
|
@ -2,4 +2,11 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuyuanshen.system.mapper.SysOssMapper">
|
||||
|
||||
<select id="selectByHash" resultType="com.fuyuanshen.system.domain.vo.SysOssVo">
|
||||
select oss_id,file_name,original_name,file_suffix,url,service,file_hash from sys_oss WHERE file_hash = #{fileHash} LIMIT 1
|
||||
</select>
|
||||
|
||||
<update id="updateHashById">
|
||||
UPDATE sys_oss SET file_hash = #{fileHash} WHERE oss_id = #{ossId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user