From 4364ce9d573f031404809568bd1bc0d4fbc3f33a Mon Sep 17 00:00:00 2001
From: sxu <602087911@qq.com>
Date: Mon, 14 Apr 2025 20:01:07 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=96=87=E4=BB=B6=EF=BC=8C?=
=?UTF-8?q?=20=E5=8C=BA=E5=9F=9F=E9=80=89=E6=8B=A9=E9=97=AE=E9=A2=98?=
=?UTF-8?q?=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/houqin/constant/GlobalConstants.java | 4 ++++
.../canteen/core/alloc/domain/AllocCanteen.java | 6 +++++-
.../bonus/canteen/core/alloc/domain/AllocStall.java | 6 +++++-
.../canteen/core/common/utils/FileUrlUtil.java | 13 ++++++++++---
.../main/resources/mapper/alloc/AllocAreaMapper.xml | 1 +
5 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/bonus-common-biz/src/main/java/com/bonus/common/houqin/constant/GlobalConstants.java b/bonus-common-biz/src/main/java/com/bonus/common/houqin/constant/GlobalConstants.java
index fbf5dcf..025ee12 100644
--- a/bonus-common-biz/src/main/java/com/bonus/common/houqin/constant/GlobalConstants.java
+++ b/bonus-common-biz/src/main/java/com/bonus/common/houqin/constant/GlobalConstants.java
@@ -8,6 +8,7 @@ public class GlobalConstants {
public static final Long TENANT_ID = 99999999L;
public static final String PERSONAL_RECHARGE = "PERSONAL_RECHARGE";
+
/**
* 字符串 MSIE
*/
@@ -20,6 +21,9 @@ public class GlobalConstants {
* 字符串 Chrome
*/
public static final String STRING_CHROME = "Chrome";
+
+ public static final String HTTP_PROTOCOL = "http://";
+
/**
* 字符串 #//
*/
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocCanteen.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocCanteen.java
index ae5d389..8f1f299 100644
--- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocCanteen.java
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocCanteen.java
@@ -1,6 +1,8 @@
package com.bonus.canteen.core.alloc.domain;
import java.util.Date;
+
+import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@@ -127,5 +129,7 @@ public class AllocCanteen extends BaseEntity {
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
-
+ public String getImgUrl() {
+ return FileUrlUtil.getFileUrl(this.imgUrl);
+ }
}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocStall.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocStall.java
index 6c02547..806ce1a 100644
--- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocStall.java
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocStall.java
@@ -1,6 +1,8 @@
package com.bonus.canteen.core.alloc.domain;
import java.util.Date;
+
+import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@@ -152,5 +154,7 @@ public class AllocStall extends BaseEntity {
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
-
+ public String getImgUrl() {
+ return FileUrlUtil.getFileUrl(this.imgUrl);
+ }
}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/common/utils/FileUrlUtil.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/common/utils/FileUrlUtil.java
index 4de6052..bde16b2 100644
--- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/common/utils/FileUrlUtil.java
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/common/utils/FileUrlUtil.java
@@ -2,6 +2,8 @@ package com.bonus.canteen.core.common.utils;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.common.core.exception.ServiceException;
+import com.bonus.common.core.utils.StringUtils;
+import com.bonus.common.houqin.constant.GlobalConstants;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -23,9 +25,14 @@ public class FileUrlUtil {
}
public static String getFileUrl(String fileUrl) {
- if (ObjectUtil.isEmpty(fileUrl)){
- throw new ServiceException("照片路径为空");
+ if (StringUtils.isNotEmpty(fileUrl)){
+ if (fileUrl.startsWith(GlobalConstants.HTTP_PROTOCOL)) {
+ return fileUrl;
+ } else {
+ return endpoint + "/" + fileUrl;
+ }
+ } else {
+ return "";
}
- return endpoint + "/" + fileUrl;
}
}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocAreaMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocAreaMapper.xml
index 94433af..3befd93 100644
--- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocAreaMapper.xml
+++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocAreaMapper.xml
@@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and area_name like concat('%', #{areaName}, '%')
+ and (area_id = #{areaId} or parent_id = #{areaId})
and parent_id = #{parentId}
and director = #{director}
and contact_tel = #{contactTel}