diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateuse/impl/CardTemplateUseServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateuse/impl/CardTemplateUseServiceImpl.java index ea6625e..6718e2c 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateuse/impl/CardTemplateUseServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateuse/impl/CardTemplateUseServiceImpl.java @@ -1,5 +1,6 @@ package cn.com.tenlion.systemcard.service.cardtemplateuse.impl; +import cn.com.tenlion.buildingpictures.pojo.dtos.picturestemplate.PicturesTemplateDTO; import cn.com.tenlion.buildingpictures.pojo.dtos.picturestemplatearea.PicturesTemplateAreaBuildingDTO; import cn.com.tenlion.buildingpictures.service.picturestemplatebuilding.IPicturesTemplateBuildingService; import cn.com.tenlion.buildingpictures.util.CreateImageBean; @@ -24,6 +25,7 @@ import ink.wgink.exceptions.SaveException; import ink.wgink.exceptions.UpdateException; import ink.wgink.module.dictionary.pojo.dtos.DataDTO; import ink.wgink.module.dictionary.service.IDataService; +import ink.wgink.module.file.service.IFileService; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.app.AppTokenUser; import ink.wgink.pojo.bos.UserInfoBO; @@ -92,6 +94,9 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC @Autowired private IDataService iDataService; + @Autowired + private IFileService iFileService; + private static BufferedImage viewButtonBuffer; static { @@ -422,6 +427,12 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC BufferedImage bufferedImage = base64ToBufferedImage(cardTemplateUsePhoto); // cardTemplateUseDispatchPhoto = thumbnailImage(bufferedImage, 220 , 176); cardTemplateUseDispatchPhoto = wXDispatchImage(bufferedImage); + /** + * 删除旧的名片预览图 + */ + if(!StringUtils.isEmpty(useDTO.getCardTemplateUsePhotoUrl())) { + iFileService.delete(useDTO.getCardTemplateUsePhotoUrl()); + } cardTemplateUsePhotoUrl = iPicturesTemplateBuildingService.saveBase64ToFile(cardTemplateUsePhoto); } catch (Exception e) { e.printStackTrace();