增加动态表单自动排版配置界面的保存回显逻辑

This commit is contained in:
cuibaocheng 2021-08-06 18:54:39 +08:00
parent 6f835c801b
commit 7927c4c96a
8 changed files with 112 additions and 36 deletions

View File

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

View File

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

View File

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

View File

@ -191,14 +191,19 @@ public class CardTemplateScansServiceImpl extends DefaultBaseService implements
List<CardTemplateScansDTO> list = cardTemplateScansDao.list(params);
// 放入名片数据
Set<String> userSet = new HashSet<String>();
for(CardTemplateScansDTO scansDTO : list) {
/**
* 封装名片信息
*/
Iterator<CardTemplateScansDTO> iterator = list.iterator();
while(iterator.hasNext()) {
CardTemplateScansDTO scansDTO = iterator.next();
// 迭代删除已经不存在的名片记录
CardTemplateUseDTO cardTemplateUseDTO = iCardTemplateUseService.get(scansDTO.getCardTemplateUseId());
if(cardTemplateUseDTO == null) {
iterator.remove();
}else{
scansDTO.setCardTemplateUseDTO(cardTemplateUseDTO);
// 封装人员ID, 用于批量查询人员的昵称和头像
userSet.add(scansDTO.getCreator());
}
}
// 查询出人员的信息
List<String> userList = new ArrayList<String>();
userList.addAll(userSet);

View File

@ -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<CardTemplateUseAreaDTO> 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());

View File

@ -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<CardTemplateUseBagDTO> list(Map<String, Object> params) {
List<CardTemplateUseBagDTO> list = cardTemplateUseBagDao.list(params);
for (CardTemplateUseBagDTO bagDTO : list) {
CardTemplateUseDTO useDTO = iCardTemplateUseService.get(bagDTO.getCardTemplateUseId());
bagDTO.setCardTemplateUseDTO(useDTO);
Iterator<CardTemplateUseBagDTO> 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;
}

View File

@ -11,7 +11,9 @@
<result column="card_template_use_height" property="cardTemplateUseHeight"/>
<result column="card_template_use_width" property="cardTemplateUseWidth"/>
<result column="card_template_use_picture" property="cardTemplateUsePicture"/>
<result column="card_template_use_picture_url" property="cardTemplateUsePictureUrl"/>
<result column="card_template_use_photo" property="cardTemplateUsePhoto"/>
<result column="card_template_use_photo_url" property="cardTemplateUsePhotoUrl"/>
<result column="card_template_use_switch" property="cardTemplateUseSwitch"/>
<result column="card_template_use_barcode" property="cardTemplateUseBarcode"/>
<result column="card_template_use_password" property="cardTemplateUsePassword"/>
@ -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 @@
<if test="cardTemplateUsePhoto != null and cardTemplateUsePhoto != ''">
card_template_use_photo = #{cardTemplateUsePhoto},
</if>
<if test="cardTemplateUsePhotoUrl != null and cardTemplateUsePhotoUrl != ''">
card_template_use_photo_url = #{cardTemplateUsePhotoUrl},
</if>
<if test="cardTemplateUseDispatchPhoto != null and cardTemplateUseDispatchPhoto != ''">
card_template_use_dispatch_photo = #{cardTemplateUseDispatchPhoto},
</if>
@ -227,7 +236,7 @@
card_template_use_id = #{cardTemplateUseId}
</update>
<!-- 系统默认 -->
<!-- 我的默认 -->
<select id="getDefault" parameterType="map" resultMap="cardTemplateUseDTO">
SELECT
t1.card_template_use_id,
@ -237,8 +246,8 @@
t1.card_template_use_title,
t1.card_template_use_height,
t1.card_template_use_width,
t1.card_template_use_picture,
t1.card_template_use_photo,
t1.card_template_use_picture_url,
t1.card_template_use_photo_url,
t1.card_template_use_switch,
t1.card_template_use_barcode,
t1.card_template_use_password,
@ -273,8 +282,8 @@
t1.card_template_use_title,
t1.card_template_use_height,
t1.card_template_use_width,
t1.card_template_use_picture,
t1.card_template_use_photo,
t1.card_template_use_picture_url,
t1.card_template_use_photo_url,
t1.card_template_use_switch,
t1.card_template_use_barcode,
t1.card_template_use_password,
@ -309,8 +318,8 @@
t1.card_template_use_title,
t1.card_template_use_height,
t1.card_template_use_width,
t1.card_template_use_picture,
t1.card_template_use_photo,
t1.card_template_use_picture_url,
t1.card_template_use_photo_url,
t1.card_template_use_switch,
t1.card_template_use_barcode,
t1.card_template_use_password,
@ -414,9 +423,9 @@
t1.card_template_use_title,
t1.card_template_use_height,
t1.card_template_use_width,
t1.card_template_use_picture,
t1.card_template_use_picture_url,
t1.card_template_use_barcode,
t1.card_template_use_photo,
t1.card_template_use_photo_url,
t1.card_template_use_switch,
t1.card_template_use_password,
t1.card_template_use_scans_number,

View File

@ -97,19 +97,19 @@
{field: 'picturesTemplateBackgroundImage', width: 100, title: '预览图', align:'center', data2:'ce',
templet: function(row) {
var rowData = row[this.field];
var picturesTemplatePicture = row['picturesTemplatePicture'];
var picturesTemplatePictureUrl = row['picturesTemplatePictureUrl'];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
var value = '<img style="height: 50px;width: 50px;" src="route/file/download/false/'+ rowData +'" >';
if(picturesTemplatePicture) {
value = '<img style="height: 50px;width: 50px;" src="' + picturesTemplatePicture + '">';
if(picturesTemplatePictureUrl) {
value = '<img style="height: 50px;width: 50px;" src="route/file/download/false/' + picturesTemplatePictureUrl + '">';
}
setTimeout(function() {
new Viewer(document.getElementById("viewer"),{
loop:true
});
}, 50);
}, 150);
return value;
}
},