Commit fa5dda92 by guojuxing

装修页面,顶部导航从全局迁移到自定义页面

parent 76833805
......@@ -114,6 +114,16 @@ public class AppletCustomPageDTO implements Serializable{
*/
private Integer crowdWidgetType;
/**
* 自定义页面专属 导航颜色,#ffffff
*/
private String guideTopColor;
/**
* 自定义页面专属 标题颜色1:黑色 2:白色
*/
private Integer titleColor;
public Integer getPageId() {
return pageId;
}
......@@ -286,6 +296,24 @@ public class AppletCustomPageDTO implements Serializable{
return this;
}
public String getGuideTopColor() {
return guideTopColor;
}
public AppletCustomPageDTO setGuideTopColor(String guideTopColor) {
this.guideTopColor = guideTopColor;
return this;
}
public Integer getTitleColor() {
return titleColor;
}
public AppletCustomPageDTO setTitleColor(Integer titleColor) {
this.titleColor = titleColor;
return this;
}
@Override
public String toString() {
return "AppletCustomPageDTO{" +
......@@ -309,6 +337,8 @@ public class AppletCustomPageDTO implements Serializable{
", backgroundType=" + backgroundType +
", backgroundImage=" + backgroundImage +
", appletTitle=" + appletTitle +
", guideTopColor=" + guideTopColor +
", titleColor=" + titleColor +
'}';
}
}
......@@ -17,15 +17,24 @@ public interface CustomGuideTopApiService {
* @param titleColor 标题颜色1:黑色 2:白色
* @param enterpriseId 商户ID
* @param appKey 小程序key
* @param pageId
* @return
*/
ServiceResponse<Void> saveCustomGuideTop(String guideTopColor, Integer titleColor, Integer enterpriseId, String appKey);
ServiceResponse<Void> saveCustomGuideTop(String guideTopColor, Integer titleColor, Integer enterpriseId, String appKey, Integer pageId);
/**
* 已经废弃 @Deprecated
* 查询顶部导航配置信息
* @param enterpriseId
* @param appKey
* @return
*/
ServiceResponse<CustomGuideTopDTO> getCustomGuideTop(Integer enterpriseId, String appKey);
/**
* 查询顶部导航配置信息
* @param pageId
* @return
*/
ServiceResponse<CustomGuideTopDTO> getCustomGuideTop(Integer pageId);
}
......@@ -54,9 +54,8 @@ public interface TabCustomGuideTopMapper {
/**
* 详情
* @param enterpriseId
* @param appKey
* @param pageId
* @return
*/
TabCustomGuideTop getCustomGuideTop(@Param("enterpriseId") Integer enterpriseId, @Param("appKey") String appKey);
TabCustomGuideTop getCustomGuideTop(@Param("pageId") Integer pageId);
}
\ No newline at end of file
......@@ -50,6 +50,11 @@ public class TabCustomGuideTop {
*/
private Date updateTime;
/**
* 自定义页面的页面ID
*/
private Integer pageId;
public Integer getGuideTopId() {
return guideTopId;
}
......@@ -121,4 +126,13 @@ public class TabCustomGuideTop {
this.updateTime = updateTime;
return this;
}
public Integer getPageId() {
return pageId;
}
public TabCustomGuideTop setPageId(Integer pageId) {
this.pageId = pageId;
return this;
}
}
\ No newline at end of file
......@@ -24,9 +24,8 @@ public interface CustomGuideTopService {
/**
* 获取详情
* @param enterpriseId
* @param appKey
* @param pageId
* @return
*/
TabCustomGuideTop getCustomGuideTop(Integer enterpriseId, String appKey);
TabCustomGuideTop getCustomGuideTop(Integer pageId);
}
......@@ -37,7 +37,7 @@ public class CustomGuideTopServiceImpl implements CustomGuideTopService{
}
@Override
public TabCustomGuideTop getCustomGuideTop(Integer enterpriseId, String appKey) {
return tabCustomGuideTopMapper.getCustomGuideTop(enterpriseId, appKey);
public TabCustomGuideTop getCustomGuideTop(Integer pageId) {
return tabCustomGuideTopMapper.getCustomGuideTop(pageId);
}
}
......@@ -10,15 +10,13 @@ import com.gic.enterprise.constant.applet.AppletPageComponentEnum;
import com.gic.enterprise.constant.applet.AppletPageTypeEnum;
import com.gic.enterprise.constant.applet.EntryConditionEnum;
import com.gic.enterprise.dto.AppletCustomPageDTO;
import com.gic.enterprise.dto.CustomGuideTopDTO;
import com.gic.enterprise.entity.TabAppletCustomPage;
import com.gic.enterprise.entity.TabAppletPageComponent;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.exception.CommonException;
import com.gic.enterprise.qo.AppletPageQO;
import com.gic.enterprise.service.AppletCustomPageApiService;
import com.gic.enterprise.service.AppletCustomPageService;
import com.gic.enterprise.service.AppletPageComponentService;
import com.gic.enterprise.service.CustomStoreApiService;
import com.gic.enterprise.service.*;
import com.gic.member.filter.api.dto.CrowdWidgetDTO;
import com.gic.member.filter.api.service.CrowdWidgetApiService;
import org.apache.commons.collections.CollectionUtils;
......@@ -54,6 +52,8 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
private CustomStoreApiService customStoreApiService;
@Autowired
private CrowdWidgetApiService crowdWidgetApiService;
@Autowired
private CustomGuideTopApiService customGuideTopApiService;
@Transactional(rollbackFor = Exception.class)
@Override
......@@ -178,6 +178,12 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
appletCustomPageService.edit(record);
}
}
//顶部导航
if (pageType == AppletPageTypeEnum.CUSTOM.getCode()) {
String guideTopColor = jsonObject.getString("guideTopColor");
Integer titleColor = jsonObject.getInteger("titleColor");
customGuideTopApiService.saveCustomGuideTop(guideTopColor, titleColor, enterpriseId, appId, pageId);
}
//保存组件表数据
List<TabAppletPageComponent> componentList = new ArrayList<>();
//组件key存储
......@@ -321,6 +327,12 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
public ServiceResponse<AppletCustomPageDTO> getDetailByPageId(Integer pageId) {
TabAppletCustomPage record = exist(pageId);
AppletCustomPageDTO dto = EntityUtil.changeEntityNew(AppletCustomPageDTO.class, record);
if (record.getPageType() == AppletPageTypeEnum.CUSTOM.getCode()) {
CustomGuideTopDTO guideTopDTO = customGuideTopApiService.getCustomGuideTop(pageId).getResult();
dto.setGuideTopColor(guideTopDTO.getGuideTopColor());
dto.setTitleColor(guideTopDTO.getTitleColor());
}
//查询组件数据
List<TabAppletPageComponent> componentList = appletPageComponentService.listByPageId(pageId);
JSONArray component = new JSONArray();
......
......@@ -27,17 +27,18 @@ public class CustomGuideTopApiServiceImpl implements CustomGuideTopApiService{
private CustomGuideTopService customGuideTopService;
@Override
public ServiceResponse<Void> saveCustomGuideTop(String guideTopColor, Integer titleColor, Integer enterpriseId, String appKey) {
public ServiceResponse<Void> saveCustomGuideTop(String guideTopColor, Integer titleColor, Integer enterpriseId, String appKey, Integer pageId) {
if (StringUtils.isBlank(guideTopColor) || titleColor == null) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "参数为空");
}
TabCustomGuideTop record = customGuideTopService.getCustomGuideTop(enterpriseId, appKey);
TabCustomGuideTop record = customGuideTopService.getCustomGuideTop(pageId);
if (record == null) {
customGuideTopService.saveCustomGuideTop(new TabCustomGuideTop()
.setAppid(appKey)
.setEnterpriseId(enterpriseId)
.setGuideTopColor(guideTopColor)
.setTitleColor(titleColor));
.setTitleColor(titleColor)
.setPageId(pageId));
} else {
customGuideTopService.editCustomGuideTop(new TabCustomGuideTop()
.setGuideTopId(record.getGuideTopId())
......@@ -50,7 +51,18 @@ public class CustomGuideTopApiServiceImpl implements CustomGuideTopApiService{
@Override
public ServiceResponse<CustomGuideTopDTO> getCustomGuideTop(Integer enterpriseId, String appKey) {
LOGGER.info("查询参数:{}-{}", enterpriseId, appKey);
TabCustomGuideTop record = customGuideTopService.getCustomGuideTop(enterpriseId, appKey);
TabCustomGuideTop record = new TabCustomGuideTop();
record.setGuideTopColor("#ffffff");
record.setTitleColor(1);
return ServiceResponse.success(EntityUtil.changeEntityNew(CustomGuideTopDTO.class, record));
}
@Override
public ServiceResponse<CustomGuideTopDTO> getCustomGuideTop(Integer pageId) {
TabCustomGuideTop record = customGuideTopService.getCustomGuideTop(pageId);
if (record == null) {
new TabCustomGuideTop().setTitleColor(1).setGuideTopColor("#ffffff");
}
return ServiceResponse.success(EntityUtil.changeEntityNew(CustomGuideTopDTO.class, record));
}
}
......@@ -10,10 +10,11 @@
<result column="delete_flag" jdbcType="INTEGER" property="deleteFlag" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="page_id" jdbcType="INTEGER" property="pageId" />
</resultMap>
<sql id="Base_Column_List">
guide_top_id, enterprise_id, guide_top_color, title_color, appid, delete_flag, create_time,
update_time
update_time, page_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -24,10 +25,10 @@
<insert id="insert" parameterType="com.gic.enterprise.entity.TabCustomGuideTop">
insert into tab_custom_guide_top (guide_top_id, enterprise_id, guide_top_color,
title_color, appid, delete_flag,
create_time, update_time)
create_time, update_time, page_id)
values (#{guideTopId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{guideTopColor,jdbcType=VARCHAR},
#{titleColor,jdbcType=INTEGER}, #{appid,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{pageId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabCustomGuideTop">
insert into tab_custom_guide_top
......@@ -56,6 +57,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="pageId != null">
page_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guideTopId != null">
......@@ -82,6 +86,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="pageId != null">
#{pageId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabCustomGuideTop">
......@@ -108,6 +115,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="pageId != null">
page_id = #{pageId,jdbcType=INTEGER},
</if>
</set>
where guide_top_id = #{guideTopId,jdbcType=INTEGER}
</update>
......@@ -119,15 +129,15 @@
appid = #{appid,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
page_id = #{pageId,jdbcType=INTEGER}
where guide_top_id = #{guideTopId,jdbcType=INTEGER}
</update>
<select id="getCustomGuideTop" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_custom_guide_top
where enterprise_id = #{enterpriseId}
and appid = #{appKey}
where page_id = #{pageId}
and delete_flag = 0
</select>
</mapper>
\ No newline at end of file
......@@ -81,7 +81,6 @@ public class CustomGuideController {
log.info("保存的导航内容:{}", JSON.toJSONString(list));
ServiceResponse<Void> serviceResponse = this.customGuideApiService.saveGuide(list, isNeedNewVersion, enterpriseId, appId);
if(serviceResponse.isSuccess()){
customGuideTopApiService.saveCustomGuideTop(guideTopColor, titleColor, enterpriseId, appId);
return RestResponse.success();
}else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
......@@ -103,8 +102,7 @@ public class CustomGuideController {
*/
@RequestMapping("save-or-update-custom-guide-top")
public RestResponse saveOrUpdateCustomGuideTop(String appId, String guideTopColor, Integer titleColor){
return ResultControllerUtils.commonResult(customGuideTopApiService
.saveCustomGuideTop(guideTopColor, titleColor, UserDetailUtils.getUserDetail().getEnterpriseId(), appId));
return RestResponse.success();
}
/**
......
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