forked from dyf/fys-Multi-tenant
Compare commits
5 Commits
7753444f25
...
c8f9cc4f31
| Author | SHA1 | Date | |
|---|---|---|---|
| c8f9cc4f31 | |||
| 26d2f05c4e | |||
| d57d17dc50 | |||
| 20ddbf6e05 | |||
| 63a9d2f8f9 |
@ -4,6 +4,7 @@ import cn.dev33.satoken.exception.NotLoginException;
|
|||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.fuyuanshen.app.domain.bo.AppDeviceBindRecordBo;
|
import com.fuyuanshen.app.domain.bo.AppDeviceBindRecordBo;
|
||||||
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
|
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
|
||||||
import com.fuyuanshen.app.domain.vo.AppDeviceBindRecordVo;
|
import com.fuyuanshen.app.domain.vo.AppDeviceBindRecordVo;
|
||||||
@ -27,6 +28,8 @@ import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
|||||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||||
import com.fuyuanshen.common.tenant.exception.TenantException;
|
import com.fuyuanshen.common.tenant.exception.TenantException;
|
||||||
import com.fuyuanshen.common.tenant.helper.TenantHelper;
|
import com.fuyuanshen.common.tenant.helper.TenantHelper;
|
||||||
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
|
import com.fuyuanshen.equipment.service.DeviceService;
|
||||||
import com.fuyuanshen.system.domain.vo.SysTenantVo;
|
import com.fuyuanshen.system.domain.vo.SysTenantVo;
|
||||||
import com.fuyuanshen.system.service.ISysTenantService;
|
import com.fuyuanshen.system.service.ISysTenantService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -59,6 +62,7 @@ public class AppLoginService {
|
|||||||
private final IAppUserService appUserService;
|
private final IAppUserService appUserService;
|
||||||
private final IAppDeviceShareService appDeviceShareService;
|
private final IAppDeviceShareService appDeviceShareService;
|
||||||
private final IAppDeviceBindRecordService appDeviceBindRecordService;
|
private final IAppDeviceBindRecordService appDeviceBindRecordService;
|
||||||
|
private final DeviceService deviceService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,8 +213,7 @@ public class AppLoginService {
|
|||||||
if(ObjectUtil.length(appDeviceBindRecordVos)>0){
|
if(ObjectUtil.length(appDeviceBindRecordVos)>0){
|
||||||
|
|
||||||
|
|
||||||
// 根据设备id批量删除
|
Set<Long> deviceIds = appDeviceBindRecordVos.stream().map(AppDeviceBindRecordVo::getDeviceId).collect(Collectors.toSet());
|
||||||
List<Long> deviceIds = appDeviceBindRecordVos.stream().map(AppDeviceBindRecordVo::getDeviceId).toList();
|
|
||||||
appDeviceShareService.deleteByDeviceIds(deviceIds);
|
appDeviceShareService.deleteByDeviceIds(deviceIds);
|
||||||
|
|
||||||
|
|
||||||
@ -219,6 +222,21 @@ public class AppLoginService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
appDeviceBindRecordService.deleteWithValidByIds(ids, true);
|
appDeviceBindRecordService.deleteWithValidByIds(ids, true);
|
||||||
log.info("删除绑定关系表数据:ids={}",ids);
|
log.info("删除绑定关系表数据:ids={}",ids);
|
||||||
|
|
||||||
|
|
||||||
|
// 检查设备id是否存在绑定关系
|
||||||
|
for (Long deviceId : deviceIds){
|
||||||
|
// 根据设备id查询是否存在绑定关系
|
||||||
|
Long count = appDeviceBindRecordService.checkDeviceExistBindRecord(deviceId);
|
||||||
|
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq("id",deviceId);
|
||||||
|
if(count>0){
|
||||||
|
updateWrapper.set("binding_status",1);
|
||||||
|
}else{
|
||||||
|
updateWrapper.set("binding_status",0);
|
||||||
|
}
|
||||||
|
deviceService.update(updateWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TenantHelper.isEnable() && LoginHelper.isSuperAdmin()) {
|
if (TenantHelper.isEnable() && LoginHelper.isSuperAdmin()) {
|
||||||
|
|||||||
@ -101,13 +101,13 @@ public class AuthController {
|
|||||||
// 登录
|
// 登录
|
||||||
LoginVo loginVo = IAuthStrategy.login(body, client, grantType);
|
LoginVo loginVo = IAuthStrategy.login(body, client, grantType);
|
||||||
|
|
||||||
Long userId = LoginHelper.getUserId();
|
// Long userId = LoginHelper.getUserId();
|
||||||
scheduledExecutorService.schedule(() -> {
|
// scheduledExecutorService.schedule(() -> {
|
||||||
SseMessageDto dto = new SseMessageDto();
|
// SseMessageDto dto = new SseMessageDto();
|
||||||
dto.setMessage("欢迎登录fys-Vue-Plus后台管理系统");
|
// dto.setMessage("欢迎登录fys-Vue-Plus后台管理系统");
|
||||||
dto.setUserIds(List.of(userId));
|
// dto.setUserIds(List.of(userId));
|
||||||
SseMessageUtils.publishMessage(dto);
|
// SseMessageUtils.publishMessage(dto);
|
||||||
}, 5, TimeUnit.SECONDS);
|
// }, 5, TimeUnit.SECONDS);
|
||||||
return R.ok(loginVo);
|
return R.ok(loginVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -72,13 +72,13 @@ public class ImageCompressUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 先尝试质量压缩
|
// 先尝试质量压缩
|
||||||
byte[] compressedData = compressImageQuality(originalImage, formatName, 0.8f);
|
byte[] compressedData = compressImageQuality(originalImage, formatName, 0.7f);
|
||||||
|
|
||||||
// 如果质量压缩后仍大于目标大小,则进行尺寸压缩
|
// 如果质量压缩后仍大于目标大小,则进行尺寸压缩
|
||||||
if (compressedData.length > maxSize) {
|
if (compressedData.length > maxSize) {
|
||||||
// 计算缩放比例
|
// 计算缩放比例
|
||||||
double scale = Math.sqrt((double) maxSize / compressedData.length);
|
double scale = Math.sqrt((double) maxSize / compressedData.length);
|
||||||
scale = Math.max(scale, 0.5); // 最小缩放到原来的一半
|
scale = Math.max(scale, 0.2); // 最小缩放到原来的20%
|
||||||
|
|
||||||
// 尺寸压缩
|
// 尺寸压缩
|
||||||
compressedData = compressImageByScale(originalImage, scale, formatName);
|
compressedData = compressImageByScale(originalImage, scale, formatName);
|
||||||
@ -86,20 +86,36 @@ public class ImageCompressUtil {
|
|||||||
|
|
||||||
// 如果压缩后还是太大,继续压缩
|
// 如果压缩后还是太大,继续压缩
|
||||||
int attempts = 0;
|
int attempts = 0;
|
||||||
while (compressedData.length > maxSize && attempts < 5) {
|
while (compressedData.length > maxSize && attempts < 15) { // 增加尝试次数到15次
|
||||||
// 优先降低质量
|
// 优先降低质量
|
||||||
float quality = Math.max(0.1f, 0.8f - attempts * 0.1f);
|
float quality = Math.max(0.01f, 0.7f - attempts * 0.1f); // 最低质量降至0.01
|
||||||
compressedData = compressImageQuality(originalImage, formatName, quality);
|
compressedData = compressImageQuality(originalImage, formatName, quality);
|
||||||
|
|
||||||
// 如果质量压缩不够,再缩小尺寸
|
// 如果质量压缩不够,再缩小尺寸
|
||||||
if (compressedData.length > maxSize) {
|
if (compressedData.length > maxSize) {
|
||||||
double scale = 0.9 - attempts * 0.1; // 逐步缩小尺寸
|
double scale = 0.8 - attempts * 0.15; // 更积极地缩小尺寸
|
||||||
scale = Math.max(scale, 0.5);
|
scale = Math.max(scale, 0.1); // 最小缩放到原来的10%
|
||||||
compressedData = compressImageByScale(originalImage, scale, formatName);
|
compressedData = compressImageByScale(originalImage, scale, formatName);
|
||||||
}
|
}
|
||||||
attempts++;
|
attempts++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果经过多次尝试仍然大于目标大小,则强制压缩到目标大小以下
|
||||||
|
if (compressedData.length > maxSize) {
|
||||||
|
// 强制尺寸压缩到目标大小
|
||||||
|
double finalScale = Math.sqrt((double) maxSize / compressedData.length) * 0.8; // 留一些余量
|
||||||
|
finalScale = Math.max(finalScale, 0.05); // 至少保留5%的尺寸
|
||||||
|
compressedData = compressImageByScale(originalImage, finalScale, formatName);
|
||||||
|
|
||||||
|
// 如果仍然太大,强制质量压缩
|
||||||
|
if (compressedData.length > maxSize) {
|
||||||
|
// 计算需要的质量值
|
||||||
|
float finalQuality = (float) maxSize / compressedData.length * 0.7f; // 留一些余量
|
||||||
|
finalQuality = Math.max(finalQuality, 0.005f); // 至少保留0.5%的质量
|
||||||
|
compressedData = compressImageQuality(originalImage, formatName, finalQuality);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.info("图片压缩完成,原始大小: {} bytes, 压缩后大小: {} bytes, 压缩率: {}%",
|
log.info("图片压缩完成,原始大小: {} bytes, 压缩后大小: {} bytes, 压缩率: {}%",
|
||||||
imageData.length, compressedData.length,
|
imageData.length, compressedData.length,
|
||||||
String.format("%.2f", (1.0 - (double) compressedData.length / imageData.length) * 100));
|
String.format("%.2f", (1.0 - (double) compressedData.length / imageData.length) * 100));
|
||||||
@ -110,6 +126,12 @@ public class ImageCompressUtil {
|
|||||||
return imageData;
|
return imageData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 特殊处理:如果目标大小是50KB或更小,确保最终结果符合要求
|
||||||
|
if (maxSize <= 50 * 1024 && compressedData.length > maxSize) {
|
||||||
|
// 使用更强力的压缩策略
|
||||||
|
compressedData = forceCompressToSize(originalImage, formatName, maxSize);
|
||||||
|
}
|
||||||
|
|
||||||
return compressedData;
|
return compressedData;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("图片压缩失败: {}", e.getMessage(), e);
|
log.error("图片压缩失败: {}", e.getMessage(), e);
|
||||||
@ -117,6 +139,63 @@ public class ImageCompressUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制压缩到指定大小
|
||||||
|
*
|
||||||
|
* @param originalImage 原始图片
|
||||||
|
* @param formatName 图片格式
|
||||||
|
* @param maxSize 目标大小
|
||||||
|
* @return 压缩后的图片数据
|
||||||
|
*/
|
||||||
|
private static byte[] forceCompressToSize(BufferedImage originalImage, String formatName, int maxSize) throws IOException {
|
||||||
|
byte[] result = null;
|
||||||
|
int width = originalImage.getWidth();
|
||||||
|
int height = originalImage.getHeight();
|
||||||
|
|
||||||
|
// 通过不断缩小尺寸来达到目标大小
|
||||||
|
double scale = 0.9;
|
||||||
|
do {
|
||||||
|
int newWidth = (int) (width * scale);
|
||||||
|
int newHeight = (int) (height * scale);
|
||||||
|
|
||||||
|
// 创建缩放后的图片
|
||||||
|
Image scaledImage = originalImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH);
|
||||||
|
BufferedImage bufferedImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
|
||||||
|
Graphics2D g2d = bufferedImage.createGraphics();
|
||||||
|
|
||||||
|
// 绘制缩放后的图片
|
||||||
|
g2d.drawImage(scaledImage, 0, 0, null);
|
||||||
|
g2d.dispose();
|
||||||
|
|
||||||
|
// 以最低质量压缩
|
||||||
|
result = compressImageQuality(bufferedImage, formatName, 0.01f);
|
||||||
|
|
||||||
|
if (result.length <= maxSize) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
scale -= 0.1;
|
||||||
|
} while (scale > 0.1 && result.length > maxSize);
|
||||||
|
|
||||||
|
// 如果还是太大,强制调整大小
|
||||||
|
if (result.length > maxSize) {
|
||||||
|
// 计算精确的缩放比例
|
||||||
|
double targetScale = Math.sqrt((double) maxSize / result.length) * 0.9;
|
||||||
|
int newWidth = Math.max((int) (width * targetScale), 5);
|
||||||
|
int newHeight = Math.max((int) (height * targetScale), 5);
|
||||||
|
|
||||||
|
Image scaledImage = originalImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH);
|
||||||
|
BufferedImage bufferedImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
|
||||||
|
Graphics2D g2d = bufferedImage.createGraphics();
|
||||||
|
g2d.drawImage(scaledImage, 0, 0, null);
|
||||||
|
g2d.dispose();
|
||||||
|
|
||||||
|
result = compressImageQuality(bufferedImage, formatName, 0.005f);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按比例缩放图片
|
* 按比例缩放图片
|
||||||
*
|
*
|
||||||
@ -130,6 +209,10 @@ public class ImageCompressUtil {
|
|||||||
int width = (int) (originalImage.getWidth() * scale);
|
int width = (int) (originalImage.getWidth() * scale);
|
||||||
int height = (int) (originalImage.getHeight() * scale);
|
int height = (int) (originalImage.getHeight() * scale);
|
||||||
|
|
||||||
|
// 确保最小尺寸不小于5像素
|
||||||
|
width = Math.max(width, 5);
|
||||||
|
height = Math.max(height, 5);
|
||||||
|
|
||||||
// 创建缩放后的图片
|
// 创建缩放后的图片
|
||||||
Image scaledImage = originalImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
|
Image scaledImage = originalImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
|
||||||
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.fuyuanshen.app.mapper;
|
|||||||
import com.fuyuanshen.app.domain.AppDeviceBindRecord;
|
import com.fuyuanshen.app.domain.AppDeviceBindRecord;
|
||||||
import com.fuyuanshen.app.domain.vo.AppDeviceBindRecordVo;
|
import com.fuyuanshen.app.domain.vo.AppDeviceBindRecordVo;
|
||||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备绑定关系Mapper接口
|
* 设备绑定关系Mapper接口
|
||||||
@ -12,4 +13,5 @@ import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
|||||||
*/
|
*/
|
||||||
public interface AppDeviceBindRecordMapper extends BaseMapperPlus<AppDeviceBindRecord, AppDeviceBindRecordVo> {
|
public interface AppDeviceBindRecordMapper extends BaseMapperPlus<AppDeviceBindRecord, AppDeviceBindRecordVo> {
|
||||||
|
|
||||||
|
Long checkDeviceExistBindRecord(@Param("deviceId") Long deviceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备分享Mapper接口
|
* 设备分享Mapper接口
|
||||||
@ -30,5 +31,5 @@ public interface AppDeviceShareMapper extends BaseMapperPlus<AppDeviceShare, App
|
|||||||
*/
|
*/
|
||||||
Page<AppDeviceShareVo> selectWebDeviceShareList(@Param("bo") AppDeviceShareBo bo, Page<AppDeviceShareVo> page);
|
Page<AppDeviceShareVo> selectWebDeviceShareList(@Param("bo") AppDeviceShareBo bo, Page<AppDeviceShareVo> page);
|
||||||
|
|
||||||
void deleteByDeviceIds(@Param("deviceIds") List<Long> deviceIds);
|
void deleteByDeviceIds(@Param("deviceIds") Set<Long> deviceIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.fuyuanshen.app.domain.vo.AppDeviceBindRecordVo;
|
|||||||
import com.fuyuanshen.app.domain.bo.AppDeviceBindRecordBo;
|
import com.fuyuanshen.app.domain.bo.AppDeviceBindRecordBo;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -65,4 +66,6 @@ public interface IAppDeviceBindRecordService {
|
|||||||
* @return 是否删除成功
|
* @return 是否删除成功
|
||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
Long checkDeviceExistBindRecord(Long deviceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备分享Service接口
|
* 设备分享Service接口
|
||||||
@ -68,5 +69,5 @@ public interface IAppDeviceShareService {
|
|||||||
|
|
||||||
TableDataInfo<AppDeviceShareVo> otherDeviceShareList(AppDeviceShareBo bo, PageQuery pageQuery);
|
TableDataInfo<AppDeviceShareVo> otherDeviceShareList(AppDeviceShareBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
void deleteByDeviceIds(List<Long> deviceIds);
|
void deleteByDeviceIds(Set<Long> deviceIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -130,4 +130,9 @@ public class AppDeviceBindRecordServiceImpl implements IAppDeviceBindRecordServi
|
|||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long checkDeviceExistBindRecord(Long deviceId) {
|
||||||
|
return baseMapper.checkDeviceExistBindRecord(deviceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import com.fuyuanshen.app.service.IAppDeviceShareService;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备分享Service业务层处理
|
* 设备分享Service业务层处理
|
||||||
@ -168,7 +169,7 @@ public class AppDeviceShareServiceImpl implements IAppDeviceShareService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByDeviceIds(List<Long> deviceIds) {
|
public void deleteByDeviceIds(Set<Long> deviceIds) {
|
||||||
baseMapper.deleteByDeviceIds(deviceIds);
|
baseMapper.deleteByDeviceIds(deviceIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,4 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper">
|
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper">
|
||||||
|
|
||||||
|
<select id="checkDeviceExistBindRecord" resultType="java.lang.Long">
|
||||||
|
select count(1) from app_device_bind_record where device_id = #{deviceId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceShareMapper">
|
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceShareMapper">
|
||||||
<delete id="deleteByDeviceIds">
|
<delete id="deleteByDeviceIds">
|
||||||
delete from app_device_share where device_id in
|
delete from app_device_share where device_id in
|
||||||
<foreach item="item" collection="deviceIds" separator="," open="(" close=")">
|
<foreach item="item" collection="deviceIds" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|||||||
@ -34,9 +34,9 @@ public class IgnoreFailedImageConverter implements Converter<URL> {
|
|||||||
// 指数退避初始延迟(毫秒)
|
// 指数退避初始延迟(毫秒)
|
||||||
private static final int INITIAL_DELAY = 1000;
|
private static final int INITIAL_DELAY = 1000;
|
||||||
// 图片压缩阈值(1MB)
|
// 图片压缩阈值(1MB)
|
||||||
private static final int COMPRESSION_THRESHOLD = 1024 * 1024;
|
private static final int COMPRESSION_THRESHOLD = 100 * 1024;
|
||||||
// 压缩目标大小(100KB)
|
// 压缩目标大小(50KB)
|
||||||
private static final int COMPRESSION_TARGET = 100 * 1024;
|
private static final int COMPRESSION_TARGET = 50 * 1024;
|
||||||
// 用于跟踪本次任务中使用到的URL缓存键
|
// 用于跟踪本次任务中使用到的URL缓存键
|
||||||
private static final ThreadLocal<Set<String>> USED_CACHE_KEYS = new ThreadLocal<Set<String>>() {
|
private static final ThreadLocal<Set<String>> USED_CACHE_KEYS = new ThreadLocal<Set<String>>() {
|
||||||
@Override
|
@Override
|
||||||
@ -82,6 +82,7 @@ public class IgnoreFailedImageConverter implements Converter<URL> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载图片数据的核心方法
|
* 加载图片数据的核心方法
|
||||||
|
*
|
||||||
* @param value 图片URL
|
* @param value 图片URL
|
||||||
* @return WriteCellData对象
|
* @return WriteCellData对象
|
||||||
*/
|
*/
|
||||||
@ -296,6 +297,7 @@ public class IgnoreFailedImageConverter implements Converter<URL> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 预加载图片到缓存
|
* 预加载图片到缓存
|
||||||
|
*
|
||||||
* @param imageUrls 图片URL列表
|
* @param imageUrls 图片URL列表
|
||||||
*/
|
*/
|
||||||
public static void preloadImages(Set<URL> imageUrls) {
|
public static void preloadImages(Set<URL> imageUrls) {
|
||||||
|
|||||||
@ -123,4 +123,12 @@ public class DeviceQueryCriteria extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer onlineStatus;
|
private Integer onlineStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定状态
|
||||||
|
* 0 未绑定
|
||||||
|
* 1 已绑定
|
||||||
|
*/
|
||||||
|
@Schema(title = "绑定状态")
|
||||||
|
private Integer bindingStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
package com.fuyuanshen.equipment.service;
|
package com.fuyuanshen.equipment.service;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Dict;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fuyuanshen.common.core.domain.PageResult;
|
|
||||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.fuyuanshen.equipment.domain.Device;
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
import com.fuyuanshen.equipment.domain.DeviceType;
|
|
||||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||||
import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
||||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
@ -146,7 +143,7 @@ public interface DeviceService extends IService<Device> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> getEquipmentUsageData(Long deviceTypeId, Integer range);
|
List<Map<String, Object>> getEquipmentUsageData(Long deviceTypeId, Integer range);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备IMEI查询设备
|
* 根据设备IMEI查询设备
|
||||||
*
|
*
|
||||||
@ -191,7 +188,7 @@ public interface DeviceService extends IService<Device> {
|
|||||||
/**
|
/**
|
||||||
* 根据条件查询设备位置信息
|
* 根据条件查询设备位置信息
|
||||||
*
|
*
|
||||||
* @param groupId 设备分组ID
|
* @param groupId 设备分组ID
|
||||||
* @param deviceType 设备类型
|
* @param deviceType 设备类型
|
||||||
* @param deviceImei 设备IMEI
|
* @param deviceImei 设备IMEI
|
||||||
* @return 设备位置信息列表
|
* @return 设备位置信息列表
|
||||||
|
|||||||
@ -74,6 +74,9 @@
|
|||||||
<if test="criteria.onlineStatus != null">
|
<if test="criteria.onlineStatus != null">
|
||||||
and d.online_status = #{criteria.onlineStatus}
|
and d.online_status = #{criteria.onlineStatus}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="criteria.bindingStatus != null">
|
||||||
|
and d.binding_status = #{criteria.bindingStatus}
|
||||||
|
</if>
|
||||||
<if test="criteria.groupId != null">
|
<if test="criteria.groupId != null">
|
||||||
and d.group_id = #{criteria.groupId}
|
and d.group_id = #{criteria.groupId}
|
||||||
</if>
|
</if>
|
||||||
@ -305,7 +308,7 @@
|
|||||||
<select id="getLocationHistory" resultType="com.fuyuanshen.equipment.domain.vo.LocationHistoryVo">
|
<select id="getLocationHistory" resultType="com.fuyuanshen.equipment.domain.vo.LocationHistoryVo">
|
||||||
select a.id,a.device_name,a.device_type,b.type_name deviceTypeName,a.device_imei,a.device_mac from device a
|
select a.id,a.device_name,a.device_type,b.type_name deviceTypeName,a.device_imei,a.device_mac from device a
|
||||||
inner join device_type b on a.device_type = b.id
|
inner join device_type b on a.device_type = b.id
|
||||||
|
where b.communication_mode in (0, 2)
|
||||||
<if test="bo.deviceType != null">
|
<if test="bo.deviceType != null">
|
||||||
AND b.id = #{bo.deviceType}
|
AND b.id = #{bo.deviceType}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user