From 7927c4c96a55039b83d4c94c7c5a8723c40e0c41 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Fri, 6 Aug 2021 18:54:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=A8=E6=80=81=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E8=87=AA=E5=8A=A8=E6=8E=92=E7=89=88=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E4=BF=9D=E5=AD=98=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardtemplateuse/CardTemplateUseDTO.java | 26 +++++++++++++++--- .../cardtemplateuse/CardTemplateUseVO.java | 27 ++++++++++++++++--- .../impl/CardTemplateServiceImpl.java | 14 +++++----- .../impl/CardTemplateScansServiceImpl.java | 17 +++++++----- .../impl/CardTemplateUseServiceImpl.java | 15 +++++++++-- .../impl/CardTemplateUseBagServiceImpl.java | 14 +++++++--- .../card-template-use-mapper.xml | 27 ++++++++++++------- .../route/cardtemplate/list-cardtemplate.html | 8 +++--- 8 files changed, 112 insertions(+), 36 deletions(-) diff --git a/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/cardtemplateuse/CardTemplateUseDTO.java b/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/cardtemplateuse/CardTemplateUseDTO.java index 693784f..8103318 100644 --- a/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/cardtemplateuse/CardTemplateUseDTO.java +++ b/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/cardtemplateuse/CardTemplateUseDTO.java @@ -32,8 +32,10 @@ public class CardTemplateUseDTO { private Double cardTemplateUseHeight; @ApiModelProperty(name = "cardTemplateUseWidth", value = "模板宽度(快照)") private Double cardTemplateUseWidth; - @ApiModelProperty(name = "cardTemplateUsePicture", value = "名片预览图片") + @ApiModelProperty(name = "cardTemplateUsePicture", value = "名片预览图片Base64(快照)") private String cardTemplateUsePicture; + @ApiModelProperty(name = "cardTemplateUsePictureUrl", value = "名片预览图片ID(快照)") + private String cardTemplateUsePictureUrl; @ApiModelProperty(name = "cardTemplateUseBarcode", value = "名片小程序二维码") private String cardTemplateUseBarcode; @ApiModelProperty(name = "cardTemplateUsePassword", value = "名片访问密码(为空则不加密)") @@ -56,8 +58,10 @@ public class CardTemplateUseDTO { private String gmtModified; @ApiModelProperty(name = "isDelete", value = "") private Integer isDelete; - @ApiModelProperty(name = "cardTemplateUsePhoto", value = "我的名片预览图") + @ApiModelProperty(name = "cardTemplateUsePhoto", value = "我的名片预览图Base64") private String cardTemplateUsePhoto; + @ApiModelProperty(name = "cardTemplateUsePhotoUrl", value = "我的名片预览图ID") + private String cardTemplateUsePhotoUrl; @ApiModelProperty(name = "cardTemplateUseSwitch", value = "名片是否公开1:公开,0:不公开") private Integer cardTemplateUseSwitch; @ApiModelProperty(name = "cardTemplateUseSwitch", value = "名片区域") @@ -74,9 +78,25 @@ public class CardTemplateUseDTO { private String templateIndustryName; @ApiModelProperty(name = "templateCharge", value = "是否收费1:收费,0:免费") private String templateCharge; - @ApiModelProperty(name = "cardTemplateUseDispatchPhoto", value = "我的名片转发图") + @ApiModelProperty(name = "cardTemplateUseDispatchPhoto", value = "我的名片二维码") private String cardTemplateUseDispatchPhoto; + public String getCardTemplateUsePictureUrl() { + return cardTemplateUsePictureUrl == null ? "" : cardTemplateUsePictureUrl; + } + + public void setCardTemplateUsePictureUrl(String cardTemplateUsePictureUrl) { + this.cardTemplateUsePictureUrl = cardTemplateUsePictureUrl; + } + + public String getCardTemplateUsePhotoUrl() { + return cardTemplateUsePhotoUrl == null ? "" : cardTemplateUsePhotoUrl; + } + + public void setCardTemplateUsePhotoUrl(String cardTemplateUsePhotoUrl) { + this.cardTemplateUsePhotoUrl = cardTemplateUsePhotoUrl; + } + public String getCardTemplateUseDispatchPhoto() { return cardTemplateUseDispatchPhoto == null ? "" : cardTemplateUseDispatchPhoto; } diff --git a/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardtemplateuse/CardTemplateUseVO.java b/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardtemplateuse/CardTemplateUseVO.java index 5a2c7e8..8df7298 100644 --- a/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardtemplateuse/CardTemplateUseVO.java +++ b/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardtemplateuse/CardTemplateUseVO.java @@ -31,8 +31,10 @@ public class CardTemplateUseVO { @ApiModelProperty(name = "cardTemplateUseWidth", value = "模板宽度(快照)") @CheckNumberAnnotation(name = "模板宽度(快照)") private Double cardTemplateUseWidth; - @ApiModelProperty(name = "cardTemplateUsePicture", value = "名片预览图片") + @ApiModelProperty(name = "cardTemplateUsePicture", value = "名片预览图片Base64(快照)") private String cardTemplateUsePicture; + @ApiModelProperty(name = "cardTemplateUsePictureUrl", value = "名片预览图片ID(快照)") + private String cardTemplateUsePictureUrl; @ApiModelProperty(name = "cardTemplateUseBarcode", value = "名片小程序二维码") private String cardTemplateUseBarcode; @ApiModelProperty(name = "cardTemplateUsePassword", value = "名片访问密码(为空则不加密)") @@ -48,9 +50,12 @@ public class CardTemplateUseVO { @ApiModelProperty(name = "cardTemplateUseOrder", value = "名片顺序") @CheckNumberAnnotation(name = "名片顺序") private Integer cardTemplateUseOrder; - @ApiModelProperty(name = "cardTemplateUsePhoto", value = "我的名片图") - @CheckNumberAnnotation(name = "我的名片图") + @ApiModelProperty(name = "cardTemplateUsePhoto", value = "我的名片预览图Base64") + @CheckNumberAnnotation(name = "我的名片预览图Base64") private String cardTemplateUsePhoto; + @ApiModelProperty(name = "cardTemplateUsePhotoUrl", value = "我的名片预览图ID") + @CheckNumberAnnotation(name = "我的名片预览图ID") + private String cardTemplateUsePhotoUrl; @ApiModelProperty(name = "cardTemplateUseSwitch", value = "名片是否公开1:公开,0:不公开") private String cardTemplateUseSwitch; @ApiModelProperty(name = "templateMode", value = "模板用途,1:名片,2:海报") @@ -64,6 +69,22 @@ public class CardTemplateUseVO { @ApiModelProperty(name = "cardTemplateUseDispatchPhoto", value = "我的名片转发图") private String cardTemplateUseDispatchPhoto; + public String getCardTemplateUsePictureUrl() { + return cardTemplateUsePictureUrl == null ? "" : cardTemplateUsePictureUrl; + } + + public void setCardTemplateUsePictureUrl(String cardTemplateUsePictureUrl) { + this.cardTemplateUsePictureUrl = cardTemplateUsePictureUrl; + } + + public String getCardTemplateUsePhotoUrl() { + return cardTemplateUsePhotoUrl == null ? "" : cardTemplateUsePhotoUrl; + } + + public void setCardTemplateUsePhotoUrl(String cardTemplateUsePhotoUrl) { + this.cardTemplateUsePhotoUrl = cardTemplateUsePhotoUrl; + } + public String getCardTemplateUseDispatchPhoto() { return cardTemplateUseDispatchPhoto == null ? "" : cardTemplateUseDispatchPhoto; } diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplate/impl/CardTemplateServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplate/impl/CardTemplateServiceImpl.java index 60fbc33..aaa6a19 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplate/impl/CardTemplateServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplate/impl/CardTemplateServiceImpl.java @@ -223,6 +223,7 @@ public class CardTemplateServiceImpl extends DefaultBaseService implements ICard cardTemplateAppDTO.setPicturesTemplateHeight(buildingDTO.getPicturesTemplateHeight()); cardTemplateAppDTO.setPicturesTemplateId(buildingDTO.getPicturesTemplateId()); cardTemplateAppDTO.setPicturesTemplatePicture(buildingDTO.getPicturesTemplatePicture()); + cardTemplateAppDTO.setPicturesTemplatePictureUrl(buildingDTO.getPicturesTemplatePictureUrl()); cardTemplateAppDTO.setPicturesTemplatePublishStatus(buildingDTO.getPicturesTemplatePublishStatus()); cardTemplateAppDTO.setPicturesTemplateRemark(buildingDTO.getPicturesTemplateRemark()); cardTemplateAppDTO.setPicturesTemplateTitle(buildingDTO.getPicturesTemplateTitle()); @@ -237,12 +238,12 @@ public class CardTemplateServiceImpl extends DefaultBaseService implements ICard cardTemplateAppDTO.setCardTemplateId(dto.getCardTemplateId()); /** * 查询数据字典 行业 - */ + *//* DataDTO typeDataDTO = iDataService.get(dto.getTemplateType()); cardTemplateAppDTO.setTemplateTypeName(typeDataDTO.getDataName()); - /** + *//** * 查询数据字典 类型 - */ + *//* String[] templateIndustryArray = dto.getTemplateIndustry().split(","); StringBuffer stringBuffer = new StringBuffer(); for (int i = 0 ; i < templateIndustryArray.length; i++) { @@ -253,7 +254,7 @@ public class CardTemplateServiceImpl extends DefaultBaseService implements ICard stringBuffer.append(",").append(dataDTO.getDataName()); } } - cardTemplateAppDTO.setTemplateIndustryName(stringBuffer.toString()); + cardTemplateAppDTO.setTemplateIndustryName(stringBuffer.toString());*/ cardTemplateAppDTOList.add(cardTemplateAppDTO); break b; } @@ -275,7 +276,8 @@ public class CardTemplateServiceImpl extends DefaultBaseService implements ICard cardTemplateAppDTO.setPicturesTemplateCode(buildingDTO.getPicturesTemplateCode()); cardTemplateAppDTO.setPicturesTemplateHeight(buildingDTO.getPicturesTemplateHeight()); cardTemplateAppDTO.setPicturesTemplateId(buildingDTO.getPicturesTemplateId()); - cardTemplateAppDTO.setPicturesTemplatePicture(buildingDTO.getPicturesTemplatePicture()); + /* cardTemplateAppDTO.setPicturesTemplatePicture(buildingDTO.getPicturesTemplatePicture());*/ + cardTemplateAppDTO.setPicturesTemplatePictureUrl(buildingDTO.getPicturesTemplatePictureUrl()); cardTemplateAppDTO.setPicturesTemplatePublishStatus(buildingDTO.getPicturesTemplatePublishStatus()); cardTemplateAppDTO.setPicturesTemplateRemark(buildingDTO.getPicturesTemplateRemark()); cardTemplateAppDTO.setPicturesTemplateTitle(buildingDTO.getPicturesTemplateTitle()); @@ -302,7 +304,7 @@ public class CardTemplateServiceImpl extends DefaultBaseService implements ICard if(stringBuffer.length() < 1) { stringBuffer.append(dataDTO.getDataName()); }else{ - stringBuffer.append(",").append(dataDTO.getDataName()); + stringBuffer.append("、").append(dataDTO.getDataName()); } } cardTemplateAppDTO.setTemplateIndustryName(stringBuffer.toString()); diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplatescans/impl/CardTemplateScansServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplatescans/impl/CardTemplateScansServiceImpl.java index 3b9a934..91ff728 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplatescans/impl/CardTemplateScansServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplatescans/impl/CardTemplateScansServiceImpl.java @@ -191,13 +191,18 @@ public class CardTemplateScansServiceImpl extends DefaultBaseService implements List list = cardTemplateScansDao.list(params); // 放入名片数据 Set userSet = new HashSet(); - for(CardTemplateScansDTO scansDTO : list) { - /** - * 封装名片信息 - */ + Iterator iterator = list.iterator(); + while(iterator.hasNext()) { + CardTemplateScansDTO scansDTO = iterator.next(); + // 迭代删除已经不存在的名片记录 CardTemplateUseDTO cardTemplateUseDTO = iCardTemplateUseService.get(scansDTO.getCardTemplateUseId()); - scansDTO.setCardTemplateUseDTO(cardTemplateUseDTO); - userSet.add(scansDTO.getCreator()); + if(cardTemplateUseDTO == null) { + iterator.remove(); + }else{ + scansDTO.setCardTemplateUseDTO(cardTemplateUseDTO); + // 封装人员ID, 用于批量查询人员的昵称和头像 + userSet.add(scansDTO.getCreator()); + } } // 查询出人员的信息 List userList = new ArrayList(); 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 f8f03f0..8b82925 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 @@ -205,11 +205,13 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC * 生成Base64名片预览图 */ String cardTemplateUsePhoto = null; + String cardTemplateUsePhotoUrl = null; String cardTemplateUseDispatchPhoto = null; try { cardTemplateUsePhoto = iPicturesTemplateBuildingService.buildingPictures(cardTemplateAppDTO.getPicturesTemplateCode(), buildingPicturesMap); BufferedImage bufferedImage = base64ToBufferedImage(cardTemplateUsePhoto); cardTemplateUseDispatchPhoto = thumbnailImage(bufferedImage, 220 , 176); + cardTemplateUsePhotoUrl = iPicturesTemplateBuildingService.saveBase64ToFile(cardTemplateUsePhoto); } catch (Exception e) { e.printStackTrace(); throw new SaveException("生成预览图失败"); @@ -237,7 +239,7 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC cardTemplateDispatchSaveVO.setCardTemplateDispatchParentId("-1"); String cardTemplateDispatchId = iCardTemplateDispatchService.saveReturnId(token, cardTemplateDispatchSaveVO); // 生成名片二维码 - BufferedImage weiXinImage = WeiXinBarCodeUtils.getBarCodeImage(appKey, appSecret, "pages/sharePage/sharePage?cardTemplateDispatchId=" + cardTemplateDispatchId, 200); + BufferedImage weiXinImage = WeiXinBarCodeUtils.getBarCodeImage(appKey, appSecret, "pages/index/index?cardTemplateDispatchId=" + cardTemplateDispatchId, 200); String fileId = iPicturesTemplateBuildingService.saveBufferImageToFile(weiXinImage); vo.setCardTemplateUseBarcode(fileId); } catch (Exception e) { @@ -245,6 +247,7 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC throw new SaveException("生成二维码失败"); } vo.setCardTemplateUsePhoto(cardTemplateUsePhoto); + vo.setCardTemplateUsePhotoUrl(cardTemplateUsePhotoUrl); vo.setCardTemplateUseDispatchPhoto(cardTemplateUseDispatchPhoto); vo.setPictureTemplateId(cardTemplateAppDTO.getCardTemplateId()); vo.setCardTemplateUseCode(cardTemplateAppDTO.getPicturesTemplateCode()); @@ -253,6 +256,7 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC vo.setCardTemplateUseHeight(cardTemplateAppDTO.getPicturesTemplateHeight()); vo.setCardTemplateUseWidth(cardTemplateAppDTO.getPicturesTemplateWidth()); vo.setCardTemplateUsePicture(cardTemplateAppDTO.getPicturesTemplatePicture()); + vo.setCardTemplateUsePictureUrl(cardTemplateAppDTO.getPicturesTemplatePictureUrl()); vo.setCardTemplateUsePassword(cardTemplateUseSaveVO.getCardTemplateUsePassword()); vo.setCardTemplateUseScansNumber(0); vo.setCardTemplateUseDispatchNumber(0); @@ -362,11 +366,13 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC * 生成Base64名片预览图 */ String cardTemplateUsePhoto = null; + String cardTemplateUsePhotoUrl = null; String cardTemplateUseDispatchPhoto = null; try { cardTemplateUsePhoto = iPicturesTemplateBuildingService.buildingPictures(useDTO.getCardTemplateUseCode(), buildingPicturesMap); BufferedImage bufferedImage = base64ToBufferedImage(cardTemplateUsePhoto); cardTemplateUseDispatchPhoto = thumbnailImage(bufferedImage, 220 , 176); + cardTemplateUsePhotoUrl = iPicturesTemplateBuildingService.saveBase64ToFile(cardTemplateUsePhoto); } catch (Exception e) { e.printStackTrace(); throw new SaveException("生成预览图失败"); @@ -376,6 +382,7 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC */ CardTemplateUseVO vo = new CardTemplateUseVO(); vo.setCardTemplateUsePhoto(cardTemplateUsePhoto); + vo.setCardTemplateUsePhotoUrl(cardTemplateUsePhotoUrl); vo.setCardTemplateUseDispatchPhoto(cardTemplateUseDispatchPhoto); vo.setCardTemplateUsePassword(cardTemplateUseUpdateVO.getCardTemplateUsePassword()); vo.setCardTemplateUseOrder(0); @@ -403,7 +410,11 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC * 封装区域 */ List useAreaList = iCardTemplateUseAreaService.list(params); + // 防止已经被删除的名片被查出来 CardTemplateUseDTO useDTO = get(params); + if(useDTO == null ) { + return null; + } CardTemplateDTO cardTemplateDTO = iCardTemplateService.get(useDTO.getPictureTemplateId()); /** * 查询数据字典 行业 @@ -420,7 +431,7 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC if(stringBuffer.length() < 1) { stringBuffer.append(dataDTO.getDataName()); }else{ - stringBuffer.append(",").append(dataDTO.getDataName()); + stringBuffer.append("、").append(dataDTO.getDataName()); } } useDTO.setTemplateIndustryName(stringBuffer.toString()); diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateusebag/impl/CardTemplateUseBagServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateusebag/impl/CardTemplateUseBagServiceImpl.java index 815913d..4dd5425 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateusebag/impl/CardTemplateUseBagServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardtemplateusebag/impl/CardTemplateUseBagServiceImpl.java @@ -1,5 +1,6 @@ package cn.com.tenlion.systemcard.service.cardtemplateusebag.impl; +import cn.com.tenlion.systemcard.pojo.dtos.cardtemplatescans.CardTemplateScansDTO; import cn.com.tenlion.systemcard.pojo.dtos.cardtemplateuse.CardTemplateUseDTO; import cn.com.tenlion.systemcard.service.cardtemplateuse.ICardTemplateUseService; import ink.wgink.common.base.DefaultBaseService; @@ -188,9 +189,16 @@ public class CardTemplateUseBagServiceImpl extends DefaultBaseService implements @Override public List list(Map params) { List list = cardTemplateUseBagDao.list(params); - for (CardTemplateUseBagDTO bagDTO : list) { - CardTemplateUseDTO useDTO = iCardTemplateUseService.get(bagDTO.getCardTemplateUseId()); - bagDTO.setCardTemplateUseDTO(useDTO); + Iterator iterator = list.iterator(); + while(iterator.hasNext()) { + CardTemplateUseBagDTO bagDTO = iterator.next(); + // 迭代删除已经不存在的名片记录 + CardTemplateUseDTO cardTemplateUseDTO = iCardTemplateUseService.get(bagDTO.getCardTemplateUseId()); + if(cardTemplateUseDTO == null) { + iterator.remove(); + }else{ + bagDTO.setCardTemplateUseDTO(cardTemplateUseDTO); + } } return list; } diff --git a/src/main/resources/mybatis/mapper/cardtemplateuse/card-template-use-mapper.xml b/src/main/resources/mybatis/mapper/cardtemplateuse/card-template-use-mapper.xml index 1640f68..6313538 100644 --- a/src/main/resources/mybatis/mapper/cardtemplateuse/card-template-use-mapper.xml +++ b/src/main/resources/mybatis/mapper/cardtemplateuse/card-template-use-mapper.xml @@ -11,7 +11,9 @@ + + @@ -121,7 +123,9 @@ card_template_use_height, card_template_use_width, card_template_use_picture, + card_template_use_picture_url, card_template_use_photo, + card_template_use_photo_url, card_template_use_switch, card_template_use_barcode, card_template_use_password, @@ -149,7 +153,9 @@ #{cardTemplateUseHeight}, #{cardTemplateUseWidth}, #{cardTemplateUsePicture}, + #{cardTemplateUsePictureUrl}, #{cardTemplateUsePhoto}, + #{cardTemplateUsePhotoUrl}, #{cardTemplateUseSwitch}, #{cardTemplateUseBarcode}, #{cardTemplateUsePassword}, @@ -205,6 +211,9 @@ card_template_use_photo = #{cardTemplateUsePhoto}, + + card_template_use_photo_url = #{cardTemplateUsePhotoUrl}, + card_template_use_dispatch_photo = #{cardTemplateUseDispatchPhoto}, @@ -227,7 +236,7 @@ card_template_use_id = #{cardTemplateUseId} - +