From ac5bde4d3c52931c32a9961b4d8c30c2be78dc3f Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Thu, 13 Nov 2025 22:54:09 +0800 Subject: [PATCH] =?UTF-8?q?youercehsi=E5=8A=9F=E8=83=BD=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CookDishesServiceImpl.java | 6 ++- .../ims/service/impl/SupplierServiceImpl.java | 37 +++++++++++++++++++ .../KitchenSampleDishesRecordServiceImpl.java | 6 +++ ...KitchenStaffIllegalWarningServiceImpl.java | 20 +++++++++- .../impl/KitchenWasteDealServiceImpl.java | 20 ++++++---- .../impl/KitchenWasteMealServiceImpl.java | 26 +++++++++---- 6 files changed, 98 insertions(+), 17 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookDishesServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookDishesServiceImpl.java index a7b4265..c377529 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookDishesServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookDishesServiceImpl.java @@ -41,6 +41,7 @@ import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.houqin.constant.DelFlagEnum; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.RemoteFileService; import org.codehaus.groovy.tools.StringHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,6 +81,9 @@ public class CookDishesServiceImpl implements ICookDishesService { ) private AsyncTaskExecutor asyncTaskExecutor; + @Autowired + private RemoteFileService remoteFileService; + /** * 查询菜品信息 * @@ -107,7 +111,7 @@ public class CookDishesServiceImpl implements ICookDishesService { String imageUrl = dish.getImageUrl(); if (imageUrl != null && !imageUrl.isEmpty()) { try { - dish.setImageUrl(FileCommonUtils.getFullFileUrl(imageUrl)); + dish.setImageUrl( remoteFileService.getFullFileUrl(FileCommonUtils.getFullFileUrl(imageUrl))); } catch (Exception e) { // 可以记录日志,确保异常不会影响分页 log.warn("处理菜品图片URL失败: {}", imageUrl, e); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/SupplierServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/SupplierServiceImpl.java index 29ff412..e8c8211 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/SupplierServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/SupplierServiceImpl.java @@ -12,6 +12,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -34,11 +35,13 @@ import com.bonus.canteen.core.ims.vo.SupplierPageVO; import com.bonus.canteen.core.ims.vo.SupplierQualificationDetailPageVO; import com.bonus.canteen.core.ims.vo.SupplyStatisticsPageVO; import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo; +import com.bonus.canteen.core.kitchen.utils.FileCommonUtils; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.houqin.constant.DelFlagEnum; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.RemoteFileService; import org.apache.commons.compress.utils.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -68,6 +71,9 @@ public class SupplierServiceImpl extends ServiceImpl @Autowired private ISupplierBindMaterialService supplierBindMaterialService; + @Autowired + private RemoteFileService remoteFileService; + /** * 查询供应商信息 @@ -96,6 +102,21 @@ public class SupplierServiceImpl extends ServiceImpl while(var4.hasNext()) { SupplierPageVO item = (SupplierPageVO)var4.next(); + //身份证 正反图片 idCardImgZ idCardImgF 两个字段需要调用下面 + String idCardImgZ = item.getIdCardImgZ(); + if (StrUtil.isNotBlank(idCardImgZ)) { // 非空判断,避免空值处理异常 + String fullIdCardImgZ = remoteFileService.getFullFileUrl( + FileCommonUtils.getFullFileUrl(idCardImgZ) + ); + item.setIdCardImgZ(fullIdCardImgZ); // 回写完整URL到VO,返回给前端 + } + String idCardImgF = item.getIdCardImgF(); + if (StrUtil.isNotBlank(idCardImgF)) { // 非空判断,避免空值处理异常 + String fullIdCardImgF = remoteFileService.getFullFileUrl( + FileCommonUtils.getFullFileUrl(idCardImgF) + ); + item.setIdCardImgF(fullIdCardImgF); // 回写完整URL到VO,返回给前端 + } List categoryList = supplierCategoryService.selectNameBySupplier(item.getSupplierId()); if (CollUtil.isNotEmpty(categoryList)) { categoryList = (List)categoryList.stream().filter((a) -> { @@ -111,6 +132,14 @@ public class SupplierServiceImpl extends ServiceImpl List otherQualificationList = this.supplierQualificationService.selectSupplierQualificationList(supplierQualification); List voList1 = new ArrayList<>(); for (SupplierQualification qualification : qualificationList) { + String originalImgUrl = qualification.getImgUrl(); + if (StrUtil.isNotBlank(originalImgUrl)) { // 非空判断,避免空值异常 + // 同样经过两层URL拼接,获取完整可访问地址 + String fullImgUrl = remoteFileService.getFullFileUrl( + FileCommonUtils.getFullFileUrl(originalImgUrl) + ); + qualification.setImgUrl(fullImgUrl); // 回写完整URL,返回给前端 + } SupplierQualificationDetailPageVO vo = new SupplierQualificationDetailPageVO(); BeanUtil.copyProperties(qualification, vo); // 复制同名属性 String expirationDate = qualification.getExpirationDate(); @@ -122,6 +151,14 @@ public class SupplierServiceImpl extends ServiceImpl item.setMainQualificationList(voList1); List voList2 = new ArrayList<>(); for (SupplierQualification qualification : otherQualificationList) { + String originalImgUrl = qualification.getImgUrl(); + if (StrUtil.isNotBlank(originalImgUrl)) { // 非空判断,避免空值异常 + // 同样经过两层URL拼接,获取完整可访问地址 + String fullImgUrl = remoteFileService.getFullFileUrl( + FileCommonUtils.getFullFileUrl(originalImgUrl) + ); + qualification.setImgUrl(fullImgUrl); // 回写完整URL,返回给前端 + } SupplierQualificationDetailPageVO vo = new SupplierQualificationDetailPageVO(); BeanUtil.copyProperties(qualification, vo); // 复制同名属性 voList2.add(vo); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenSampleDishesRecordServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenSampleDishesRecordServiceImpl.java index 4a8a856..831b64f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenSampleDishesRecordServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenSampleDishesRecordServiceImpl.java @@ -15,10 +15,12 @@ import com.bonus.canteen.core.kitchen.domain.constants.CommonFlagEnum; import com.bonus.canteen.core.kitchen.domain.constants.SampleDishesSaveStatusEnum; import com.bonus.canteen.core.kitchen.domain.constants.SampleDishesSearchType; import com.bonus.canteen.core.kitchen.dto.KitchenSampleDishesRecordDTO; +import com.bonus.canteen.core.kitchen.utils.FileCommonUtils; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.RemoteFileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.canteen.core.kitchen.mapper.KitchenSampleDishesRecordMapper; @@ -39,6 +41,9 @@ public class KitchenSampleDishesRecordServiceImpl implements IKitchenSampleDishe @Autowired private BasicStallMealtimeMapper basicStallMealtimeMapper; + @Autowired + private RemoteFileService remoteFileService; + /** * 查询留样机留样清单 * @@ -70,6 +75,7 @@ public class KitchenSampleDishesRecordServiceImpl implements IKitchenSampleDishe .selectKitchenSampleDishesRecordList(kitchenSampleDishesRecord); if(CollUtil.isNotEmpty(kitchenSampleDishesRecordList)) { for (KitchenSampleDishesRecord record : kitchenSampleDishesRecordList) { + record.setImageUrl( remoteFileService.getFullFileUrl(FileCommonUtils.getFullFileUrl(record.getImageUrl()))); record.setSaveStatusName(SampleDishesSaveStatusEnum.getDescByKey(record.getSaveStatus())); String illegalStatusName = ""; if(CommonFlagEnum.NO.getKey().equals(record.getWeightStandard())) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenStaffIllegalWarningServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenStaffIllegalWarningServiceImpl.java index e58fd65..9fe4e00 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenStaffIllegalWarningServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenStaffIllegalWarningServiceImpl.java @@ -11,6 +11,7 @@ import java.util.Date; import java.util.List; import java.util.Objects; +import com.bonus.canteen.core.cook.domain.CookDishes; import com.bonus.canteen.core.kitchen.domain.KitchenDeviceInfo; import com.bonus.canteen.core.kitchen.domain.KitchenWasteDeal; import com.bonus.canteen.core.kitchen.domain.constants.ViolationEnum; @@ -18,6 +19,7 @@ import com.bonus.canteen.core.kitchen.dto.VideoPhotoDTO; import com.bonus.canteen.core.kitchen.feign.FileServiceClient; import com.bonus.canteen.core.kitchen.mapper.KitchenDeviceInfoMapper; import com.bonus.canteen.core.kitchen.mapper.KitchenWasteDealMapper; +import com.bonus.canteen.core.kitchen.utils.FileCommonUtils; import com.bonus.canteen.core.kitchen.utils.TimestampUtils; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; @@ -25,6 +27,7 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.houqin.constant.DeviceTypeEnum; import com.bonus.common.houqin.utils.SM4EncryptUtils; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.system.api.RemoteFileService; import com.bonus.system.api.domain.SysFile; import com.jayway.jsonpath.JsonPath; import org.apache.commons.fileupload.FileItem; @@ -61,6 +64,9 @@ public class KitchenStaffIllegalWarningServiceImpl implements IKitchenStaffIlleg @Resource private KitchenWasteDealMapper kitchenWasteDealMapper; + @Autowired + private RemoteFileService remoteFileService; + /** * 查询厨房员工违规报警 * @@ -82,7 +88,19 @@ public class KitchenStaffIllegalWarningServiceImpl implements IKitchenStaffIlleg public List selectKitchenStaffIllegalWarningList(KitchenStaffIllegalWarning kitchenStaffIllegalWarning) { String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(kitchenStaffIllegalWarning.getSearchValue()); kitchenStaffIllegalWarning.setEncryptedSearchValue(encryptedSearchValue); - return kitchenStaffIllegalWarningMapper.selectKitchenStaffIllegalWarningList(kitchenStaffIllegalWarning); + List kitchenStaffIllegalWarnings = kitchenStaffIllegalWarningMapper.selectKitchenStaffIllegalWarningList(kitchenStaffIllegalWarning); + for (KitchenStaffIllegalWarning dish : kitchenStaffIllegalWarnings) { + String imageUrl = dish.getImgUrl(); + if (imageUrl != null && !imageUrl.isEmpty()) { + try { + dish.setImgUrl( remoteFileService.getFullFileUrl(FileCommonUtils.getFullFileUrl(imageUrl))); + } catch (Exception e) { + // 可以记录日志,确保异常不会影响分页 + e.printStackTrace(); + } + } + } + return kitchenStaffIllegalWarnings; } /** diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenWasteDealServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenWasteDealServiceImpl.java index 6793d11..8c271fc 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenWasteDealServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenWasteDealServiceImpl.java @@ -7,9 +7,11 @@ import java.util.Objects; import cn.hutool.core.collection.CollUtil; import com.bonus.canteen.core.common.utils.FileUrlUtil; import com.bonus.canteen.core.kitchen.domain.constants.WasteDealTypeEnum; +import com.bonus.canteen.core.kitchen.utils.FileCommonUtils; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; +import com.bonus.system.api.RemoteFileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.canteen.core.kitchen.mapper.KitchenWasteDealMapper; @@ -18,7 +20,7 @@ import com.bonus.canteen.core.kitchen.service.IKitchenWasteDealService; /** * 厨房废弃物处置Service业务层处理 - * + * * @author xsheng * @date 2025-06-16 */ @@ -27,9 +29,12 @@ public class KitchenWasteDealServiceImpl implements IKitchenWasteDealService { @Autowired private KitchenWasteDealMapper kitchenWasteDealMapper; + @Autowired + private RemoteFileService remoteFileService; + /** * 查询厨房废弃物处置 - * + * * @param wasteId 厨房废弃物处置主键 * @return 厨房废弃物处置 */ @@ -40,7 +45,7 @@ public class KitchenWasteDealServiceImpl implements IKitchenWasteDealService { /** * 查询厨房废弃物处置列表 - * + * * @param kitchenWasteDeal 厨房废弃物处置 * @return 厨房废弃物处置 */ @@ -49,6 +54,7 @@ public class KitchenWasteDealServiceImpl implements IKitchenWasteDealService { List list = kitchenWasteDealMapper.selectKitchenWasteDealList(kitchenWasteDeal); if(CollUtil.isNotEmpty(list)) { for(KitchenWasteDeal wasteDeal : list) { + wasteDeal.setScenePicture( remoteFileService.getFullFileUrl(FileCommonUtils.getFullFileUrl(wasteDeal.getScenePicture()))); wasteDeal.setDealTypeName(WasteDealTypeEnum.getDescByKey(wasteDeal.getDealType())); if(StringUtils.isNotBlank(wasteDeal.getScenePicture())) { List scenePictureList = new ArrayList<>(); @@ -68,7 +74,7 @@ public class KitchenWasteDealServiceImpl implements IKitchenWasteDealService { /** * 新增厨房废弃物处置 - * + * * @param kitchenWasteDeal 厨房废弃物处置 * @return 结果 */ @@ -85,7 +91,7 @@ public class KitchenWasteDealServiceImpl implements IKitchenWasteDealService { /** * 修改厨房废弃物处置 - * + * * @param kitchenWasteDeal 厨房废弃物处置 * @return 结果 */ @@ -101,7 +107,7 @@ public class KitchenWasteDealServiceImpl implements IKitchenWasteDealService { /** * 批量删除厨房废弃物处置 - * + * * @param wasteIds 需要删除的厨房废弃物处置主键 * @return 结果 */ @@ -112,7 +118,7 @@ public class KitchenWasteDealServiceImpl implements IKitchenWasteDealService { /** * 删除厨房废弃物处置信息 - * + * * @param wasteId 厨房废弃物处置主键 * @return 结果 */ diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenWasteMealServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenWasteMealServiceImpl.java index 20aeea0..2c89d02 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenWasteMealServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenWasteMealServiceImpl.java @@ -2,8 +2,11 @@ package com.bonus.canteen.core.kitchen.service.impl; import java.util.Collections; import java.util.List; + +import com.bonus.canteen.core.kitchen.utils.FileCommonUtils; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.system.api.RemoteFileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.canteen.core.kitchen.mapper.KitchenWasteMealMapper; @@ -12,7 +15,7 @@ import com.bonus.canteen.core.kitchen.service.IKitchenWasteMealService; /** * 厨房餐余浪费Service业务层处理 - * + * * @author xsheng * @date 2025-06-16 */ @@ -21,9 +24,11 @@ public class KitchenWasteMealServiceImpl implements IKitchenWasteMealService { @Autowired private KitchenWasteMealMapper kitchenWasteMealMapper; + @Autowired + private RemoteFileService remoteFileService; /** * 查询厨房餐余浪费 - * + * * @param ledgerId 厨房餐余浪费主键 * @return 厨房餐余浪费 */ @@ -34,18 +39,23 @@ public class KitchenWasteMealServiceImpl implements IKitchenWasteMealService { /** * 查询厨房餐余浪费列表 - * + * * @param kitchenWasteMeal 厨房餐余浪费 * @return 厨房餐余浪费 */ @Override public List selectKitchenWasteMealList(KitchenWasteMeal kitchenWasteMeal) { - return kitchenWasteMealMapper.selectKitchenWasteMealList(kitchenWasteMeal); + List kitchenWasteMeals = kitchenWasteMealMapper.selectKitchenWasteMealList(kitchenWasteMeal); + for (KitchenWasteMeal item : kitchenWasteMeals) { + item.setFileUrl(remoteFileService.getFullFileUrl( + FileCommonUtils.getFullFileUrl(item.getFileUrl()))); + } + return kitchenWasteMeals; } /** * 新增厨房餐余浪费 - * + * * @param kitchenWasteMeal 厨房餐余浪费 * @return 结果 */ @@ -62,7 +72,7 @@ public class KitchenWasteMealServiceImpl implements IKitchenWasteMealService { /** * 修改厨房餐余浪费 - * + * * @param kitchenWasteMeal 厨房餐余浪费 * @return 结果 */ @@ -78,7 +88,7 @@ public class KitchenWasteMealServiceImpl implements IKitchenWasteMealService { /** * 批量删除厨房餐余浪费 - * + * * @param ledgerIds 需要删除的厨房餐余浪费主键 * @return 结果 */ @@ -89,7 +99,7 @@ public class KitchenWasteMealServiceImpl implements IKitchenWasteMealService { /** * 删除厨房餐余浪费信息 - * + * * @param ledgerId 厨房餐余浪费主键 * @return 结果 */