Commit c5b03ea0 by guiq

feat: [1007135] 【新增】泛链路-纯社群支持多图多码配置

parent d7a3d848
......@@ -2,6 +2,7 @@ package com.pcloud.book.group.biz.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.pcloud.advertising.advertising.dto.AdvertisingSpaceDTO;
......@@ -170,6 +171,7 @@ import com.pcloud.wechatgroup.wxwork.dto.WxworkGroupQrcodeBaseDTO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -3701,13 +3703,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
ResourcePageWxwork resourcePageWxwork = new ResourcePageWxwork();
BeanUtils.copyProperties(wxworkPageCreateVO,resourcePageWxwork);
//自定义存下高度
// 新版直接存储自定义配置到 fixed_set 字段
if (ResourcePageConstants.WxworkPageTemplateTypeEnum.CUSTOM.getCode().equals(templateType)) {
WxworkPageFixedDTO fixedDTO = new WxworkPageFixedDTO();
fixedDTO.setHeight(wxworkPageCreateVO.getHeight());
wxworkPageCreateVO.setFixedDTO(fixedDTO);
}
//资源模板参数json存放
if (null != wxworkPageCreateVO.getFixedDTO()) {
resourcePageWxwork.setFixedSet(JSON.toJSONString(wxworkPageCreateVO.getConfig()));
} else if (null != wxworkPageCreateVO.getFixedDTO()) { //资源模板参数json存放
resourcePageWxwork.setFixedSet(JSONUtils.toJsonString(wxworkPageCreateVO.getFixedDTO()));
}
ResourcePageWxwork pageWxwork = resourcePageWxworkDao.getByPageId(resourcePageId);
......@@ -3717,13 +3716,13 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
} else {
resourcePageWxworkDao.insert(resourcePageWxwork);
}
if (ResourcePageConstants.WxworkPageTemplateTypeEnum.CUSTOM.getCode().equals(templateType)) {
/*if (ResourcePageConstants.WxworkPageTemplateTypeEnum.CUSTOM.getCode().equals(templateType)) {
//生成图片更新到数据库
HtmlDto htmlDto = new HtmlDto();
htmlDto.setHeight(wxworkPageCreateVO.getHeight());
htmlDto.setWidth(750);
htmlDto.setHtmlCode(wxworkPageCreateVO.getHtml());
htmlDto.setSnapshot(new Long(System.currentTimeMillis()).toString());
htmlDto.setSnapshot(Long.toString(System.currentTimeMillis()));
ThreadPoolUtils.RESOURCE_POOL.execute(()->{
String url = shareImageConsr.toJPGByChrome(htmlDto);
if (!StringUtil.isEmpty(url)) {
......@@ -3731,7 +3730,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePageWxworkDao.update(resourcePageWxwork);
}
});
}
}*/
}
......@@ -3742,18 +3741,17 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if (null == wxworkPageCreateVO.getTemplateType()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少模板类型");
}
if (null == wxworkPageCreateVO.getQrcodeType() || null == wxworkPageCreateVO.getQrcodeId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"请选择二维码");
}
Integer templateType = wxworkPageCreateVO.getTemplateType();
if (!Objects.equals(ResourcePageConstants.WxworkPageTemplateTypeEnum.CUSTOM.getCode(), templateType)
&& (null == wxworkPageCreateVO.getQrcodeType() || null == wxworkPageCreateVO.getQrcodeId())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择二维码");
}
if (ResourcePageConstants.WxworkPageTemplateTypeEnum.FIXED_NORMAL.getCode().equals(templateType)) {
if (null == wxworkPageCreateVO.getGuide()|| null == wxworkPageCreateVO.getDisplayBook()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数");
}
} else if (ResourcePageConstants.WxworkPageTemplateTypeEnum.CUSTOM.getCode().equals(templateType)) {
if (StringUtil.isEmpty(wxworkPageCreateVO.getBasePic()) || StringUtil.isEmpty(wxworkPageCreateVO.getHtml())
|| null == wxworkPageCreateVO.getTopSpace() || null == wxworkPageCreateVO.getLeftSpace()
|| null == wxworkPageCreateVO.getHeight()) {
if (CollectionUtil.isEmpty(wxworkPageCreateVO.getConfig())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数");
}
} else if (null == wxworkPageCreateVO.getFixedDTO()) {
......@@ -3770,12 +3768,19 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
return wxworkPageVO;
}
BeanUtils.copyProperties(pageWxwork, wxworkPageVO);
if(!StringUtil.isEmpty(pageWxwork.getFixedSet())) {
wxworkPageVO.setFixedDTO(JSONUtils.jsonToBean(pageWxwork.getFixedSet(), WxworkPageFixedDTO.class));
}
if (ResourcePageConstants.WxworkPageTemplateTypeEnum.CUSTOM.getCode().equals(pageWxwork.getTemplateType())) {
wxworkPageVO.setHeight(wxworkPageVO.getFixedDTO().getHeight());
if (!StringUtil.isEmpty(pageWxwork.getFixedSet())) {
if (ResourcePageConstants.WxworkPageTemplateTypeEnum.CUSTOM.getCode().equals(pageWxwork.getTemplateType())) {
if (BooleanUtils.isTrue(pageWxwork.getOldTemplate())) {
wxworkPageVO.setFixedDTO(JSONUtils.jsonToBean(pageWxwork.getFixedSet(), WxworkPageFixedDTO.class));
wxworkPageVO.setHeight(wxworkPageVO.getFixedDTO().getHeight());
} else {
wxworkPageVO.setConfig(JSON.parseObject(pageWxwork.getFixedSet()));
}
} else {
wxworkPageVO.setFixedDTO(JSONUtils.jsonToBean(pageWxwork.getFixedSet(), WxworkPageFixedDTO.class));
}
}
Integer qrcodeType = pageWxwork.getQrcodeType();
Long qrcodeId = pageWxwork.getQrcodeId();
if (!isWechat && null != qrcodeId) {
......
......@@ -80,7 +80,10 @@ public class ResourcePageWxwork extends BaseEntity {
*/
private Date updateTime;
/**
* 是否旧模板 - 旧数据标识
*/
private Boolean oldTemplate;
}
......@@ -4,6 +4,8 @@ import com.pcloud.book.group.dto.WxworkPageFixedDTO;
import lombok.Data;
import java.util.Map;
/**
* @ClassName com.pcloud.book.group.vo.WxworkPageCreateVO
* @Author zhuyajie
......@@ -68,4 +70,9 @@ public class WxworkPageCreateVO {
* 图片高度
*/
private Integer height;
/**
* 存储落地页 - 自定义类型的前端配置
*/
private Map<String,Object> config;
}
......@@ -5,6 +5,8 @@ import com.pcloud.common.dto.BaseDto;
import lombok.Data;
import java.util.Map;
/**
* @ClassName com.pcloud.book.group.vo.WxworkPageVO
* @Author zhuyajie
......@@ -73,4 +75,14 @@ public class WxworkPageVO extends BaseDto {
* 图片高度
*/
private Integer height;
/**
* 存储落地页 - 自定义类型的前端配置
*/
private Map<String,Object> config;
/**
* 是否旧模板 - 旧数据标识
*/
private Boolean oldTemplate;
}
......@@ -16,13 +16,14 @@
<result property="leftSpace" column="left_space" jdbcType="INTEGER"/>
<result property="htmlPic" column="html_pic" jdbcType="VARCHAR"/>
<result property="fixedSet" column="fixed_set" jdbcType="VARCHAR"/>
<result property="oldTemplate" column="is_old_template" jdbcType="VARCHAR"/>
<result property="createUser" column="create_user" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_columns">
id, resource_page_id, template_type, display_book, guide, qrcode_type, qrcode_id, qrcode_url, base_pic, top_space, left_space, html_pic, fixed_set, create_user, create_time, update_time
id, resource_page_id, template_type, display_book, guide, qrcode_type, qrcode_id, qrcode_url, base_pic, top_space, left_space, html_pic, fixed_set, is_old_template, create_user, create_time, update_time
</sql>
<!--查询单个-->
......@@ -35,8 +36,8 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into resource_page_wxwork(resource_page_id, template_type, display_book, guide, qrcode_type, qrcode_id, qrcode_url, base_pic, top_space, left_space, html_pic, fixed_set, create_user, create_time, update_time)
values (#{resourcePageId}, #{templateType}, #{displayBook}, #{guide}, #{qrcodeType}, #{qrcodeId}, #{qrcodeUrl}, #{basePic}, #{topSpace}, #{leftSpace}, #{htmlPic}, #{fixedSet}, #{createUser}, now(), now())
insert into resource_page_wxwork(resource_page_id, template_type, display_book, guide, qrcode_type, qrcode_id, qrcode_url, base_pic, top_space, left_space, html_pic, fixed_set, is_old_template, create_user, create_time, update_time)
values (#{resourcePageId}, #{templateType}, #{displayBook}, #{guide}, #{qrcodeType}, #{qrcodeId}, #{qrcodeUrl}, #{basePic}, #{topSpace}, #{leftSpace}, #{htmlPic}, #{fixedSet}, 0, #{createUser}, now(), now())
</insert>
<!--通过主键修改数据-->
......@@ -59,6 +60,7 @@
<if test="qrcodeUrl != null and qrcodeUrl != ''">
qrcode_url = #{qrcodeUrl},
</if>
is_old_template = 0,
base_pic = #{basePic},
top_space = #{topSpace},
left_space = #{leftSpace},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment