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

This commit is contained in:
cuibaocheng 2021-08-17 15:53:39 +08:00
parent e6c6426200
commit 3f628821b2
10 changed files with 175 additions and 15 deletions

View File

@ -87,6 +87,7 @@ public class CardTemplateScansController extends DefaultBaseController {
@ApiOperation(value = "分页列表", notes = "分页列表接口") @ApiOperation(value = "分页列表", notes = "分页列表接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "homePage", value = "是否为首页(1:首页,需要将系统默认的名片置顶返回)", paramType = "query", dataType = "int", defaultValue = "0"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),

View File

@ -35,6 +35,26 @@ public class CardTemplateAppDTO extends PicturesTemplateBuildingDTO {
private String templateCharge; private String templateCharge;
@ApiModelProperty(name = "templateStatus", value = "是否发布1:发布,0:停用") @ApiModelProperty(name = "templateStatus", value = "是否发布1:发布,0:停用")
private String templateStatus; private String templateStatus;
@ApiModelProperty(name = "templatePrice", value = "收费价格")
private Double templatePrice;
@ApiModelProperty(name = "templateCompany", value = "企业定制模板")
private String templateCompany;
public String getTemplateCompany() {
return templateCompany == null ? "" : templateCompany;
}
public void setTemplateCompany(String templateCompany) {
this.templateCompany = templateCompany;
}
public Double getTemplatePrice() {
return templatePrice == null ? 0.0 : templatePrice;
}
public void setTemplatePrice(Double templatePrice) {
this.templatePrice = templatePrice;
}
public String getCardTemplateId() { public String getCardTemplateId() {
return cardTemplateId == null ? "" : cardTemplateId; return cardTemplateId == null ? "" : cardTemplateId;

View File

@ -24,6 +24,10 @@ public class CardTemplateDTO {
private String templateIndustry; private String templateIndustry;
@ApiModelProperty(name = "templateCharge", value = "是否收费1:收费,0:免费") @ApiModelProperty(name = "templateCharge", value = "是否收费1:收费,0:免费")
private String templateCharge; private String templateCharge;
@ApiModelProperty(name = "templatePrice", value = "收费价格")
private Double templatePrice;
@ApiModelProperty(name = "templateCompany", value = "企业定制模板")
private String templateCompany;
@ApiModelProperty(name = "templateStatus", value = "是否发布1:发布,0:停用") @ApiModelProperty(name = "templateStatus", value = "是否发布1:发布,0:停用")
private String templateStatus; private String templateStatus;
@ApiModelProperty(name = "creator", value = "") @ApiModelProperty(name = "creator", value = "")
@ -37,6 +41,22 @@ public class CardTemplateDTO {
@ApiModelProperty(name = "isDelete", value = "") @ApiModelProperty(name = "isDelete", value = "")
private Integer isDelete; private Integer isDelete;
public Double getTemplatePrice() {
return templatePrice;
}
public void setTemplatePrice(Double templatePrice) {
this.templatePrice = templatePrice;
}
public String getTemplateCompany() {
return templateCompany == null ? "" : templateCompany;
}
public void setTemplateCompany(String templateCompany) {
this.templateCompany = templateCompany;
}
public String getCardTemplateId() { public String getCardTemplateId() {
return cardTemplateId == null ? "" : cardTemplateId.trim(); return cardTemplateId == null ? "" : cardTemplateId.trim();
} }

View File

@ -31,6 +31,26 @@ public class CardTemplateVO {
@ApiModelProperty(name = "templateStatus", value = "是否发布1:发布,0:停用") @ApiModelProperty(name = "templateStatus", value = "是否发布1:发布,0:停用")
@CheckEmptyAnnotation(name = "模板开关") @CheckEmptyAnnotation(name = "模板开关")
private String templateStatus; private String templateStatus;
@ApiModelProperty(name = "templatePrice", value = "收费价格")
private Double templatePrice;
@ApiModelProperty(name = "templateCompany", value = "企业定制模板")
private String templateCompany;
public Double getTemplatePrice() {
return templatePrice == null ? 0.0 : templatePrice;
}
public void setTemplatePrice(Double templatePrice) {
this.templatePrice = templatePrice;
}
public String getTemplateCompany() {
return templateCompany == null ? "" : templateCompany;
}
public void setTemplateCompany(String templateCompany) {
this.templateCompany = templateCompany;
}
public String getTemplateMode() { public String getTemplateMode() {
return templateMode == null ? "" : templateMode.trim(); return templateMode == null ? "" : templateMode.trim();

View File

@ -240,9 +240,24 @@ public class CardTemplateScansServiceImpl extends DefaultBaseService implements
public SuccessResultList<List<CardTemplateScansDTO>> listPage(ListPage page) { public SuccessResultList<List<CardTemplateScansDTO>> listPage(ListPage page) {
PageHelper.startPage(page.getPage(), page.getRows()); PageHelper.startPage(page.getPage(), page.getRows());
List<CardTemplateScansDTO> cardTemplateScansDTOs = list(page.getParams()); List<CardTemplateScansDTO> cardTemplateScansDTOs = list(page.getParams());
// 加载系统默认名片在最上面
if(1 == page.getPage() && page.getParams().get("homePage") != null && 1 == Integer.valueOf(page.getParams().get("homePage").toString())) {
CardTemplateUseDTO cardTemplateUseDTO = iCardTemplateUseService.getSystemCard();
List<CardTemplateScansDTO> cardTemplateScansDTOList = new ArrayList<CardTemplateScansDTO>();
if(cardTemplateUseDTO != null) {
CardTemplateScansDTO scansDTO = new CardTemplateScansDTO();
scansDTO.setCardTemplateUseId(cardTemplateUseDTO.getCardTemplateUseId());
scansDTO.setCardTemplateUseDTO(cardTemplateUseDTO);
cardTemplateScansDTOList.add(scansDTO);
}
cardTemplateScansDTOList.addAll(cardTemplateScansDTOs);
PageInfo<CardTemplateScansDTO> pageInfo = new PageInfo<>(cardTemplateScansDTOList);
return new SuccessResultList<>(cardTemplateScansDTOList, pageInfo.getPageNum(), pageInfo.getTotal());
}else {
PageInfo<CardTemplateScansDTO> pageInfo = new PageInfo<>(cardTemplateScansDTOs); PageInfo<CardTemplateScansDTO> pageInfo = new PageInfo<>(cardTemplateScansDTOs);
return new SuccessResultList<>(cardTemplateScansDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); return new SuccessResultList<>(cardTemplateScansDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
} }
}
@Override @Override
public Integer count(Map<String, Object> params) { public Integer count(Map<String, Object> params) {

View File

@ -5,6 +5,7 @@ import cn.com.tenlion.buildingpictures.pojo.dtos.picturestemplatearea.PicturesTe
import cn.com.tenlion.buildingpictures.service.picturestemplatebuilding.IPicturesTemplateBuildingService; import cn.com.tenlion.buildingpictures.service.picturestemplatebuilding.IPicturesTemplateBuildingService;
import cn.com.tenlion.buildingpictures.util.CreateImageBean; import cn.com.tenlion.buildingpictures.util.CreateImageBean;
import cn.com.tenlion.buildingpictures.util.WeiXinBarCodeUtils; import cn.com.tenlion.buildingpictures.util.WeiXinBarCodeUtils;
import cn.com.tenlion.configcontent.util.AntistopUtil;
import cn.com.tenlion.projectconfig.util.ProjectConfigUtil; import cn.com.tenlion.projectconfig.util.ProjectConfigUtil;
import cn.com.tenlion.systemcard.pojo.dtos.cardtemplate.CardTemplateAppDTO; import cn.com.tenlion.systemcard.pojo.dtos.cardtemplate.CardTemplateAppDTO;
import cn.com.tenlion.systemcard.pojo.dtos.cardtemplate.CardTemplateDTO; import cn.com.tenlion.systemcard.pojo.dtos.cardtemplate.CardTemplateDTO;
@ -243,6 +244,17 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC
areaVO.setTemplateAreaFontValue(cardTemplateUseAreaSaveVO.getTemplateAreaFontValue()); areaVO.setTemplateAreaFontValue(cardTemplateUseAreaSaveVO.getTemplateAreaFontValue());
// 封装模板预览图参数 // 封装模板预览图参数
if(!StringUtils.isEmpty(cardTemplateUseAreaSaveVO.getTemplateAreaFontValue())) { if(!StringUtils.isEmpty(cardTemplateUseAreaSaveVO.getTemplateAreaFontValue())) {
/**
* 判断评论是否违规
*/
// 评论内容敏感词识别
String viewContent = AntistopUtil.buiderView(cardTemplateUseAreaSaveVO.getTemplateAreaFontValue());
// 敏感词触发次数
int count = AntistopUtil.getCount(viewContent);
// 发生敏感词
if(count > 0) {
throw new SaveException(buildingDTO.getTemplateAreaName() + "涉嫌违规");
}
buildingPicturesMap.put(buildingDTO.getTemplateAreaSource(), cardTemplateUseAreaSaveVO.getTemplateAreaFontValue()); buildingPicturesMap.put(buildingDTO.getTemplateAreaSource(), cardTemplateUseAreaSaveVO.getTemplateAreaFontValue());
}else if(!StringUtils.isEmpty(cardTemplateUseAreaSaveVO.getTemplateAreaFile())) { }else if(!StringUtils.isEmpty(cardTemplateUseAreaSaveVO.getTemplateAreaFile())) {
buildingPicturesMap.put(buildingDTO.getTemplateAreaSource(), cardTemplateUseAreaSaveVO.getTemplateAreaFile()); buildingPicturesMap.put(buildingDTO.getTemplateAreaSource(), cardTemplateUseAreaSaveVO.getTemplateAreaFile());
@ -407,6 +419,17 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC
if (useAreaDTO.getCardTemplateUseAreaId().equals(cardTemplateUseAreaUpdateVO.getCardTemplateUseAreaId())) { if (useAreaDTO.getCardTemplateUseAreaId().equals(cardTemplateUseAreaUpdateVO.getCardTemplateUseAreaId())) {
// 封装模板预览图参数 // 封装模板预览图参数
if(!StringUtils.isEmpty(cardTemplateUseAreaUpdateVO.getTemplateAreaFontValue())) { if(!StringUtils.isEmpty(cardTemplateUseAreaUpdateVO.getTemplateAreaFontValue())) {
/**
* 判断评论是否违规
*/
// 评论内容敏感词识别
String viewContent = AntistopUtil.buiderView(cardTemplateUseAreaUpdateVO.getTemplateAreaFontValue());
// 敏感词触发次数
int count = AntistopUtil.getCount(viewContent);
// 发生敏感词
if(count > 0) {
throw new SaveException(useAreaDTO.getTemplateAreaName() + "涉嫌违规");
}
buildingPicturesMap.put(useAreaDTO.getTemplateAreaSource(), cardTemplateUseAreaUpdateVO.getTemplateAreaFontValue()); buildingPicturesMap.put(useAreaDTO.getTemplateAreaSource(), cardTemplateUseAreaUpdateVO.getTemplateAreaFontValue());
}else if(!StringUtils.isEmpty(cardTemplateUseAreaUpdateVO.getTemplateAreaFile())) { }else if(!StringUtils.isEmpty(cardTemplateUseAreaUpdateVO.getTemplateAreaFile())) {
buildingPicturesMap.put(useAreaDTO.getTemplateAreaSource(), cardTemplateUseAreaUpdateVO.getTemplateAreaFile()); buildingPicturesMap.put(useAreaDTO.getTemplateAreaSource(), cardTemplateUseAreaUpdateVO.getTemplateAreaFile());
@ -584,9 +607,9 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC
*/ */
params.put("userId", getUserId(token)); params.put("userId", getUserId(token));
List<CardTemplateUseDTO> list = list(params); List<CardTemplateUseDTO> list = list(params);
if(list == null || list.size() < 1) { if(list != null || list.size() > 0) {
// 没有创建名片 , 显示系统默认名片 // 创建了名片 , 加载我的默认名片
CardTemplateUseDTO cardTemplateUseDTO = cardTemplateUseDao.getSystem(params); CardTemplateUseDTO cardTemplateUseDTO = cardTemplateUseDao.getDefault(params);
if(cardTemplateUseDTO == null) { if(cardTemplateUseDTO == null) {
return null; return null;
} }
@ -596,8 +619,8 @@ public class CardTemplateUseServiceImpl extends DefaultBaseService implements IC
cardTemplateUseDTO.setAreaList(useAreaList); cardTemplateUseDTO.setAreaList(useAreaList);
return cardTemplateUseDTO; return cardTemplateUseDTO;
}else{ }else{
// 创建了名片 , 加载我的默认名片 // 没有创建名片 , 显示系统默认名片
CardTemplateUseDTO cardTemplateUseDTO = cardTemplateUseDao.getDefault(params); CardTemplateUseDTO cardTemplateUseDTO = cardTemplateUseDao.getSystem(params);
if(cardTemplateUseDTO == null) { if(cardTemplateUseDTO == null) {
return null; return null;
} }

View File

@ -9,6 +9,8 @@
<result column="template_industry" property="templateIndustry"/> <result column="template_industry" property="templateIndustry"/>
<result column="template_charge" property="templateCharge"/> <result column="template_charge" property="templateCharge"/>
<result column="template_status" property="templateStatus"/> <result column="template_status" property="templateStatus"/>
<result column="template_price" property="templatePrice"/>
<result column="template_company" property="templateCompany"/>
<result column="creator" property="creator"/> <result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/> <result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/> <result column="modifier" property="modifier"/>
@ -53,6 +55,8 @@
template_industry, template_industry,
template_charge, template_charge,
template_status, template_status,
template_price,
template_company,
creator, creator,
gmt_create, gmt_create,
modifier, modifier,
@ -65,6 +69,8 @@
#{templateIndustry}, #{templateIndustry},
#{templateCharge}, #{templateCharge},
#{templateStatus}, #{templateStatus},
#{templatePrice},
#{templateCompany},
#{creator}, #{creator},
#{gmtCreate}, #{gmtCreate},
#{modifier}, #{modifier},
@ -119,6 +125,8 @@
<if test="templateStatus != null and templateStatus != ''"> <if test="templateStatus != null and templateStatus != ''">
template_status = #{templateStatus}, template_status = #{templateStatus},
</if> </if>
template_price = #{templatePrice},
template_company = #{templateCompany},
gmt_modified = #{gmtModified}, gmt_modified = #{gmtModified},
modifier = #{modifier}, modifier = #{modifier},
card_template_id = card_template_id card_template_id = card_template_id
@ -134,7 +142,9 @@
t1.template_industry, t1.template_industry,
t1.template_charge, t1.template_charge,
t1.template_status, t1.template_status,
t1.card_template_id t1.card_template_id,
t1.template_price,
t1.template_company
FROM FROM
e_card_template t1 e_card_template t1
WHERE WHERE
@ -158,7 +168,9 @@
t1.gmt_create, t1.gmt_create,
t1.modifier, t1.modifier,
t1.gmt_modified, t1.gmt_modified,
t1.is_delete t1.is_delete,
t1.template_price,
t1.template_company
FROM FROM
e_card_template t1 e_card_template t1
WHERE WHERE
@ -182,7 +194,9 @@
t1.gmt_create, t1.gmt_create,
t1.modifier, t1.modifier,
t1.gmt_modified, t1.gmt_modified,
t1.is_delete t1.is_delete,
t1.template_price,
t1.template_company
FROM FROM
e_card_template t1 e_card_template t1
WHERE WHERE
@ -207,7 +221,8 @@
t1.modifier, t1.modifier,
t1.gmt_modified, t1.gmt_modified,
t1.is_delete, t1.is_delete,
1 t1.template_price,
t1.template_company
FROM FROM
e_card_template t1 e_card_template t1
WHERE WHERE
@ -254,7 +269,9 @@
t1.gmt_create, t1.gmt_create,
t1.modifier, t1.modifier,
t1.gmt_modified, t1.gmt_modified,
t1.is_delete t1.is_delete,
t1.template_price,
t1.template_company
FROM FROM
e_card_template t1 e_card_template t1
WHERE WHERE
@ -295,7 +312,9 @@
t1.gmt_create, t1.gmt_create,
t1.modifier, t1.modifier,
t1.gmt_modified, t1.gmt_modified,
t1.is_delete t1.is_delete,
t1.template_price,
t1.template_company
FROM FROM
e_card_template t1 e_card_template t1
WHERE WHERE

View File

@ -218,6 +218,10 @@
t1.is_delete t1.is_delete
FROM FROM
e_card_template_scans t1 e_card_template_scans t1
LEFT JOIN
e_card_template_use t2
ON
t1.card_template_use_id = t2.card_template_use_id
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
<if test="creator != null and creator != ''"> <if test="creator != null and creator != ''">
@ -229,6 +233,10 @@
<if test="cardTemplateUseId != null and cardTemplateUseId != ''"> <if test="cardTemplateUseId != null and cardTemplateUseId != ''">
AND t1.card_template_use_id = #{cardTemplateUseId} AND t1.card_template_use_id = #{cardTemplateUseId}
</if> </if>
<!-- 不查询首页 -->
<if test="homePage != null and homePage == 1">
AND t2.card_template_use_system = '0'
</if>
ORDER BY ORDER BY
t1.gmt_create DESC t1.gmt_create DESC
</select> </select>

View File

@ -210,7 +210,7 @@
if(picturesTemplateId == params[j].cardTemplateId) { if(picturesTemplateId == params[j].cardTemplateId) {
$(".templateCharge" + picturesTemplateId).each(function(i, e) { $(".templateCharge" + picturesTemplateId).each(function(i, e) {
if(params[j].templateCharge == 1) { if(params[j].templateCharge == 1) {
$(e).parent().html('<button type="button" class="layui-btn layui-btn-danger layui-btn-xs">收费</button>'); $(e).parent().html('<button type="button" class="layui-btn layui-btn-danger layui-btn-xs">收费(' + params[j].templatePrice + '元)</button>');
}else { }else {
$(e).parent().html('<button type="button" class="layui-btn layui-btn-xs">免费</button>'); $(e).parent().html('<button type="button" class="layui-btn layui-btn-xs">免费</button>');
} }

View File

@ -41,7 +41,24 @@
<div class="layui-form-item" pane> <div class="layui-form-item" pane>
<label class="layui-form-label">模板收费<span style="color: red">*</span></label> <label class="layui-form-label">模板收费<span style="color: red">*</span></label>
<div class="layui-input-block" > <div class="layui-input-block" >
<input type="checkbox" value="1" id="templateCharge" name="templateCharge" lay-skin="switch" lay-text="收费|免费"> <input type="checkbox" value="1" id="templateCharge" name="templateCharge" lay-filter="templateChargeFilter" lay-skin="switch" lay-text="收费|免费">
</div>
</div>
<div id="templatePriceDiv"></div>
<script id="templatePriceScript" type="text/html">
{{# if(d == true ) { }}
<div class="layui-form-item" >
<label class="layui-form-label">收费价格<span style="color: red">*</span></label>
<div class="layui-input-block" >
<input type="number" value="" id="templatePrice" name="templatePrice" class="layui-input" value="" placeholder="请输入收费价格">
</div>
</div>
{{# } }}
</script>
<div class="layui-form-item" >
<label class="layui-form-label">企业定制</label>
<div class="layui-input-block" >
<input type="text" value="" id="templateCompany" name="templateCompany" class="layui-input" value="" placeholder="请输入企业邀请码">
</div> </div>
</div> </div>
<div class="layui-form-item" pane> <div class="layui-form-item" pane>
@ -90,6 +107,17 @@
var viewerObj = {}; var viewerObj = {};
var picturesTemplateId = top.restAjax.params(window.location.href).picturesTemplateId; var picturesTemplateId = top.restAjax.params(window.location.href).picturesTemplateId;
form.on('switch(templateChargeFilter)', function (data) {
if(this.checked) {
laytpl(document.getElementById('templatePriceScript').innerHTML).render(this.checked, function(html) {
document.getElementById('templatePriceDiv').innerHTML = html;
form.render(null, 'dataForm');
});
}else{
document.getElementById('templatePriceDiv').innerHTML = "";
}
});
// 初始化类型 // 初始化类型
function initTemplateType(templateType) { function initTemplateType(templateType) {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/4bf68c60-eac5-480d-b5e1-15203d0282f9', []), {}, null, function(code, data, args) { top.restAjax.get(top.restAjax.path('api/data/listbyparentid/4bf68c60-eac5-480d-b5e1-15203d0282f9', []), {}, null, function(code, data, args) {
@ -143,6 +171,12 @@
console.log(dataFormData); console.log(dataFormData);
dataFormData.templateStatus = dataFormData.templateStatus == 1 ? true : false; dataFormData.templateStatus = dataFormData.templateStatus == 1 ? true : false;
dataFormData.templateCharge = dataFormData.templateCharge == 1 ? true : false; dataFormData.templateCharge = dataFormData.templateCharge == 1 ? true : false;
if(dataFormData.templateCharge ) {
laytpl(document.getElementById('templatePriceScript').innerHTML).render(dataFormData.templateCharge, function(html) {
document.getElementById('templatePriceDiv').innerHTML = html;
form.render(null, 'dataForm');
});
}
initTemplateIndustry(dataFormData.templateIndustry); initTemplateIndustry(dataFormData.templateIndustry);
initTemplateType(dataFormData.templateType); initTemplateType(dataFormData.templateType);