From e861c8ea2fd047f31d5b4827fb2a598af60e9378 Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期一, 11 四月 2022 13:49:49 +0800
Subject: [PATCH] ip音柱文件上传
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java | 5 ++++-
ximon-admin/pom.xml | 4 ++++
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightService.java | 17 ++++++++++++++++-
ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java | 31 +++++++++++++++++++++++++++++--
4 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/ximon-admin/pom.xml b/ximon-admin/pom.xml
index ed505f6..5764ff2 100644
--- a/ximon-admin/pom.xml
+++ b/ximon-admin/pom.xml
@@ -117,6 +117,10 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <executable>true</executable>
+ <includeSystemScope>true</includeSystemScope>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
index 1e87569..537f359 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/IpVolumeFileService.java
@@ -53,15 +53,42 @@
public boolean deleteFile(Long fileId) {
IpVolumeFile byId = getById(fileId);
+ String bucketName;
+ if (SecurityUtils.getClientId() == null) {
+ bucketName = MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName();
+ } else {
+ bucketName = MinIoConstant.BROADCAST_FILE.getBucketName() + SecurityUtils.getUserId();
+ }
if (byId == null) {
throw new BusinessException("鎵句笉鍒板搴旀枃浠�");
}
+ boolean b = minIoUtil.deleteFile(bucketName, byId.getFileName());
+// if (!b) {
+// throw new BusinessException("鏈嶅姟鍣ㄥ垹闄ゅけ璐�");
+// }
+
+
return removeById(fileId);
}
public LambdaQueryWrapper<IpVolumeFile> listFile(BaseConditionVO baseConditionVO, String keyword) {
PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
- LambdaQueryWrapper<IpVolumeFile> wrapper = Wrappers.lambdaQuery(IpVolumeFile.class).eq(IpVolumeFile::getClientId, clientService.getClientId());
+ LambdaQueryWrapper<IpVolumeFile> wrapper;
+
+ if (SecurityUtils.getClientId() == null) {
+ wrapper = Wrappers.lambdaQuery(IpVolumeFile.class);
+ } else {
+ if (clientService.findClientId()) {
+ wrapper = Wrappers.lambdaQuery(IpVolumeFile.class).eq(IpVolumeFile::getUserId, SecurityUtils.getUserId());
+ } else {
+ wrapper = Wrappers.lambdaQuery(IpVolumeFile.class).eq(IpVolumeFile::getClientId, clientService.getClientId())
+ .or(file -> {
+ file.eq(IpVolumeFile::getClientId, SecurityUtils.getUserId());
+ });
+ }
+ }
+
+
if (keyword.isEmpty()) {
return wrapper;
} else {
@@ -74,7 +101,7 @@
* 鏂囦欢涓婁紶
*
* @param file
- * @param userId
+ * @param
* @return
*/
public FileUploadDto upload(MultipartFile file) {
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightService.java
index 65aeaad..d966d0f 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightService.java
@@ -22,6 +22,8 @@
import com.sandu.ximon.dao.bo.LightBo;
import com.sandu.ximon.dao.domain.Light;
import com.sandu.ximon.dao.domain.LightReportData;
+import com.sandu.ximon.dao.domain.Pole;
+import com.sandu.ximon.dao.domain.PoleBinding;
import com.sandu.ximon.dao.enums.DeviceRespStatusEnums;
import com.sandu.ximon.dao.mapper.LightMapper;
import lombok.AllArgsConstructor;
@@ -46,6 +48,8 @@
private final RedisService redisService;
private final LightReportDataService lightReportDataService;
+ private final PoleBindingService bindingService;
+ private final PoleService poleService;
/**
* 褰曞叆褰撳墠璁惧鐮佺殑璺伅鏁版嵁
@@ -94,6 +98,17 @@
if (CollectionUtil.isNotEmpty(deviceCodeList)) {
List<LightReportData> reportDataList = lightReportDataService.getNewestReportByDeviceCode(deviceCodeList);
for (LightBo lightBo : listLight) {
+ deviceCodeList.forEach(code -> {
+ PoleBinding bind = bindingService.getPoleIdByMac(code);
+ if (bind != null&&lightBo.getDeviceCode().equals(bind.getDeviceCode())) {
+ Long poleId = bind.getPoleId();
+ Pole pole = poleService.getById(poleId);
+ lightBo.setPoleId(pole.getId());
+ lightBo.setPoleCode(pole.getDeviceCode());
+ lightBo.setPoleName(pole.getPoleName());
+ }
+ }
+ );
for (LightReportData lightReportData : reportDataList) {
if (StrUtil.equals(lightBo.getDeviceCode(), lightReportData.getDeviceCode())) {
lightBo.setReportTime(lightReportData.getCreateTime());
@@ -152,7 +167,7 @@
light.setLightPercent(param.getBrightness());
update(light, Wrappers.lambdaUpdate(Light.class).eq(Light::getDeviceCode, param.getDeviceCode()));
}
- }catch (BusinessException e){
+ } catch (BusinessException e) {
map.put("status", DeviceRespStatusEnums.OTHER_ERROR.getCode());
resultList.add(map);
}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
index 62d5eef..4716a7e 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
@@ -5,7 +5,6 @@
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.param.PoleBindingParam;
import com.sandu.ximon.dao.domain.PoleBinding;
-import com.sandu.ximon.dao.enums.PoleBindingEnums;
import com.sandu.ximon.dao.mapper.PoleBindingMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@@ -86,4 +85,8 @@
return false;
}
}
+
+ public PoleBinding getPoleIdByMac(String deviceCode){
+ return getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode));
+ }
}
--
Gitblit v1.9.3