Commit d6905253 by guojuxing

小程序页面装修——顶部导航

parent 7f7de5b9
package com.gic.enterprise.dto;
import java.io.Serializable;
import java.util.Date;
/**
* 小程序装修-顶部导航
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/6/2 1:57 PM

*/
public class CustomGuideTopDTO implements Serializable{
private static final long serialVersionUID = 8618674958994205102L;
/**
*
*/
private Integer guideTopId;
/**
*
*/
private Integer enterpriseId;
/**
* 导航颜色,#ffffff
*/
private String guideTopColor;
/**
* 标题颜色1:黑色 2:白色
*/
private Integer titleColor;
/**
* 小程序appid
*/
private String appid;
/**
* 0:未删除
*/
private Integer deleteFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getGuideTopId() {
return guideTopId;
}
public CustomGuideTopDTO setGuideTopId(Integer guideTopId) {
this.guideTopId = guideTopId;
return this;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public CustomGuideTopDTO setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public String getGuideTopColor() {
return guideTopColor;
}
public CustomGuideTopDTO setGuideTopColor(String guideTopColor) {
this.guideTopColor = guideTopColor;
return this;
}
public Integer getTitleColor() {
return titleColor;
}
public CustomGuideTopDTO setTitleColor(Integer titleColor) {
this.titleColor = titleColor;
return this;
}
public String getAppid() {
return appid;
}
public CustomGuideTopDTO setAppid(String appid) {
this.appid = appid;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public CustomGuideTopDTO setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
public Date getCreateTime() {
return createTime;
}
public CustomGuideTopDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public CustomGuideTopDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
@Override
public String toString() {
return "CustomGuideTopDTO{" +
"guideTopId=" + guideTopId +
", enterpriseId=" + enterpriseId +
", guideTopColor='" + guideTopColor + '\'' +
", titleColor=" + titleColor +
", appid='" + appid + '\'' +
", deleteFlag=" + deleteFlag +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.CustomGuideTopDTO;
/**
* 小程序装修-顶部导航
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/6/2 1:58 PM

*/
public interface CustomGuideTopApiService {
/**
* 新增/更新,根据商户ID和小程序key唯一确认一条数据
* @param guideTopColor 导航颜色,#ffffff
* @param titleColor 标题颜色1:黑色 2:白色
* @param enterpriseId 商户ID
* @param appKey 小程序key
* @return
*/
ServiceResponse<Void> saveCustomGuideTop(String guideTopColor, Integer titleColor, Integer enterpriseId, String appKey);
/**
* 查询顶部导航配置信息
* @param enterpriseId
* @param appKey
* @return
*/
ServiceResponse<CustomGuideTopDTO> getCustomGuideTop(Integer enterpriseId, String appKey);
}
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabCustomGuideTop;
import org.apache.ibatis.annotations.Param;
/**
* 小程序装修-顶部导航
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/6/3 9:32 AM

*/
public interface TabCustomGuideTopMapper {
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabCustomGuideTop record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabCustomGuideTop record);
/**
* 根据主键查询
*
* @param guideTopId 主键
* @return 实体对象
*/
TabCustomGuideTop selectByPrimaryKey(Integer guideTopId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabCustomGuideTop record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabCustomGuideTop record);
/**
* 详情
* @param enterpriseId
* @param appKey
* @return
*/
TabCustomGuideTop getCustomGuideTop(@Param("enterpriseId") Integer enterpriseId, @Param("appKey") String appKey);
}
\ No newline at end of file
package com.gic.enterprise.entity;
import java.util.Date;
/**
* 小程序装修-顶部导航
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/6/2 1:56 PM

*/
public class TabCustomGuideTop {
/**
*
*/
private Integer guideTopId;
/**
*
*/
private Integer enterpriseId;
/**
* 导航颜色,#ffffff
*/
private String guideTopColor;
/**
* 标题颜色1:黑色 2:白色
*/
private Integer titleColor;
/**
* 小程序appid
*/
private String appid;
/**
* 0:未删除
*/
private Integer deleteFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getGuideTopId() {
return guideTopId;
}
public TabCustomGuideTop setGuideTopId(Integer guideTopId) {
this.guideTopId = guideTopId;
return this;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public TabCustomGuideTop setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public String getGuideTopColor() {
return guideTopColor;
}
public TabCustomGuideTop setGuideTopColor(String guideTopColor) {
this.guideTopColor = guideTopColor;
return this;
}
public Integer getTitleColor() {
return titleColor;
}
public TabCustomGuideTop setTitleColor(Integer titleColor) {
this.titleColor = titleColor;
return this;
}
public String getAppid() {
return appid;
}
public TabCustomGuideTop setAppid(String appid) {
this.appid = appid;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public TabCustomGuideTop setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
public Date getCreateTime() {
return createTime;
}
public TabCustomGuideTop setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public TabCustomGuideTop setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
}
\ No newline at end of file
package com.gic.enterprise.service;
import com.gic.enterprise.entity.TabCustomGuideTop;
/**
* 小程序装修-顶部导航
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/6/3 9:29 AM

*/
public interface CustomGuideTopService {
/**
* 新增
* @param record
*/
void saveCustomGuideTop(TabCustomGuideTop record);
/**
* 编辑
* @param record
*/
void editCustomGuideTop(TabCustomGuideTop record);
/**
* 获取详情
* @param enterpriseId
* @param appKey
* @return
*/
TabCustomGuideTop getCustomGuideTop(Integer enterpriseId, String appKey);
}
package com.gic.enterprise.service.impl;
import com.gic.enterprise.constant.DeleteFlagConstants;
import com.gic.enterprise.dao.mapper.TabCustomGuideTopMapper;
import com.gic.enterprise.entity.TabCustomGuideTop;
import com.gic.enterprise.service.CustomGuideTopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* 小程序装修-顶部导航
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/6/3 9:31 AM

*/
@Service("customGuideTopService")
public class CustomGuideTopServiceImpl implements CustomGuideTopService{
@Autowired
private TabCustomGuideTopMapper tabCustomGuideTopMapper;
@Override
public void saveCustomGuideTop(TabCustomGuideTop record) {
Date now = new Date();
record.setCreateTime(now);
record.setUpdateTime(now);
record.setDeleteFlag(DeleteFlagConstants.NORMAL_STATUS);
tabCustomGuideTopMapper.insert(record);
}
@Override
public void editCustomGuideTop(TabCustomGuideTop record) {
record.setUpdateTime(new Date());
tabCustomGuideTopMapper.updateByPrimaryKeySelective(record);
}
@Override
public TabCustomGuideTop getCustomGuideTop(Integer enterpriseId, String appKey) {
return tabCustomGuideTopMapper.getCustomGuideTop(enterpriseId, appKey);
}
}
package com.gic.enterprise.service.outer.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dto.CustomGuideTopDTO;
import com.gic.enterprise.entity.TabCustomGuideTop;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.exception.CommonException;
import com.gic.enterprise.service.CustomGuideTopApiService;
import com.gic.enterprise.service.CustomGuideTopService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/6/2 4:34 PM

*/
@Service("customGuideTopApiService")
public class CustomGuideTopApiServiceImpl implements CustomGuideTopApiService{
private static final Logger LOGGER = LogManager.getLogger(CustomGuideTopApiServiceImpl.class);
@Autowired
private CustomGuideTopService customGuideTopService;
@Override
public ServiceResponse<Void> saveCustomGuideTop(String guideTopColor, Integer titleColor, Integer enterpriseId, String appKey) {
if (StringUtils.isBlank(guideTopColor) || titleColor == null) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "参数为空");
}
TabCustomGuideTop record = customGuideTopService.getCustomGuideTop(enterpriseId, appKey);
if (record == null) {
customGuideTopService.saveCustomGuideTop(new TabCustomGuideTop()
.setAppid(appKey)
.setEnterpriseId(enterpriseId)
.setGuideTopColor(guideTopColor)
.setTitleColor(titleColor));
} else {
customGuideTopService.editCustomGuideTop(new TabCustomGuideTop()
.setGuideTopId(record.getGuideTopId())
.setTitleColor(titleColor)
.setGuideTopColor(guideTopColor));
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<CustomGuideTopDTO> getCustomGuideTop(Integer enterpriseId, String appKey) {
TabCustomGuideTop record = customGuideTopService.getCustomGuideTop(enterpriseId, appKey);
if (record == null) {
LOGGER.info("查询参数:{}-{}", enterpriseId, appKey);
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "查无数据");
}
return ServiceResponse.success(EntityUtil.changeEntityNew(CustomGuideTopDTO.class, record));
}
}
......@@ -137,6 +137,7 @@
<dubbo:service interface="com.gic.enterprise.service.ProductMarketApiService" ref="productMarketApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.BlackListApiService" ref="blackListApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.CustomSettingApiService" ref="customSettingApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.CustomGuideTopApiService" ref="customGuideTopApiService" timeout="6000" />
<dubbo:reference interface="com.gic.mall.share.api.service.ShopApiService" id="shopApiService" timeout="6000" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.enterprise.dao.mapper.TabCustomGuideTopMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabCustomGuideTop">
<id column="guide_top_id" jdbcType="INTEGER" property="guideTopId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="guide_top_color" jdbcType="VARCHAR" property="guideTopColor" />
<result column="title_color" jdbcType="INTEGER" property="titleColor" />
<result column="appid" jdbcType="VARCHAR" property="appid" />
<result column="delete_flag" jdbcType="INTEGER" property="deleteFlag" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
guide_top_id, enterprise_id, guide_top_color, title_color, appid, delete_flag, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_custom_guide_top
where guide_top_id = #{guideTopId,jdbcType=INTEGER}
</select>
<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)
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})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabCustomGuideTop">
insert into tab_custom_guide_top
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guideTopId != null">
guide_top_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="guideTopColor != null">
guide_top_color,
</if>
<if test="titleColor != null">
title_color,
</if>
<if test="appid != null">
appid,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guideTopId != null">
#{guideTopId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="guideTopColor != null">
#{guideTopColor,jdbcType=VARCHAR},
</if>
<if test="titleColor != null">
#{titleColor,jdbcType=INTEGER},
</if>
<if test="appid != null">
#{appid,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabCustomGuideTop">
update tab_custom_guide_top
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="guideTopColor != null">
guide_top_color = #{guideTopColor,jdbcType=VARCHAR},
</if>
<if test="titleColor != null">
title_color = #{titleColor,jdbcType=INTEGER},
</if>
<if test="appid != null">
appid = #{appid,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where guide_top_id = #{guideTopId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabCustomGuideTop">
update tab_custom_guide_top
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
guide_top_color = #{guideTopColor,jdbcType=VARCHAR},
title_color = #{titleColor,jdbcType=INTEGER},
appid = #{appid,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
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}
and delete_flag = 0
</select>
</mapper>
\ No newline at end of file
......@@ -11,6 +11,8 @@ import com.gic.enterprise.dto.CustomGuideDTO;
import com.gic.enterprise.dto.GuideTypeDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.CustomGuideApiService;
import com.gic.enterprise.service.CustomGuideTopApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
......@@ -33,9 +35,11 @@ public class CustomGuideController {
private static final Logger log = LogManager.getLogger(CustomGuideController.class);
@Autowired
private CustomGuideApiService customGuideApiService;
@Autowired
private CustomGuideTopApiService customGuideTopApiService;
@RequestMapping("save-custom-guide")
public RestResponse saveCustomGuide(String param, boolean isNeedNewVersion, String appId){
public RestResponse saveCustomGuide(String param, boolean isNeedNewVersion, String appId, String guideTopColor, Integer titleColor ){
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
JSONArray array = JSON.parseArray(param);
List<CustomGuideDTO> list = new ArrayList<>();
......@@ -77,6 +81,7 @@ 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());
......@@ -89,6 +94,30 @@ public class CustomGuideController {
return RestResponse.success(response.getResult());
}
/**
* 新增顶部导航
* @param appId
* @param guideTopColor
* @param titleColor
* @return
*/
@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));
}
/**
* 顶部导航
* @param appId
* @return
*/
@RequestMapping("get-custom-guide-top")
public RestResponse getCustomGuideTop(String appId){
return ResultControllerUtils.commonResult(this.customGuideTopApiService
.getCustomGuideTop(UserDetailUtils.getUserDetail().getEnterpriseId(), appId));
}
@RequestMapping("list-guide-type")
public RestResponse listGuideType(){
ServiceResponse<List<GuideTypeDTO>> response = this.customGuideApiService.listGuideType();
......
......@@ -159,4 +159,5 @@
<dubbo:reference interface="com.gic.member.config.api.service.UserListFieldApiService" id="userListFieldApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.store.service.StoreResourceApiService" id="storeResourceApiService" timeout="6000" retries="0"/>
<dubbo:reference interface="com.gic.enterprise.service.CustomGuideTopApiService" id="customGuideTopApiService" timeout="6000" retries="0"/>
</beans>
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