图片文件, 区域选择问题修复

This commit is contained in:
sxu 2025-04-14 20:01:07 +08:00
parent bd4604c3db
commit 4364ce9d57
5 changed files with 25 additions and 5 deletions

View File

@ -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://";
/**
* 字符串 #//
*/

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectAllocAreaVo"/>
<where>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="areaId != null "> and (area_id = #{areaId} or parent_id = #{areaId})</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="director != null and director != ''"> and director = #{director}</if>
<if test="contactTel != null and contactTel != ''"> and contact_tel = #{contactTel}</if>